code: def _get_external_network_dict(self, context, port_db):
          
          if port_db.device_owner == DEVICE_OWNER_ROUTER_GW:
              network = self._core_plugin.get_network(context,
                  port_db.network_id)
          else:
              router = self.l3_plugin.get_router(context,
                  port_db.device_id)
              ext_gw_info = router.get(EXTERNAL_GW_INFO)
              if not ext_gw_info:
                  return {}, None
              network = self._core_plugin.get_network(context,
                  ext_gw_info['network_id'])
  
          # network names in GBP workflow need to be reduced, since
          # the network may contain UUIDs
          external_network = self.get_ext_net_name(network['name'])
          # TODO(tbachman): see if we can get rid of the default
          transit_net = self.transit_nets_cfg.get(
              external_network) or self._default_ext_dict
          transit_net['network_name'] = external_network
          return transit_net, network
docs: Get external network information
  
          Get the information about the external network,
          so that it can be used to create the hidden port,
          subnet, and network.