Exemplo n.º 1
0
    def testGetBridgeAndIfaceConfigDhcpNetwork(self):

        centos = CentOS()

        ifaceConfOrig = """DEVICE=eth0
HWADDR=00:15:17:CF:F1:A0
IPV6INIT=yes
ONBOOT=yes
BOOTPROTO=dhcp
"""
        iface = 'eth0'
        bridge = 'br0'
        
        ifaceConfTest = """DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
IPV6INIT=yes
HWADDR=00:15:17:CF:F1:A0
"""
        bridgeConfTest = """DEVICE=br0
TYPE=Bridge
ONBOOT=yes
DELAY=0
IPV6INIT=yes
BOOTPROTO=dhcp
"""
        bridgeConf, ifaceConf = centos._buildBridgeAndIfaceConfig(ifaceConfOrig, 
                                                                  iface, bridge)
        assert bridgeConf == bridgeConfTest
        assert ifaceConf == ifaceConfTest
Exemplo n.º 2
0
    def testGetBridgeAndIfaceConfigStaticNetwork(self):

        centos = CentOS()

        ifaceConfOrig = """DEVICE=eth0
HWADDR=00:15:17:CF:F1:A0
IPV6INIT=yes
ONBOOT=yes
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.100
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
"""
        iface = 'eth0'
        bridge = 'br0'
        
        ifaceConfTest = """DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
IPV6INIT=yes
HWADDR=00:15:17:CF:F1:A0
"""
        bridgeConfTest = """DEVICE=br0
TYPE=Bridge
ONBOOT=yes
DELAY=0
IPV6INIT=yes
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.100
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
"""
        bridgeConf, ifaceConf  = centos._buildBridgeAndIfaceConfig(ifaceConfOrig, 
                                                                  iface, bridge)
        assert bridgeConf == bridgeConfTest
        assert ifaceConf == ifaceConfTest