Merge "Fix get_ipv6_llas method in the interface driver" into stable/train

This commit is contained in:
Zuul 2020-08-28 11:12:10 +00:00 committed by Gerrit Code Review
commit c1dc43adcd
2 changed files with 19 additions and 0 deletions

View File

@ -1361,6 +1361,9 @@ def get_devices_with_ip(namespace, name=None, **kwargs):
link_args = {}
if name:
link_args['ifname'] = name
scope = kwargs.pop('scope', None)
if scope:
kwargs['scope'] = IP_ADDRESS_SCOPE_NAME[scope]
devices = privileged.get_link_devices(namespace, **link_args)
retval = []
for parsed_ips in (_parse_link_device(namespace, device, **kwargs)

View File

@ -69,6 +69,22 @@ class InterfaceDriverTestCaseMixin(object):
self.interface.set_mtu,
device_name=device_name, namespace=namespace))
def test_ipv6_lla_create_and_get(self):
lla_address = "fe80::f816:3eff:fe66:73bf/64"
global_address = "2001::1/64"
device_name = utils.get_rand_name()
namespace = self.useFixture(net_helpers.NamespaceFixture())
namespace.ip_wrapper.add_dummy(device_name)
self.interface.add_ipv6_addr(
device_name, lla_address, namespace.name, 'link')
self.interface.add_ipv6_addr(
device_name, global_address, namespace.name, 'global')
existing_addresses = [
a['cidr'] for a in self.interface.get_ipv6_llas(
device_name, namespace.name)]
self.assertIn(lla_address, existing_addresses)
self.assertNotIn(global_address, existing_addresses)
class OVSInterfaceDriverTestCase(linux_base.BaseOVSLinuxTestCase,
InterfaceDriverTestCaseMixin):