WIP - fix mac_address access issue

This commit is contained in:
Alex Kavanagh
2019-10-01 10:49:19 +01:00
parent 17f18e3fc1
commit 55ee8ffe3f

View File

@@ -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',