Search in sources :

Example 31 with Adjacencies

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies in project netvirt by opendaylight.

the class VpnInterfaceManager method processVpnInterfaceUp.

// "Unconditional wait" and "Wait not in loop" wrt the VpnNotifyTask below - suppressing the FB violation -
// see comments below.
@SuppressFBWarnings({ "UW_UNCOND_WAIT", "WA_NOT_IN_LOOP" })
protected void processVpnInterfaceUp(final BigInteger dpId, VpnInterface vpnInterface, final String primaryRd, final int lportTag, boolean isInterfaceUp, WriteTransaction writeConfigTxn, WriteTransaction writeOperTxn, WriteTransaction writeInvTxn, Interface interfaceState, final String vpnName) {
    final String interfaceName = vpnInterface.getName();
    Optional<VpnInterfaceOpDataEntry> optOpVpnInterface = VpnUtil.getVpnInterfaceOpDataEntry(dataBroker, interfaceName, vpnName);
    VpnInterfaceOpDataEntry opVpnInterface = optOpVpnInterface.isPresent() ? optOpVpnInterface.get() : null;
    boolean isBgpVpnInternetVpn = VpnUtil.isBgpVpnInternet(dataBroker, vpnName);
    if (!isInterfaceUp) {
        LOG.info("processVpnInterfaceUp: Binding vpn service to interface {} onto dpn {} for vpn {}", interfaceName, dpId, vpnName);
        long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
        if (vpnId == VpnConstants.INVALID_ID) {
            LOG.warn("processVpnInterfaceUp: VpnInstance to VPNId mapping not available for VpnName {}" + " processing vpninterface {} on dpn {}, bailing out now.", vpnName, interfaceName, dpId);
            return;
        }
        boolean waitForVpnInterfaceOpRemoval = false;
        if (opVpnInterface != null && !opVpnInterface.isScheduledForRemove()) {
            String opVpnName = opVpnInterface.getVpnInstanceName();
            String primaryInterfaceIp = null;
            if (opVpnName.equals(vpnName)) {
                // Please check if the primary VRF Entry does not exist for VPNInterface
                // If so, we have to process ADD, as this might be a DPN Restart with Remove and Add triggered
                // back to back
                // However, if the primary VRF Entry for this VPNInterface exists, please continue bailing out !
                List<Adjacency> adjs = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, interfaceName);
                if (adjs == null) {
                    LOG.error("processVpnInterfaceUp: VPN Interface {} on dpn {} for vpn {} failed as adjacencies" + " for this vpn interface could not be obtained", interfaceName, dpId, vpnName);
                    return;
                }
                for (Adjacency adj : adjs) {
                    if (adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
                        primaryInterfaceIp = adj.getIpAddress();
                        break;
                    }
                }
                if (primaryInterfaceIp == null) {
                    LOG.error("processVpnInterfaceUp: VPN Interface {} addition on dpn {} for vpn {} failed" + " as primary adjacency for this vpn interface could not be obtained", interfaceName, dpId, vpnName);
                    return;
                }
                // Get the rd of the vpn instance
                VrfEntry vrf = VpnUtil.getVrfEntry(dataBroker, primaryRd, primaryInterfaceIp);
                if (vrf != null) {
                    LOG.error("processVpnInterfaceUp: VPN Interface {} on dpn {} for vpn {} already provisioned ," + " bailing out from here.", interfaceName, dpId, vpnName);
                    return;
                }
                waitForVpnInterfaceOpRemoval = true;
            } else {
                LOG.error("processVpnInterfaceUp: vpn interface {} to go to configured vpn {} on dpn {}," + " but in operational vpn {}", interfaceName, vpnName, dpId, opVpnName);
            }
        }
        if (!waitForVpnInterfaceOpRemoval) {
            // Add the VPNInterface and quit
            vpnFootprintService.updateVpnToDpnMapping(dpId, vpnName, primaryRd, interfaceName, null, /*ipAddressSourceValuePair*/
            true);
            processVpnInterfaceAdjacencies(dpId, lportTag, vpnName, primaryRd, interfaceName, vpnId, writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState);
            if (!isBgpVpnInternetVpn) {
                VpnUtil.bindService(vpnName, interfaceName, dataBroker, false, /*isTunnelInterface*/
                jobCoordinator);
            }
            LOG.info("processVpnInterfaceUp: Plumbed vpn interface {} onto dpn {} for vpn {}", interfaceName, dpId, vpnName);
            if (interfaceManager.isExternalInterface(interfaceName)) {
                processExternalVpnInterface(interfaceName, vpnName, vpnId, dpId, lportTag, writeInvTxn, NwConstants.ADD_FLOW);
            }
            return;
        }
        // FIB didn't get a chance yet to clean up this VPNInterface
        // Let us give it a chance here !
        LOG.info("processVpnInterfaceUp: Trying to add VPN Interface {} on dpn {} for vpn {}," + " but waiting for FIB to clean up! ", interfaceName, dpId, vpnName);
        try {
            Runnable notifyTask = new VpnNotifyTask();
            synchronized (notifyTask) {
                // Per FB's "Unconditional wait" violation, the code should really verify that the condition it
                // intends to wait for is not already satisfied before calling wait. However the VpnNotifyTask is
                // published here while holding the lock on it so this path will hit the wait before notify can be
                // invoked.
                vpnIntfMap.put(interfaceName, notifyTask);
                try {
                    notifyTask.wait(VpnConstants.MAX_WAIT_TIME_IN_MILLISECONDS);
                } catch (InterruptedException e) {
                // Ignored
                }
            }
        } finally {
            vpnIntfMap.remove(interfaceName);
        }
        if (opVpnInterface != null) {
            LOG.warn("processVpnInterfaceUp: VPN Interface {} removal on dpn {} for vpn {}" + " by FIB did not complete on time," + " bailing addition ...", interfaceName, dpId, vpnName);
            VpnUtil.unsetScheduledToRemoveForVpnInterface(txRunner, interfaceName);
            return;
        }
        // VPNInterface got removed, proceed with Add
        LOG.info("processVpnInterfaceUp: Continuing to plumb vpn interface {} onto dpn {} for vpn {}", interfaceName, dpId, vpnName);
        vpnFootprintService.updateVpnToDpnMapping(dpId, vpnName, primaryRd, interfaceName, null, /*ipAddressSourceValuePair*/
        true);
        processVpnInterfaceAdjacencies(dpId, lportTag, vpnName, primaryRd, interfaceName, vpnId, writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState);
        if (!isBgpVpnInternetVpn) {
            VpnUtil.bindService(vpnName, interfaceName, dataBroker, false, /*isTunnelInterface*/
            jobCoordinator);
        }
        LOG.info("processVpnInterfaceUp: Plumbed vpn interface {} onto dpn {} for vpn {} after waiting for" + " FIB to clean up", interfaceName, dpId, vpnName);
        if (interfaceManager.isExternalInterface(interfaceName)) {
            processExternalVpnInterface(interfaceName, vpnName, vpnId, dpId, lportTag, writeInvTxn, NwConstants.ADD_FLOW);
        }
    } else {
        // Interface is retained in the DPN, but its Link Up.
        // Advertise prefixes again for this interface to BGP
        InstanceIdentifier<VpnInterface> identifier = VpnUtil.getVpnInterfaceIdentifier(vpnInterface.getName());
        InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier = VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
        advertiseAdjacenciesForVpnToBgp(primaryRd, dpId, vpnInterfaceOpIdentifier, vpnName, interfaceName);
        // Perform similar operation as interface add event for extraroutes.
        InstanceIdentifier<Adjacencies> path = identifier.augmentation(Adjacencies.class);
        Optional<Adjacencies> optAdjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
        if (!optAdjacencies.isPresent()) {
            LOG.trace("No config adjacencies present for vpninterface {}", vpnInterface);
            return;
        }
        List<Adjacency> adjacencies = optAdjacencies.get().getAdjacency();
        for (Adjacency adjacency : adjacencies) {
            if (adjacency.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
                continue;
            }
            // if BGPVPN Internet, filter only IPv6 Adjacencies
            if (isBgpVpnInternetVpn && !VpnUtil.isAdjacencyEligibleToVpnInternet(dataBroker, adjacency)) {
                continue;
            }
            addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adjacency, dpId, writeOperTxn, writeConfigTxn);
        }
    }
}
Also used : Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.Adjacencies) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VpnInterface(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 32 with Adjacencies

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies in project netvirt by opendaylight.

the class VpnInterfaceManager method withdrawAdjacenciesForVpnFromBgp.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void withdrawAdjacenciesForVpnFromBgp(final InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, String vpnName, String interfaceName, WriteTransaction writeConfigTxn) {
    // Read NextHops
    InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
    Optional<AdjacenciesOp> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
    String rd = VpnUtil.getVpnRd(dataBroker, interfaceName);
    if (rd == null) {
        LOG.error("withdrawAdjacenciesForVpnFromBgp: Unable to recover rd for interface {} in vpn {}", interfaceName, vpnName);
        return;
    } else {
        if (rd.equals(vpnName)) {
            LOG.info("withdrawAdjacenciesForVpnFromBgp: Ignoring BGP withdrawal for interface {} as it is in " + "internal vpn{} with rd {}", interfaceName, vpnName, rd);
            return;
        }
    }
    LOG.info("withdrawAdjacenciesForVpnFromBgp: For interface {} in vpn {} with rd {}", interfaceName, vpnName, rd);
    if (adjacencies.isPresent()) {
        List<Adjacency> nextHops = adjacencies.get().getAdjacency();
        if (!nextHops.isEmpty()) {
            LOG.trace("withdrawAdjacenciesForVpnFromBgp: NextHops are {} for interface {} in vpn {} rd {}", nextHops, interfaceName, vpnName, rd);
            for (Adjacency nextHop : nextHops) {
                try {
                    if (nextHop.getAdjacencyType() != AdjacencyType.ExtraRoute) {
                        LOG.info("VPN WITHDRAW: withdrawAdjacenciesForVpnFromBgp: Removing Fib Entry rd {}" + " prefix {} for interface {} in vpn {}", rd, nextHop.getIpAddress(), interfaceName, vpnName);
                        bgpManager.withdrawPrefix(rd, nextHop.getIpAddress());
                        LOG.info("VPN WITHDRAW: withdrawAdjacenciesForVpnFromBgp: Removed Fib Entry rd {}" + " prefix {} for interface {} in vpn {}", rd, nextHop.getIpAddress(), interfaceName, vpnName);
                    } else {
                        // Perform similar operation as interface delete event for extraroutes.
                        String allocatedRd = nextHop.getVrfId();
                        for (String nh : nextHop.getNextHopIpList()) {
                            deleteExtraRouteFromCurrentAndImportingVpns(vpnName, nextHop.getIpAddress(), nh, allocatedRd, interfaceName, writeConfigTxn);
                        }
                    }
                } catch (Exception e) {
                    LOG.error("withdrawAdjacenciesForVpnFromBgp: Failed to withdraw prefix {} in vpn {} with rd {}" + " for interface {} ", nextHop.getIpAddress(), vpnName, rd, interfaceName, e);
                }
            }
        }
    }
}
Also used : AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) ExecutionException(java.util.concurrent.ExecutionException)

