Search in sources :

Example 46 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project netvirt by opendaylight.

the class VpnUtil method removeVrfEntriesByOrigin.

/**
 * Remove from MDSAL all those VrfEntries in a VPN that have an specific RouteOrigin.
 *
 * @param rd Route Distinguisher
 * @param origin Origin of the Routes to be removed (see {@link RouteOrigin})
 */
public void removeVrfEntriesByOrigin(String rd, RouteOrigin origin) {
    InstanceIdentifier<VrfTables> vpnVrfTableIid = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).build();
    Optional<VrfTables> vrfTablesOpc = read(LogicalDatastoreType.CONFIGURATION, vpnVrfTableIid);
    if (vrfTablesOpc.isPresent()) {
        VrfTables vrfTables = vrfTablesOpc.get();
        LoggingFutures.addErrorLogging(new ManagedNewTransactionRunnerImpl(dataBroker).callWithNewWriteOnlyTransactionAndSubmit(Datastore.CONFIGURATION, tx -> {
            for (VrfEntry vrfEntry : vrfTables.nonnullVrfEntry().values()) {
                if (origin == RouteOrigin.value(vrfEntry.getOrigin())) {
                    tx.delete(vpnVrfTableIid.child(VrfEntry.class, vrfEntry.key()));
                }
            }
        }), LOG, "Error removing VRF entries by origin");
    }
}
Also used : SubnetsAssociatedToRouteTargets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetsAssociatedToRouteTargets) Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks) VpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) RoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.RoutesBuilder) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) Future(java.util.concurrent.Future) Vpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.Vpn) Map(java.util.Map) IBgpManager(org.opendaylight.netvirt.bgpmanager.api.IBgpManager) BigInteger(java.math.BigInteger) UnlockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInputBuilder) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) AllocatedRdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.extraroute.rds.dest.prefixes.AllocatedRdsKey) NetworkMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.networkmaps.NetworkMapKey) UnlockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInput) NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput) VpnInstanceOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInstanceOpData) AllocateIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) VpnInterfaceOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryKey) GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) VpnInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstanceKey) SendNeighborSolicitationToOfGroupInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInputBuilder) SubnetOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey) MacEntry(org.opendaylight.netvirt.vpnmanager.iplearn.model.MacEntry) VpnIdToVpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnIdToVpnInstance) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) NetworksKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.NetworksKey) WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) VpnInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterfaceBuilder) ReleaseIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdOutput) Inet4Address(java.net.Inet4Address) UnknownHostException(java.net.UnknownHostException) Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies) FutureCallback(com.google.common.util.concurrent.FutureCallback) VpnInstanceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryBuilder) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ExternalIpsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIpsKey) ElanInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) VpnIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIds) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) Date(java.util.Date) VpnPortipToPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPortBuilder) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) LearntVpnVipToPortEventKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEventKey) IpVersionBase(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionBase) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) Locale(java.util.Locale) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) AdjacenciesOpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOpBuilder) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) NetworkType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NetworkAttributes.NetworkType) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) AdjacencyKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyKey) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) VpnToDpnListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnListKey) NeutronVpnPortipPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NeutronVpnPortipPortData) Collection(java.util.Collection) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes) Collectors(java.util.stream.Collectors) AllocateIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Objects(java.util.Objects) VrfEntryBase(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.VrfEntryBase) AssociatedSubnet(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnet) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) NaptSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.NaptSwitches) SendNeighborSolicitationToOfGroupInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInput) Entry(java.util.Map.Entry) Ipv6NdUtilService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilService) VpnInstanceOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryKey) AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) AdjacencyType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency.AdjacencyType) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) SubnetmapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.SubnetmapKey) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RouteTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTarget) IfIndexesInterfaceMap(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.IfIndexesInterfaceMap) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) DpnInterfacesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesKey) HashSet(java.util.HashSet) RoutersKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.RoutersKey) ExternalSubnets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalSubnets) VpnNexthopsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthopsKey) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) VpnTargets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnTargets) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) VpnInterfaceOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInterfaceOpData) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) AssociatedVpnKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpnKey) Logger(org.slf4j.Logger) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Operational(org.opendaylight.mdsal.binding.util.Datastore.Operational) VpnInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterfaceKey) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) Inet6Address(java.net.Inet6Address) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) RouteTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTargetKey) AllocateIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) JvmGlobalLocks(org.opendaylight.genius.utils.JvmGlobalLocks) VpnInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInstances) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) AllocatedRdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.extraroute.rds.dest.prefixes.AllocatedRdsBuilder) VpnToExtraroutes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnToExtraroutes) LearntVpnVipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPortKey) AdjacenciesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.AdjacenciesBuilder) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) InetAddress(java.net.InetAddress) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) IpVersionV4(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) SegmentTypeVlan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.SegmentTypeVlan) DpnInterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesBuilder) Datastore(org.opendaylight.mdsal.binding.util.Datastore) VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInterfaces) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) VpnKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.VpnKey) Subnet(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet) AssociatedVpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpnBuilder) Set(java.util.Set) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) VpnHelper(org.opendaylight.netvirt.vpnmanager.api.VpnHelper) Interfaces(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces) ElanTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) LearntVpnVipToPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPortBuilder) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) NonNull(org.eclipse.jdt.annotation.NonNull) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) TimeUnits(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TimeUnits) LearntVpnVipToPortEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEvent) SimpleDateFormat(java.text.SimpleDateFormat) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) INeutronVpnManager(org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager) ArrayList(java.util.ArrayList) NetworkMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.networkmaps.NetworkMap) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.SubnetsKey) ModifiedNodeDoesNotExistException(org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException) SendNeighborSolicitationToOfGroupOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupOutput) TryLockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockOutput) PrefixToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.PrefixToInterface) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets) PrefixesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesKey) TryLockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockInput) VpnNexthops(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops) VpnTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetKey) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.vpn._interface.VpnInstanceNames) TryLockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockInputBuilder) Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes) VpnToDpnList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList) VpnPortipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) InetAddresses(com.google.common.net.InetAddresses) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) LearntVpnVipToPortEventAction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventAction) VpnIdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIdsKey) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) VpnInterfaceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryBuilder) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) LoggerFactory(org.slf4j.LoggerFactory) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ExternalNetworks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks) TypedReadTransaction(org.opendaylight.mdsal.binding.util.TypedReadTransaction) Nullable(org.eclipse.jdt.annotation.Nullable) ElanTagNameKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameKey) AssociatedSubnetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnetKey) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Collections.emptyList(java.util.Collections.emptyList) Predicate(java.util.function.Predicate) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) LearntVpnVipToPortEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEventBuilder) PrefixesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesBuilder) SubnetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.SubnetKey) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) FlowEntityBuilder(org.opendaylight.genius.mdsalutil.FlowEntityBuilder) ExtRouters(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExtRouters) Optional(java.util.Optional) ExternalIps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps) VpnTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget) NWUtil(org.opendaylight.genius.mdsalutil.NWUtil) LearntVpnVipToPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortData) RouterToNaptSwitch(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitch) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) Iterators(com.google.common.collect.Iterators) L3nexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.L3nexthop) LearntVpnVipToPortEventData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventData) VpnExtraRouteHelper(org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) ElanTagNameMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanTagNameMap) Uint32(org.opendaylight.yangtools.yang.common.Uint32) ReentrantLock(java.util.concurrent.locks.ReentrantLock) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) Subnetmaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.Subnetmaps) VpnPortipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPortKey) NetworkL3Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3Extension) ReleaseIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder) SystemPropertyReader(org.opendaylight.genius.utils.SystemPropertyReader) AssociatedVpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpn) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) SubnetOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) IpVersionChoice(org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice) SubnetOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetOpData) UnlockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockOutput) VpnInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstanceBuilder) NetworkMaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NetworkMaps) Collections(java.util.Collections) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) RouterToNaptSwitchKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitchKey) IpAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables)

