Search in sources :

Example 76 with Label

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.

the class IVpnLinkServiceImpl method leakRoute.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public void leakRoute(InterVpnLinkDataComposite interVpnLink, String srcVpnUuid, String dstVpnUuid, String prefix, Long label, RouteOrigin forcedOrigin) {
    String ivpnLinkName = interVpnLink.getInterVpnLinkName();
    // The source VPN must participate in the InterVpnLink
    Preconditions.checkArgument(interVpnLink.isVpnLinked(srcVpnUuid), "The source VPN {} does not participate in the interVpnLink {}", srcVpnUuid, ivpnLinkName);
    // The destination VPN must participate in the InterVpnLink
    Preconditions.checkArgument(interVpnLink.isVpnLinked(dstVpnUuid), "The destination VPN {} does not participate in the interVpnLink {}", dstVpnUuid, ivpnLinkName);
    String endpointIp = interVpnLink.getOtherEndpointIpAddr(dstVpnUuid);
    String leakedOrigin = forcedOrigin != null ? forcedOrigin.getValue() : RouteOrigin.INTERVPN.getValue();
    FibHelper.buildRoutePath(endpointIp, label);
    VrfEntry newVrfEntry = new VrfEntryBuilder().setKey(new VrfEntryKey(prefix)).setDestPrefix(prefix).setRoutePaths(Collections.singletonList(FibHelper.buildRoutePath(endpointIp, label))).setOrigin(leakedOrigin).build();
    String dstVpnRd = VpnUtil.getVpnRd(dataBroker, dstVpnUuid);
    InstanceIdentifier<VrfEntry> newVrfEntryIid = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(dstVpnRd)).child(VrfEntry.class, new VrfEntryKey(newVrfEntry.getDestPrefix())).build();
    VpnUtil.asyncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, newVrfEntryIid, newVrfEntry);
    // Finally, route is advertised it to the DC-GW. But while in the FibEntries the nexthop is the other
    // endpoint's IP, in the DC-GW the nexthop for those prefixes are the IPs of those DPNs where the target
    // VPN has been instantiated
    List<BigInteger> srcDpnList = interVpnLink.getEndpointDpnsByVpnName(srcVpnUuid);
    List<String> nexthops = srcDpnList.stream().map(dpnId -> InterfaceUtils.getEndpointIpAddressForDPN(dataBroker, dpnId)).collect(Collectors.toList());
    LOG.debug("Advertising route in VPN={} [prefix={} label={}  nexthops={}] to DC-GW", dstVpnRd, newVrfEntry.getDestPrefix(), label.intValue(), nexthops);
    try {
        bgpManager.advertisePrefix(dstVpnRd, null, /*macAddress*/
        prefix, nexthops, VrfEntry.EncapType.Mplsgre, label.intValue(), 0, /*l3vni*/
        0, /*l2vni*/
        null);
    } catch (Exception e) {
        LOG.error("Exception while advertising prefix {} on vpnRd {} for intervpn link", prefix, dstVpnRd, e);
    }
}
Also used : IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) VpnUtil(org.opendaylight.netvirt.vpnmanager.VpnUtil) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) Singleton(javax.inject.Singleton) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) PreDestroy(javax.annotation.PreDestroy) InterVpnLinkCache(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite) Optional(com.google.common.base.Optional) VpnConstants(org.opendaylight.netvirt.vpnmanager.VpnConstants) Map(java.util.Map) IBgpManager(org.opendaylight.netvirt.bgpmanager.api.IBgpManager) BigInteger(java.math.BigInteger) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) IVpnLinkService(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.IVpnLinkService) VpnMaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.VpnMaps) Logger(org.slf4j.Logger) Predicate(java.util.function.Predicate) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes) Collectors(java.util.stream.Collectors) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) VpnMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.VpnMap) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) VrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryBuilder) PostConstruct(javax.annotation.PostConstruct) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Router(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router) Preconditions(com.google.common.base.Preconditions) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) Collections(java.util.Collections) FibHelper(org.opendaylight.netvirt.fibmanager.api.FibHelper) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) BigInteger(java.math.BigInteger) VrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryBuilder) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey)

