diff options
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_impl_ifcfg.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index efee254..cb2e881 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -41,11 +41,20 @@ NETMASK=255.255.255.0 _V4_IFCFG_MAPPED = _V4_IFCFG.replace('em1', 'nic1') + "HWADDR=a1:b2:c3:d4:e5\n" +_V4_IFCFG_MULTIPLE = _V4_IFCFG + """IPADDR1=192.168.1.3 +NETMASK1=255.255.255.255 +IPADDR2=10.0.0.2 +NETMASK2=255.0.0.0 +""" + _V6_IFCFG = _BASE_IFCFG + """IPV6INIT=yes IPV6_AUTOCONF=no -IPV6ADDR=2001:abc:a:: +IPV6ADDR=2001:abc:a::/64 """ +_V6_IFCFG_MULTIPLE = (_V6_IFCFG + "IPV6ADDR_SECONDARIES=\"2001:abc:b::1/64 " + + "2001:abc:c::2/96\"\n") + _OVS_IFCFG = _BASE_IFCFG + "DEVICETYPE=ovs\nBOOTPROTO=none\n" @@ -180,6 +189,15 @@ class TestIfcfgNetConfig(base.TestCase): self.assertEqual(_V4_IFCFG, self.get_interface_config()) self.assertEqual('', self.get_route_config()) + def test_add_interface_with_v4_multiple(self): + addresses = [objects.Address('192.168.1.2/24'), + objects.Address('192.168.1.3/32'), + objects.Address('10.0.0.2/8')] + interface = objects.Interface('em1', addresses=addresses) + self.provider.add_interface(interface) + self.assertEqual(_V4_IFCFG_MULTIPLE, self.get_interface_config()) + self.assertEqual('', self.get_route_config()) + def test_add_interface_map_persisted(self): def test_interface_mac(name): macs = {'em1': 'a1:b2:c3:d4:e5'} @@ -203,6 +221,14 @@ class TestIfcfgNetConfig(base.TestCase): self.provider.add_interface(interface) self.assertEqual(_V6_IFCFG, self.get_interface_config()) + def test_add_interface_with_v6_multiple(self): + addresses = [objects.Address('2001:abc:a::/64'), + objects.Address('2001:abc:b::1/64'), + objects.Address('2001:abc:c::2/96')] + interface = objects.Interface('em1', addresses=addresses) + self.provider.add_interface(interface) + self.assertEqual(_V6_IFCFG_MULTIPLE, self.get_interface_config()) + def test_network_with_routes(self): route1 = objects.Route('192.168.1.1', default=True) route2 = objects.Route('192.168.1.1', '172.19.0.0/24') |