'Configure IP addresses on router\'s external gateway interface.
Ensures addresses for existing floating IPs and cleans up
those that should not longer be configured.'

def process_floating_ip_addresses(self, interface_name):

    fip_statuses = {}
    if (interface_name is None):
        LOG.debug('No    Interface    for    floating    IPs    router:    %s', self.router['id'])
        return fip_statuses
    device = ip_lib.IPDevice(interface_name, namespace=self.ns_name)
    existing_cidrs = self.get_router_cidrs(device)
    new_cidrs = set()
    gw_cidrs = self._get_gw_ips_cidr()
    floating_ips = self.get_floating_ips()
    for fip in floating_ips:
        fip_ip = fip['floating_ip_address']
        ip_cidr = common_utils.ip_to_cidr(fip_ip)
        new_cidrs.add(ip_cidr)
        fip_statuses[fip['id']] = lib_constants.FLOATINGIP_STATUS_ACTIVE
        if (ip_cidr not in existing_cidrs):
            fip_statuses[fip['id']] = self.add_floating_ip(fip, interface_name, device)
            LOG.debug('Floating    ip    %(id)s    added,    status    %(status)s', {'id': fip['id'], 'status': fip_statuses.get(fip['id'])})
        elif ((fip_ip in self.fip_map) and (self.fip_map[fip_ip] != fip['fixed_ip_address'])):
            LOG.debug('Floating    IP    was    moved    from    fixed    IP    %(old)s    to    %(new)s', {'old': self.fip_map[fip_ip], 'new': fip['fixed_ip_address']})
            fip_statuses[fip['id']] = self.move_floating_ip(fip)
        elif (fip_statuses[fip['id']] == fip['status']):
            fip_statuses[fip['id']] = FLOATINGIP_STATUS_NOCHANGE
    fips_to_remove = (ip_cidr for ip_cidr in ((existing_cidrs - new_cidrs) - gw_cidrs) if common_utils.is_cidr_host(ip_cidr))
    for ip_cidr in fips_to_remove:
        LOG.debug('Removing    floating    ip    %s    from    interface    %s    in    namespace    %s', ip_cidr, interface_name, self.ns_name)
        self.remove_floating_ip(device, ip_cidr)
    return fip_statuses
