Search in sources :

Example 86 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class ArpNotificationHandler method onArpRequestReceived.

@Override
public void onArpRequestReceived(ArpRequestReceived notification) {
    String srcInterface = notification.getInterface();
    IpAddress srcIP = notification.getSrcIpaddress();
    PhysAddress srcMac = notification.getSrcMac();
    IpAddress targetIP = notification.getDstIpaddress();
    BigInteger metadata = notification.getMetadata();
    boolean isGarp = srcIP.equals(targetIP);
    if (!isGarp) {
        LOG.info("ArpNotification Non-Gratuitous Request Received from " + "interface {} and IP {} having MAC {} target destination {}, ignoring..", srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue(), targetIP.getIpv4Address().getValue());
        return;
    }
    LOG.info("ArpNotification Gratuitous Request Received from " + "interface {} and IP {} having MAC {} target destination {}, learning MAC", srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue(), targetIP.getIpv4Address().getValue());
    processArpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
Also used : BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 87 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class ArpNotificationHandler method onArpResponseReceived.

@Override
public void onArpResponseReceived(ArpResponseReceived notification) {
    String srcInterface = notification.getInterface();
    IpAddress srcIP = notification.getSrcIpaddress();
    PhysAddress srcMac = notification.getSrcMac();
    LOG.info("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC", srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue());
    List<Adjacency> adjacencies = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, srcInterface);
    if (adjacencies != null) {
        for (Adjacency adj : adjacencies) {
            String ipAddress = adj.getIpAddress();
            try {
                if (NWUtil.isIpInSubnet(NWUtil.ipAddressToInt(srcIP.getIpv4Address().getValue()), ipAddress)) {
                    return;
                }
            } catch (UnknownHostException e) {
                LOG.error("Subnet string {} not convertible to InetAdddress", srcIP, e);
            }
        }
    }
    BigInteger metadata = notification.getMetadata();
    IpAddress targetIP = notification.getDstIpaddress();
    LOG.trace("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC", srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue());
    processArpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
Also used : UnknownHostException(java.net.UnknownHostException) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 88 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class ArpNotificationHandler method processArpLearning.

private void processArpLearning(String srcInterface, IpAddress srcIP, PhysAddress srcMac, BigInteger metadata, IpAddress dstIP) {
    if (metadata != null && !Objects.equals(metadata, BigInteger.ZERO)) {
        Optional<List<String>> vpnList = VpnUtil.getVpnHandlingIpv4AssociatedWithInterface(dataBroker, srcInterface);
        if (vpnList.isPresent()) {
            for (String vpnName : vpnList.get()) {
                LOG.info("Received ARP for sender MAC {} and sender IP {} via interface {}", srcMac.getValue(), srcIP.getIpv4Address().getValue(), srcInterface);
                String ipToQuery = srcIP.getIpv4Address().getValue();
                LOG.info("ARP being processed for Source IP {}", ipToQuery);
                VpnPortipToPort vpnPortipToPort = VpnUtil.getNeutronPortFromVpnPortFixedIp(dataBroker, vpnName, ipToQuery);
                if (vpnPortipToPort != null) {
                    /* This is a well known neutron port and so should be ignored
                         * from being discovered
                         */
                    continue;
                }
                LearntVpnVipToPort learntVpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, ipToQuery);
                if (learntVpnVipToPort != null) {
                    String oldPortName = learntVpnVipToPort.getPortName();
                    String oldMac = learntVpnVipToPort.getMacAddress();
                    if (!oldMac.equalsIgnoreCase(srcMac.getValue())) {
                        // MAC has changed for requested IP
                        LOG.info("ARP Source IP/MAC data modified for IP {} with MAC {} and Port {}", ipToQuery, srcMac, srcInterface);
                        synchronized ((vpnName + ipToQuery).intern()) {
                            removeMipAdjacency(vpnName, oldPortName, srcIP);
                            VpnUtil.removeLearntVpnVipToPort(dataBroker, vpnName, ipToQuery);
                            putVpnIpToMigrateArpCache(vpnName, ipToQuery, srcMac);
                        }
                    }
                } else if (!isIpInArpMigrateCache(vpnName, ipToQuery)) {
                    learnMacFromArpPackets(vpnName, srcInterface, srcIP, srcMac, dstIP);
                }
            }
        } else {
            LOG.info("ARP NO_RESOLVE: VPN  not configured. Ignoring responding to ARP requests from this" + " Interface {}.", srcInterface);
            return;
        }
    }
}
Also used : VpnPortipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort) ArrayList(java.util.ArrayList) List(java.util.List) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort)

Example 89 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class GeniusProvider method getEgressVxlanPortForNode.

public Optional<Long> getEgressVxlanPortForNode(BigInteger dpnId) {
    List<OvsdbTerminationPointAugmentation> tpList = interfaceMgr.getTunnelPortsOnBridge(dpnId);
    if (tpList == null) {
        // Most likely the bridge doesnt exist for this dpnId
        LOG.warn("getEgressVxlanPortForNode Tunnel Port TerminationPoint list not available for dpnId [{}]", dpnId);
        return Optional.empty();
    }
    for (OvsdbTerminationPointAugmentation tp : tpList) {
        if (tp == null) {
            // Technically we should never have a list with NULL entries, but
            // in a preliminary version of interfaceMgr.getTunnelPortsOnBridge()
            // we were getting a list where all termination point entries were
            // null. Leaving this check for now for protection.
            LOG.error("getEgressVxlanPortForNode received a NULL termination point from tpList on dpnId [{}]", dpnId);
            continue;
        }
        Class<? extends InterfaceTypeBase> ifType = tp.getInterfaceType();
        if (ifType.equals(InterfaceTypeVxlan.class)) {
            List<Options> tpOptions = tp.getOptions();
            for (Options tpOption : tpOptions) {
                // From the VXLAN Tunnels, we want the one with the GPE option set
                if (tpOption.getKey().getOption().equals(OPTION_KEY_EXTS)) {
                    if (tpOption.getValue().equals(OPTION_VALUE_EXTS_GPE)) {
                        return Optional.ofNullable(tp.getOfport());
                    }
                }
            }
        }
    }
    LOG.warn("getEgressVxlanPortForNode no Vxgpe tunnel ports available for dpnId [{}]", dpnId);
    return Optional.empty();
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Example 90 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project openflowplugin by opendaylight.

the class MeterForwarder method update.

@Override
public Future<RpcResult<UpdateMeterOutput>> update(final InstanceIdentifier<Meter> identifier, final Meter original, final Meter update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Received the Meter UPDATE request [Tbl id, node Id {} {} {}", identifier, nodeIdent, update);
    final UpdateMeterInputBuilder builder = new UpdateMeterInputBuilder();
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    builder.setMeterRef(new MeterRef(identifier));
    builder.setUpdatedMeter(new UpdatedMeterBuilder(update).build());
    builder.setOriginalMeter(new OriginalMeterBuilder(original).build());
    return salMeterService.updateMeter(builder.build());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) UpdateMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef) UpdatedMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder) OriginalMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)29 ArrayList (java.util.ArrayList)24 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)23 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)18 BigInteger (java.math.BigInteger)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 List (java.util.List)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 Test (org.junit.Test)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)12 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 UnknownHostException (java.net.UnknownHostException)10 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)9 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)9 Collections (java.util.Collections)8 Map (java.util.Map)8 VpnInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface)8