Search in sources :

Example 76 with Route

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

the class VpnSubnetRouteHandler method publishSubnetRouteToBgp.

@SuppressWarnings("checkstyle:IllegalCatch")
private void publishSubnetRouteToBgp(SubnetOpDataEntryBuilder subOpBuilder, String nextHopIp) {
    try {
        // BGP manager will handle withdraw and advertise internally if prefix
        // already exist
        Uint32 label = Uint32.ZERO;
        Uint32 l3vni = Uint32.ZERO;
        VrfEntry.EncapType encapType = VpnUtil.getEncapType(VpnUtil.isL3VpnOverVxLan(l3vni));
        if (encapType.equals(VrfEntry.EncapType.Vxlan)) {
            l3vni = subOpBuilder.getL3vni();
        } else {
            label = subOpBuilder.getLabel();
            if (label.longValue() == VpnConstants.INVALID_LABEL) {
                LOG.error("publishSubnetRouteToBgp: Label not found for rd {}, subnetIp {}", subOpBuilder.getVrfId(), subOpBuilder.getSubnetCidr());
                return;
            }
        }
        bgpManager.advertisePrefix(subOpBuilder.getVrfId(), null, /*macAddress*/
        subOpBuilder.getSubnetCidr(), Arrays.asList(nextHopIp), encapType, label, l3vni, Uint32.ZERO, /*l2vni*/
        null);
        subOpBuilder.setLastAdvState(subOpBuilder.getRouteAdvState()).setRouteAdvState(TaskState.Advertised);
    } catch (Exception e) {
        LOG.error("{} publishSubnetRouteToBgp: Subnet route not advertised for subnet {} subnetIp {} vpn {} rd {}" + " with dpnid {}", LOGGING_PREFIX, subOpBuilder.getSubnetId().getValue(), subOpBuilder.getSubnetCidr(), subOpBuilder.getVpnName(), subOpBuilder.getVrfId(), nextHopIp, e);
    }
}
Also used : VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) Uint32(org.opendaylight.yangtools.yang.common.Uint32) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException)

Example 77 with Route

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

