Search in sources :

Example 21 with Uint32

use of org.opendaylight.yangtools.yang.common.Uint32 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 22 with Uint32

use of org.opendaylight.yangtools.yang.common.Uint32 in project netvirt by opendaylight.

the class VpnManagerImpl method addExtraRoute.

@Override
public void addExtraRoute(String vpnName, String destination, String nextHop, String rd, @Nullable String routerID, Uint32 l3vni, RouteOrigin origin, @Nullable String intfName, @Nullable Adjacency operationalAdj, VrfEntry.EncapType encapType, Set<String> prefixListForRefreshFib, @NonNull TypedWriteTransaction<Configuration> confTx) {
    // add extra route to vpn mapping; advertise with nexthop as tunnel ip
    vpnUtil.syncUpdate(LogicalDatastoreType.OPERATIONAL, VpnExtraRouteHelper.getVpnToExtrarouteVrfIdIdentifier(vpnName, rd != null ? rd : routerID, destination), VpnUtil.getVpnToExtraroute(destination, Collections.singletonList(nextHop)));
    Uint64 dpnId = null;
    if (intfName != null && !intfName.isEmpty()) {
        dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, intfName);
        String nextHopIp = InterfaceUtils.getEndpointIpAddressForDPN(dataBroker, dpnId);
        if (nextHopIp == null || nextHopIp.isEmpty()) {
            LOG.error("addExtraRoute: NextHop for interface {} is null / empty." + " Failed advertising extra route for rd {} prefix {} dpn {}", intfName, rd, destination, dpnId);
            return;
        }
        nextHop = nextHopIp;
    }
    String primaryRd = vpnUtil.getPrimaryRd(vpnName);
    // TODO: This is a limitation to be stated in docs. When configuring static route to go to
    // another VPN, there can only be one nexthop or, at least, the nexthop to the interVpnLink should be in
    // first place.
    Optional<InterVpnLinkDataComposite> optVpnLink = interVpnLinkCache.getInterVpnLinkByEndpoint(nextHop);
    if (optVpnLink.isPresent() && optVpnLink.get().isActive()) {
        InterVpnLinkDataComposite interVpnLink = optVpnLink.get();
        // If the nexthop is the endpoint of Vpn2, then prefix must be advertised to Vpn1 in DC-GW, with nexthops
        // pointing to the DPNs where Vpn1 is instantiated. LFIB in these DPNS must have a flow entry, with lower
        // priority, where if Label matches then sets the lportTag of the Vpn2 endpoint and goes to LportDispatcher
        // This is like leaking one of the Vpn2 routes towards Vpn1
        String srcVpnUuid = interVpnLink.getVpnNameByIpAddress(nextHop);
        String dstVpnUuid = interVpnLink.getOtherVpnNameByIpAddress(nextHop);
        String dstVpnRd = vpnUtil.getVpnRd(dstVpnUuid);
        Uint32 newLabel = vpnUtil.getUniqueId(VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(dstVpnRd, destination));
        if (newLabel.longValue() == VpnConstants.INVALID_LABEL) {
            LOG.error("addExtraRoute: Unable to fetch label from Id Manager. Bailing out of adding intervpnlink" + " route for destination {}", destination);
            return;
        }
        ivpnLinkService.leakRoute(interVpnLink, srcVpnUuid, dstVpnUuid, destination, newLabel, RouteOrigin.STATIC);
    } else {
        Optional<Routes> optVpnExtraRoutes = VpnExtraRouteHelper.getVpnExtraroutes(dataBroker, vpnName, rd != null ? rd : routerID, destination);
        if (optVpnExtraRoutes.isPresent()) {
            List<String> nhList = optVpnExtraRoutes.get().getNexthopIpList();
            if (nhList != null && nhList.size() > 1) {
                // If nhList is greater than one for vpnextraroute, a call to populatefib doesn't update vrfentry.
                prefixListForRefreshFib.add(destination);
            } else {
                L3vpnInput input = new L3vpnInput().setNextHop(operationalAdj).setNextHopIp(nextHop).setL3vni(l3vni.longValue()).setPrimaryRd(primaryRd).setVpnName(vpnName).setDpnId(dpnId).setEncapType(encapType).setRd(rd).setRouteOrigin(origin);
                L3vpnRegistry.getRegisteredPopulator(encapType).populateFib(input, confTx);
            }
        }
    }
}
Also used : Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes) L3vpnInput(org.opendaylight.netvirt.vpnmanager.populator.input.L3vpnInput) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 23 with Uint32

