From 55ee8ffe3faea91a6aa82fda5430ffc0f9a65d9f Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Tue, 1 Oct 2019 10:49:19 +0100 Subject: [PATCH] WIP - fix mac_address access issue --- zaza/openstack/utilities/openstack.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 4b9a4e0..1fd9603 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -608,9 +608,11 @@ def configure_gateway_ext_port(novaclient, neutronclient, port = neutronclient.create_port(body=body_value) server.interface_attach(port_id=port['port']['id'], net_id=None, fixed_ip=None) - # Temporarily disable call to add_interface_to_netplan as it - # sometimes throws a KeyError - # https://github.com/openstack-charmers/zaza-openstack-tests/issues/72 + if add_dataport_to_netplan: + mac_address = get_mac_from_port(port, neutronclient) + add_interface_to_netplan(server.name, + mac_address=mac_address, + dvr_mode=dvr_mode) ext_br_macs = [] for port in neutronclient.list_ports(network_id=net_id)['ports']: if 'ext-port' in port['name']: @@ -652,9 +654,9 @@ def get_mac_from_port(port, neutronclient): :rtype: string """ logging.info("Trying to get mac address from port:" - "{}".format(port['id'])) - refresh_port = neutronclient.show_port(port['id'])['port'] - return refresh_port['mac_address'] + "{}".format(port['port']['id'])) + refresh_port = neutronclient.show_port(port['port']['id']) + return refresh_port['port']['mac_address'] def create_project_network(neutron_client, project_id, net_name='private',