the class VpnSubnetRouteHandler method onSubnetDeletedFromVpn.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void onSubnetDeletedFromVpn(Subnetmap subnetmap, boolean isBgpVpn) {
    Uuid subnetId = subnetmap.getId();
    LOG.info("{} onSubnetDeletedFromVpn: Subnet {} with ip {} being removed from vpnId {}", LOGGING_PREFIX, subnetId, subnetmap.getSubnetIp(), subnetmap.getVpnId());
    // TODO(vivek): Change this to use more granularized lock at subnetId level
    try {
        vpnUtil.lockSubnet(subnetId.getValue());
        InstanceIdentifier<SubnetOpDataEntry> subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).child(SubnetOpDataEntry.class, new SubnetOpDataEntryKey(subnetId)).build();
        Optional<SubnetOpDataEntry> optionalSubs = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier);
        if (!optionalSubs.isPresent()) {
            LOG.error("{} onSubnetDeletedFromVpn: SubnetOpDataEntry for subnet {} subnetIp {} vpn {}" + " not available in datastore", LOGGING_PREFIX, subnetId.getValue(), subnetId.getValue(), subnetmap.getVpnId());
            return;
        }
        LOG.trace("{} onSubnetDeletedFromVpn: Removing the SubnetOpDataEntry node for subnet {} subnetIp {}" + " vpnName {} rd {} TaskState {}", LOGGING_PREFIX, subnetId.getValue(), optionalSubs.get().getSubnetCidr(), optionalSubs.get().getVpnName(), optionalSubs.get().getVrfId(), optionalSubs.get().getRouteAdvState());
        /* If subnet is deleted (or if its removed from VPN), the ports that are DOWN on that subnet
             * will continue to be stale in portOpData DS, as subDpnList used for portOpData removal will
             * contain only ports that are UP. So here we explicitly cleanup the ports of the subnet by
             * going through the list of ports on the subnet
             */
        List<Uuid> portList = subnetmap.getPortList();
        if (portList != null) {
            for (Uuid port : portList) {
                InstanceIdentifier<PortOpDataEntry> portOpIdentifier = InstanceIdentifier.builder(PortOpData.class).child(PortOpDataEntry.class, new PortOpDataEntryKey(port.getValue())).build();
                LOG.trace("{} onSubnetDeletedFromVpn: Deleting portOpData entry for port {}" + " from subnet {} subnetIp {} vpnName {} TaskState {}", LOGGING_PREFIX, port.getValue(), subnetId.getValue(), optionalSubs.get().getSubnetCidr(), optionalSubs.get().getVpnName(), optionalSubs.get().getRouteAdvState());
                SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, portOpIdentifier, VpnUtil.SINGLE_TRANSACTION_BROKER_NO_RETRY);
            }
        }
        SubnetOpDataEntryBuilder subOpBuilder = new SubnetOpDataEntryBuilder(optionalSubs.get());
        String rd = subOpBuilder.getVrfId();
        String subnetIp = subOpBuilder.getSubnetCidr();
        String vpnName = subOpBuilder.getVpnName();
        // Withdraw the routes for all the interfaces on this subnet
        // Remove subnet route entry from FIB
        deleteSubnetRouteFromFib(rd, subnetIp, vpnName, isBgpVpn);
        SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier, VpnUtil.SINGLE_TRANSACTION_BROKER_NO_RETRY);
        int releasedLabel = vpnUtil.releaseId(VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(rd, subnetIp));
        if (releasedLabel == VpnConstants.INVALID_LABEL) {
            LOG.error("onSubnetDeletedFromVpn: Unable to release label for key {}", VpnUtil.getNextHopLabelKey(rd, subnetIp));
        }
        LOG.info("{} onSubnetDeletedFromVpn: Removed subnetopdataentry successfully from Datastore" + " for subnet {} subnetIp {} vpnName {} rd {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, rd);
    } catch (RuntimeException e) {
        // TODO: Avoid this
        LOG.error("{} onSubnetDeletedFromVpn: Unable to handle subnet {} with Ip {} removed from vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetmap.getSubnetIp(), subnetmap.getVpnId(), e);
    } catch (TransactionCommitFailedException ex) {
        LOG.error("{} onSubnetDeletedFromVpn: Removal of SubnetOpDataEntry for subnet {} subnetIp {}" + " vpnId {} failed", LOGGING_PREFIX, subnetId.getValue(), subnetmap.getSubnetIp(), subnetmap.getVpnId(), ex);
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("{} onSubnetDeletedFromVpn: Failed to read data store for subnet {} ip {} vpn {}", LOGGING_PREFIX, subnetId, subnetmap.getSubnetIp(), subnetmap.getVpnId());
    } finally {
        vpnUtil.unlockSubnet(subnetId.getValue());
    }
}
Also used : SubnetOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryBuilder) PortOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.port.op.data.PortOpDataEntry) PortOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.port.op.data.PortOpDataEntryKey) SubnetOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) SubnetOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey) ExecutionException(java.util.concurrent.ExecutionException)

Example 78 with Route

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

the class VpnSubnetRouteHandler method addSubnetRouteToFib.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private boolean addSubnetRouteToFib(String rd, String subnetIp, Uint64 nhDpnId, String nextHopIp, String vpnName, Long elanTag, Uint32 label, Uint32 l3vni, Uuid subnetId, boolean isBgpVpn, String networkName) {
    requireNonNull(rd, LOGGING_PREFIX + " addSubnetRouteToFib: RouteDistinguisher cannot be null or empty!");
    requireNonNull(subnetIp, LOGGING_PREFIX + " addSubnetRouteToFib: SubnetRouteIp cannot be null or empty!");
    requireNonNull(vpnName, LOGGING_PREFIX + " addSubnetRouteToFib: vpnName cannot be null or empty!");
    requireNonNull(elanTag, LOGGING_PREFIX + " addSubnetRouteToFib: elanTag cannot be null or empty!");
    requireNonNull(label, LOGGING_PREFIX + " addSubnetRouteToFib: label cannot be null or empty!");
    VrfEntry.EncapType encapType = VpnUtil.getEncapType(VpnUtil.isL3VpnOverVxLan(l3vni));
    VpnPopulator vpnPopulator = L3vpnRegistry.getRegisteredPopulator(encapType);
    LOG.info("{} addSubnetRouteToFib: Adding SubnetRoute fib entry for vpnName {}, subnetIP {}, elanTag {}", LOGGING_PREFIX, vpnName, subnetIp, elanTag);
    L3vpnInput input = new L3vpnInput().setRouteOrigin(RouteOrigin.CONNECTED).setRd(rd).setVpnName(vpnName).setSubnetIp(subnetIp).setNextHopIp(nextHopIp).setL3vni(l3vni.longValue()).setLabel(label.longValue()).setElanTag(elanTag).setDpnId(nhDpnId).setEncapType(encapType).setNetworkName(networkName).setPrimaryRd(rd);
    if (!isBgpVpn) {
        vpnPopulator.populateFib(input, null);
        return true;
    }
    requireNonNull(nextHopIp, LOGGING_PREFIX + "NextHopIp cannot be null or empty!");
    vpnUtil.syncWrite(LogicalDatastoreType.OPERATIONAL, VpnUtil.getPrefixToInterfaceIdentifier(vpnUtil.getVpnId(vpnName), subnetIp), VpnUtil.getPrefixToInterface(nhDpnId, subnetId.getValue(), subnetIp, Prefixes.PrefixCue.SubnetRoute));
    vpnPopulator.populateFib(input, null);
    try {
        // BGP manager will handle withdraw and advertise internally if prefix
        // already exist
        bgpManager.advertisePrefix(rd, null, /*macAddress*/
        subnetIp, Collections.singletonList(nextHopIp), encapType, label, l3vni, Uint32.ZERO, /*l2vni*/
        null);
    } catch (Exception e) {
        LOG.error("{} addSubnetRouteToFib: Subnet route not advertised for subnet {} subnetIp {} vpnName {} rd {} " + "with dpnid {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, rd, nhDpnId, e);
        return false;
    }
    return true;
}
Also used : VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VpnPopulator(org.opendaylight.netvirt.vpnmanager.populator.intfc.VpnPopulator) L3vpnInput(org.opendaylight.netvirt.vpnmanager.populator.input.L3vpnInput) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException)