Example 33 with Adjacencies

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies in project netvirt by opendaylight.

the class VpnInterfaceManager method createFibEntryForRouterInterface.

protected void createFibEntryForRouterInterface(String primaryRd, VpnInterface vpnInterface, String interfaceName, WriteTransaction writeConfigTxn, String vpnName) {
    if (vpnInterface == null) {
        return;
    }
    List<Adjacency> adjs = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, interfaceName);
    if (adjs == null) {
        LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as adjacencies for" + " this vpn interface could not be obtained. vpn {}", interfaceName, vpnName);
        return;
    }
    for (Adjacency adj : adjs) {
        if (adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
            String primaryInterfaceIp = adj.getIpAddress();
            String macAddress = adj.getMacAddress();
            String prefix = VpnUtil.getIpPrefix(primaryInterfaceIp);
            long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(primaryRd, prefix));
            RouterInterface routerInt = new RouterInterfaceBuilder().setUuid(vpnName).setIpAddress(primaryInterfaceIp).setMacAddress(macAddress).build();
            fibManager.addFibEntryForRouterInterface(primaryRd, prefix, routerInt, label, writeConfigTxn);
            LOG.info("createFibEntryForRouterInterface: Router interface {} for vpn {} rd {} prefix {} label {}" + " macAddress {} processed successfully;", interfaceName, vpnName, primaryRd, prefix, label, macAddress);
            return;
        }
    }
    LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as primary" + " adjacency for this vpn interface could not be obtained. rd {} vpnName {}", interfaceName, primaryRd, vpnName);
}
Also used : RouterInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) RouterInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterfaceBuilder)