Example 47 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project netvirt by opendaylight.

the class VpnUtil method getVpnsImportingMyRoute.

@SuppressWarnings("checkstyle:IllegalCatch")
public List<VpnInstanceOpDataEntry> getVpnsImportingMyRoute(final String vpnName) {
    List<VpnInstanceOpDataEntry> vpnsToImportRoute = new ArrayList<>();
    final VpnInstanceOpDataEntry vpnInstanceOpDataEntry;
    final String vpnRd = getVpnRd(vpnName);
    if (vpnRd == null) {
        LOG.error("getVpnsImportingMyRoute: vpn {} not present in config DS.", vpnName);
        return vpnsToImportRoute;
    }
    if (vpnRd.equals(vpnName)) {
        LOG.error("getVpnsImportingMyRoute: Internal vpn {} do not export/import routes", vpnName);
        return vpnsToImportRoute;
    }
    try {
        final VpnInstanceOpDataEntry opDataEntry = getVpnInstanceOpData(vpnRd);
        if (opDataEntry == null) {
            LOG.error("getVpnsImportingMyRoute: Could not retrieve vpn instance op data for vpn {} rd {}" + " to check for vpns importing the routes", vpnName, vpnRd);
            return vpnsToImportRoute;
        }
        vpnInstanceOpDataEntry = opDataEntry;
    } catch (Exception e) {
        LOG.error("getVpnsImportingMyRoute: DSException when retrieving vpn instance op data for vpn {} rd {}" + " to check for vpns importing the routes", vpnName, vpnRd);
        return vpnsToImportRoute;
    }
    Predicate<VpnInstanceOpDataEntry> excludeVpn = input -> {
        if (input.getVpnInstanceName() == null) {
            LOG.error("getVpnsImportingMyRoute.excludeVpn: Received vpn instance with rd {} without a name.", input.getVrfId());
            return false;
        }
        return !input.getVpnInstanceName().equals(vpnName);
    };
    Predicate<VpnInstanceOpDataEntry> matchRTs = input -> {
        Iterable<String> commonRTs = intersection(getRts(vpnInstanceOpDataEntry, VpnTarget.VrfRTType.ExportExtcommunity), getRts(input, VpnTarget.VrfRTType.ImportExtcommunity));
        return Iterators.size(commonRTs.iterator()) > 0;
    };
    vpnsToImportRoute = getAllVpnInstanceOpData().stream().filter(excludeVpn).filter(matchRTs).collect(Collectors.toList());
    return vpnsToImportRoute;
}
Also used : SubnetsAssociatedToRouteTargets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetsAssociatedToRouteTargets) Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks) VpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) RoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.RoutesBuilder) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) Future(java.util.concurrent.Future) Vpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.Vpn) Map(java.util.Map) IBgpManager(org.opendaylight.netvirt.bgpmanager.api.IBgpManager) BigInteger(java.math.BigInteger) UnlockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInputBuilder) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) AllocatedRdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.extraroute.rds.dest.prefixes.AllocatedRdsKey) NetworkMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.networkmaps.NetworkMapKey) UnlockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInput) NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput) VpnInstanceOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInstanceOpData) AllocateIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) VpnInterfaceOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryKey) GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) VpnInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstanceKey) SendNeighborSolicitationToOfGroupInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInputBuilder) SubnetOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey) MacEntry(org.opendaylight.netvirt.vpnmanager.iplearn.model.MacEntry) VpnIdToVpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnIdToVpnInstance) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) NetworksKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.NetworksKey) WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) VpnInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterfaceBuilder) ReleaseIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdOutput) Inet4Address(java.net.Inet4Address) UnknownHostException(java.net.UnknownHostException) Adjacencies(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.Adjacencies) FutureCallback(com.google.common.util.concurrent.FutureCallback) VpnInstanceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryBuilder) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ExternalIpsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIpsKey) ElanInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) VpnIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIds) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) Date(java.util.Date) VpnPortipToPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPortBuilder) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) LearntVpnVipToPortEventKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEventKey) IpVersionBase(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionBase) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) Locale(java.util.Locale) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) AdjacenciesOpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOpBuilder) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) NetworkType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NetworkAttributes.NetworkType) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) AdjacencyKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyKey) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) VpnToDpnListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnListKey) NeutronVpnPortipPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NeutronVpnPortipPortData) Collection(java.util.Collection) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes) Collectors(java.util.stream.Collectors) AllocateIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Objects(java.util.Objects) VrfEntryBase(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.VrfEntryBase) AssociatedSubnet(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnet) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) NaptSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.NaptSwitches) SendNeighborSolicitationToOfGroupInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupInput) Entry(java.util.Map.Entry) Ipv6NdUtilService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.Ipv6NdUtilService) VpnInstanceOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryKey) AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) AdjacencyType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency.AdjacencyType) VpnInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface) SubnetmapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.SubnetmapKey) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RouteTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTarget) IfIndexesInterfaceMap(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.IfIndexesInterfaceMap) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) DpnInterfacesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesKey) HashSet(java.util.HashSet) RoutersKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.RoutersKey) ExternalSubnets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalSubnets) VpnNexthopsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthopsKey) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) VpnTargets(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnTargets) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) VpnInterfaceOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInterfaceOpData) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) AssociatedVpnKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpnKey) Logger(org.slf4j.Logger) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Operational(org.opendaylight.mdsal.binding.util.Datastore.Operational) VpnInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterfaceKey) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) Inet6Address(java.net.Inet6Address) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) RouteTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTargetKey) AllocateIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) JvmGlobalLocks(org.opendaylight.genius.utils.JvmGlobalLocks) VpnInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInstances) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) AllocatedRdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.extraroute.rds.dest.prefixes.AllocatedRdsBuilder) VpnToExtraroutes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnToExtraroutes) LearntVpnVipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPortKey) AdjacenciesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.AdjacenciesBuilder) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) InetAddress(java.net.InetAddress) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) IpVersionV4(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) SegmentTypeVlan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.SegmentTypeVlan) DpnInterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesBuilder) Datastore(org.opendaylight.mdsal.binding.util.Datastore) VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.VpnInterfaces) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) VpnKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.VpnKey) Subnet(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet) AssociatedVpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpnBuilder) Set(java.util.Set) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) VpnHelper(org.opendaylight.netvirt.vpnmanager.api.VpnHelper) Interfaces(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces) ElanTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) LearntVpnVipToPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPortBuilder) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) NonNull(org.eclipse.jdt.annotation.NonNull) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) TimeUnits(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TimeUnits) LearntVpnVipToPortEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEvent) SimpleDateFormat(java.text.SimpleDateFormat) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) INeutronVpnManager(org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager) ArrayList(java.util.ArrayList) NetworkMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.networkmaps.NetworkMap) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.SubnetsKey) ModifiedNodeDoesNotExistException(org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException) SendNeighborSolicitationToOfGroupOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.SendNeighborSolicitationToOfGroupOutput) TryLockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockOutput) PrefixToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.PrefixToInterface) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets) PrefixesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesKey) TryLockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockInput) VpnNexthops(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops) VpnTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetKey) VpnInstanceNames(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.vpn._interface.VpnInstanceNames) TryLockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.TryLockInputBuilder) Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes) VpnToDpnList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList) VpnPortipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) InetAddresses(com.google.common.net.InetAddresses) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) LearntVpnVipToPortEventAction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventAction) VpnIdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIdsKey) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) VpnInterfaceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryBuilder) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) LoggerFactory(org.slf4j.LoggerFactory) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ExternalNetworks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks) TypedReadTransaction(org.opendaylight.mdsal.binding.util.TypedReadTransaction) Nullable(org.eclipse.jdt.annotation.Nullable) ElanTagNameKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameKey) AssociatedSubnetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnetKey) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Collections.emptyList(java.util.Collections.emptyList) Predicate(java.util.function.Predicate) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) LearntVpnVipToPortEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.event.data.LearntVpnVipToPortEventBuilder) PrefixesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesBuilder) SubnetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.SubnetKey) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) FlowEntityBuilder(org.opendaylight.genius.mdsalutil.FlowEntityBuilder) ExtRouters(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExtRouters) Optional(java.util.Optional) ExternalIps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps) VpnTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget) NWUtil(org.opendaylight.genius.mdsalutil.NWUtil) LearntVpnVipToPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortData) RouterToNaptSwitch(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitch) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) Iterators(com.google.common.collect.Iterators) L3nexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.L3nexthop) LearntVpnVipToPortEventData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventData) VpnExtraRouteHelper(org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) ElanTagNameMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanTagNameMap) Uint32(org.opendaylight.yangtools.yang.common.Uint32) ReentrantLock(java.util.concurrent.locks.ReentrantLock) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) Subnetmaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.Subnetmaps) VpnPortipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPortKey) NetworkL3Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3Extension) ReleaseIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder) SystemPropertyReader(org.opendaylight.genius.utils.SystemPropertyReader) AssociatedVpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpn) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) SubnetOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) IpVersionChoice(org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice) SubnetOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetOpData) UnlockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockOutput) VpnInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstanceBuilder) NetworkMaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NetworkMaps) Collections(java.util.Collections) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) RouterToNaptSwitchKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitchKey) IpAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) ArrayList(java.util.ArrayList) UnknownHostException(java.net.UnknownHostException) ExecutionException(java.util.concurrent.ExecutionException) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ModifiedNodeDoesNotExistException(org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException)