use of org.opendaylight.yangtools.yang.common.Uint32 in project netvirt by opendaylight.

the class TunnelEndPointChangeListener method add.

@Override
public void add(InstanceIdentifier<TunnelEndPoints> key, TunnelEndPoints tep) {
    Uint64 dpnId = key.firstIdentifierOf(DPNTEPsInfo.class).firstKeyOf(DPNTEPsInfo.class).getDPNID();
    if (Uint64.ZERO.equals(dpnId)) {
        LOG.warn("add: Invalid DPN id for TEP {}", tep.getInterfaceName());
        return;
    }
    List<VpnInstance> vpnInstances = VpnHelper.getAllVpnInstances(broker);
    if (vpnInstances == null || vpnInstances.isEmpty()) {
        LOG.warn("add: dpnId: {}: tep: {}: No VPN instances defined", dpnId, tep.getInterfaceName());
        return;
    }
    for (VpnInstance vpnInstance : vpnInstances) {
        final String vpnName = vpnInstance.getVpnInstanceName();
        final Uint32 vpnId = vpnUtil.getVpnId(vpnName);
        LOG.info("add: Handling TEP {} add for VPN instance {}", tep.getInterfaceName(), vpnName);
        final String primaryRd = vpnUtil.getPrimaryRd(vpnName);
        if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
            List<VpnInterfaces> vpnInterfaces = vpnUtil.getDpnVpnInterfaces(vpnInstance, dpnId);
            if (vpnInterfaces != null) {
                for (VpnInterfaces vpnInterface : vpnInterfaces) {
                    String vpnInterfaceName = vpnInterface.getInterfaceName();
                    jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterfaceName, () -> {
                        final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(broker, vpnInterfaceName);
                        if (interfaceState == null) {
                            LOG.debug("add: Cannot retrieve interfaceState for vpnInterfaceName {}, " + "cannot generate lPortTag and process adjacencies", vpnInterfaceName);
                            return Collections.emptyList();
                        }
                        final int lPortTag = interfaceState.getIfIndex();
                        List<ListenableFuture<?>> futures = new ArrayList<>();
                        Set<String> prefixesForRefreshFib = new HashSet<>();
                        ListenableFuture<?> writeConfigFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, writeOperTxn -> futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> vpnInterfaceManager.processVpnInterfaceAdjacencies(dpnId, lPortTag, vpnName, primaryRd, vpnInterfaceName, vpnId, writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState, prefixesForRefreshFib))))));
                        Futures.addCallback(writeConfigFuture, new FutureCallback<Object>() {

                            @Override
                            public void onSuccess(Object voidObj) {
                                prefixesForRefreshFib.forEach(prefix -> {
                                    fibManager.refreshVrfEntry(primaryRd, prefix);
                                });
                            }

                            @Override
                            public void onFailure(Throwable throwable) {
                                LOG.debug("addVpnInterface: write Tx config execution failed", throwable);
                            }
                        }, MoreExecutors.directExecutor());
                        futures.add(writeConfigFuture);
                        LOG.trace("add: Handled TEP {} add for VPN instance {} VPN interface {}", tep.getInterfaceName(), vpnName, vpnInterfaceName);
                        return futures;
                    });
                }
            }
        } else {
            LOG.error("add: Ignoring addition of tunnel interface {} dpn {} for vpnInstance {} with primaryRd {}," + " as the VPN is already marked for deletion", tep.getInterfaceName(), dpnId, vpnName, primaryRd);
        }
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpn.to.dpn.list.VpnInterfaces) LoggerFactory(org.slf4j.LoggerFactory) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) DpnEndpoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpoints) Singleton(javax.inject.Singleton) VpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) PreDestroy(javax.annotation.PreDestroy) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Logger(org.slf4j.Logger) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Set(java.util.Set) TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) FutureCallback(com.google.common.util.concurrent.FutureCallback) VpnHelper(org.opendaylight.netvirt.vpnmanager.api.VpnHelper) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) Collections(java.util.Collections) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpn.to.dpn.list.VpnInterfaces) Collections(java.util.Collections) VpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance) ArrayList(java.util.ArrayList) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) Uint32(org.opendaylight.yangtools.yang.common.Uint32) HashSet(java.util.HashSet) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 24 with Uint32