Example 77 with Label

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.

the class VpnRpcServiceImpl method addStaticRoute.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public Future<RpcResult<AddStaticRouteOutput>> addStaticRoute(AddStaticRouteInput input) {
    SettableFuture<RpcResult<AddStaticRouteOutput>> result = SettableFuture.create();
    String destination = input.getDestination();
    String vpnInstanceName = input.getVpnInstanceName();
    String nexthop = input.getNexthop();
    Long label = input.getLabel();
    LOG.info("Adding static route for Vpn {} with destination {}, nexthop {} and label {}", vpnInstanceName, destination, nexthop, label);
    Collection<RpcError> rpcErrors = validateAddStaticRouteInput(input);
    if (!rpcErrors.isEmpty()) {
        result.set(RpcResultBuilder.<AddStaticRouteOutput>failed().withRpcErrors(rpcErrors).build());
        return result;
    }
    if (label == null || label == 0) {
        label = (long) VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(vpnInstanceName, destination));
        if (label == 0) {
            String message = "Unable to retrieve a new Label for the new Route";
            result.set(RpcResultBuilder.<AddStaticRouteOutput>failed().withError(RpcError.ErrorType.APPLICATION, message).build());
            return result;
        }
    }
    String vpnRd = VpnUtil.getVpnRd(dataBroker, input.getVpnInstanceName());
    VpnInstanceOpDataEntry vpnOpEntry = VpnUtil.getVpnInstanceOpData(dataBroker, vpnRd);
    Boolean isVxlan = VpnUtil.isL3VpnOverVxLan(vpnOpEntry.getL3vni());
    VrfEntry.EncapType encapType = VpnUtil.getEncapType(isVxlan);
    if (vpnRd == null) {
        String message = "Could not find Route-Distinguisher for VpnName " + vpnInstanceName;
        result.set(RpcResultBuilder.<AddStaticRouteOutput>failed().withError(RpcError.ErrorType.APPLICATION, message).build());
        return result;
    }
    Optional<InterVpnLinkDataComposite> optIVpnLink = interVpnLinkCache.getInterVpnLinkByEndpoint(nexthop);
    if (optIVpnLink.isPresent()) {
        try {
            InterVpnLinkUtil.handleStaticRoute(optIVpnLink.get(), vpnInstanceName, destination, nexthop, label.intValue(), dataBroker, fibManager, bgpManager);
        } catch (Exception e) {
            result.set(RpcResultBuilder.<AddStaticRouteOutput>failed().withError(ErrorType.APPLICATION, formatAndLog(LOG::warn, "Could not advertise route [vpn={}, prefix={}, label={}, nexthop={}] to BGP: {}", vpnRd, destination, label, nexthop, e.getMessage(), e)).build());
            return result;
        }
    } else {
        vpnManager.addExtraRoute(vpnInstanceName, destination, nexthop, vpnRd, null, /* routerId */
        vpnOpEntry.getL3vni(), RouteOrigin.STATIC, null, /* intfName */
        null, /*Adjacency*/
        encapType, null);
    }
    AddStaticRouteOutput labelOutput = new AddStaticRouteOutputBuilder().setLabel(label).build();
    result.set(RpcResultBuilder.success(labelOutput).build());
    return result;
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RpcError(org.opendaylight.yangtools.yang.common.RpcError) AddStaticRouteOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.rpc.rev160201.AddStaticRouteOutput) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) AddStaticRouteOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.rpc.rev160201.AddStaticRouteOutputBuilder) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite)

Example 78 with Label

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.

the class VpnRpcServiceImpl method generateVpnLabel.

/**
 * Generate label for the given ip prefix from the associated VPN.
 */
