diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index c8a0e672a4..68ef4ee626 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -94,7 +94,7 @@ class IPWrapper(SubProcessBase): continue tokens = line.split(':', 2) if len(tokens) >= 3: - name = tokens[1].strip() + name = tokens[1].split('@', 1)[0].strip() if exclude_loopback and name == LOOPBACK_DEVNAME: continue diff --git a/neutron/tests/unit/test_linux_ip_lib.py b/neutron/tests/unit/test_linux_ip_lib.py index b186dbbe33..6c4eb5d0c6 100644 --- a/neutron/tests/unit/test_linux_ip_lib.py +++ b/neutron/tests/unit/test_linux_ip_lib.py @@ -35,7 +35,10 @@ LINK_SAMPLE = [ '3: br-int: mtu 1500 qdisc noop state DOWN ' '\ link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff', '4: gw-ddc717df-49: mtu 1500 qdisc noop ' - 'state DOWN \ link/ether fe:dc:ba:fe:dc:ba brd ff:ff:ff:ff:ff:ff'] + 'state DOWN \ link/ether fe:dc:ba:fe:dc:ba brd ff:ff:ff:ff:ff:ff', + '5: eth0.50@eth0: mtu 1500 qdisc ' + ' noqueue master brq0b24798c-07 state UP mode DEFAULT' + '\ link/ether ab:04:49:b6:ab:a0 brd ff:ff:ff:ff:ff:ff'] ADDR_SAMPLE = (""" 2: eth0: mtu 1500 qdisc mq state UP qlen 1000 @@ -164,7 +167,8 @@ class TestIpWrapper(base.BaseTestCase): [ip_lib.IPDevice('lo'), ip_lib.IPDevice('eth0'), ip_lib.IPDevice('br-int'), - ip_lib.IPDevice('gw-ddc717df-49')]) + ip_lib.IPDevice('gw-ddc717df-49'), + ip_lib.IPDevice('eth0.50')]) self.execute.assert_called_once_with('o', 'link', ('list',), 'sudo', None) @@ -176,7 +180,8 @@ class TestIpWrapper(base.BaseTestCase): [ip_lib.IPDevice('lo'), ip_lib.IPDevice('eth0'), ip_lib.IPDevice('br-int'), - ip_lib.IPDevice('gw-ddc717df-49')]) + ip_lib.IPDevice('gw-ddc717df-49'), + ip_lib.IPDevice('eth0.50')]) self.execute.assert_called_once_with('o', 'link', ('list',), 'sudo', None)