'Add or delete arp entry into router namespace for the subnet.'

def _update_arp_entry(self, ip, mac, subnet_id, operation):

    port = self._get_internal_port(subnet_id)
    if (not port):
        return False
    try:
        interface_name = self.get_internal_device_name(port['id'])
        device = ip_lib.IPDevice(interface_name, namespace=self.ns_name)
        if device.exists():
            if (operation == 'add'):
                device.neigh.add(ip, mac)
            elif (operation == 'delete'):
                device.neigh.delete(ip, mac)
            return True
        else:
            if (operation == 'add'):
                LOG.warning(_LW('Device    %s    does    not    exist    so    ARP    entry    cannot    be    updated,    will    cache    information    to    be    applied    later    when    the    device    exists'), device)
                self._cache_arp_entry(ip, mac, subnet_id, operation)
            return False
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_LE('DVR:    Failed    updating    arp    entry'))
