diff --git a/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py b/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py index 31323d9ef3..3f7f8a492e 100644 --- a/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py +++ b/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py @@ -23,6 +23,7 @@ from neutron_lib import exceptions as n_exc from oslo_log import log as logging from vmware_nsx._i18n import _ +from vmware_nsx._i18n import _LE from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import locking from vmware_nsx.db import nsxv_db @@ -384,8 +385,12 @@ class RouterSharedDriver(router_driver.RouterBaseDriver): router_dict['gateway'] = None for gwp in gw_ports: if gwp['id'] == r['gw_port_id']: - router_dict['gateway'] = ( - gwp['fixed_ips'][0]['subnet_id']) + try: + router_dict['gateway'] = ( + gwp['fixed_ips'][0]['subnet_id']) + except IndexError: + LOG.error(_LE("Skipping GW port %s with no fixed IP"), + gwp['id']) subnet_ids = [p['fixed_ips'][0]['subnet_id'] for p in intf_ports if p['device_id'] == r['id']] router_dict['subnet_ids'] = subnet_ids