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 c61ce3447e)
This commit is contained in:
Rodolfo Alonso Hernandez 2023-02-17 09:55:50 +01:00
parent 1ac90fba3e
commit 7e012aa071
1 changed files with 7 additions and 7 deletions

View File

@ -20,6 +20,7 @@ from unittest import mock
import eventlet
import fixtures
import netaddr
from neutron_lib.api import converters
from neutron_lib import constants as lib_const
from oslo_config import fixture as fixture_config
from oslo_log import log as logging
@ -45,10 +46,10 @@ LOG = logging.getLogger(__name__)
class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
_DHCP_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:4c")
_DHCP_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
_TENANT_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:3a")
_TENANT_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
_DHCP_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
'24:77:03:7d:00:4c')
_TENANT_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
'24:77:03:7d:00:3a')
_IP_ADDRS = {
4: {'addr': '192.168.10.11',
@ -312,9 +313,8 @@ class DHCPAgentOVSTestCase(DHCPAgentOVSTestFramework):
network, port = self._get_network_port_for_allocation_test()
network.ports.append(port)
self.configure_dhcp_for_network(network=network)
bad_mac_address = netaddr.EUI(self._TENANT_PORT_MAC_ADDRESS.value + 1)
bad_mac_address.dialect = netaddr.mac_unix
port.mac_address = str(bad_mac_address)
port.mac_address = converters.convert_to_sanitized_mac_address(
'24:77:03:7d:00:4d')
self._plug_port_for_dhcp_request(network, port)
self.assert_bad_allocation_for_port(network, port)