Example 48 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project netvirt by opendaylight.

the class L3vpnOverMplsGrePopulator method populateFib.

@Override
public void populateFib(L3vpnInput input, TypedWriteTransaction<Configuration> writeConfigTxn) {
    if (input.getRouteOrigin() == RouteOrigin.CONNECTED) {
        LOG.info("populateFib : Found SubnetRoute for subnet {} rd {}", input.getSubnetIp(), input.getPrimaryRd());
        addSubnetRouteFibEntry(input);
        return;
    }
    Adjacency nextHop = input.getNextHop();
    Uint32 label = nextHop.getLabel();
    String vpnName = input.getVpnName();
    String primaryRd = input.getPrimaryRd();
    String rd = input.getRd();
    String nextHopIp = input.getNextHopIp();
    VrfEntry.EncapType encapType = input.getEncapType();
    LOG.info("populateFib : Found Interface Adjacency with prefix {} rd {}", nextHop.getIpAddress(), primaryRd);
    List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
    Uint32 vpnId = vpnUtil.getVpnId(vpnName);
    // it is a valid case for nextHopIpAddress to be null
    String nextHopIpAddress = nextHop.getIpAddress();
    // and internalVpnForExtraRoute (where rd is DpnId)
    if (VpnUtil.isEligibleForBgp(primaryRd, input.getVpnName(), input.getDpnId(), input.getNetworkName())) {
        // the DpnId is set as rd in case of extra routes present in router based VPN
        addToLabelMapper(label, input.getDpnId(), nextHopIpAddress, singletonList(nextHopIp), vpnId, input.getInterfaceName(), null, false, primaryRd);
        Objects.requireNonNull(input.getRouteOrigin(), "RouteOrigin is mandatory");
        addPrefixToBGP(rd, primaryRd, null, /*macAddress*/
        nextHopIpAddress, nextHopIp, encapType, label, Uint32.ZERO, /*l3vni*/
        input.getGatewayMac(), input.getRouteOrigin(), writeConfigTxn);
        // TODO: ERT - check for VPNs importing my route
        for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
            String vpnRd = vpn.getVrfId();
            if (vpnRd != null) {
                fibManager.addOrUpdateFibEntry(vpnRd, null, /*macAddress*/
                nextHopIpAddress, Arrays.asList(nextHopIp), encapType, label, Uint32.ZERO, /*l3vni*/
                input.getGatewayMac(), primaryRd, RouteOrigin.SELF_IMPORTED, writeConfigTxn);
                LOG.info("populateFib: Exported route with rd {} prefix {} nexthop {} label {}" + " to VPN {} for interface {} on dpn {}", vpnRd, nextHop.getIpAddress(), nextHopIp, label, vpn, input.getInterfaceName(), input.getDpnId());
            }
        }
    } else {
        // ### add FIB route directly
        fibManager.addOrUpdateFibEntry(vpnName, null, /*macAddress*/
        nextHopIpAddress, Arrays.asList(nextHopIp), encapType, label, Uint32.ZERO, /*l3vni*/
        input.getGatewayMac(), null, /*parentVpnRd*/
        input.getRouteOrigin(), writeConfigTxn);
        LOG.info("populateFib: Added internal FIB entry for prefix {} nexthop {} label {}" + " to VPN {} for interface {} on dpn {}", nextHop.getIpAddress(), nextHopIp, label, vpnName, input.getInterfaceName(), input.getDpnId());
    }
}
Also used : 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) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.Adjacency) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Example 49 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project netvirt by opendaylight.

