Search in sources :

Example 86 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier 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 Uint64 dpId, VpnInterface vpnInterface, final String primaryRd, final int lportTag, boolean isInterfaceUp, TypedWriteTransaction<Configuration> writeConfigTxn, TypedWriteTransaction<Operational> writeOperTxn, TypedReadWriteTransaction<Configuration> writeInvTxn, Interface interfaceState, final String vpnName, Set<String> prefixListForRefreshFib) throws ExecutionException, InterruptedException {
    final String interfaceName = vpnInterface.getName();
    Optional<VpnInterfaceOpDataEntry> optOpVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(interfaceName, vpnName);
    VpnInterfaceOpDataEntry opVpnInterface = optOpVpnInterface.isPresent() ? optOpVpnInterface.get() : null;
    boolean isBgpVpnInternetVpn = vpnUtil.isBgpVpnInternet(vpnName);
    if (!isInterfaceUp) {
        LOG.info("processVpnInterfaceUp: Binding vpn service to interface {} onto dpn {} for vpn {}", interfaceName, dpId, vpnName);
        Uint32 vpnId = vpnUtil.getVpnId(vpnName);
        if (VpnConstants.INVALID_ID.equals(vpnId)) {
            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) {
            String opVpnName = opVpnInterface.getVpnInstanceName();
            String primaryInterfaceIp = null;
            if (Objects.equals(opVpnName, 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(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(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, prefixListForRefreshFib);
            if (!isBgpVpnInternetVpn) {
                vpnUtil.bindService(vpnName, interfaceName, false);
            }
            LOG.info("processVpnInterfaceUp: Plumbed vpn interface {} onto dpn {} for vpn {}", interfaceName, dpId, vpnName);
            if (interfaceManager.isExternalInterface(interfaceName)) {
                processExternalVpnInterface(interfaceName, vpnName, dpId, lportTag, 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(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, prefixListForRefreshFib);
        if (!isBgpVpnInternetVpn) {
            vpnUtil.bindService(vpnName, interfaceName, false);
        }
        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, dpId, lportTag, NwConstants.ADD_FLOW);
        }
    } else {
        try {
            // 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 = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
            if (!optAdjacencies.isPresent()) {
                LOG.trace("No config adjacencyKeyAdjacencyMap present for vpninterface {}", vpnInterface);
                return;
            }
            Map<AdjacencyKey, Adjacency> adjacencyKeyAdjacencyMap = optAdjacencies.get().nonnullAdjacency();
            for (Adjacency adjacency : adjacencyKeyAdjacencyMap.values()) {
                if (adjacency.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
                    continue;
                }
                // if BGPVPN Internet, filter only IPv6 Adjacencies
                if (isBgpVpnInternetVpn && !vpnUtil.isAdjacencyEligibleToVpnInternet(adjacency)) {
                    continue;
                }
                addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adjacency, dpId, writeOperTxn, writeConfigTxn, writeInvTxn, prefixListForRefreshFib);
            }
        } catch (InterruptedException | ExecutionException e) {
            LOG.error("processVpnInterfaceUp: Failed to read data store for interface {} vpn {} rd {} dpn {}", interfaceName, vpnName, primaryRd, dpId);
        }
    }
}
Also used : AdjacencyKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyKey) Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) ExecutionException(java.util.concurrent.ExecutionException) Uint32(org.opendaylight.yangtools.yang.common.Uint32) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 87 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project netvirt by opendaylight.

the class VpnInterfaceOpListener method remove.

@Override
public void remove(final InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, final VpnInterfaceOpDataEntry del) {
    final VpnInterfaceOpDataEntryKey key = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class);
    final String interfaceName = key.getName();
    jobCoordinator.enqueueJob("VPNINTERFACE-" + interfaceName, () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
        postProcessVpnInterfaceRemoval(identifier, del, tx, null);
        LOG.info("remove: Removed vpn operational data for interface {} on dpn {} vpn {}", del.getName(), del.getDpnId(), del.getVpnInstanceName());
    })));
}
Also used : VpnInterfaceOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryKey)

Example 88 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project netvirt by opendaylight.

the class InterfaceStateChangeListener method remove.

