Class FibUtil
- java.lang.Object
-
- org.opendaylight.netvirt.fibmanager.FibUtil
-
@Singleton public class FibUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FibUtil(org.opendaylight.mdsal.binding.api.DataBroker dataBroker, org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService idManager, org.opendaylight.genius.itm.api.IITMProvider iitmProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFibEntryForRouterInterface(java.lang.String rd, java.lang.String prefix, RouterInterface routerInterface, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
static void
addL3vpnDcGateWay(java.lang.String destinationIp, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
void
addOrUpdateFibEntry(java.lang.String rd, java.lang.String macAddress, java.lang.String prefix, java.util.List<java.lang.String> nextHopList, VrfEntryBase.EncapType encapType, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.yangtools.yang.common.Uint32 l3vni, java.lang.String gwMacAddress, java.lang.String parentVpnRd, RouteOrigin origin, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
void
addVrfTable(java.lang.String rd, org.opendaylight.mdsal.binding.api.WriteTransaction writeConfigTxn)
static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface>
buildStateInterfaceId(java.lang.String interfaceName)
static boolean
checkFibEntryExist(org.opendaylight.mdsal.binding.api.DataBroker broker, java.lang.String rd, java.lang.String prefix, java.lang.String nextHopIp)
static java.lang.String
getBroadcastAddressFromCidr(java.lang.String cidr)
static java.lang.String
getCreateLocalNextHopJobKey(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String prefix)
static java.lang.String
getCreateRemoteNextHopJobKey(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String prefix)
static java.util.Optional<java.lang.String>
getFirstNextHopAddress(VrfEntry vrfEntry)
static java.lang.String
getGreLbGroupKey(java.util.List<java.lang.String> availableDcGws)
@Nullable org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
getInterfaceStateFromOperDS(java.lang.String interfaceName)
static java.lang.String
getIpPrefix(java.lang.String prefix)
static java.lang.String
getJobKeyForRdPrefix(java.lang.String rd, java.lang.String prefix)
static java.lang.String
getJobKeyForVpnIdDpnId(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId)
java.util.List<java.lang.String>
getL3VpnDcGateWays()
static java.util.Optional<org.opendaylight.yangtools.yang.common.Uint32>
getLabelForNextHop(VrfEntry vrfEntry, java.lang.String nextHopIp)
static java.util.Optional<org.opendaylight.yangtools.yang.common.Uint32>
getLabelFromRoutePaths(VrfEntry vrfEntry)
java.util.List<java.lang.String>
getNextHopAddresses(java.lang.String rd, java.lang.String prefix)
static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<VrfEntry>
getNextHopIdentifier(java.lang.String rd, java.lang.String prefix)
java.util.Optional<Nexthops>
getNexthops(java.lang.String nextHopKey)
@Nullable org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList
getTunnelState(java.lang.String interfaceName)
org.opendaylight.yangtools.yang.common.Uint32
getVpnId(java.lang.String vpnName)
@Nullable java.lang.String
getVpnNameFromId(org.opendaylight.yangtools.yang.common.Uint32 vpnId)
java.util.Optional<java.lang.String>
getVpnNameFromRd(java.lang.String rd)
Retrieves the VpnInstance name (typically the VPN Uuid) out from the route-distinguisher.boolean
isInterfacePresentInDpn(java.lang.String vpnName, org.opendaylight.yangtools.yang.common.Uint64 dpnId)
static boolean
isTunnelInterface(org.opendaylight.netvirt.fibmanager.NexthopManager.AdjacencyResult adjacencyResult)
static boolean
lockCluster(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService lockManager, java.lang.String lockName, long tryLockPeriod)
void
removeFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String eventSource, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
static void
removeL3vpnDcGateWay(java.lang.String destinationIp, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
void
removeOrUpdateFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String nextHopToRemove, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
Removes a specific Nexthop from a VrfEntry.static void
removeOrUpdateNextHopInfo(org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String nextHopKey, java.lang.String groupId, Nexthops nexthops, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
void
removeVrfTable(java.lang.String rd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
static void
unlockCluster(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService lockManager, java.lang.String lockName)
static void
updateLbGroupInfo(org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String groupIdKey, java.lang.String groupId, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
void
updateRoutePathForFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String nextHop, org.opendaylight.yangtools.yang.common.Uint32 label, boolean nextHopAdd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
Adds or removes nextHop from routePath based on the flag nextHopAdd.void
updateUsedRdAndVpnToExtraRoute(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> confTx, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> operTx, java.lang.String tunnelIpRemoved, java.lang.String primaryRd, java.lang.String prefix)
void
writeFibEntryToDs(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<VrfEntry> vrfEntryId, java.lang.String prefix, java.util.List<java.lang.String> nextHopList, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.yangtools.yang.common.Uint32 l3vni, VrfEntryBase.EncapType encapType, RouteOrigin origin, java.lang.String macAddress, java.lang.String gatewayMacAddress, java.lang.String parentVpnRd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
-
-
Method Detail
-
getVpnId
public org.opendaylight.yangtools.yang.common.Uint32 getVpnId(java.lang.String vpnName)
-
getVpnNameFromRd
public java.util.Optional<java.lang.String> getVpnNameFromRd(java.lang.String rd)
Retrieves the VpnInstance name (typically the VPN Uuid) out from the route-distinguisher.- Parameters:
rd
- The route-distinguisher- Returns:
- The vpn instance
-
getVpnNameFromId
public @Nullable java.lang.String getVpnNameFromId(org.opendaylight.yangtools.yang.common.Uint32 vpnId)
-
addOrUpdateFibEntry
public void addOrUpdateFibEntry(java.lang.String rd, java.lang.String macAddress, java.lang.String prefix, java.util.List<java.lang.String> nextHopList, VrfEntryBase.EncapType encapType, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.yangtools.yang.common.Uint32 l3vni, java.lang.String gwMacAddress, java.lang.String parentVpnRd, RouteOrigin origin, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
writeFibEntryToDs
public void writeFibEntryToDs(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<VrfEntry> vrfEntryId, java.lang.String prefix, java.util.List<java.lang.String> nextHopList, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.yangtools.yang.common.Uint32 l3vni, VrfEntryBase.EncapType encapType, RouteOrigin origin, java.lang.String macAddress, java.lang.String gatewayMacAddress, java.lang.String parentVpnRd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
addFibEntryForRouterInterface
public void addFibEntryForRouterInterface(java.lang.String rd, java.lang.String prefix, RouterInterface routerInterface, org.opendaylight.yangtools.yang.common.Uint32 label, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
removeFibEntry
public void removeFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String eventSource, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
removeOrUpdateFibEntry
public void removeOrUpdateFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String nextHopToRemove, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
Removes a specific Nexthop from a VrfEntry. If Nexthop to remove is the last one in the VrfEntry, then the VrfEntry is removed too.- Parameters:
rd
- Route-Distinguisher to which the VrfEntry belongs toprefix
- Destination of the routenextHopToRemove
- Specific nexthop within the Route to be removed. If null or empty, then the whole VrfEntry is removed
-
updateRoutePathForFibEntry
public void updateRoutePathForFibEntry(java.lang.String rd, java.lang.String prefix, java.lang.String nextHop, org.opendaylight.yangtools.yang.common.Uint32 label, boolean nextHopAdd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
Adds or removes nextHop from routePath based on the flag nextHopAdd.
-
addVrfTable
public void addVrfTable(java.lang.String rd, org.opendaylight.mdsal.binding.api.WriteTransaction writeConfigTxn)
-
removeVrfTable
public void removeVrfTable(java.lang.String rd, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> writeConfigTxn)
-
getLabelFromRoutePaths
public static java.util.Optional<org.opendaylight.yangtools.yang.common.Uint32> getLabelFromRoutePaths(VrfEntry vrfEntry)
-
getFirstNextHopAddress
public static java.util.Optional<java.lang.String> getFirstNextHopAddress(VrfEntry vrfEntry)
-
getLabelForNextHop
public static java.util.Optional<org.opendaylight.yangtools.yang.common.Uint32> getLabelForNextHop(VrfEntry vrfEntry, java.lang.String nextHopIp)
-
getTunnelState
public @Nullable org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList getTunnelState(java.lang.String interfaceName) throws org.opendaylight.mdsal.common.api.ReadFailedException
- Throws:
org.opendaylight.mdsal.common.api.ReadFailedException
-
buildStateInterfaceId
public static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> buildStateInterfaceId(java.lang.String interfaceName)
-
getInterfaceStateFromOperDS
public @Nullable org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface getInterfaceStateFromOperDS(java.lang.String interfaceName)
-
getCreateLocalNextHopJobKey
public static java.lang.String getCreateLocalNextHopJobKey(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String prefix)
-
getCreateRemoteNextHopJobKey
public static java.lang.String getCreateRemoteNextHopJobKey(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String prefix)
-
getJobKeyForRdPrefix
public static java.lang.String getJobKeyForRdPrefix(java.lang.String rd, java.lang.String prefix)
-
getJobKeyForVpnIdDpnId
public static java.lang.String getJobKeyForVpnIdDpnId(org.opendaylight.yangtools.yang.common.Uint32 vpnId, org.opendaylight.yangtools.yang.common.Uint64 dpnId)
-
updateUsedRdAndVpnToExtraRoute
public void updateUsedRdAndVpnToExtraRoute(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> confTx, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> operTx, java.lang.String tunnelIpRemoved, java.lang.String primaryRd, java.lang.String prefix) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException
-
getIpPrefix
public static java.lang.String getIpPrefix(java.lang.String prefix)
-
isTunnelInterface
public static boolean isTunnelInterface(org.opendaylight.netvirt.fibmanager.NexthopManager.AdjacencyResult adjacencyResult)
-
getNextHopIdentifier
public static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<VrfEntry> getNextHopIdentifier(java.lang.String rd, java.lang.String prefix)
-
getNextHopAddresses
public java.util.List<java.lang.String> getNextHopAddresses(java.lang.String rd, java.lang.String prefix)
-
getGreLbGroupKey
public static java.lang.String getGreLbGroupKey(java.util.List<java.lang.String> availableDcGws)
-
updateLbGroupInfo
public static void updateLbGroupInfo(org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String groupIdKey, java.lang.String groupId, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
-
removeL3vpnDcGateWay
public static void removeL3vpnDcGateWay(java.lang.String destinationIp, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
addL3vpnDcGateWay
public static void addL3vpnDcGateWay(java.lang.String destinationIp, org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
removeOrUpdateNextHopInfo
public static void removeOrUpdateNextHopInfo(org.opendaylight.yangtools.yang.common.Uint64 dpnId, java.lang.String nextHopKey, java.lang.String groupId, Nexthops nexthops, org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Operational> tx)
-
getNexthops
public java.util.Optional<Nexthops> getNexthops(java.lang.String nextHopKey)
-
getL3VpnDcGateWays
public java.util.List<java.lang.String> getL3VpnDcGateWays()
-
getBroadcastAddressFromCidr
public static java.lang.String getBroadcastAddressFromCidr(java.lang.String cidr)
-
lockCluster
public static boolean lockCluster(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService lockManager, java.lang.String lockName, long tryLockPeriod)
-
unlockCluster
public static void unlockCluster(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService lockManager, java.lang.String lockName)
-
isInterfacePresentInDpn
public boolean isInterfacePresentInDpn(java.lang.String vpnName, org.opendaylight.yangtools.yang.common.Uint64 dpnId)
-
checkFibEntryExist
public static boolean checkFibEntryExist(org.opendaylight.mdsal.binding.api.DataBroker broker, java.lang.String rd, java.lang.String prefix, java.lang.String nextHopIp)
-
-