How to use the ifcfg.parser.WindowsParser function in ifcfg

To help you get started, we’ve selected a few ifcfg 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 ftao / python-ifcfg / tests / ipconfig_tests.py View on Github external
def test_interfaces(self):
        ifcfg.Parser = WindowsParser
        interfaces = ifcfg.interfaces(ifconfig=ipconfig_out.WINDOWS_10_ETH)
        res = len(interfaces) > 0
        ok_(res)
github ftao / python-ifcfg / tests / ipconfig_tests.py View on Github external
def test_cp1252_non_utf8_byte(self):
        """
        Tests that things are still working when using this bizarre encoding
        """

        ifcfg.distro = "Windows"
        ifcfg.Parser = ifcfg.get_parser_class()

        self.assertTrue(issubclass(ifcfg.Parser, WindowsParser))

        parser = ifcfg.get_parser()
        interfaces = parser.interfaces

        self.assertIn("Ethernet adapter Local Area Connection 2", interfaces.keys())
        self.assertIn("Tunnel adapter isatap.lan", interfaces.keys())
        self.assertIn("Tunnel adapter Teredo Tunneling Pseudo-Interface", interfaces.keys())

        self.assertEqual(len(interfaces.keys()), 3)

        eq_(interfaces['Ethernet adapter Local Area Connection 2']['inet'], '10.0.2.15')
        self.assertEqual(
            len(interfaces['Ethernet adapter Local Area Connection 2']['inet6']),
            0
        )