use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanGroupListener method getElanInstanceFromGroupId.
ElanInstance getElanInstanceFromGroupId(Group update) {
for (ElanInstance elanInstance : elanInstanceCache.getAllPresent()) {
if (elanInstance.getElanTag() != null) {
long elanTag = elanInstance.getElanTag();
long elanBCGroupId = ElanUtils.getElanRemoteBroadCastGroupID(elanTag);
if (elanBCGroupId == update.getGroupId().getValue()) {
return elanInstance;
}
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class HwvtepLocalUcastMacListener method added.
@Override
public void added(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs macAdded) {
String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
String macAddress = macAdded.getMacEntryKey().getValue().toLowerCase(Locale.getDefault());
LOG.trace("LocalUcastMacs {} added to {}", macAddress, hwvtepNodeId);
String elanName = getElanName(macAdded);
ElanInstance elan = elanInstanceCache.get(elanName).orNull();
if (elan == null) {
LOG.warn("Could not find ELAN for mac {} being added", macAddress);
return;
}
L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
if (elanL2GwDevice == null) {
LOG.warn("Could not find L2GatewayDevice for ELAN: {}, nodeID:{} from cache", elanName, hwvtepNodeId);
return;
}
// Cache MAC for furthur processing later
elanL2GwDevice.addUcastLocalMac(macAdded);
elanL2GatewayUtils.installL2GwUcastMacInElan(elan, elanL2GwDevice, macAddress.toLowerCase(Locale.getDefault()), macAdded, null);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class LocalUcastMacListener method removed.
public void removed(final InstanceIdentifier<LocalUcastMacs> identifier, final LocalUcastMacs macRemoved) {
String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
String macAddress = macRemoved.getMacEntryKey().getValue().toLowerCase(Locale.getDefault());
LOG.trace("LocalUcastMacs {} removed from {}", macAddress, hwvtepNodeId);
ResourceBatchingManager.getInstance().delete(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, identifier);
String elanName = getElanName(macRemoved);
jobCoordinator.enqueueJob(elanName + HwvtepHAUtil.L2GW_JOB_KEY, () -> {
L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
if (elanL2GwDevice == null) {
LOG.warn("Could not find L2GatewayDevice for ELAN: {}, nodeID:{} from cache", elanName, hwvtepNodeId);
return null;
}
elanL2GwDevice.removeUcastLocalMac(macRemoved);
ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
elanL2GatewayUtils.unInstallL2GwUcastMacFromL2gwDevices(elanName, elanL2GwDevice, Collections.singletonList(new MacAddress(macAddress.toLowerCase(Locale.getDefault()))));
elanL2GatewayUtils.unInstallL2GwUcastMacFromElanDpns(elanInstance, elanL2GwDevice, Collections.singletonList(new MacAddress(macAddress.toLowerCase(Locale.getDefault()))));
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceProvider method addArpResponderFlow.
@Override
public void addArpResponderFlow(ArpResponderInput arpResponderInput) {
String ingressInterfaceName = arpResponderInput.getInterfaceName();
String macAddress = arpResponderInput.getSha();
String ipAddress = arpResponderInput.getSpa();
int lportTag = arpResponderInput.getLportTag();
BigInteger dpnId = arpResponderInput.getDpId();
LOG.info("Installing the ARP responder flow on DPN {} for Interface {} with MAC {} & IP {}", dpnId, ingressInterfaceName, macAddress, ipAddress);
Optional<ElanInterface> elanIface = elanInterfaceCache.get(ingressInterfaceName);
ElanInstance elanInstance = elanIface.isPresent() ? elanInstanceCache.get(elanIface.get().getElanInstanceName()).orNull() : null;
if (elanInstance == null) {
LOG.debug("addArpResponderFlow: elanInstance is null, Failed to install arp responder flow for dpnId {}" + "for Interface {} with MAC {} & IP {}", dpnId, ingressInterfaceName, macAddress, ipAddress);
return;
}
String flowId = ArpResponderUtil.getFlowId(lportTag, ipAddress);
ArpResponderUtil.installFlow(mdsalManager, dpnId, flowId, flowId, NwConstants.DEFAULT_ARP_FLOW_PRIORITY, ArpResponderUtil.generateCookie(lportTag, ipAddress), ArpResponderUtil.getMatchCriteria(lportTag, elanInstance, ipAddress), arpResponderInput.getInstructions());
LOG.info("Installed the ARP Responder flow for Interface {}", ingressInterfaceName);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceProvider method updateExternalElanNetworks.
@Override
public void updateExternalElanNetworks(Node origNode, Node updatedNode) {
if (!bridgeMgr.isIntegrationBridge(updatedNode)) {
return;
}
List<ElanInstance> elanInstances = getElanInstances();
if (elanInstances == null || elanInstances.isEmpty()) {
LOG.trace("No ELAN instances found");
return;
}
LOG.debug("updateExternalElanNetworks, orig bridge {} . updated bridge {}", origNode, updatedNode);
Map<String, String> origProviderMappping = getMapFromOtherConfig(origNode, ElanBridgeManager.PROVIDER_MAPPINGS_KEY);
Map<String, String> updatedProviderMappping = getMapFromOtherConfig(updatedNode, ElanBridgeManager.PROVIDER_MAPPINGS_KEY);
boolean hasDatapathIdOnOrigNode = bridgeMgr.hasDatapathID(origNode);
boolean hasDatapathIdOnUpdatedNode = bridgeMgr.hasDatapathID(updatedNode);
BigInteger origDpnID = bridgeMgr.getDatapathId(origNode);
for (ElanInstance elanInstance : elanInstances) {
String physicalNetworkName = elanInstance.getPhysicalNetworkName();
boolean createExternalElanNw = true;
if (physicalNetworkName != null) {
String origPortName = origProviderMappping.get(physicalNetworkName);
String updatedPortName = updatedProviderMappping.get(physicalNetworkName);
/**
* for internal vlan network, vlan provider interface creation should be
* triggered only if there is existing vlan provider intf indicating presence
* of VM ports on the DPN
*/
if (hasDatapathIdOnOrigNode && !elanInstance.isExternal() && ElanUtils.isVlan(elanInstance)) {
String externalIntf = getExternalElanInterface(elanInstance.getElanInstanceName(), origDpnID);
if (externalIntf == null) {
createExternalElanNw = false;
}
}
if (hasPortNameRemoved(origPortName, updatedPortName)) {
deleteExternalElanNetwork(elanInstance, bridgeMgr.getProviderInterfaceName(origNode, physicalNetworkName));
}
if (createExternalElanNw && (hasPortNameUpdated(origPortName, updatedPortName) || hasDatapathIdAdded(hasDatapathIdOnOrigNode, hasDatapathIdOnUpdatedNode))) {
createExternalElanNetwork(elanInstance, bridgeMgr.getProviderInterfaceName(updatedNode, physicalNetworkName));
}
}
}
}
Aggregations