@Override
public Future<RpcResult<GenerateVpnLabelOutput>> generateVpnLabel(GenerateVpnLabelInput input) {
    String vpnName = input.getVpnName();
    String ipPrefix = input.getIpPrefix();
    SettableFuture<RpcResult<GenerateVpnLabelOutput>> futureResult = SettableFuture.create();
    String rd = VpnUtil.getVpnRd(dataBroker, vpnName);
    long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(rd != null ? rd : vpnName, ipPrefix));
    if (label == 0) {
        futureResult.set(RpcResultBuilder.<GenerateVpnLabelOutput>failed().withError(ErrorType.APPLICATION, formatAndLog(LOG::error, "Could not retrieve the label for prefix {} in VPN {}", ipPrefix, vpnName)).build());
    } else {
        GenerateVpnLabelOutput output = new GenerateVpnLabelOutputBuilder().setLabel(label).build();
        futureResult.set(RpcResultBuilder.success(output).build());
    }
    return futureResult;
}
Also used : GenerateVpnLabelOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.rpc.rev160201.GenerateVpnLabelOutput) GenerateVpnLabelOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.rpc.rev160201.GenerateVpnLabelOutputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult)

Example 79 with Label

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.

the class VpnSubnetRouteHandler method electNewDpnForSubnetRoute.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void electNewDpnForSubnetRoute(SubnetOpDataEntryBuilder subOpBuilder, BigInteger oldDpnId, Uuid subnetId, Uuid networkId, boolean isBgpVpn) {
    List<SubnetToDpn> subDpnList = null;
    boolean isRouteAdvertised = false;
    subDpnList = subOpBuilder.getSubnetToDpn();
    String rd = subOpBuilder.getVrfId();
    String subnetIp = subOpBuilder.getSubnetCidr();
    String vpnName = subOpBuilder.getVpnName();
    long elanTag = subOpBuilder.getElanTag();
    boolean isAlternateDpnSelected = false;
    long l3vni = 0;
    long label = 0;
    String networkName = networkId != null ? networkId.getValue() : null;
    LOG.info("{} electNewDpnForSubnetRoute: Handling subnet {} subnetIp {} vpn {} rd {} TaskState {}" + " lastTaskState {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, subOpBuilder.getVpnName(), subOpBuilder.getVrfId(), subOpBuilder.getRouteAdvState(), subOpBuilder.getLastAdvState());
    if (!isBgpVpn) {
        // blended more better into this design.
        if (VpnUtil.isL3VpnOverVxLan(subOpBuilder.getL3vni())) {
            l3vni = subOpBuilder.getL3vni();
        } else {
            label = getLabel(rd, subnetIp);
            subOpBuilder.setLabel(label);
        }
        isRouteAdvertised = addSubnetRouteToFib(rd, subnetIp, null, /* nhDpnId */
        null, /* nhTepIp */
        vpnName, elanTag, label, l3vni, subnetId, isBgpVpn, networkName);
        if (isRouteAdvertised) {
            subOpBuilder.setRouteAdvState(TaskState.Advertised);
        } else {
            LOG.error("{} electNewDpnForSubnetRoute: Unable to find TepIp for subnet {} subnetip {} vpnName {}" + " rd {}, attempt next dpn", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, rd);
            subOpBuilder.setRouteAdvState(TaskState.PendingAdvertise);
        }
        return;
    }
    String nhTepIp = null;
    BigInteger nhDpnId = null;
    Iterator<SubnetToDpn> subnetDpnIter = subDpnList.iterator();
    while (subnetDpnIter.hasNext()) {
        SubnetToDpn subnetToDpn = subnetDpnIter.next();
        if (subnetToDpn.getDpnId().equals(oldDpnId)) {
            // Is this same is as input dpnId, then ignore it
            continue;
        }
        nhDpnId = subnetToDpn.getDpnId();
        if (vpnNodeListener.isConnectedNode(nhDpnId)) {
            // but does it have a TEP configured at all?
            try {
                nhTepIp = InterfaceUtils.getEndpointIpAddressForDPN(dataBroker, nhDpnId);
                if (nhTepIp != null) {
                    isAlternateDpnSelected = true;
                    break;
                }
            } catch (Exception e) {
                LOG.warn("{} electNewDpnForSubnetRoute: Unable to find TepIp for rd {} subnetroute subnetip {}" + " for dpnid {}, attempt next", LOGGING_PREFIX, rd, subnetIp, nhDpnId.toString(), e);
                continue;
            }
        }
    }
    if (!isAlternateDpnSelected) {
        // If no alternate Dpn is selected as nextHopDpn, withdraw the subnetroute if it had a nextHop already.
        if (isRouteAdvertised(subOpBuilder) && oldDpnId != null) {
            LOG.info("{} electNewDpnForSubnetRoute: No alternate DPN available for subnet {} subnetIp {} vpn {}" + " rd {} Prefix withdrawn from BGP", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, rd);
            // Withdraw route from BGP for this subnet
            boolean routeWithdrawn = deleteSubnetRouteFromFib(rd, subnetIp, vpnName, isBgpVpn);
            subOpBuilder.setNhDpnId(null);
            subOpBuilder.setLastAdvState(subOpBuilder.getRouteAdvState());
            if (routeWithdrawn) {
                subOpBuilder.setRouteAdvState(TaskState.Withdrawn);
            } else {
                LOG.error("{} electNewDpnForSubnetRoute: Withdrawing NextHopDPN {} for subnet {} subnetIp {}" + " vpn {} rd {} from BGP failed", LOGGING_PREFIX, oldDpnId, subnetId.getValue(), subnetIp, vpnName, rd);
                subOpBuilder.setRouteAdvState(TaskState.PendingWithdraw);
            }
        }
    } else {
        // If alternate Dpn is selected as nextHopDpn, use that for subnetroute.
        subOpBuilder.setNhDpnId(nhDpnId);
        if (VpnUtil.isL3VpnOverVxLan(subOpBuilder.getL3vni())) {
            l3vni = subOpBuilder.getL3vni();
        } else {
            label = getLabel(rd, subnetIp);
            subOpBuilder.setLabel(label);
        }
        // update the VRF entry for the subnetroute.
        isRouteAdvertised = addSubnetRouteToFib(rd, subnetIp, nhDpnId, nhTepIp, vpnName, elanTag, label, l3vni, subnetId, isBgpVpn, networkName);
        subOpBuilder.setLastAdvState(subOpBuilder.getRouteAdvState());
        if (isRouteAdvertised) {
            subOpBuilder.setRouteAdvState(TaskState.Advertised);
        } else {
            LOG.error("{} electNewDpnForSubnetRoute: Swapping to add new NextHopDpn {} for subnet {} subnetIp {}" + " vpn {} rd {} failed", LOGGING_PREFIX, nhDpnId, subnetId.getValue(), subnetIp, vpnName, rd);
            subOpBuilder.setRouteAdvState(TaskState.PendingAdvertise);
        }
    }
}
Also used : BigInteger(java.math.BigInteger) SubnetToDpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.subnet.op.data.entry.SubnetToDpn)

