Handle portbindings with no local_link_information gracefully

We were assuming that all ports with binding::profiles would have
local_link_information. This assumption is incorrect, so we should
handle such ports gracefully rather than throwing a KeyError.

Change-Id: Id73e43199c933bc7eb6e71f75d4e6f04cce6c091
changes/14/464014/1
Mitchell Jameson 6 years ago
parent d95f31fe00
commit 4328ed0d3b

@ -657,7 +657,7 @@ class AristaDriver(driver_api.MechanismDriver):
binding_profile = port['binding:profile']
bindings = []
if binding_profile:
bindings = binding_profile['local_link_information']
bindings = binding_profile.get('local_link_information', [])
port_id = port['id']
port_name = port['name']
@ -818,7 +818,7 @@ class AristaDriver(driver_api.MechanismDriver):
binding_profile = port['binding:profile']
switch_bindings = []
if binding_profile:
switch_bindings = binding_profile['local_link_information']
switch_bindings = binding_profile.get('local_link_information', [])
sg = port['security_groups']
if not device_id or not host:

Loading…
Cancel
Save