Merge "Scan for mac through all devices" into stable/newton

This commit is contained in:
Jenkins 2017-05-17 10:03:30 +00:00 committed by Gerrit Code Review
commit af363f521b
2 changed files with 6 additions and 4 deletions

View File

@ -725,8 +725,10 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
list(self.bridge_mappings.values())[0])
else:
devices = ip_lib.IPWrapper().get_devices(True)
if devices:
mac = utils.get_interface_mac(devices[0].name)
for device in devices:
mac = utils.get_interface_mac(device.name)
if mac:
break
else:
LOG.error(_LE("Unable to obtain MAC address for unique ID. "
"Agent terminated!"))

View File

@ -880,11 +880,11 @@ class TestLinuxBridgeManager(base.BaseTestCase):
mock.patch.object(
utils,
"get_interface_mac",
return_value='16:63:69:10:a0:59') as mock_gim:
side_effect=[None, '16:63:69:10:a0:59']) as mock_gim:
agent_id = lbm.get_agent_id()
self.assertEqual("lb16636910a059", agent_id)
mock_gim.assert_called_with("eth1")
mock_gim.assert_has_calls([mock.call("eth1"), mock.call("eth2")])
class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):