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 VpnServiceElanDpnInterfacesListener method add.
@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, DpnInterfaces dpnInterfaces) {
BigInteger dpnId = dpnInterfaces.getDpId();
String elanInstanceName = identifier.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
ElanInstance elanInstance = VpnUtil.getElanInstanceByName(dataBroker, elanInstanceName);
if (!VpnUtil.isVlan(elanInstance)) {
return;
}
String vpnName = VpnUtil.getVpnNameFromElanIntanceName(dataBroker, elanInstanceName);
if (vpnName == null) {
return;
}
VpnUtil.addRouterPortToElanForVlanInDpn(vpnName, dpnId, dataBroker);
}
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 ElanDpnInterfacesListener method add.
@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
final String elanName = getElanName(identifier);
BigInteger addDpnId = dpnInterfaces.getDpId();
LOG.debug("ELAN interfaces {} added on DPN {} for Elan {}", dpnInterfaces.getInterfaces(), addDpnId, elanName);
Optional<ElanServiceChainState> elanServiceChainState = ElanServiceChainUtils.getElanServiceChainState(broker, elanName);
if (elanServiceChainState.isPresent()) {
List<ElanToPseudoPortData> elanToPseudoPortDataList = elanServiceChainState.get().getElanToPseudoPortData();
for (ElanToPseudoPortData elanToPseudoPortData : elanToPseudoPortDataList) {
Long scfTag = elanToPseudoPortData.getScfTag();
Long elanLportTag = elanToPseudoPortData.getElanLportTag();
if (elanLportTag != null && scfTag != null) {
short tableId = NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
handleUpdate(addDpnId, elanName, tableId, elanLportTag.intValue(), /*21 bit*/
scfTag, NwConstants.ADD_FLOW);
} else {
LOG.debug("Could not find lportTag for ELAN={}", elanName);
}
}
}
}
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 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.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanL2GatewayUtils method unInstallL2GwUcastMacFromElanDpns.
/**
* Uninstall l2gw macs from other DPNs in the elan instance provided.
* @param elan - Elan Instance for which other DPNs will be scanned.
* @param l2GwDevice - l2gwDevice whose macs are required to be cleared from other devices.
* @param macAddresses - Mac address to be cleared.
*/
public void unInstallL2GwUcastMacFromElanDpns(final ElanInstance elan, final L2GatewayDevice l2GwDevice, final Collection<MacAddress> macAddresses) {
if (macAddresses == null || macAddresses.isEmpty()) {
return;
}
if (elan == null || elan.getElanInstanceName() == null) {
LOG.error("Could not delete l2gw ucast macs, Failed to find the elan for device {}", l2GwDevice.getHwvtepNodeId());
return;
}
final Collection<DpnInterfaces> elanDpns = getElanDpns(elan.getElanInstanceName());
// Retrieve all participating DPNs in this Elan. Populate this MAC in
// DMAC table. Looping through all DPNs in order to add/remove mac flows
// in their DMAC table
List<ListenableFuture<Void>> result = new ArrayList<>();
for (final MacAddress mac : macAddresses) {
elanClusterUtils.runOnlyInOwnerNode(elan.getElanInstanceName() + ":" + mac.getValue(), "delete remote ucast macs in elan DPNs", () -> {
for (DpnInterfaces elanDpn : elanDpns) {
BigInteger dpnId = elanDpn.getDpId();
result.addAll(elanDmacUtils.deleteDmacFlowsToExternalMac(elan.getElanTag(), dpnId, l2GwDevice.getHwvtepNodeId(), mac.getValue().toLowerCase(Locale.getDefault())));
}
return result;
});
}
}
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 setupOrigDmacFlows.
private void setupOrigDmacFlows(ElanInstance elanInfo, InterfaceInfo interfaceInfo, String macAddress, boolean configureRemoteFlows, IMdsalApiManager mdsalApiManager, WriteTransaction writeFlowGroupTx) throws ElanException {
BigInteger dpId = interfaceInfo.getDpId();
String ifName = interfaceInfo.getInterfaceName();
long ifTag = interfaceInfo.getInterfaceTag();
String elanInstanceName = elanInfo.getElanInstanceName();
Long elanTag = elanInfo.getElanTag();
setupLocalDmacFlow(elanTag, dpId, ifName, macAddress, elanInfo, mdsalApiManager, ifTag, writeFlowGroupTx);
LOG.debug("Dmac flow entry created for elan Name:{}, logical port Name:{} mand mac address:{} " + "on dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, dpId);
if (!configureRemoteFlows) {
return;
}
List<DpnInterfaces> elanDpns = getInvolvedDpnsInElan(elanInstanceName);
for (DpnInterfaces elanDpn : elanDpns) {
if (elanDpn.getDpId().equals(dpId)) {
continue;
}
// Check for the Remote DPN present in Inventory Manager
if (!isDpnPresent(elanDpn.getDpId())) {
continue;
}
// For remote DPNs a flow is needed to indicate that packets of this ELAN going to this MAC need to be
// forwarded through the appropriate ITM tunnel
setupRemoteDmacFlow(// srcDpn (the remote DPN in this case)
elanDpn.getDpId(), // dstDpn (the local DPN)
dpId, // lportTag of the local interface
interfaceInfo.getInterfaceTag(), // identifier of the Elan
elanTag, // MAC to be programmed in remote DPN
macAddress, elanInstanceName, writeFlowGroupTx, ifName, elanInfo);
LOG.debug("Remote Dmac flow entry created for elan Name:{}, logical port Name:{} and mac address:{} on" + " dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, elanDpn.getDpId());
}
// TODO: Make sure that the same is performed against the ElanDevices.
}
Aggregations