Search in sources :

Example 1 with GetTunnelInterfaceNameOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput in project netvirt by opendaylight.

the class ExternalRoutersListener method getTunnelInterfaceName.

protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
    try {
        Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
        rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            tunType = TunnelTypeGre.class;
            result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
            rpcResult = result.get();
            if (!rpcResult.isSuccessful()) {
                LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
            } else {
                return rpcResult.getResult().getInterfaceName();
            }
            LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
        } else {
            return rpcResult.getResult().getInterfaceName();
        }
    } catch (InterruptedException | ExecutionException | NullPointerException e) {
        LOG.error("getTunnelInterfaceName : Exception when getting tunnel interface Id for tunnel " + "between {} and {}", srcDpId, dstDpId, e);
    }
    return null;
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ExecutionException(java.util.concurrent.ExecutionException) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder)

Example 2 with GetTunnelInterfaceNameOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput in project netvirt by opendaylight.

the class ElanItmUtils method getInternalTunnelItmEgressAction.

/**
 * Builds the list of actions to be taken when sending the packet over an internal VxLAN tunnel interface, such
 * as setting the serviceTag/segmentationID on the VNI field of the VxLAN header, setting the vlanId if it proceeds
 * and output the packet over the right port.
 *
 * @param sourceDpnId
 *            Dpn where the tunnelInterface is located
 * @param destinationDpnId
 *            Dpn where the packet must be sent to. It is used here in order
 *            to select the right tunnel interface.
 * @param tunnelKey
 *            Tunnel key to be sent on the VxLAN header.
 * @return the internal itm egress action
 */
public List<Action> getInternalTunnelItmEgressAction(BigInteger sourceDpnId, BigInteger destinationDpnId, long tunnelKey) {
    List<Action> result = Collections.emptyList();
    LOG.trace("In getInternalItmEgressAction Action source {}, destination {}, serviceTag/Vni {}", sourceDpnId, destinationDpnId, tunnelKey);
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    GetTunnelInterfaceNameInput input = new GetTunnelInterfaceNameInputBuilder().setDestinationDpid(destinationDpnId).setSourceDpid(sourceDpnId).setTunnelType(tunType).build();
    Future<RpcResult<GetTunnelInterfaceNameOutput>> output = itmRpcService.getTunnelInterfaceName(input);
    try {
        if (output.get().isSuccessful()) {
            GetTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
            String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
            LOG.info("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
            result = buildTunnelItmEgressActions(tunnelIfaceName, tunnelKey);
        } else {
            LOG.trace("Tunnel interface doesn't exist between srcDpId {} dstDpId {}", sourceDpnId, destinationDpnId);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
    }
    return result;
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) GetTunnelInterfaceNameInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with GetTunnelInterfaceNameOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput in project genius by opendaylight.

the class ItmRpcTestImpl method getTunnelInterfaceName.

@Override
public synchronized Future<RpcResult<GetTunnelInterfaceNameOutput>> getTunnelInterfaceName(GetTunnelInterfaceNameInput input) {
    String interfaceName = interfaceNames.get(input.getSourceDpid()).get(new String(tepIps.get(input.getDestinationDpid()).getValue()));
    GetTunnelInterfaceNameOutput output = new GetTunnelInterfaceNameOutputBuilder().setInterfaceName(interfaceName).build();
    return RpcResultBuilder.success(output).buildFuture();
}
Also used : GetTunnelInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput)

Example 4 with GetTunnelInterfaceNameOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput in project netvirt by opendaylight.

the class AbstractSnatService method getTunnelInterfaceName.

protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
    try {
        Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
        rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            tunType = TunnelTypeGre.class;
            result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
            rpcResult = result.get();
            if (!rpcResult.isSuccessful()) {
                LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
            } else {
                return rpcResult.getResult().getInterfaceName();
            }
            LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
        } else {
            return rpcResult.getResult().getInterfaceName();
        }
    } catch (InterruptedException | ExecutionException | NullPointerException e) {
        LOG.error("getTunnelInterfaceName : Exception when getting tunnel interface Id for tunnel " + "between {} and {}", srcDpId, dstDpId);
    }
    return null;
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ExecutionException(java.util.concurrent.ExecutionException) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder)

Example 5 with GetTunnelInterfaceNameOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput in project netvirt by opendaylight.

the class NaptSwitchHA method getTunnelInterfaceName.

protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
    try {
        Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
        rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            tunType = TunnelTypeGre.class;
            result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
            rpcResult = result.get();
            if (!rpcResult.isSuccessful()) {
                LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
            } else {
                return rpcResult.getResult().getInterfaceName();
            }
            LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
        } else {
            return rpcResult.getResult().getInterfaceName();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("getTunnelInterfaceName :Exception when getting tunnel interface Id for tunnel between {} and {}", srcDpId, dstDpId, e);
    }
    LOG.error("getTunnelInterfaceName : Tunnel missing between dpn {}:{}", srcDpId, dstDpId);
    return null;
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ExecutionException(java.util.concurrent.ExecutionException) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder)

Aggregations

GetTunnelInterfaceNameOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput)6 ExecutionException (java.util.concurrent.ExecutionException)4 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)4 GetTunnelInterfaceNameInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder)4 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)4 GetTunnelInterfaceNameOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder)2 BigInteger (java.math.BigInteger)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 TunnelTypeLogicalGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup)1 InternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel)1 GetTunnelInterfaceNameInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInput)1