@Override
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void remove(InstanceIdentifier<Interface> identifier, Interface intrf) {
    final String ifName = intrf.getName();
    Uint64 dpId = Uint64.ZERO;
    try {
        if (L2vlan.class.equals(intrf.getType())) {
            LOG.info("VPN Interface remove event - intfName {} from InterfaceStateChangeListener", intrf.getName());
            try {
                dpId = InterfaceUtils.getDpIdFromInterface(intrf);
            } catch (Exception e) {
                LOG.error("Unable to retrieve dpnId from interface operational data store for interface" + " {}. Fetching from vpn interface op data store. ", ifName, e);
            }
            final Uint64 inputDpId = dpId;
            jobCoordinator.enqueueJob("VPNINTERFACE-" + ifName, () -> {
                List<ListenableFuture<?>> futures = new ArrayList<>(3);
                ListenableFuture<?> configFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, writeOperTxn -> futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
                    VpnInterface cfgVpnInterface = vpnUtil.getConfiguredVpnInterface(ifName);
                    if (cfgVpnInterface == null) {
                        LOG.debug("Interface {} is not a vpninterface, ignoring.", ifName);
                        return;
                    }
                    for (VpnInstanceNames vpnInterfaceVpnInstance : cfgVpnInterface.nonnullVpnInstanceNames().values()) {
                        String vpnName = vpnInterfaceVpnInstance.getVpnName();
                        Optional<VpnInterfaceOpDataEntry> optVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(ifName, vpnName);
                        if (!optVpnInterface.isPresent()) {
                            LOG.debug("Interface {} vpn {} is not a vpninterface, or deletion" + " triggered by northbound agent. ignoring.", ifName, vpnName);
                            continue;
                        }
                        handleMipAdjRemoval(cfgVpnInterface, vpnName);
                        final VpnInterfaceOpDataEntry vpnInterface = optVpnInterface.get();
                        String gwMac = intrf.getPhysAddress() != null ? intrf.getPhysAddress().getValue() : vpnInterface.getGatewayMacAddress();
                        Uint64 dpnId = inputDpId;
                        if (dpnId == null || dpnId.equals(Uint64.ZERO)) {
                            dpnId = vpnInterface.getDpnId();
                        }
                        final int ifIndex = intrf.getIfIndex();
                        LOG.info("VPN Interface remove event - intfName {} onto vpnName {}" + " running oper-driver", vpnInterface.getName(), vpnName);
                        vpnInterfaceManager.processVpnInterfaceDown(dpnId, ifName, ifIndex, gwMac, vpnInterface, false, writeConfigTxn, writeOperTxn, writeInvTxn);
                    }
                })))));
                futures.add(configFuture);
                Futures.addCallback(configFuture, new PostVpnInterfaceThreadWorker(intrf.getName(), false, "Operational"), MoreExecutors.directExecutor());
                return futures;
            }, DJC_MAX_RETRIES);
        }
    } catch (Exception e) {
        LOG.error("Exception observed in handling deletion of VPN Interface {}. ", ifName, e);
    }
}
Also used : ArrayList(java.util.ArrayList) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.vpn._interface.VpnInstanceNames) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 89 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project netvirt by opendaylight.

