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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations