Search in sources :

Example 6 with ElanDpnInterfacesList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.

the class ElanUtils method getParticipatingDpnsInElanInstance.

/**
 * This method is useful get all ELAN participating CSS dpIds to install
 * program remote dmac entries and updating remote bc groups for tor
 * integration.
 *
 * @param elanInstanceName
 *            the elan instance name
 * @return list of dpIds
 */
@Nonnull
public List<BigInteger> getParticipatingDpnsInElanInstance(String elanInstanceName) {
    List<BigInteger> dpIds = new ArrayList<>();
    InstanceIdentifier<ElanDpnInterfacesList> elanDpnInterfaceId = getElanDpnOperationDataPath(elanInstanceName);
    Optional<ElanDpnInterfacesList> existingElanDpnInterfaces = read(broker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId);
    if (!existingElanDpnInterfaces.isPresent()) {
        return dpIds;
    }
    List<DpnInterfaces> dpnInterfaces = existingElanDpnInterfaces.get().getDpnInterfaces();
    for (DpnInterfaces dpnInterface : dpnInterfaces) {
        dpIds.add(dpnInterface.getDpId());
    }
    return dpIds;
}
Also used : ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) ArrayList(java.util.ArrayList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) BigInteger(java.math.BigInteger) Nonnull(javax.annotation.Nonnull)

Example 7 with ElanDpnInterfacesList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.

the class ElanL2GatewayMulticastUtils method getRemoteBCGroupTunnelBuckets.

@SuppressWarnings("checkstyle:IllegalCatch")
private List<Bucket> getRemoteBCGroupTunnelBuckets(ElanDpnInterfacesList elanDpns, BigInteger dpnId, int bucketId, long elanTagOrVni) {
    List<Bucket> listBucketInfo = new ArrayList<>();
    if (elanDpns != null) {
        for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
            if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpnId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
                try {
                    List<Action> listActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnId, dpnInterface.getDpId(), elanTagOrVni);
                    if (listActionInfo.isEmpty()) {
                        continue;
                    }
                    listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
                    bucketId++;
                } catch (Exception ex) {
                    LOG.error("Logical Group Interface not found between source Dpn - {}, destination Dpn - {} ", dpnId, dpnInterface.getDpId(), ex);
                }
            }
        }
    }
    return listBucketInfo;
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)

Example 8 with ElanDpnInterfacesList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.

the class ElanUtils method isDpnAlreadyPresentInElanInstance.

/**
 * To check given dpId is already present in Elan instance. This can be used
 * to program flow entry in external tunnel table when a new access port
 * added for first time into the ELAN instance
 *
 * @param dpId
 *            the dp id
 * @param elanInstanceName
 *            the elan instance name
 * @return true if dpId is already present, otherwise return false
 */
public boolean isDpnAlreadyPresentInElanInstance(BigInteger dpId, String elanInstanceName) {
    InstanceIdentifier<ElanDpnInterfacesList> elanDpnInterfaceId = getElanDpnOperationDataPath(elanInstanceName);
    Optional<ElanDpnInterfacesList> existingElanDpnInterfaces = read(broker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId);
    if (!existingElanDpnInterfaces.isPresent()) {
        return false;
    }
    List<DpnInterfaces> dpnInterfaces = existingElanDpnInterfaces.get().getDpnInterfaces();
    for (DpnInterfaces dpnInterface : dpnInterfaces) {
        if (dpnInterface.getDpId().equals(dpId)) {
            return true;
        }
    }
    return false;
}
Also used : ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)

Example 9 with ElanDpnInterfacesList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.

the class VpnUtil method getDpnInElan.

public static Set<BigInteger> getDpnInElan(DataBroker dataBroker, Map<String, String> elanInstanceRouterPortMap) {
    Set<BigInteger> dpnIdSet = new HashSet<BigInteger>();
    for (String elanInstanceName : elanInstanceRouterPortMap.keySet()) {
        InstanceIdentifier<ElanDpnInterfacesList> elanDpnInterfaceId = getElanDpnOperationalDataPath(elanInstanceName);
        Optional<ElanDpnInterfacesList> dpnInElanInterfaces = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId);
        if (dpnInElanInterfaces.isPresent()) {
            List<DpnInterfaces> dpnInterfaces = dpnInElanInterfaces.get().getDpnInterfaces();
            for (DpnInterfaces dpnInterface : dpnInterfaces) {
                dpnIdSet.add(dpnInterface.getDpId());
            }
        }
    }
    return dpnIdSet;
}
Also used : ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) BigInteger(java.math.BigInteger) HashSet(java.util.HashSet)

Example 10 with ElanDpnInterfacesList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.

the class DhcpServiceUtils method getDpnsForElan.

@Nonnull
public static List<BigInteger> getDpnsForElan(String elanInstanceName, DataBroker broker) {
    List<BigInteger> elanDpns = new LinkedList<>();
    InstanceIdentifier<ElanDpnInterfacesList> elanDpnInstanceIdentifier = InstanceIdentifier.builder(ElanDpnInterfaces.class).child(ElanDpnInterfacesList.class, new ElanDpnInterfacesListKey(elanInstanceName)).build();
    Optional<ElanDpnInterfacesList> elanDpnOptional = MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, elanDpnInstanceIdentifier);
    if (elanDpnOptional.isPresent()) {
        List<DpnInterfaces> dpns = elanDpnOptional.get().getDpnInterfaces();
        for (DpnInterfaces dpnInterfaces : dpns) {
            elanDpns.add(dpnInterfaces.getDpId());
        }
    }
    return elanDpns;
}
Also used : ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) BigInteger(java.math.BigInteger) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull)

Aggregations

ElanDpnInterfacesList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList)10 DpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces)10 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)9 BigInteger (java.math.BigInteger)6 ArrayList (java.util.ArrayList)6 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)4 Nonnull (javax.annotation.Nonnull)3 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)3 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)3 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)3 HashSet (java.util.HashSet)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 ElanException (org.opendaylight.netvirt.elan.ElanException)2 ElanDpnInterfacesListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey)2 Optional (com.google.common.base.Optional)1 Collections (java.util.Collections)1 Collections.emptyList (java.util.Collections.emptyList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1