Skip to content

Commit 71a47b6

Browse files
committed
Format correctly (dialect=mac_unix_expanded) the MAC addresses
Format correctly (dialect=mac_unix_expanded) the MAC addresses in ``DHCPAgentOVSTestFramework``. Before this patch, this is the leases file the DHCP server was using: Done building initial lease file /tmp/tmp3_m7_fqk/tmpiadm5q0e/9afb0444-e28e-4582-abb0-031d6ed500e4/leases with contents: 1676775199 24:77:3:7d:0:4c 192.168.10.11 * * 1676775199 24:77:3:7d:0:3a 192.168.10.1 * * Related-Bug: #2007992 Change-Id: Ie903fd3f645f7428854cf6b2fe48a1edf342cc32 (cherry picked from commit c61ce34)
1 parent 43f8e59 commit 71a47b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

neutron/tests/functional/agent/test_dhcp_agent.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import eventlet
2121
import fixtures
2222
import netaddr
23+
from neutron_lib.api import converters
2324
from neutron_lib import constants as lib_const
2425
from oslo_config import fixture as fixture_config
2526
from oslo_utils import uuidutils
@@ -42,10 +43,10 @@
4243

4344
class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
4445

45-
_DHCP_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:4c")
46-
_DHCP_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
47-
_TENANT_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:3a")
48-
_TENANT_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
46+
_DHCP_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
47+
'24:77:03:7d:00:4c')
48+
_TENANT_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
49+
'24:77:03:7d:00:3a')
4950

5051
_IP_ADDRS = {
5152
4: {'addr': '192.168.10.11',
@@ -307,9 +308,8 @@ def test_bad_address_allocation(self):
307308
network, port = self._get_network_port_for_allocation_test()
308309
network.ports.append(port)
309310
self.configure_dhcp_for_network(network=network)
310-
bad_mac_address = netaddr.EUI(self._TENANT_PORT_MAC_ADDRESS.value + 1)
311-
bad_mac_address.dialect = netaddr.mac_unix
312-
port.mac_address = str(bad_mac_address)
311+
port.mac_address = converters.convert_to_sanitized_mac_address(
312+
'24:77:03:7d:00:4d')
313313
self._plug_port_for_dhcp_request(network, port)
314314
self.assert_bad_allocation_for_port(network, port)
315315

0 commit comments

Comments
 (0)