use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class LocalUcastMacListener method added.
public void added(final InstanceIdentifier<LocalUcastMacs> identifier, final LocalUcastMacs macAdded) {
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, identifier, macAdded);
String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
String macAddress = macAdded.getMacEntryKey().getValue().toLowerCase(Locale.getDefault());
String elanName = getElanName(macAdded);
LOG.trace("LocalUcastMacs {} added to {}", macAddress, hwvtepNodeId);
ElanInstance elan = elanInstanceCache.get(elanName).orNull();
if (elan == null) {
LOG.warn("Could not find ELAN for mac {} being added", macAddress);
return;
}
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.addUcastLocalMac(macAdded);
elanL2GatewayUtils.installL2GwUcastMacInElan(elan, elanL2GwDevice, macAddress.toLowerCase(), macAdded, null);
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class ElanServiceProvider method removeKnownL3DmacAddress.
@Override
public void removeKnownL3DmacAddress(String macAddress, String elanInstanceName) {
if (!isL2BeforeL3) {
LOG.trace("ELAN service is after L3VPN in the Netvirt pipeline skip known L3DMAC flows installation");
return;
}
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance == null) {
LOG.warn("Null elan instance {}", elanInstanceName);
return;
}
List<BigInteger> dpnsIdsForElanInstance = elanUtils.getParticipatingDpnsInElanInstance(elanInstanceName);
if (dpnsIdsForElanInstance.isEmpty()) {
LOG.warn("No DPNs for elan instance {}", elanInstance);
return;
}
elanUtils.removeDmacRedirectToDispatcherFlows(elanInstance.getElanTag(), macAddress, dpnsIdsForElanInstance);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class ElanServiceProvider method addExternalTunnelArpResponderFlow.
@Override
public void addExternalTunnelArpResponderFlow(ArpResponderInput arpResponderInput, String elanInstanceName) {
BigInteger dpnId = arpResponderInput.getDpId();
String ipAddress = arpResponderInput.getSpa();
String macAddress = arpResponderInput.getSha();
LOG.trace("Installing the ExternalTunnel ARP responder flow on DPN {} for ElanInstance {} with MAC {} & IP {}", dpnId, elanInstanceName, macAddress, ipAddress);
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance == null) {
LOG.warn("Null elan instance {}", elanInstanceName);
return;
}
int lportTag = arpResponderInput.getLportTag();
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.trace("Installed the ExternalTunnel ARP Responder flow for ElanInstance {}", elanInstanceName);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class ElanServiceProvider method addKnownL3DmacAddress.
@Override
public void addKnownL3DmacAddress(String macAddress, String elanInstanceName) {
if (!isL2BeforeL3) {
LOG.trace("ELAN service is after L3VPN in the Netvirt pipeline skip known L3DMAC flows installation");
return;
}
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance == null) {
LOG.warn("Null elan instance {}", elanInstanceName);
return;
}
List<BigInteger> dpnsIdsForElanInstance = elanUtils.getParticipatingDpnsInElanInstance(elanInstanceName);
if (dpnsIdsForElanInstance.isEmpty()) {
LOG.warn("No DPNs for elan instance {}", elanInstance);
return;
}
elanUtils.addDmacRedirectToDispatcherFlows(elanInstance.getElanTag(), elanInstanceName, macAddress, dpnsIdsForElanInstance);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class VpnInterfaceManager method handleVpnsExportingRoutes.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
void handleVpnsExportingRoutes(String vpnName, String vpnRd) {
List<VpnInstanceOpDataEntry> vpnsToExportRoute = getVpnsExportingMyRoute(vpnName);
for (VpnInstanceOpDataEntry vpn : vpnsToExportRoute) {
List<VrfEntry> vrfEntries = VpnUtil.getAllVrfEntries(dataBroker, vpn.getVrfId());
WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
if (vrfEntries != null) {
for (VrfEntry vrfEntry : vrfEntries) {
try {
if (!FibHelper.isControllerManagedNonInterVpnLinkRoute(RouteOrigin.value(vrfEntry.getOrigin()))) {
LOG.info("handleVpnsExportingRoutes: vrfEntry with rd {} prefix {}" + " is not a controller managed non intervpn link route. Ignoring.", vpn.getVrfId(), vrfEntry.getDestPrefix());
continue;
}
String prefix = vrfEntry.getDestPrefix();
String gwMac = vrfEntry.getGatewayMacAddress();
vrfEntry.getRoutePaths().forEach(routePath -> {
String nh = routePath.getNexthopAddress();
int label = routePath.getLabel().intValue();
if (FibHelper.isControllerManagedVpnInterfaceRoute(RouteOrigin.value(vrfEntry.getOrigin()))) {
LOG.info("handleVpnsExportingRoutesImporting: Importing fib entry rd {} prefix {}" + " nexthop {} label {} to vpn {} vpnRd {}", vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
fibManager.addOrUpdateFibEntry(vpnRd, null, /*macAddress*/
prefix, Collections.singletonList(nh), VrfEntry.EncapType.Mplsgre, label, 0, /*l3vni*/
gwMac, null, /*parentVpnRd*/
RouteOrigin.SELF_IMPORTED, writeConfigTxn);
} else {
LOG.info("handleVpnsExportingRoutes: Importing subnet route fib entry rd {} prefix {}" + " nexthop {} label {} to vpn {} vpnRd {}", vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
SubnetRoute route = vrfEntry.getAugmentation(SubnetRoute.class);
importSubnetRouteForNewVpn(vpnRd, prefix, nh, label, route, writeConfigTxn);
}
});
} catch (RuntimeException e) {
LOG.error("getNextHopAddressList: Exception occurred while importing route with rd {}" + " prefix {} routePaths {} to vpn {} vpnRd {}", vpn.getVrfId(), vrfEntry.getDestPrefix(), vrfEntry.getRoutePaths(), vpnName, vpnRd);
}
}
writeConfigTxn.submit();
} else {
LOG.info("getNextHopAddressList: No vrf entries to import from vpn {} with rd {} to vpn {} with rd {}", vpn.getVpnInstanceName(), vpn.getVrfId(), vpnName, vpnRd);
}
}
}
Aggregations