the class InterfaceStateChangeListener method update.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public void update(InstanceIdentifier<Interface> identifier, Interface original, Interface update) {
    final String ifName = update.getName();
    try {
        if (update.getIfIndex() == null) {
            return;
        }
        if (L2vlan.class.equals(update.getType())) {
            LOG.info("VPN Interface update event - intfName {} from InterfaceStateChangeListener", update.getName());
            jobCoordinator.enqueueJob("VPNINTERFACE-" + ifName, () -> {
                List<ListenableFuture<?>> futures = new ArrayList<>(3);
                futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, writeOperTxn -> {
                    // map of prefix and vpn name used, as entry in prefix-to-interface datastore
                    // is prerequisite for refresh Fib to avoid race condition leading to missing remote
                    // next hop in bucket actions on bgp-vpn delete
                    Map<String, Set<String>> mapOfRdAndPrefixesForRefreshFib = new HashMap<>();
                    ListenableFuture<?> configTxFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, writeConfigTxn -> futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
                        final VpnInterface vpnIf = vpnUtil.getConfiguredVpnInterface(ifName);
                        if (vpnIf != null) {
                            final int ifIndex = update.getIfIndex();
                            Uint64 dpnId;
                            try {
                                dpnId = InterfaceUtils.getDpIdFromInterface(update);
                            } catch (Exception e) {
                                LOG.error("remove: Unable to retrieve dpnId for interface {}", ifName, e);
                                return;
                            }
                            IntfTransitionState state = getTransitionState(original.getOperStatus(), update.getOperStatus());
                            if (state.equals(IntfTransitionState.STATE_IGNORE)) {
                                LOG.info("InterfaceStateChangeListener: Interface {} state " + "original {}" + "updated {} not handled", ifName, original.getOperStatus(), update.getOperStatus());
                                return;
                            }
                            LOG.error("InterfaceStateChangeListener- Processing ifState {} " + "update event " + "with dpnId {} operstate {}", ifName, dpnId, update.getOperStatus());
                            if (state.equals(IntfTransitionState.STATE_UP) && vpnIf.getVpnInstanceNames() != null) {
                                for (VpnInstanceNames vpnInterfaceVpnInstance : vpnIf.getVpnInstanceNames().values()) {
                                    String vpnName = vpnInterfaceVpnInstance.getVpnName();
                                    String primaryRd = vpnUtil.getPrimaryRd(vpnName);
                                    Set<String> prefixes = new HashSet<>();
                                    if (!vpnInterfaceManager.isVpnInstanceReady(vpnName)) {
                                        LOG.error("VPN Interface update event - intfName {} " + "onto vpnName {} running oper-driven UP, " + "VpnInstance not ready, holding on", vpnIf.getName(), vpnName);
                                    } else if (vpnUtil.isVpnPendingDelete(primaryRd)) {
                                        LOG.error("update: Ignoring UP event for vpnInterface " + "{}, as vpnInstance {} with primaryRd {} is " + "already marked for deletion ", vpnIf.getName(), vpnName, primaryRd);
                                    } else {
                                        vpnInterfaceManager.processVpnInterfaceUp(dpnId, vpnIf, primaryRd, ifIndex, true, writeConfigTxn, writeOperTxn, writeInvTxn, update, vpnName, prefixes);
                                        mapOfRdAndPrefixesForRefreshFib.put(primaryRd, prefixes);
                                    }
                                }
                            } else if (state.equals(IntfTransitionState.STATE_DOWN) && vpnIf.getVpnInstanceNames() != null) {
                                for (VpnInstanceNames vpnInterfaceVpnInstance : vpnIf.getVpnInstanceNames().values()) {
                                    String vpnName = vpnInterfaceVpnInstance.getVpnName();
                                    LOG.info("VPN Interface update event - intfName {} " + " onto vpnName {} running oper-driven DOWN", vpnIf.getName(), vpnName);
                                    Optional<VpnInterfaceOpDataEntry> optVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(vpnIf.getName(), vpnName);
                                    if (optVpnInterface.isPresent()) {
                                        VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
                                        vpnInterfaceManager.processVpnInterfaceDown(dpnId, vpnIf.getName(), ifIndex, update.getPhysAddress().getValue(), vpnOpInterface, true, writeConfigTxn, writeOperTxn, writeInvTxn);
                                    } else {
                                        LOG.error("InterfaceStateChangeListener Update DOWN - " + " vpnInterface {}not available, ignoring event", vpnIf.getName());
                                        continue;
                                    }
                                }
                            }
                        } else {
                            LOG.debug("Interface {} is not a vpninterface, ignoring.", ifName);
                        }
                    })));
                    Futures.addCallback(configTxFuture, new VpnInterfaceCallBackHandler(mapOfRdAndPrefixesForRefreshFib), MoreExecutors.directExecutor());
                    futures.add(configTxFuture);
                }));
                return futures;
            });
        }
    } catch (Exception e) {
        LOG.error("Exception observed in handling updation of VPN Interface {}. ", update.getName(), e);
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) InterfacesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) LoggerFactory(org.slf4j.LoggerFactory) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) HashBasedTable(com.google.common.collect.HashBasedTable) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) PreDestroy(javax.annotation.PreDestroy) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) Map(java.util.Map) AdjacencyKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyKey) Logger(org.slf4j.Logger) OperStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Set(java.util.Set) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.vpn._interface.VpnInstanceNames) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies) FutureCallback(com.google.common.util.concurrent.FutureCallback) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.L2vlan) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) Optional(java.util.Optional) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) Table(com.google.common.collect.Table) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) HashSet(java.util.HashSet) Set(java.util.Set) ArrayList(java.util.ArrayList) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.vpn._interface.VpnInstanceNames) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) HashMap(java.util.HashMap) Map(java.util.Map) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 90 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project netvirt by opendaylight.

the class ElanDpnInterfacesListener method add.

@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
    final String elanName = getElanName(identifier);
    BigInteger addDpnId = dpnInterfaces.getDpId();
    LOG.debug("ELAN interfaces {} added on DPN {} for Elan {}", dpnInterfaces.getInterfaces(), addDpnId, elanName);
    Optional<ElanServiceChainState> elanServiceChainState = ElanServiceChainUtils.getElanServiceChainState(broker, elanName);
    if (elanServiceChainState.isPresent()) {
        List<ElanToPseudoPortData> elanToPseudoPortDataList = elanServiceChainState.get().getElanToPseudoPortData();
        for (ElanToPseudoPortData elanToPseudoPortData : elanToPseudoPortDataList) {
            Long scfTag = elanToPseudoPortData.getScfTag();
            Long elanLportTag = elanToPseudoPortData.getElanLportTag();
            if (elanLportTag != null && scfTag != null) {
                short tableId = NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
                handleUpdate(addDpnId, elanName, tableId, elanLportTag.intValue(), /*21 bit*/
                scfTag, NwConstants.ADD_FLOW);
            } else {
                LOG.debug("Could not find lportTag for ELAN={}", elanName);
            }
        }
    }
}
Also used : BigInteger(java.math.BigInteger) ElanToPseudoPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData) ElanServiceChainState(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.ElanServiceChainState)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)71 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)59 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)50 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)50 ExecutionException (java.util.concurrent.ExecutionException)38 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)37 Logger (org.slf4j.Logger)35 LoggerFactory (org.slf4j.LoggerFactory)35 Inject (javax.inject.Inject)32 Singleton (javax.inject.Singleton)32 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)32 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)32 PreDestroy (javax.annotation.PreDestroy)30 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)30 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)30 Executors (org.opendaylight.infrautils.utils.concurrent.Executors)28 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)27 AbstractAsyncDataTreeChangeListener (org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener)26