Example 34 with Adjacencies

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies in project netvirt by opendaylight.

the class VpnInterfaceManager method removeAdjacenciesFromVpn.

private void removeAdjacenciesFromVpn(final BigInteger dpnId, final int lportTag, final String interfaceName, final String vpnName, final long vpnId, String gwMac, WriteTransaction writeConfigTxn, final WriteTransaction writeOperTxn, final WriteTransaction writeInvTxn) {
    // Read NextHops
    InstanceIdentifier<VpnInterfaceOpDataEntry> identifier = VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
    InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
    Optional<AdjacenciesOp> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
    String primaryRd = VpnUtil.getVpnRd(dataBroker, vpnName);
    LOG.info("removeAdjacenciesFromVpn: For interface {} on dpn {} RD recovered for vpn {} as rd {}", interfaceName, dpnId, vpnName, primaryRd);
    if (adjacencies.isPresent() && !adjacencies.get().getAdjacency().isEmpty()) {
        List<Adjacency> nextHops = adjacencies.get().getAdjacency();
        LOG.info("removeAdjacenciesFromVpn: NextHops for interface {} on dpn {} for vpn {} are {}", interfaceName, dpnId, vpnName, nextHops);
        for (Adjacency nextHop : nextHops) {
            if (nextHop.isPhysNetworkFunc()) {
                LOG.info("removeAdjacenciesFromVpn: Removing PNF FIB entry rd {} prefix {}", nextHop.getSubnetId().getValue(), nextHop.getIpAddress());
                fibManager.removeFibEntry(nextHop.getSubnetId().getValue(), nextHop.getIpAddress(), null);
            } else {
                String rd = nextHop.getVrfId();
                List<String> nhList;
                if (nextHop.getAdjacencyType() != AdjacencyType.PrimaryAdjacency) {
                    nhList = getNextHopForNonPrimaryAdjacency(nextHop, vpnName, dpnId, interfaceName);
                } else {
                    // This is a primary adjacency
                    nhList = nextHop.getNextHopIpList() != null ? nextHop.getNextHopIpList() : Collections.emptyList();
                    removeGwMacAndArpResponderFlows(nextHop, vpnId, dpnId, lportTag, gwMac, interfaceName, writeInvTxn);
                }
                if (!nhList.isEmpty()) {
                    if (rd.equals(vpnName)) {
                        // this is an internal vpn - the rd is assigned to the vpn instance name;
                        // remove from FIB directly
                        nhList.forEach(removeAdjacencyFromInternalVpn(nextHop, vpnName, interfaceName, dpnId, writeConfigTxn));
                    } else {
                        removeAdjacencyFromBgpvpn(nextHop, nhList, vpnName, primaryRd, dpnId, rd, interfaceName, writeConfigTxn);
                    }
                } else {
                    LOG.error("removeAdjacenciesFromVpn: nextHop empty for ip {} rd {} adjacencyType {}" + " interface {}", nextHop.getIpAddress(), rd, nextHop.getAdjacencyType().toString(), interfaceName);
                    bgpManager.withdrawPrefixIfPresent(rd, nextHop.getIpAddress());
                    fibManager.removeFibEntry(primaryRd, nextHop.getIpAddress(), writeConfigTxn);
                }
            }
            String ip = nextHop.getIpAddress().split("/")[0];
            LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, ip);
            if (vpnVipToPort != null) {
                VpnUtil.removeLearntVpnVipToPort(dataBroker, vpnName, ip);
                LOG.info("removeAdjacenciesFromVpn: VpnInterfaceManager removed adjacency for Interface {}" + " ip {} on dpn {} for vpn {} from VpnPortData Entry", vpnVipToPort.getPortName(), ip, dpnId, vpnName);
            }
        }
    } else {
        // this vpn interface has no more adjacency left, so clean up the vpn interface from Operational DS
        LOG.info("removeAdjacenciesFromVpn: Vpn Interface {} on vpn {} dpn {} has no adjacencies." + " Removing it.", interfaceName, vpnName, dpnId);
        writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, identifier);
    }
}
Also used : AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)