Example 79 with Route

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

the class VpnSubnetRouteHandler method onSubnetAddedToVpn.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void onSubnetAddedToVpn(Subnetmap subnetmap, boolean isBgpVpn, Long elanTag) {
    Uuid subnetId = subnetmap.getId();
    String subnetIp = subnetmap.getSubnetIp();
    SubnetOpDataEntry subOpEntry = null;
    SubnetOpDataEntryBuilder subOpBuilder = null;
    InstanceIdentifier<SubnetOpDataEntry> subOpIdentifier = null;
    Optional<SubnetOpDataEntry> optionalSubs = null;
    Uint32 label;
    requireNonNull(subnetId, LOGGING_PREFIX + " onSubnetAddedToVpn: SubnetId cannot be null or empty!");
    requireNonNull(subnetIp, LOGGING_PREFIX + " onSubnetAddedToVpn: SubnetPrefix cannot be null or empty!");
    requireNonNull(elanTag, LOGGING_PREFIX + " onSubnetAddedToVpn: ElanTag cannot be null or empty!");
    if (subnetmap.getVpnId() == null) {
        LOG.error("onSubnetAddedToVpn: VpnId {} for subnet {} not found, bailing out", subnetmap.getVpnId(), subnetId);
        return;
    }
    String vpnName = subnetmap.getVpnId().getValue();
    Uint32 vpnId = waitAndGetVpnIdIfInvalid(vpnName);
    if (VpnConstants.INVALID_ID.equals(vpnId)) {
        LOG.error("{} onSubnetAddedToVpn: VpnInstance to VPNId mapping not yet available for VpnName {} " + "processing subnet {} with IP {}, bailing out now.", LOGGING_PREFIX, vpnName, subnetId, subnetIp);
        return;
    }
    String primaryRd = vpnUtil.getPrimaryRd(vpnName);
    VpnInstanceOpDataEntry vpnInstanceOpData = waitAndGetVpnInstanceOpDataIfNull(vpnName, primaryRd);
    if (vpnInstanceOpData == null) {
        LOG.error("{} onSubnetAddedToVpn: VpnInstanceOpData not yet available for VpnName {} " + "processing subnet {} with IP {}, bailing out now.", LOGGING_PREFIX, vpnName, subnetId, subnetIp);
        return;
    }
    LOG.info("{} onSubnetAddedToVpn: Subnet {} with IP {} being added to vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName);
    // TODO(vivek): Change this to use more granularized lock at subnetId level
    try {
        vpnUtil.lockSubnet(subnetId.getValue());
        if (isBgpVpn) {
            InstanceIdentifier<Networks> netsIdentifier = InstanceIdentifier.builder(ExternalNetworks.class).child(Networks.class, new NetworksKey(subnetmap.getNetworkId())).build();
            Optional<Networks> optionalNets = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, netsIdentifier);
            if (optionalNets.isPresent()) {
                LOG.info("{} onSubnetAddedToVpn: subnet {} with IP {} is an external subnet on external " + "network {}, so ignoring this for SubnetRoute on vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, subnetmap.getNetworkId().getValue(), vpnName);
                return;
            }
        }
        // Create and add SubnetOpDataEntry object for this subnet to the SubnetOpData container
        subOpIdentifier = InstanceIdentifier.builder(SubnetOpData.class).child(SubnetOpDataEntry.class, new SubnetOpDataEntryKey(subnetId)).build();
        optionalSubs = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier);
        if (optionalSubs.isPresent()) {
            LOG.error("{} onSubnetAddedToVpn: SubnetOpDataEntry for subnet {} with ip {} and vpn {} already" + " detected to be present", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName);
            return;
        }
        LOG.debug("{} onSubnetAddedToVpn: Creating new SubnetOpDataEntry node for subnet {} subnetIp {} " + "vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName);
        subOpBuilder = new SubnetOpDataEntryBuilder().withKey(new SubnetOpDataEntryKey(subnetId));
        subOpBuilder.setSubnetId(subnetId);
        subOpBuilder.setSubnetCidr(subnetIp);
        if (isBgpVpn && !VpnUtil.isBgpVpn(vpnName, primaryRd)) {
            LOG.error("{} onSubnetAddedToVpn: The VPN Instance name {} does not have RD. Bailing out for" + " subnet {} subnetIp {} ", LOGGING_PREFIX, vpnName, subnetId.getValue(), subnetIp);
            return;
        }
        // Allocate MPLS label for subnet-route at the time SubnetOpDataEntry creation
        label = vpnUtil.getUniqueId(VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(primaryRd, subnetIp));
        if (label == VpnConstants.INVALID_ID) {
            LOG.error("onSubnetAddedToVpn: Unable to retrieve label for rd {}, subnetIp {}", primaryRd, subnetIp);
            return;
        }
        subOpBuilder.setVrfId(primaryRd);
        subOpBuilder.setVpnName(vpnName);
        subOpBuilder.setSubnetToDpn(new ArrayList<>());
        subOpBuilder.setRouteAdvState(TaskState.Idle);
        subOpBuilder.setElanTag(elanTag);
        subOpBuilder.setLabel(label);
        Long l3Vni = vpnInstanceOpData.getL3vni() != null ? vpnInstanceOpData.getL3vni().toJava() : 0L;
        subOpBuilder.setL3vni(l3Vni);
        subOpEntry = subOpBuilder.build();
        SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier, subOpEntry, VpnUtil.SINGLE_TRANSACTION_BROKER_NO_RETRY);
        LOG.info("{} onSubnetAddedToVpn: Added subnetopdataentry to OP Datastore for subnet {}", LOGGING_PREFIX, subnetId.getValue());
    } catch (TransactionCommitFailedException e) {
        LOG.error("{} Creation of SubnetOpDataEntry for subnet {} failed ", LOGGING_PREFIX, subnetId.getValue(), e);
        // The second part of this method depends on subnetmap being non-null so fail fast here.
        return;
    } catch (RuntimeException e) {
        // TODO: Avoid this
        LOG.error("{} onSubnetAddedToVpn: Unable to handle subnet {} with ip {} added to vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, e);
        return;
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("{} onSubnetAddedToVpn: Failed to read data store for subnet {} ip {} vpn {}", LOGGING_PREFIX, subnetId, subnetIp, vpnName);
        return;
    } finally {
        vpnUtil.unlockSubnet(subnetId.getValue());
    }
    try {
        // In second critical section , Port-Op-Data will be updated.
        vpnUtil.lockSubnet(subnetId.getValue());
        Uint64 dpnId = null;
        SubnetToDpn subDpn = null;
        Map<Uint64, SubnetToDpn> subDpnMap = new HashMap<>();
        optionalSubs = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier);
        subOpBuilder = new SubnetOpDataEntryBuilder(optionalSubs.get()).withKey(new SubnetOpDataEntryKey(subnetId));
        List<Uuid> portList = subnetmap.getPortList();
        if (portList != null) {
            for (Uuid port : portList) {
                Interface intfState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker, port.getValue());
                if (intfState != null) {
                    try {
                        dpnId = InterfaceUtils.getDpIdFromInterface(intfState);
                    } catch (Exception e) {
                        LOG.error("{} onSubnetAddedToVpn: Unable to obtain dpnId for interface {}," + " subnetroute inclusion for this interface for subnet {} subnetIp {} " + "vpn {} failed with exception", LOGGING_PREFIX, port.getValue(), subnetId.getValue(), subnetIp, vpnName, e);
                        continue;
                    }
                    if (dpnId.equals(Uint64.ZERO)) {
                        LOG.error("{} onSubnetAddedToVpn: Port {} is not assigned DPN yet," + " ignoring subnet {} subnetIP {} vpn {}", LOGGING_PREFIX, port.getValue(), subnetId.getValue(), subnetIp, vpnName);
                        continue;
                    }
                    subOpDpnManager.addPortOpDataEntry(port.getValue(), subnetId, dpnId);
                    if (intfState.getOperStatus() != OperStatus.Up) {
                        LOG.error("{} onSubnetAddedToVpn: Port {} is not UP yet, ignoring subnet {}" + " subnetIp {} vpn {}", LOGGING_PREFIX, port.getValue(), subnetId.getValue(), subnetIp, vpnName);
                        continue;
                    }
                    subDpn = subOpDpnManager.addInterfaceToDpn(subnetId, dpnId, port.getValue());
                    if (intfState.getOperStatus() == OperStatus.Up) {
                        // port is UP
                        subDpnMap.put(dpnId, subDpn);
                    }
                } else {
                    subOpDpnManager.addPortOpDataEntry(port.getValue(), subnetId, null);
                }
            }
            if (subDpnMap.size() > 0) {
                subOpBuilder.setSubnetToDpn(new ArrayList<>(subDpnMap.values()));
            }
        }
        electNewDpnForSubnetRoute(subOpBuilder, null, /* oldDpnId */
        subnetId, subnetmap.getNetworkId(), isBgpVpn, label);
        subOpEntry = subOpBuilder.build();
        SingleTransactionDataBroker.syncUpdate(dataBroker, LogicalDatastoreType.OPERATIONAL, subOpIdentifier, subOpEntry, VpnUtil.SINGLE_TRANSACTION_BROKER_NO_RETRY);
        LOG.info("{} onSubnetAddedToVpn: Added PortOpDataEntry and VpnInterfaces to SubnetOpData" + " for subnet {} subnetIp {} vpn {} TaskState {} lastTaskState {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, subOpEntry.getRouteAdvState(), subOpEntry.getLastAdvState());
    } catch (RuntimeException e) {
        LOG.error("{} onSubnetAddedToVpn: Unable to handle subnet {} with ip {} added to vpn {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, e);
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("{} onSubnetAddedToVpn: Failed to read data store for subnet {} ip {} vpn {}", LOGGING_PREFIX, subnetId, subnetIp, vpnName);
    } catch (TransactionCommitFailedException ex) {
        LOG.error("{} onSubnetAddedToVpn: Creation of SubnetOpDataEntry for subnet {} subnetIp {} vpn {} failed", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, ex);
    } finally {
        vpnUtil.unlockSubnet(subnetId.getValue());
    }
}
Also used : Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks) ExternalNetworks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks) HashMap(java.util.HashMap) SubnetOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException) Uint32(org.opendaylight.yangtools.yang.common.Uint32) SubnetOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryBuilder) SubnetOpData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetOpData) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException) SubnetToDpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.subnet.op.data.entry.SubnetToDpn) NetworksKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.NetworksKey) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) SubnetOpDataEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 80 with Route

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

