use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.
the class L2GatewayConnectionUtils method addL2GatewayConnection.
public void addL2GatewayConnection(final L2gatewayConnection input, final String l2GwDeviceName, L2gateway l2Gateway) {
LOG.info("Adding L2gateway Connection with ID: {}", input.getKey().getUuid());
Uuid networkUuid = input.getNetworkId();
// Taking cluster reboot scenario , if Elan instance is not available when l2GatewayConnection add events
// comes we need to wait for elaninstance to resolve. Hence updating the map with the runnable .
// When elanInstance add comes , it look in to the map and run the associated runnable associated with it.
ElanInstance elanInstance = elanInstanceCache.get(networkUuid.getValue(), () -> addL2GatewayConnection(input, l2GwDeviceName)).orNull();
if (elanInstance == null) {
return;
}
if (!isVxlanNetworkOrVxlanSegment(elanInstance)) {
LOG.error("Neutron network with id {} is not VxlanNetwork", networkUuid.getValue());
} else {
Uuid l2GatewayId = input.getL2gatewayId();
if (l2Gateway == null) {
l2Gateway = getNeutronL2gateway(broker, l2GatewayId);
}
if (l2Gateway == null) {
LOG.error("L2Gateway with id {} is not present", l2GatewayId.getValue());
} else {
associateHwvtepsToElan(elanInstance, l2Gateway, input, l2GwDeviceName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.
the class ElanStatisticsImpl method getElanInterfaceStatistics.
@Override
public Future<RpcResult<GetElanInterfaceStatisticsOutput>> getElanInterfaceStatistics(GetElanInterfaceStatisticsInput input) {
String interfaceName = input.getInterfaceName();
LOG.debug("getElanInterfaceStatistics is called for elan interface {}", interfaceName);
RpcResultBuilder<GetElanInterfaceStatisticsOutput> rpcResultBuilder = null;
if (interfaceName == null) {
rpcResultBuilder = RpcResultBuilder.failed();
return getFutureWithAppErrorMessage(rpcResultBuilder, "Interface name is not provided");
}
Optional<ElanInterface> elanInterface = elanInterfaceCache.get(interfaceName);
if (!elanInterface.isPresent()) {
rpcResultBuilder = RpcResultBuilder.failed();
return getFutureWithAppErrorMessage(rpcResultBuilder, String.format("Interface %s is not a ELAN interface", interfaceName));
}
String elanInstanceName = elanInterface.get().getElanInstanceName();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
// FIXME [ELANBE] Get this API Later
short tableId = 0;
// }
if (!interfaceInfo.isOperational()) {
LOG.debug("interface {} is down and returning with no statistics", interfaceName);
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.withResult(new GetElanInterfaceStatisticsOutputBuilder().setStatResult(new StatResultBuilder().setStatResultCode(ResultCode.NotFound).setByteRxCount(0L).setByteTxCount(0L).setPacketRxCount(0L).setPacketTxCount(0L).build()).build()).build());
}
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.withResult(queryforElanInterfaceStatistics(tableId, elanInstanceName, interfaceInfo)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.
the class ElanDmacUtils method installDmacFlowsToExternalRemoteMac.
/**
* Installs a Flow in the specified DPN's DMAC table. The flow is for a MAC
* that is connected remotely in an External Device (TOR) and that is
* accessible through an external tunnel. It also installs the flow for
* dropping the packet if it came over an ITM tunnel (that is, if the
* Split-Horizon flag is set)
*
* @param dpnId
* Id of the DPN where the flow must be installed
* @param extDeviceNodeId
* the ext device node id
* @param elanTag
* the elan tag
* @param vni
* the vni
* @param macAddress
* the mac address
* @param displayName
* the display name
* @param interfaceName
* the interface name
*
* @return the dmac flows
* @throws ElanException in case of issues creating the flow objects
*/
public List<ListenableFuture<Void>> installDmacFlowsToExternalRemoteMac(BigInteger dpnId, String extDeviceNodeId, Long elanTag, Long vni, String macAddress, String displayName, String interfaceName) throws ElanException {
synchronized (ElanUtils.getElanMacDPNKey(elanTag, macAddress, dpnId)) {
Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName);
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
Flow dropFlow = buildDmacFlowDropIfPacketComingFromTunnel(dpnId, extDeviceNodeId, elanTag, macAddress);
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(dropFlow, dpnId), dropFlow);
installEtreeDmacFlowsToExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName, interfaceName);
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan 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.
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.
the class ElanUtils method removeTerminatingServiceAction.
public void removeTerminatingServiceAction(BigInteger destDpId, int serviceId) {
RemoveTerminatingServiceActionsInput input = new RemoveTerminatingServiceActionsInputBuilder().setDpnId(destDpId).setServiceId(serviceId).build();
Future<RpcResult<Void>> futureObject = itmRpcService.removeTerminatingServiceActions(input);
try {
RpcResult<Void> result = futureObject.get();
if (result.isSuccessful()) {
LOG.debug("Successfully completed removeTerminatingServiceActions for ELAN with serviceId {} on " + "dpn {}", serviceId, destDpId);
} else {
LOG.debug("Failure in removeTerminatingServiceAction RPC call for ELAN with serviceId {} on " + "dpn {}", serviceId, destDpId);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error in RPC call removeTerminatingServiceActions for ELAN with serviceId {} on " + "dpn {}", serviceId, destDpId, e);
}
}
Aggregations