Search in sources :

Example 71 with Elan

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);
        }
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)

Example 72 with Elan

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());
}
Also used : GetElanInterfaceStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.statistics.rev150824.GetElanInterfaceStatisticsOutput) GetElanInterfaceStatisticsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.statistics.rev150824.GetElanInterfaceStatisticsOutputBuilder) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) StatResultBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.statistics.rev150824.get.elan._interface.statistics.output.StatResultBuilder) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Example 73 with Elan

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();
}
Also used : Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 74 with Elan

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.
}
Also used : DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) BigInteger(java.math.BigInteger)

Example 75 with Elan

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);
    }
}
Also used : RemoveTerminatingServiceActionsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveTerminatingServiceActionsInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RemoveTerminatingServiceActionsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveTerminatingServiceActionsInput) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)52 BigInteger (java.math.BigInteger)36 ArrayList (java.util.ArrayList)31 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)18 DpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces)18 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)14 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)14 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)14 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)13 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)13 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)13 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)12 ElanDpnInterfacesList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)10 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)9 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)9 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)9 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)9 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)8