use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method setupStandardElanBroadcastGroups.
public void setupStandardElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
int actionKey = 0;
Long elanTag = elanInfo.getElanTag();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, elanTag);
listBucket.addAll(listBucketInfoRemote);
long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("Installing the remote BroadCast Group:{}", group);
mdsalManager.syncInstallGroup(dpnId, group);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanL2GatewayUtils method installL2GwUcastMacInElan.
public void installL2GwUcastMacInElan(final ElanInstance elan, final L2GatewayDevice extL2GwDevice, final String macToBeAdded, final LocalUcastMacs localUcastMacs, String interfaceName) {
final String extDeviceNodeId = extL2GwDevice.getHwvtepNodeId();
final String elanInstanceName = elan.getElanInstanceName();
final Collection<DpnInterfaces> elanDpns = getElanDpns(elanInstanceName);
ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanInstanceName);
// DMAC table
if (elanDpns.size() > 0 || elanL2GwDevices.values().size() > 0) {
String jobKey = elanInstanceName + ":" + macToBeAdded;
IpAddress extL2GwDeviceTepIp = extL2GwDevice.getTunnelIp();
List<PhysAddress> macList = Lists.newArrayList(new PhysAddress(macToBeAdded));
elanClusterUtils.runOnlyInOwnerNode(jobKey, "install l2gw macs in dmac table", () -> {
if (doesLocalUcastMacExistsInCache(extL2GwDevice, localUcastMacs)) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
for (DpnInterfaces elanDpn : elanDpns) {
futures.addAll(elanDmacUtils.installDmacFlowsToExternalRemoteMacInBatch(elanDpn.getDpId(), extDeviceNodeId, elan.getElanTag(), ElanUtils.getVxlanSegmentationId(elan), macToBeAdded, elanInstanceName, interfaceName));
}
for (L2GatewayDevice otherDevice : elanL2GwDevices.values()) {
if (!otherDevice.getHwvtepNodeId().equals(extDeviceNodeId) && !areMLAGDevices(extL2GwDevice, otherDevice)) {
final String hwvtepId = otherDevice.getHwvtepNodeId();
final String logicalSwitchName = elanInstanceName;
futures.add(HwvtepUtils.installUcastMacs(broker, hwvtepId, macList, logicalSwitchName, extL2GwDeviceTepIp));
}
}
return futures;
} else {
LOG.trace("Skipping install of dmac flows for mac {} as it is not found in cache", macToBeAdded);
}
return Collections.emptyList();
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanUtils method deleteMacFlows.
public void deleteMacFlows(ElanInstance elanInfo, InterfaceInfo interfaceInfo, String macAddress, boolean deleteSmac, WriteTransaction deleteFlowGroupTx) {
String elanInstanceName = elanInfo.getElanInstanceName();
List<DpnInterfaces> remoteFEs = getInvolvedDpnsInElan(elanInstanceName);
BigInteger srcdpId = interfaceInfo.getDpId();
boolean isFlowsRemovedInSrcDpn = false;
for (DpnInterfaces dpnInterface : remoteFEs) {
Long elanTag = elanInfo.getElanTag();
BigInteger dstDpId = dpnInterface.getDpId();
if (executeDeleteMacFlows(elanInfo, interfaceInfo, macAddress, deleteSmac, elanInstanceName, srcdpId, elanTag, dstDpId, deleteFlowGroupTx)) {
isFlowsRemovedInSrcDpn = true;
}
executeEtreeDeleteMacFlows(elanInfo, interfaceInfo, macAddress, deleteSmac, elanInstanceName, srcdpId, elanTag, dstDpId, deleteFlowGroupTx);
}
if (!isFlowsRemovedInSrcDpn) {
deleteSmacAndDmacFlows(elanInfo, interfaceInfo, macAddress, deleteSmac, deleteFlowGroupTx);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces 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.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class VpnUtil method addRouterPortToElanDpn.
public static void addRouterPortToElanDpn(String elanInstanceName, String routerInterfacePortId, String vpnName, BigInteger dpnId, DataBroker dataBroker) {
InstanceIdentifier<DpnInterfaces> elanDpnInterfaceId = getElanDpnInterfaceOperationalDataPath(elanInstanceName, dpnId);
Optional<DpnInterfaces> dpnInElanInterfaces = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId);
List<String> elanInterfaceList;
DpnInterfaces dpnInterface;
if (!dpnInElanInterfaces.isPresent()) {
elanInterfaceList = new ArrayList<>();
} else {
dpnInterface = dpnInElanInterfaces.get();
elanInterfaceList = dpnInterface.getInterfaces();
}
if (!elanInterfaceList.contains(routerInterfacePortId)) {
elanInterfaceList.add(routerInterfacePortId);
dpnInterface = new DpnInterfacesBuilder().setDpId(dpnId).setInterfaces(elanInterfaceList).setKey(new DpnInterfacesKey(dpnId)).build();
VpnUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId, dpnInterface);
}
}
Aggregations