diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-10-08 15:49:19 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-10-08 15:49:19 +0000 |
commit | 95a8412bd9a80ce1e15363ae6c1a51db9432f9d7 (patch) | |
tree | 2a2a54558ac16f7295081cdf216fdb709a4e9792 /os_net_config/tests | |
parent | 2497f596be89f3f6cfb1431fba68a0a599879e40 (diff) | |
parent | 0b130b6b3b4a9e0768e99b1496d2852f2ca47bb7 (diff) |
Merge "Support multiple addresses assignment with ifcfg"
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 f083ef8..f8864c4 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" @@ -171,6 +180,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'} @@ -194,6 +212,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') |