Search in sources :

Example 6 with VpnInstances

use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnInstances in project netvirt by opendaylight.

the class NeutronvpnUtils method getExistingRDs.

public List<String> getExistingRDs() {
    List<String> existingRDs = new ArrayList<>();
    InstanceIdentifier<VpnInstances> path = InstanceIdentifier.builder(VpnInstances.class).build();
    Optional<VpnInstances> vpnInstancesOptional = read(LogicalDatastoreType.CONFIGURATION, path);
    if (vpnInstancesOptional.isPresent() && vpnInstancesOptional.get().getVpnInstance() != null) {
        for (VpnInstance vpnInstance : vpnInstancesOptional.get().getVpnInstance()) {
            if (vpnInstance.getIpv4Family() == null) {
                continue;
            }
            List<String> rds = vpnInstance.getIpv4Family().getRouteDistinguisher();
            if (rds != null) {
                existingRDs.addAll(rds);
            }
        }
    }
    return existingRDs;
}
Also used : VpnInstances(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnInstances) VpnInstance(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance) ArrayList(java.util.ArrayList)

Aggregations

VpnInstance (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance)5 ArrayList (java.util.ArrayList)4 VpnInstances (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnInstances)3 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 BigInteger (java.math.BigInteger)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 AsyncDataTreeChangeListenerBase (org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase)1 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)1 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)1 JobCoordinator (org.opendaylight.infrautils.jobcoordinator.JobCoordinator)1