From 5a099803149b2e85e6662ab85842bb087e92ed38 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 3 Apr 2019 14:52:39 +0100 Subject: [PATCH] Format generated MAC addresses using eui48.mac_unix_expanded In Ml2Plugin.create_port_bulk, the MAC generated using netaddr.EUI have the following format: "XX-XX-XX-XX-XX-XX" In order to make them more compatible with other systems, the following format is more appropiate: "00:01:23:45:67:ab" eui48.mac_unix_expanded formater will add leading zeros if needed. Change-Id: Ice382c0b4738a5a2576a3a4b151059715f106b40 Closes-Bug: #1822999 (cherry picked from commit fa5e9c6fabb8e3f2e16646a87ca29c754e7f8c7a) --- neutron/plugins/ml2/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index a8a570872c4..e979c7f60ee 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -15,6 +15,7 @@ from eventlet import greenthread import netaddr +from netaddr.strategy import eui48 from neutron_lib.agent import constants as agent_consts from neutron_lib.agent import topics from neutron_lib.api.definitions import address_scope @@ -1404,7 +1405,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, elif self._is_mac_in_use(context, network_id, raw_mac_address): raise exc.MacAddressInUse(net_id=network_id, mac=raw_mac_address) - eui_mac_address = netaddr.EUI(raw_mac_address, 48) + eui_mac_address = netaddr.EUI(raw_mac_address, + dialect=eui48.mac_unix_expanded) # Create the Port object db_port_obj = ports_obj.Port(context,