Example 80 with Label

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.

the class InterVpnLinkUtil method leakRoute.

/**
 * Leaks a route from one VPN to another. By default, the origin for this leaked route is INTERVPN.
 *
 * @param broker dataBroker service reference
 * @param bgpManager Used to advertise routes to the BGP Router
 * @param interVpnLink Reference to the object that holds the info about the link between the 2 VPNs
 * @param srcVpnUuid UUID of the VPN that has the route that is going to be leaked to the other VPN
 * @param dstVpnUuid UUID of the VPN that is going to receive the route
 * @param prefix Prefix of the route
 * @param label Label of the route in the original VPN
 */
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public static void leakRoute(DataBroker broker, IBgpManager bgpManager, InterVpnLink interVpnLink, String srcVpnUuid, String dstVpnUuid, String prefix, Long label) {
    Preconditions.checkNotNull(interVpnLink);
    // The source VPN must participate in the InterVpnLink
    Preconditions.checkArgument(interVpnLink.getFirstEndpoint().getVpnUuid().getValue().equals(srcVpnUuid) || interVpnLink.getSecondEndpoint().getVpnUuid().getValue().equals(srcVpnUuid), "The source VPN {} does not participate in the interVpnLink {}", srcVpnUuid, interVpnLink.getName());
    // The destination VPN must participate in the InterVpnLink
    Preconditions.checkArgument(interVpnLink.getFirstEndpoint().getVpnUuid().getValue().equals(dstVpnUuid) || interVpnLink.getSecondEndpoint().getVpnUuid().getValue().equals(dstVpnUuid), "The destination VPN {} does not participate in the interVpnLink {}", dstVpnUuid, interVpnLink.getName());
    boolean destinationIs1stEndpoint = interVpnLink.getFirstEndpoint().getVpnUuid().getValue().equals(dstVpnUuid);
    String endpointIp = destinationIs1stEndpoint ? interVpnLink.getSecondEndpoint().getIpAddress().getValue() : interVpnLink.getFirstEndpoint().getIpAddress().getValue();
    VrfEntry newVrfEntry = FibHelper.getVrfEntryBuilder(prefix, label, endpointIp, RouteOrigin.INTERVPN, null).build();
    String dstVpnRd = VpnUtil.getVpnRd(broker, dstVpnUuid);
    InstanceIdentifier<VrfEntry> newVrfEntryIid = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(dstVpnRd)).child(VrfEntry.class, new VrfEntryKey(newVrfEntry.getDestPrefix())).build();
    VpnUtil.asyncWrite(broker, LogicalDatastoreType.CONFIGURATION, newVrfEntryIid, newVrfEntry);
    // Finally, route is advertised it to the DC-GW. But while in the FibEntries the nexthop is the other
    // endpoint's IP, in the DC-GW the nexthop for those prefixes are the IPs of those DPNs where the target
    // VPN has been instantiated
    Optional<InterVpnLinkState> optVpnLinkState = getInterVpnLinkState(broker, interVpnLink.getName());
    if (optVpnLinkState.isPresent()) {
        InterVpnLinkState vpnLinkState = optVpnLinkState.get();
        List<BigInteger> dpnIdList = destinationIs1stEndpoint ? vpnLinkState.getFirstEndpointState().getDpId() : vpnLinkState.getSecondEndpointState().getDpId();
        List<String> nexthops = new ArrayList<>();
        for (BigInteger dpnId : dpnIdList) {
            nexthops.add(InterfaceUtils.getEndpointIpAddressForDPN(broker, dpnId));
        }
        try {
            LOG.debug("Advertising route in VPN={} [prefix={} label={}  nexthops={}] to DC-GW", dstVpnRd, newVrfEntry.getDestPrefix(), label.intValue(), nexthops);
            bgpManager.advertisePrefix(dstVpnRd, null, /*macAddress*/
            newVrfEntry.getDestPrefix(), nexthops, VrfEntry.EncapType.Mplsgre, label.intValue(), 0, /*l3vni*/
            0, /*l2vni*/
            null);
        } catch (Exception ex) {
            LOG.error("Could not advertise prefix {} with label {} to VPN rd={}", newVrfEntry.getDestPrefix(), label.intValue(), dstVpnRd, ex);
        }
    } else {
        LOG.warn("Error when advertising leaked routes: Could not find State for InterVpnLink={}", interVpnLink.getName());
    }
}
Also used : FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) ArrayList(java.util.ArrayList) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) BigInteger(java.math.BigInteger) InterVpnLinkState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkState)

Aggregations

ArrayList (java.util.ArrayList)44 BigInteger (java.math.BigInteger)38 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)24 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)20 ByteBuf (io.netty.buffer.ByteBuf)19 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)16 List (java.util.List)15 ExecutionException (java.util.concurrent.ExecutionException)14 Optional (com.google.common.base.Optional)13 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)13 RouteOrigin (org.opendaylight.netvirt.fibmanager.api.RouteOrigin)13 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)13 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)12 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)12 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)12 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12