the class IVpnLinkServiceImpl method leakExtraRoutesToVpnEndpoint.

/*
     * Checks if there are static routes in Vpn1 whose nexthop is Vpn2's endpoint.
     * Those routes must be leaked to Vpn1.
     *
     * @param vpnLink
     * @param vpn1Uuid
     * @param vpn2Uuid
     */
private void leakExtraRoutesToVpnEndpoint(InterVpnLinkDataComposite vpnLink, String vpn1Uuid, String vpn2Uuid) {
    String vpn1Rd = vpnUtil.getVpnRd(vpn1Uuid);
    String vpn2Endpoint = vpnLink.getOtherEndpointIpAddr(vpn2Uuid);
    List<VrfEntry> allVpnVrfEntries = vpnUtil.getAllVrfEntries(vpn1Rd);
    for (VrfEntry vrfEntry : allVpnVrfEntries) {
        vrfEntry.nonnullRoutePaths().values().stream().filter(routePath -> Objects.equals(routePath.getNexthopAddress(), vpn2Endpoint)).forEach(routePath -> {
            // Vpn1 has a route pointing to Vpn2's endpoint. Forcing the leaking of the route will update
            // the BGP accordingly
            Uint32 label = vpnUtil.getUniqueId(VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(vpn1Rd, vrfEntry.getDestPrefix()));
            if (label.longValue() == VpnConstants.INVALID_LABEL) {
                LOG.error("Unable to fetch label from Id Manager. Bailing out of leaking extra routes for " + "InterVpnLink {} rd {} prefix {}", vpnLink.getInterVpnLinkName(), vpn1Rd, vrfEntry.getDestPrefix());
            } else {
                leakRoute(vpnLink, vpn2Uuid, vpn1Uuid, vrfEntry.getDestPrefix(), label, RouteOrigin.value(vrfEntry.getOrigin()));
            }
        });
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) IFibManager(org.opendaylight.netvirt.fibmanager.api.IFibManager) VpnUtil(org.opendaylight.netvirt.vpnmanager.VpnUtil) RouterIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.vpnmap.RouterIds) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) LoggerFactory(org.slf4j.LoggerFactory) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) PreDestroy(javax.annotation.PreDestroy) InterVpnLinkCache(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache) Nullable(org.eclipse.jdt.annotation.Nullable) Map(java.util.Map) IBgpManager(org.opendaylight.netvirt.bgpmanager.api.IBgpManager) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) IVpnLinkService(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.IVpnLinkService) VpnMaps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.VpnMaps) VpnMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpnmaps.VpnMapKey) NeutronUtils(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils) RoutesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.RoutesKey) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) Optional(java.util.Optional) Router(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router) RouterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.RouterKey) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) HashMap(java.util.HashMap) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) Singleton(javax.inject.Singleton) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) InterfaceUtils(org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite) VpnConstants(org.opendaylight.netvirt.vpnmanager.VpnConstants) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Logger(org.slf4j.Logger) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) 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) 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) ExecutionException(java.util.concurrent.ExecutionException) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) VrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryBuilder) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) 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) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Example 50 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project netvirt by opendaylight.

