How to use the ifcfg.parser.UnixIPParser 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 / ip_tests.py View on Github external
def test_linux_multi_inet4(self):
        ifcfg.Parser = UnixIPParser
        parser = ifcfg.get_parser(ifconfig=ip_out.LINUX_MULTI_IPV4)
        interfaces = parser.interfaces
        # Connected interface
        eq_(interfaces['eth0']['ether'], 'b8:27:eb:50:39:69')
        eq_(interfaces['eth0']['inet'], '192.168.13.1')
        eq_(interfaces['eth0']['inet4'], ['192.168.13.1', '192.168.10.3'])
        eq_(interfaces['eth0']['broadcast'], '192.168.13.255')
        eq_(interfaces['eth0']['netmask'], '/24')
        eq_(interfaces['eth0']['mtu'], '1500')
github ftao / python-ifcfg / tests / ip_tests.py View on Github external
def test_ifcfg(self):
        ifcfg.distro = 'Linux'
        ifcfg.Parser = UnixIPParser
        interfaces = ifcfg.interfaces(ifconfig=ip_out.LINUX)
        res = len(interfaces) > 0
        ok_(res)