the class VpnSubnetRouteHandler method deleteSubnetRouteFibEntryFromDS.

public void deleteSubnetRouteFibEntryFromDS(String rd, String prefix, String vpnName) {
    fibManager.removeFibEntry(rd, prefix, VPN_EVENT_SOURCE_SUBNET_ROUTE, null);
    List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
    for (VpnInstanceOpDataEntry vpnInstance : vpnsToImportRoute) {
        String importingRd = vpnInstance.getVrfId();
        fibManager.removeFibEntry(importingRd, prefix, VPN_EVENT_SOURCE_SUBNET_ROUTE, null);
        LOG.info("SUBNETROUTE: deleteSubnetRouteFibEntryFromDS: Deleted imported subnet route rd {} prefix {}" + " from vpn {} importingRd {}", rd, prefix, vpnInstance.getVpnInstanceName(), importingRd);
    }
    LOG.info("SUBNETROUTE: deleteSubnetRouteFibEntryFromDS: Removed subnetroute FIB for prefix {} rd {}" + " vpnName {}", prefix, rd, vpnName);
}
Also used : VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)

Aggregations

ArrayList (java.util.ArrayList)82 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)57 ExecutionException (java.util.concurrent.ExecutionException)55 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)55 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)51 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)45 Test (org.junit.Test)44 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)43 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)40 BigInteger (java.math.BigInteger)33 List (java.util.List)33 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)33 Logger (org.slf4j.Logger)33 LoggerFactory (org.slf4j.LoggerFactory)33 Singleton (javax.inject.Singleton)32 Inject (javax.inject.Inject)30 RouteOrigin (org.opendaylight.netvirt.fibmanager.api.RouteOrigin)30 Collections (java.util.Collections)29 Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes)29 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes)29