diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index faa9212513..3ab61d1c9a 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -15,6 +15,7 @@ import contextlib import copy +import itertools from eventlet import greenthread import mock @@ -1074,8 +1075,8 @@ class TestPortsV2(NsxVPluginV2TestCase, # simulate duplicate mac generation to make sure DBDuplicate is retried responses = ['12:34:56:78:00:00', '12:34:56:78:00:00', '12:34:56:78:00:01'] - with mock.patch.object(net, 'get_random_mac', - side_effect=responses) as grand_mac: + with mock.patch.object(net, 'random_mac_generator', + return_value=itertools.cycle(responses)) as grand_mac: with self.subnet(enable_dhcp=False) as s: with self.port(subnet=s) as p1, self.port(subnet=s) as p2: self.assertEqual('12:34:56:78:00:00',