Search in sources :

Example 6 with VpnNexthop

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop in project netvirt by opendaylight.

the class BaseVrfEntryHandler method deleteRemoteRoute.

public void deleteRemoteRoute(final BigInteger localDpnId, final BigInteger remoteDpnId, final long vpnId, final VrfTablesKey vrfTableKey, final VrfEntry vrfEntry, Optional<Routes> extraRouteOptional, WriteTransaction tx) {
    Boolean wrTxPresent = true;
    if (tx == null) {
        wrTxPresent = false;
        tx = dataBroker.newWriteOnlyTransaction();
    }
    LOG.debug("deleting remote route: prefix={}, vpnId={} localDpnId {} remoteDpnId {}", vrfEntry.getDestPrefix(), vpnId, localDpnId, remoteDpnId);
    String rd = vrfTableKey.getRouteDistinguisher();
    if (localDpnId != null && localDpnId != BigInteger.ZERO) {
        // localDpnId is not known when clean up happens for last vm for a vpn on a dpn
        if (extraRouteOptional.isPresent()) {
            nextHopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
            false);
        }
        makeConnectedRoute(remoteDpnId, vpnId, vrfEntry, rd, null, NwConstants.DEL_FLOW, tx, null);
        LOG.debug("Successfully delete FIB entry: vrfEntry={}, vpnId={}", vrfEntry.getDestPrefix(), vpnId);
        return;
    }
    // below two reads are kept as is, until best way is found to identify dpnID
    VpnNexthop localNextHopInfo = nextHopManager.getVpnNexthop(vpnId, vrfEntry.getDestPrefix());
    if (extraRouteOptional.isPresent()) {
        nextHopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
        false);
    } else {
        checkDpnDeleteFibEntry(localNextHopInfo, remoteDpnId, vpnId, vrfEntry, rd, tx, null);
    }
    if (!wrTxPresent) {
        tx.submit();
    }
}
Also used : VpnNexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop)

Example 7 with VpnNexthop

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop in project netvirt by opendaylight.

the class NexthopManager method getDpnForPrefix.

public BigInteger getDpnForPrefix(long vpnId, String prefixIp) {
    VpnNexthop vpnNexthop = getVpnNexthop(vpnId, prefixIp);
    BigInteger localDpnId = vpnNexthop == null ? null : vpnNexthop.getDpnId();
    return localDpnId;
}
Also used : BigInteger(java.math.BigInteger) VpnNexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop)

Example 8 with VpnNexthop

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop in project netvirt by opendaylight.

the class BgpRouteVrfEntryHandler method deleteRemoteRoute.

public void deleteRemoteRoute(final BigInteger localDpnId, final BigInteger remoteDpnId, final long vpnId, final VrfTablesKey vrfTableKey, final VrfEntry vrfEntry, Optional<Routes> extraRouteOptional, WriteTransaction tx, List<SubTransaction> subTxns) {
    Boolean wrTxPresent = true;
    if (tx == null) {
        wrTxPresent = false;
        tx = dataBroker.newWriteOnlyTransaction();
    }
    LOG.debug("deleting remote route: prefix={}, vpnId={} localDpnId {} remoteDpnId {}", vrfEntry.getDestPrefix(), vpnId, localDpnId, remoteDpnId);
    String rd = vrfTableKey.getRouteDistinguisher();
    if (localDpnId != null && localDpnId != BigInteger.ZERO) {
        // localDpnId is not known when clean up happens for last vm for a vpn on a dpn
        if (extraRouteOptional.isPresent()) {
            nexthopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
            false);
        }
        deleteFibEntryForBgpRoutes(remoteDpnId, vpnId, vrfEntry, rd, tx, subTxns);
        return;
    }
    // below two reads are kept as is, until best way is found to identify dpnID
    VpnNexthop localNextHopInfo = nexthopManager.getVpnNexthop(vpnId, vrfEntry.getDestPrefix());
    if (extraRouteOptional.isPresent()) {
        nexthopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
        false);
    } else {
        checkDpnDeleteFibEntry(localNextHopInfo, remoteDpnId, vpnId, vrfEntry, rd, tx, subTxns);
    }
    if (!wrTxPresent) {
        tx.submit();
    }
}
Also used : VpnNexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop)

Example 9 with VpnNexthop

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop in project netvirt by opendaylight.

the class EvpnVrfEntryHandler method removeFlows.

@Override
public void removeFlows(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
    final VrfTablesKey vrfTableKey = identifier.firstKeyOf(VrfTables.class);
    final VpnInstanceOpDataEntry vpnInstance = getFibUtil().getVpnInstanceOpData(vrfTableKey.getRouteDistinguisher()).get();
    if (vpnInstance == null) {
        LOG.error("VPN Instance for rd {} is not available from VPN Op Instance Datastore", rd);
        return;
    }
    VpnNexthop localNextHopInfo = nexthopManager.getVpnNexthop(vpnInstance.getVpnId(), vrfEntry.getDestPrefix());
    List<BigInteger> localDpnId = checkDeleteLocalEvpnFLows(vpnInstance.getVpnId(), rd, vrfEntry, localNextHopInfo);
    deleteRemoteEvpnFlows(rd, vrfEntry, vpnInstance, vrfTableKey, localDpnId);
    vrfEntryListener.cleanUpOpDataForFib(vpnInstance.getVpnId(), rd, vrfEntry);
}
Also used : VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) BigInteger(java.math.BigInteger) VpnNexthop(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop)

Aggregations

VpnNexthop (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop)9 VpnNexthopKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthopKey)4 VpnNexthops (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops)3 VpnNexthopsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthopsKey)3 VpnNexthopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthopBuilder)3 BigInteger (java.math.BigInteger)2 GroupEntity (org.opendaylight.genius.mdsalutil.GroupEntity)2 L3nexthop (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.L3nexthop)2 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)1 BucketInfo (org.opendaylight.genius.mdsalutil.BucketInfo)1 ActionSetFieldEthernetDestination (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetDestination)1 ActionSetFieldEthernetSource (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)1 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)1