def create_fip_agent_gw_port_if_not_exists(
        self, context, network_id, host):
        l3_agent_db = self._get_agent_by_type_and_host(
            context, const.AGENT_TYPE_L3, host)
        if l3_agent_db:
            LOG.debug("Agent ID exists: %s", l3_agent_db['id'])
            f_port = self._get_agent_gw_ports_exist_for_network(
                context, network_id, host, l3_agent_db['id'])
            if not f_port:
                LOG.info(_LI('Agent Gateway port does not exist,'
                             ' so create one: %s'), f_port)
                port_data = {'tenant_id': '',
                             'network_id': network_id,
                             'device_id': l3_agent_db['id'],
                             'device_owner': const.DEVICE_OWNER_AGENT_GW,
                             portbindings.HOST_ID: host,
                             'admin_state_up': True,
                             'name': ''}
                agent_port = p_utils.create_port(self._core_plugin, context,
                                                 {'port': port_data})
                if agent_port:
                    self._populate_mtu_and_subnets_for_ports(context,
                                                             [agent_port])
                    return agent_port
                msg = _("Unable to create the Agent Gateway Port")
                raise n_exc.BadRequest(resource='router', msg=msg)
            else:
                self._populate_mtu_and_subnets_for_ports(context, [f_port])
                return f_port
Function to return the FIP Agent GW port.
dataset/ETHPy150Open openstack/neutron/neutron/db/l3_dvr_db.py/L3_NAT_with_dvr_db_mixin.create_fip_agent_gw_port_if_not_exists