summaryrefslogtreecommitdiff
path: root/tests/unittests/test_net.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-10-09 17:31:33 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-10-09 17:31:33 +0000
commit00e36d3ded0b0f81f352de993036fc9f89e14a7a (patch)
tree5254db94dd7b77aa084b385f86999b7382f782fa /tests/unittests/test_net.py
parent638f09e82260ea3256c387cd55408e0411f36c23 (diff)
downloadvyos-cloud-init-00e36d3ded0b0f81f352de993036fc9f89e14a7a.tar.gz
vyos-cloud-init-00e36d3ded0b0f81f352de993036fc9f89e14a7a.zip
net: ignore nics that have "zero" mac address.
Previously we explicitly excluded mac address '00:00:00:00:00:00'. But then some nics (tunl0 and sit0) ended up having a mac address like '00:00:00:00'. The change here just ignores all 00[:00[:00...]]. LP: #1796917
Diffstat (limited to 'tests/unittests/test_net.py')
-rw-r--r--tests/unittests/test_net.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 5d9c7d92..8e383739 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -3339,9 +3339,23 @@ class TestGetInterfacesByMac(CiTestCase):
addnics = ('greptap1', 'lo', 'greptap2')
self.data['macs'].update(dict((k, empty_mac) for k in addnics))
self.data['devices'].update(set(addnics))
+ self.data['own_macs'].extend(list(addnics))
ret = net.get_interfaces_by_mac()
self.assertEqual('lo', ret[empty_mac])
+ def test_skip_all_zeros(self):
+ """Any mac of 00:... should be skipped."""
+ self._mock_setup()
+ emac1, emac2, emac4, emac6 = (
+ '00', '00:00', '00:00:00:00', '00:00:00:00:00:00')
+ addnics = {'empty1': emac1, 'emac2a': emac2, 'emac2b': emac2,
+ 'emac4': emac4, 'emac6': emac6}
+ self.data['macs'].update(addnics)
+ self.data['devices'].update(set(addnics))
+ self.data['own_macs'].extend(addnics.keys())
+ ret = net.get_interfaces_by_mac()
+ self.assertEqual('lo', ret['00:00:00:00:00:00'])
+
def test_ib(self):
ib_addr = '80:00:00:28:fe:80:00:00:00:00:00:00:00:11:22:03:00:33:44:56'
ib_addr_eth_format = '00:11:22:33:44:56'