use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanInterfaceManager method deleteAllRemoteMacsInADpn.
private void deleteAllRemoteMacsInADpn(String elanName, BigInteger dpId, long elanTag) {
List<DpnInterfaces> dpnInterfaces = elanUtils.getInvolvedDpnsInElan(elanName);
for (DpnInterfaces dpnInterface : dpnInterfaces) {
BigInteger currentDpId = dpnInterface.getDpId();
if (!currentDpId.equals(dpId)) {
for (String elanInterface : dpnInterface.getInterfaces()) {
ElanInterfaceMac macs = elanUtils.getElanInterfaceMacByInterfaceName(elanInterface);
if (macs == null || macs.getMacEntry() == null) {
continue;
}
for (MacEntry mac : macs.getMacEntry()) {
removeTheMacFlowInTheDPN(dpId, elanTag, currentDpId, mac);
removeEtreeMacFlowInTheDPN(dpId, elanTag, currentDpId, mac);
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanInterfaceManager method installDMacAddressTables.
// Install DMAC entry on dst DPN
public List<ListenableFuture<Void>> installDMacAddressTables(ElanInstance elanInfo, InterfaceInfo interfaceInfo, BigInteger dstDpId) throws ElanException {
String interfaceName = interfaceInfo.getInterfaceName();
ElanInterfaceMac elanInterfaceMac = elanUtils.getElanInterfaceMacByInterfaceName(interfaceName);
if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) {
List<MacEntry> macEntries = elanInterfaceMac.getMacEntry();
WriteTransaction writeFlowTx = broker.newWriteOnlyTransaction();
for (MacEntry macEntry : macEntries) {
String macAddress = macEntry.getMacAddress().getValue();
LOG.info("Installing remote dmac for mac address {} and interface {}", macAddress, interfaceName);
synchronized (ElanUtils.getElanMacDPNKey(elanInfo.getElanTag(), macAddress, interfaceInfo.getDpId())) {
LOG.info("Acquired lock for mac : {}, proceeding with remote dmac install operation", macAddress);
elanUtils.setupDMacFlowOnRemoteDpn(elanInfo, interfaceInfo, dstDpId, macAddress, writeFlowTx);
}
}
return Collections.singletonList(ElanUtils.waitForTransactionToComplete(writeFlowTx));
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanInterfaceManager method programRemoteDmacFlow.
void programRemoteDmacFlow(ElanInstance elanInstance, InterfaceInfo interfaceInfo, WriteTransaction writeFlowGroupTx) throws ElanException {
ElanDpnInterfacesList elanDpnInterfacesList = elanUtils.getElanDpnInterfacesList(elanInstance.getElanInstanceName());
List<DpnInterfaces> dpnInterfaceLists = null;
if (elanDpnInterfacesList != null) {
dpnInterfaceLists = elanDpnInterfacesList.getDpnInterfaces();
}
if (dpnInterfaceLists == null) {
dpnInterfaceLists = new ArrayList<>();
}
for (DpnInterfaces dpnInterfaces : dpnInterfaceLists) {
BigInteger dstDpId = interfaceInfo.getDpId();
if (dpnInterfaces.getDpId().equals(dstDpId)) {
continue;
}
List<String> remoteElanInterfaces = dpnInterfaces.getInterfaces();
for (String remoteIf : remoteElanInterfaces) {
ElanInterfaceMac elanIfMac = elanUtils.getElanInterfaceMacByInterfaceName(remoteIf);
InterfaceInfo remoteInterface = interfaceManager.getInterfaceInfo(remoteIf);
if (elanIfMac == null) {
continue;
}
List<MacEntry> remoteMacEntries = elanIfMac.getMacEntry();
if (remoteMacEntries != null) {
for (MacEntry macEntry : remoteMacEntries) {
String macAddress = macEntry.getMacAddress().getValue();
LOG.info("Programming remote dmac {} on the newly added DPN {} for elan {}", macAddress, dstDpId, elanInstance.getElanInstanceName());
elanUtils.setupRemoteDmacFlow(dstDpId, remoteInterface.getDpId(), remoteInterface.getInterfaceTag(), elanInstance.getElanTag(), macAddress, elanInstance.getElanInstanceName(), writeFlowGroupTx, remoteIf, elanInstance);
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanPacketInHandler method tryAndRemoveInvalidMacEntry.
/*
* Though this method is a little costlier because it uses try-catch
* construct, it is used only in rare scenarios like MAC movement or invalid
* Static MAC having been added on a wrong ELAN.
*/
private void tryAndRemoveInvalidMacEntry(String elanName, MacEntry macEntry) {
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
if (elanInfo == null) {
LOG.warn("MAC {} is been added (either statically or dynamically) for an invalid Elan {}. " + "Manual cleanup may be necessary", macEntry.getMacAddress(), elanName);
return;
}
InterfaceInfo oldInterfaceLport = interfaceManager.getInterfaceInfo(macEntry.getInterface());
if (oldInterfaceLport == null) {
LOG.warn("MAC {} is been added (either statically or dynamically) on an invalid Logical Port {}. " + "Manual cleanup may be necessary", macEntry.getMacAddress(), macEntry.getInterface());
return;
}
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> elanUtils.deleteMacFlows(elanInfo, oldInterfaceLport, macEntry, tx)), LOG, "Error deleting invalid MAC entry");
elanL2GatewayUtils.removeMacsFromElanExternalDevices(elanInfo, Collections.singletonList(macEntry.getMacAddress()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ArpMonitoringHandler method add.
@Override
protected void add(InstanceIdentifier<LearntVpnVipToPort> identifier, LearntVpnVipToPort value) {
runOnlyInOwnerNode("ArpMonitoringHandler: add event", () -> {
try {
InetAddress srcInetAddr = InetAddress.getByName(value.getPortFixedip());
if (value.getMacAddress() == null) {
LOG.warn("The mac address received is null for VpnPortipToPort {}, ignoring the DTCN", value);
return;
}
MacAddress srcMacAddress = MacAddress.getDefaultInstance(value.getMacAddress());
String vpnName = value.getVpnName();
MacEntry macEntry = new MacEntry(vpnName, srcMacAddress, srcInetAddr, value.getPortName(), value.getCreationTime());
jobCoordinator.enqueueJob(buildJobKey(srcInetAddr.toString(), vpnName), new ArpMonitorStartTask(macEntry, arpMonitorProfileId, dataBroker, alivenessManager, neutronVpnService, interfaceManager));
} catch (UnknownHostException e) {
LOG.error("Error in deserializing packet {} with exception", value, e);
}
});
}
Aggregations