How to use the ifcfg.parser.LinuxParser 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 / ifconfig_tests.py View on Github external
def test_linux(self):
        ifcfg.distro = 'Linux'
        ifcfg.Parser = LinuxParser
        parser = ifcfg.get_parser(ifconfig=ifconfig_out.LINUX)
        interfaces = parser.interfaces
        self.assertEqual(len(interfaces.keys()), 2)
        eq_(interfaces['eth0']['ether'], '1a:2b:3c:4d:5e:6f')
        eq_(interfaces['eth0']['inet'], '192.168.0.1')
        eq_(interfaces['eth0']['broadcast'], '192.168.0.255')
        eq_(interfaces['eth0']['netmask'], '255.255.255.0')
github ftao / python-ifcfg / tests / ifconfig_tests.py View on Github external
def test_ifcfg(self):
        ifcfg.distro = 'Linux'
        ifcfg.Parser = LinuxParser
        interfaces = ifcfg.interfaces(ifconfig=ifconfig_out.LINUX)
        res = len(interfaces) > 0
        ok_(res)