How to use the napalm.base.utils.string_parsers.convert_uptime_string_seconds function in napalm

To help you get started, we’ve selected a few napalm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github napalm-automation / napalm / test / base / test_helpers.py View on Github external
31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
self.assertEqual(
            convert_uptime_string_seconds("33 weeks, 19 hours, 8 minutes"), 20027280
        )
        self.assertEqual(
            convert_uptime_string_seconds("33 weeks, 19 hours, 10 minutes"), 20027400
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 13 hours, 0 minutes"),
            31323600,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 57 minutes"),
            31323420,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 55 minutes"),
            31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 55 minutes"),
            31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
convert_uptime_string_seconds("24 days,  11 hours,  25 minutes"), 2114700
        )
        self.assertEqual(convert_uptime_string_seconds("1 hour,  5 minutes"), 3900)
        self.assertEqual(
            convert_uptime_string_seconds("1 year,  2 weeks, 5 minutes"), 32745900
        )
        self.assertEqual(
            convert_uptime_string_seconds("95 weeks, 2 days, 10 hours, 58 minutes"),
            57668280,
        )
        self.assertEqual(
            convert_uptime_string_seconds("26 weeks, 2 days, 7 hours, 7 minutes"),
            15923220,
        )
        self.assertEqual(
            convert_uptime_string_seconds("19 weeks, 2 days, 2 hours, 2 minutes"),
            11671320,
        )
        self.assertEqual(
            convert_uptime_string_seconds("15 weeks, 3 days, 5 hours, 57 minutes"),
            9352620,
        )
        self.assertEqual(
            convert_uptime_string_seconds("1 year, 8 weeks, 15 minutes"), 36375300
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 5 minutes"), 4845900
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 1 minute"), 4845660
        )
        self.assertEqual(
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
57668280,
        )
        self.assertEqual(
            convert_uptime_string_seconds("26 weeks, 2 days, 7 hours, 7 minutes"),
            15923220,
        )
        self.assertEqual(
            convert_uptime_string_seconds("19 weeks, 2 days, 2 hours, 2 minutes"),
            11671320,
        )
        self.assertEqual(
            convert_uptime_string_seconds("15 weeks, 3 days, 5 hours, 57 minutes"),
            9352620,
        )
        self.assertEqual(
            convert_uptime_string_seconds("1 year, 8 weeks, 15 minutes"), 36375300
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 5 minutes"), 4845900
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 1 minute"), 4845660
        )
        self.assertEqual(
            convert_uptime_string_seconds(
                "2 years, 40 weeks, 1 day, 22 hours, 3 minutes"
            ),
            87429780,
        )
        self.assertEqual(
            convert_uptime_string_seconds(
                "2 years, 40 weeks, 1 day, 19 hours, 46 minutes"
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
convert_uptime_string_seconds("33 weeks, 19 hours, 10 minutes"), 20027400
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 13 hours, 0 minutes"),
            31323600,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 57 minutes"),
            31323420,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 55 minutes"),
            31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 57 minutes"),
            31323420,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 55 minutes"),
            31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
convert_uptime_string_seconds("26 weeks, 2 days, 7 hours, 7 minutes"),
            15923220,
        )
        self.assertEqual(
            convert_uptime_string_seconds("19 weeks, 2 days, 2 hours, 2 minutes"),
            11671320,
        )
        self.assertEqual(
            convert_uptime_string_seconds("15 weeks, 3 days, 5 hours, 57 minutes"),
            9352620,
        )
        self.assertEqual(
            convert_uptime_string_seconds("1 year, 8 weeks, 15 minutes"), 36375300
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 5 minutes"), 4845900
        )
        self.assertEqual(
            convert_uptime_string_seconds("8 weeks, 2 hours, 1 minute"), 4845660
        )
        self.assertEqual(
            convert_uptime_string_seconds(
                "2 years, 40 weeks, 1 day, 22 hours, 3 minutes"
            ),
            87429780,
        )
        self.assertEqual(
            convert_uptime_string_seconds(
                "2 years, 40 weeks, 1 day, 19 hours, 46 minutes"
            ),
            87421560,
        )
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
"""
        Tests the parser function ```convert_uptime_string_seconds```:

            * check if all raw uptime strings passed return the expected uptime in seconds
        """

        # Regex 1
        self.assertEqual(
            convert_uptime_string_seconds("24 days,  11 hours,  25 minutes"), 2114700
        )
        self.assertEqual(convert_uptime_string_seconds("1 hour,  5 minutes"), 3900)
        self.assertEqual(
            convert_uptime_string_seconds("1 year,  2 weeks, 5 minutes"), 32745900
        )
        self.assertEqual(
            convert_uptime_string_seconds("95 weeks, 2 days, 10 hours, 58 minutes"),
            57668280,
        )
        self.assertEqual(
            convert_uptime_string_seconds("26 weeks, 2 days, 7 hours, 7 minutes"),
            15923220,
        )
        self.assertEqual(
            convert_uptime_string_seconds("19 weeks, 2 days, 2 hours, 2 minutes"),
            11671320,
        )
        self.assertEqual(
            convert_uptime_string_seconds("15 weeks, 3 days, 5 hours, 57 minutes"),
            9352620,
        )
        self.assertEqual(
            convert_uptime_string_seconds("1 year, 8 weeks, 15 minutes"), 36375300
github napalm-automation / napalm / test / base / test_helpers.py View on Github external
convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 55 minutes"),
            31323300,
        )
        self.assertEqual(
            convert_uptime_string_seconds("51 weeks, 5 days, 12 hours, 58 minutes"),
            31323480,
        )

        # Regex 2
        self.assertEqual(convert_uptime_string_seconds("114 days, 22:27:32"), 9930452)
        self.assertEqual(convert_uptime_string_seconds("0 days, 22:27:32"), 80852)
        self.assertEqual(convert_uptime_string_seconds("365 days, 5:01:44"), 31554104)

        # Regex 3
        self.assertEqual(convert_uptime_string_seconds("7w6d5h4m3s"), 4770243)
        self.assertEqual(convert_uptime_string_seconds("95w2d10h58m"), 57668280)
        self.assertEqual(convert_uptime_string_seconds("1h5m"), 3900)