the class IVpnLinkServiceImpl method handleStaticRoute.

/*
     * Takes care of an static route to see if flows related to interVpnLink
     * must be installed in tables 20 and 17
     *
     * @param vpnId Vpn to which the route belongs
     * @param route Route to handle. Will only be considered if its nexthop is the VPN's endpoint IpAddress
     *              at the other side of the InterVpnLink
     * @param iVpnLink
     */
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleStaticRoute(String vpnId, Routes route, InterVpnLinkDataComposite ivpnLink) {
    IpAddress nhIpAddr = route.getNexthop();
    String routeNextHop = nhIpAddr.getIpv4Address() != null ? nhIpAddr.getIpv4Address().getValue() : nhIpAddr.getIpv6Address().getValue();
    String destination = route.getDestination().stringValue();
    // is nexthop the other endpoint's IP
    String otherEndpoint = ivpnLink.getOtherEndpoint(vpnId);
    if (!routeNextHop.equals(otherEndpoint)) {
        LOG.debug("VPN {}: Route to {} nexthop={} points to an InterVpnLink endpoint, but its not " + "the other endpoint. Other endpoint is {}", vpnId, destination, routeNextHop, otherEndpoint);
        return;
    }
    // Lets work: 1) write Fibentry, 2) advertise to BGP and 3) check if it must be leaked
    String vpnRd = vpnUtil.getVpnRd(vpnId);
    if (vpnRd == null) {
        LOG.warn("Could not find Route-Distinguisher for VpnName {}", vpnId);
        return;
    }
    Uint32 label = vpnUtil.getUniqueId(VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(vpnId, destination));
    try {
        interVpnLinkUtil.handleStaticRoute(ivpnLink, vpnId, destination, routeNextHop, label);
    } catch (Exception e) {
        LOG.error("Exception while advertising prefix for intervpn link", e);
    }
}
Also used : IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Uint32(org.opendaylight.yangtools.yang.common.Uint32) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

Test (org.junit.Test)86 ArrayList (java.util.ArrayList)69 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)61 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)45 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)43 ExecutionException (java.util.concurrent.ExecutionException)41 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)40 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes)33 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)31 List (java.util.List)30 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)30 BigInteger (java.math.BigInteger)29 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)27 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)27 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)27 Logger (org.slf4j.Logger)27 LoggerFactory (org.slf4j.LoggerFactory)27 Collections (java.util.Collections)26 Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes)26 AttributesReach (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach)26