

def _get_vpn_gateways_external_ips(context, neutron):
    vpcs = {vpc['id']: vpc for vpc in db_api.get_items(context, 'vpc')}
    external_ips = {
        
    }
    routers = neutron.list_routers(tenant_id=context.project_id)['routers']
    for router in routers:
        info = router['external_gateway_info']
        if info:
            for ip in info['external_fixed_ips']:
                if netaddr.valid_ipv4(ip['ip_address']):
                    external_ips[vpcs['id']] = ip['ip_address']
    return {vgw['id']: external_ips.get(vpcs[vgw['vpc_id']]['os_id']) for vgw in db_api.get_items(context, 'vgw') if vgw['vpc_id']}

dataset/ETHPy150Open openstack/ec2-api/ec2api/api/vpn_connection.py _get_vpn_gateways_external_ips/VarMisuse@101/147 `router`->`vpcs`