Example 35 with Adjacencies

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies in project netvirt by opendaylight.

the class TunnelInterfaceStateListener method handleTunnelEventForDPNVpn.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleTunnelEventForDPNVpn(StateTunnelList stateTunnelList, Map<Long, String> vpnIdRdMap, TunnelAction tunnelAction, boolean isTepDeletedOnDpn, List<Uuid> subnetList, TunnelEventProcessingMethod method, VpnInterface cfgVpnInterface) {
    String rd;
    String intfName = cfgVpnInterface.getName();
    final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
    String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
    String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
    int tunTypeVal = getTunnelType(stateTunnelList);
    BigInteger remoteDpnId = null;
    if (tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
        remoteDpnId = new BigInteger(stateTunnelList.getDstInfo().getTepDeviceId());
    }
    if (cfgVpnInterface.getVpnInstanceNames() == null) {
        LOG.warn("handleTunnelEventForDpn: no vpnName found for interface {}", intfName);
        return;
    }
    for (VpnInstanceNames vpnInstance : cfgVpnInterface.getVpnInstanceNames()) {
        String vpnName = vpnInstance.getVpnName();
        if (method == TunnelEventProcessingMethod.POPULATESUBNETS) {
            Optional<VpnInterfaceOpDataEntry> opVpnInterface = VpnUtil.getVpnInterfaceOpDataEntry(dataBroker, intfName, vpnName);
            if (opVpnInterface.isPresent() && !opVpnInterface.get().isScheduledForRemove()) {
                VpnInterfaceOpDataEntry vpnInterface = opVpnInterface.get();
                jobCoordinator.enqueueJob("VPNINTERFACE-" + intfName, new UpdateVpnInterfaceOnTunnelEvent(tunnelAction, vpnInterface, stateTunnelList, isTepDeletedOnDpn));
                // Populate the List of subnets
                InstanceIdentifier<PortOpDataEntry> portOpIdentifier = InstanceIdentifier.builder(PortOpData.class).child(PortOpDataEntry.class, new PortOpDataEntryKey(intfName)).build();
                Optional<PortOpDataEntry> optionalPortOp = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, portOpIdentifier);
                if (optionalPortOp.isPresent()) {
                    List<Uuid> subnetIdList = optionalPortOp.get().getSubnetIds();
                    if (subnetIdList != null) {
                        for (Uuid subnetId : subnetIdList) {
                            if (!subnetList.contains(subnetId)) {
                                subnetList.add(subnetId);
                            }
                        }
                    }
                }
                // Populate the map for VpnId-to-Rd
                long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
                rd = VpnUtil.getVpnRd(dataBroker, vpnName);
                vpnIdRdMap.put(vpnId, rd);
            }
        } else if (method == TunnelEventProcessingMethod.MANAGEREMOTEROUTES) {
            Optional<VpnInterfaceOpDataEntry> opVpnInterface = VpnUtil.getVpnInterfaceOpDataEntry(dataBroker, intfName, vpnName);
            if (opVpnInterface.isPresent()) {
                VpnInterfaceOpDataEntry vpnInterface = opVpnInterface.get();
                AdjacenciesOp adjacencies = vpnInterface.getAugmentation(AdjacenciesOp.class);
                List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : Collections.emptyList();
                String prefix = null;
                long vpnId = VpnUtil.getVpnId(dataBroker, vpnInterface.getVpnInstanceName());
                if (vpnIdRdMap.containsKey(vpnId)) {
                    rd = vpnIdRdMap.get(vpnId);
                    LOG.info("handleTunnelEventForDPN: Remote DpnId {} VpnId {} rd {} VpnInterface {} srcTepIp " + "{} destTepIp {}", remoteDpnId, vpnId, rd, vpnInterface, srcTepIp, destTepIp);
                    for (Adjacency adj : adjList) {
                        prefix = adj.getIpAddress();
                        long label = adj.getLabel();
                        if (tunnelAction == TunnelAction.TUNNEL_EP_ADD && tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
                            fibManager.manageRemoteRouteOnDPN(true, srcDpnId, vpnId, rd, prefix, destTepIp, label);
                        }
                        if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE && tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
                            fibManager.manageRemoteRouteOnDPN(false, srcDpnId, vpnId, rd, prefix, destTepIp, label);
                        }
                    }
                }
            }
        }
    }
}
Also used : Optional(com.google.common.base.Optional) PortOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.port.op.data.PortOpDataEntry) PortOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.port.op.data.PortOpDataEntryKey) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.vpn._interface.VpnInstanceNames) AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) BigInteger(java.math.BigInteger) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) DcGatewayIpList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)

Aggregations

ArrayList (java.util.ArrayList)31 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency)28 ExecutionException (java.util.concurrent.ExecutionException)27 AdjacenciesOp (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp)22 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)22 AdjacencyKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyKey)20 VpnInterfaceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)19 Adjacencies (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies)18 VpnInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)15 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)14 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)14 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)13 LearntVpnVipToPort (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort)12 TransactionCommitFailedException (org.opendaylight.mdsal.common.api.TransactionCommitFailedException)11 Adjacencies (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.Adjacencies)9 AdjacencyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyBuilder)9 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)9 List (java.util.List)8 VpnInterface (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface)8