use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList in project netvirt by opendaylight.
the class ElanInterfaceManager method handleExternalTunnelStateEvent.
/**
* Handle external tunnel state event.
*
* @param externalTunnel
* the external tunnel
* @param intrf
* the interface
* @throws ElanException in case of issues creating the flow objects
*/
public void handleExternalTunnelStateEvent(ExternalTunnel externalTunnel, Interface intrf) throws ElanException {
if (!validateExternalTunnelStateEvent(externalTunnel, intrf)) {
return;
}
// dpId/externalNodeId will be available either in source or destination
// based on the tunnel end point
BigInteger dpId = null;
NodeId externalNodeId = null;
if (StringUtils.isNumeric(externalTunnel.getSourceDevice())) {
dpId = new BigInteger(externalTunnel.getSourceDevice());
externalNodeId = new NodeId(externalTunnel.getDestinationDevice());
} else if (StringUtils.isNumeric(externalTunnel.getDestinationDevice())) {
dpId = new BigInteger(externalTunnel.getDestinationDevice());
externalNodeId = new NodeId(externalTunnel.getSourceDevice());
}
if (dpId == null || externalNodeId == null) {
LOG.error("Dp ID / externalNodeId not found in external tunnel {}", externalTunnel);
return;
}
ElanDpnInterfaces dpnInterfaceLists = elanUtils.getElanDpnInterfacesList();
if (dpnInterfaceLists == null) {
return;
}
List<ElanDpnInterfacesList> elanDpnIf = dpnInterfaceLists.getElanDpnInterfacesList();
for (ElanDpnInterfacesList elanDpns : elanDpnIf) {
String elanName = elanDpns.getElanInstanceName();
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
DpnInterfaces dpnInterfaces = elanUtils.getElanInterfaceInfoByElanDpn(elanName, dpId);
if (elanInfo == null || dpnInterfaces == null || dpnInterfaces.getInterfaces() == null || dpnInterfaces.getInterfaces().isEmpty()) {
continue;
}
LOG.debug("Elan instance:{} is present in Dpn:{} ", elanName, dpId);
elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, dpId);
// install L2gwDevices local macs in dpn.
elanL2GatewayUtils.installL2gwDeviceMacsInDpn(dpId, externalNodeId, elanInfo, intrf.getName());
// Install dpn macs on external device
installDpnMacsInL2gwDevice(elanName, new HashSet<>(dpnInterfaces.getInterfaces()), dpId, externalNodeId);
}
LOG.info("Handled ExternalTunnelStateEvent for {}", externalTunnel);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList 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);
}
}
}
}
}
Aggregations