summaryrefslogtreecommitdiffstats
path: root/os_net_config/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-10-21 19:37:03 +0000
committerGerrit Code Review <review@openstack.org>2015-10-21 19:37:03 +0000
commit7f10579c4a75e3055adbbce4ae8c9557f545dc8d (patch)
tree917536825236ceeb7f9bbedf6f76d4fa6ebda5af /os_net_config/tests
parenta7d9cc1129370f543ab05935bcff17896d09be70 (diff)
parenteb39ca3268c805d5d57bdb224ab16c5bfb19857e (diff)
Merge "Support multiple addresses assignment with eni"
Diffstat (limited to 'os_net_config/tests')
-rw-r--r--os_net_config/tests/test_impl_eni.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/os_net_config/tests/test_impl_eni.py b/os_net_config/tests/test_impl_eni.py
index fe49c3e..e0e009d 100644
--- a/os_net_config/tests/test_impl_eni.py
+++ b/os_net_config/tests/test_impl_eni.py
@@ -32,11 +32,23 @@ _V4_IFACE_STATIC_IP = _AUTO + """iface eth0 inet static
netmask 255.255.255.0
"""
+_V4_IFACE_STATIC_IP_MULTIPLE = (_V4_IFACE_STATIC_IP + _AUTO +
+ """iface eth0 inet static
+ address 10.0.0.2
+ netmask 255.0.0.0
+""")
+
_V6_IFACE_STATIC_IP = _AUTO + """iface eth0 inet6 static
address fe80::2677:3ff:fe7d:4c
- netmask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+ netmask 128
"""
+_V6_IFACE_STATIC_IP_MULTIPLE = (_V6_IFACE_STATIC_IP + _AUTO +
+ """iface eth0 inet6 static
+ address 2001:abcd::2
+ netmask 64
+""")
+
_IFACE_DHCP = _AUTO + "iface eth0 inet dhcp\n"
_OVS_PORT_BASE = _AUTO + "allow-br0 eth0\n"
@@ -112,12 +124,28 @@ class TestENINetConfig(base.TestCase):
self.provider.add_interface(interface)
self.assertEqual(_V4_IFACE_STATIC_IP, self.get_interface_config())
+ def test_add_interface_with_v4_multiple(self):
+ v4_addresses = [objects.Address('192.168.1.2/24'),
+ objects.Address('10.0.0.2/8')]
+ interface = self._default_interface(v4_addresses)
+ self.provider.add_interface(interface)
+ self.assertEqual(_V4_IFACE_STATIC_IP_MULTIPLE,
+ self.get_interface_config())
+
def test_add_interface_with_v6(self):
v6_addr = objects.Address('fe80::2677:3ff:fe7d:4c')
interface = self._default_interface([v6_addr])
self.provider.add_interface(interface)
self.assertEqual(_V6_IFACE_STATIC_IP, self.get_interface_config())
+ def test_add_interface_with_v6_multiple(self):
+ v6_addresses = [objects.Address('fe80::2677:3ff:fe7d:4c'),
+ objects.Address('2001:abcd::2/64')]
+ interface = self._default_interface(v6_addresses)
+ self.provider.add_interface(interface)
+ self.assertEqual(_V6_IFACE_STATIC_IP_MULTIPLE,
+ self.get_interface_config())
+
def test_add_interface_dhcp(self):
interface = self._default_interface()
interface.use_dhcp = True