use of org.opendaylight.yangtools.yang.common.Uint32 in project netvirt by opendaylight.

the class BgpConfigurationManager method addPrefix.

public void addPrefix(String rd, String macAddress, String pfx, List<String> nhList, VrfEntry.EncapType encapType, Uint32 lbl, Uint32 l3vni, Uint32 l2vni, String gatewayMac) {
    for (String nh : nhList) {
        Ipv4Address nexthop = nh != null ? new Ipv4Address(nh) : null;
        Uint32 label = lbl;
        InstanceIdentifier<Networks> iid = InstanceIdentifier.builder(Bgp.class).child(NetworksContainer.class).child(Networks.class, new NetworksKey(pfx, rd)).build();
        NetworksBuilder networksBuilder = new NetworksBuilder().setRd(rd).setPrefixLen(pfx).setNexthop(nexthop).setLabel(label).setEthtag(BgpConstants.DEFAULT_ETH_TAG);
        buildVpnEncapSpecificInfo(networksBuilder, encapType, label, l3vni, l2vni, macAddress, gatewayMac);
        update(iid, networksBuilder.build());
    }
}
Also used : Networks(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.networkscontainer.Networks) NetworksKey(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.networkscontainer.NetworksKey) Bgp(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) NetworksBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.networkscontainer.NetworksBuilder)

Example 25 with Uint32

use of org.opendaylight.yangtools.yang.common.Uint32 in project netvirt by opendaylight.

the class BgpManagerTest method testConnectedRoutNullNextHop.

@Test
public void testConnectedRoutNullNextHop() {
    String rd = "101";
    String prefix = "10.10.10.10/32";
    Uint32 label = Uint32.valueOf(1234);
    try {
        bgpFibWriter.addFibEntryToDS(rd, /*macAddress*/
        prefix, null, VrfEntry.EncapType.Mplsgre, label, Uint32.ZERO, /*l3vni*/
        null, /*gatewayMacAddress*/
        RouteOrigin.CONNECTED);
        // The code is not launching NullPointerException
        assertEquals(1, 0);
    } catch (NullPointerException e) {
        // The code must launch NullPointerException
        assertEquals(1, 1);
    }
}
Also used : Uint32(org.opendaylight.yangtools.yang.common.Uint32) Test(org.junit.Test) AbstractConcurrentDataBrokerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest)

Aggregations

Uint32 (org.opendaylight.yangtools.yang.common.Uint32)216 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)98 ArrayList (java.util.ArrayList)77 ExecutionException (java.util.concurrent.ExecutionException)68 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)68 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)44 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)44 Logger (org.slf4j.Logger)44 LoggerFactory (org.slf4j.LoggerFactory)44 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)42 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)42 Inject (javax.inject.Inject)41 Singleton (javax.inject.Singleton)41 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)41 List (java.util.List)40 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)38 Optional (java.util.Optional)37 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)36 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)35 Collections (java.util.Collections)34