Tracing this again I can see that if external network is added after a tenant network ex_gw_port ("network:router_gateway") has a very limited amount of information as opposed to fip_agent_port ("network:floatingip_agent_gateway") which is retrieved from neutron service via an RPC call from neutron-l3-agent:
In connect_rtr_2_fip there is already a check for agent_gateway_port and it seems to contain identical information for the purposes of set_address_scope_interface_routes:
def connect_rtr_2_fip(self):
if self.fip_ns.agent_gateway_port and not self.rtr_fip_connect: ex_gw_port = self.get_ex_gw_port() self.fip_ns.create_rtr_2_fip_link(self) self.set_address_scope_interface_routes(ex_gw_port)
Tracing this again I can see that if external network is added after a tenant network ex_gw_port ("network: router_ gateway" ) has a very limited amount of information as opposed to fip_agent_port ("network: floatingip_ agent_gateway" ) which is retrieved from neutron service via an RPC call from neutron-l3-agent:
https:/ /paste. ubuntu. com/p/YYFmbR3JF n/
# virtually no relevant information
> /usr/lib/ python2. 7/dist- packages/ neutron/ agent/l3/ dvr_local_ router. py(577) process_ external( ) address_ pairs': [], u'extra_dhcp_opts': [], u'updated_at': u'2018- 04-01T23: 50:55Z' , u'device_owner': u'network: router_ gateway' , u'revision_number': 3, u'port_ security_ enabled' : False, u'binding:profile': {}, u'fixed_ips': [], u'id': u'1e34db4a- c33c-4c41- b65c-2256a444a7 d7', u'security_groups': [], u'binding: vif_details' : {}, u'binding: vif_type' : u'unbound', u'mac_address': u'fa:16: 3e:b7:6b: 17', u'project_id': u'', u'status': u'DOWN', u'binding:host_id': u'pillan', u'description': u'', u'tags': [], u'device_id': u'5edc73a3- 3b60-4942- 9026-4da0ce01e9 3d', u'name': u'', u'admin_state_up': True, u'network_id': u'1b78176f- c608-4283- 9bdc-e09961805e 29', u'tenant_id': u'', u'created_at': u'2018- 04-01T23: 50:55Z' , u'binding: vnic_type' : u'normal', u'ip_allocation': u'deferred'} get('address_ scopes' ) conf.agent_ mode != ( L3_AGENT_ MODE_DVR_ NO_EXTERNAL) : ex_gw_port( ) dvr_external_ gateway_ on_agent( ex_gw_port) rtr_2_fip( ) outer, self).process_ external( )
-> if ex_gw_port:
(Pdb) ex_gw_port
{u'allowed_
(Pdb) ex_gw_port.
(Pdb) l
572 import rpdb
573 rpdb.set_trace()
574 if self.agent_
575 n_const.
576 ex_gw_port = self.get_
577 -> if ex_gw_port:
578 self.create_
579 self.connect_
580 super(DvrLocalR
...
# address_scopes are present along with other information
(Pdb) fip_agent_port address_ pairs': [], u'extra_dhcp_opts': [], u'updated_at': u'2018- 04-01T23: 53:47Z' , u'device_owner': u'network: floatingip_ agent_gateway' , u'revision_number': 4, u'port_ security_ enabled' : False, u'binding:profile': {}, u'binding: vnic_type' : u'normal', u'fixed_ips': [{u'subnet_id': u'59084723- 8290-4cdd- 996f-14de3f6eea cb', u'prefixlen': 21, u'ip_address': u'10.232.17.5'}], u'id': u'84a55dbe- def4-4e60- 8089-9ecfd74f89 0a', u'security_groups': [], u'binding: vif_details' : {u'port_filter': True, u'datapath_type': u'system', u'ovs_hybrid_plug': False}, u'address_scopes': {u'4': u'd5d483bd- b1a1-4d11- 8b98-a969770732 1e', u'6': None}, u'binding: vif_type' : u'ovs', u'mac_address': u'fa:16: 3e:5a:6d: e0', u'project_id': u'', u'status': u'DOWN', u'subnets': [{u'dns_ nameservers' : [u'10.232.36.101'], u'ipv6_ra_mode': None, u'gateway_ip': u'10.232.16.1', u'cidr': u'10.232.16.0/21', u'id': u'59084723- 8290-4cdd- 996f-14de3f6eea cb', u'subnetpool_id': u'c7ba4af5- 5aca-49e1- abbf-b7072d82d7 40'}], u'binding:host_id': u'ipotane', u'description': u'', u'tags': [], u'device_id': u'acee51b4- ed49-4fa3- a8de-81dee0f384 ba', u'name': u'', u'admin_state_up': True, u'network_id': u'1b78176f- c608-4283- 9bdc-e09961805e 29', u'tenant_id': u'', u'created_at': u'2018- 04-01T23: 53:46Z' , u'mtu': 1500, u'extra_subnets': [{u'dns_ nameservers' : [u'10.232.36.101'], u'ipv6_ra_mode': None, u'gateway_ip': u'10.232.40.100', u'cidr': u'10.232.40.0/21', u'id': u'ee6795c0- 8f06-4fa6- 9531-04168403c7 4f', u'subnetpool_id': u'c7ba4af5- 5aca-49e1- abbf-b7072d82d7 40'}], u'ip_allocation': u'immediate'} port.get( 'address_ scopes' ) b1a1-4d11- 8b98-a969770732 1e', u'6': None}
{u'allowed_
(Pdb) fip_agent_
{u'4': u'd5d483bd-
In contrast, when a tenant network is added after an external network the "network: router_ gateway" port contains the relevant information
> /usr/lib/ python2. 7/dist- packages/ neutron/ agent/l3/ dvr_local_ router. py(577) process_ external( ) address_ pairs': [], u'extra_dhcp_opts': [], u'updated_at': u'2018- 04-01T23: 51:24Z' , u'device_owner': u'network: router_ gateway' , u'revision_number': 13, u'port_ security_ enabled' : False, u'binding:profile': {}, u'binding: vnic_type' : u'normal', u'fixed_ips': [{u'subnet_id': u'ee6795c0- 8f06-4fa6- 9531-04168403c7 4f', u'prefixlen': 21, u'ip_address': u'10.232.41.8'}], u'id': u'1e34db4a- c33c-4c41- b65c-2256a444a7 d7', u'security_groups': [], u'binding: vif_details' : {u'port_filter': True, u'datapath_type': u'system', u'ovs_hybrid_plug': True}, u'address_scopes': {u'4': u'd5d483bd- b1a1-4d11- 8b98-a969770732 1e', u'6': None}, u'binding: vif_type' : u'ovs', u'mac_address': u'fa:16: 3e:b7:6b: 17', u'project_id': u'', u'status': u'ACTIVE', u'subnets': [{u'dns_ nameservers' : [u'10.232.36.101'], u'ipv6_ra_mode': None, u'gateway_ip': u'10.232.40.100', u'cidr': u'10.232.40.0/21', u'id': u'ee6795c0- 8f06-4fa6- 9531-04168403c7 4f', u'subnetpool_id': u'c7ba4af5- 5aca-49e1- abbf-b7072d82d7 40'}], u'binding:host_id': u'pillan', u'description': u'', u'tags': [], u'device_id': u'5edc73a3- 3b60-4942- 9026-4da0ce01e9 3d', u'name': u'', u'admin_state_up': True, u'network_id': u'1b78176f- c608-4283- 9bdc-e09961805e 29', u'tenant_id': u'', u'created_at': u'2018- 04-01T23: 50:55Z' , u'mtu': 1500, u'extra_subnets': [{u'dns_ nameservers' : [u'10.232.36.101'], u'ipv6_ra_mode': None, u'gateway_ip': u'10.232.16.1', u'cidr': u'10.232.16.0/21', u'id': u'59084723- 8290-4cdd- 996f-14de3f6eea cb', u'subnetpool_id': u'c7ba4af5- 5aca-49e1- abbf-b7072d82d7 40'}], u'ip_allocation': u'deferred'}
-> if ex_gw_port:
(Pdb) ex_gw_port
{u'allowed_
In connect_rtr_2_fip there is already a check for agent_gateway_port and it seems to contain identical information for the purposes of set_address_ scope_interface _routes:
def connect_ rtr_2_fip( self): ns.agent_ gateway_ port and not self.rtr_ fip_connect:
ex_ gw_port = self.get_ ex_gw_port( )
self. fip_ns. create_ rtr_2_fip_ link(self)
self. set_address_ scope_interface _routes( ex_gw_port)
if self.fip_