Search in sources :

Example 6 with GetExternalTunnelInterfaceNameOutput

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

the class ElanItmUtils method getExternalTunnelInterfaceName.

/**
 * Gets the external tunnel interface name.
 *
 * @param sourceNode
 *            the source node
 * @param dstNode
 *            the dst node
 * @return the external tunnel interface name
 */
public String getExternalTunnelInterfaceName(String sourceNode, String dstNode) {
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    String tunnelInterfaceName = null;
    try {
        Future<RpcResult<GetExternalTunnelInterfaceNameOutput>> output = itmRpcService.getExternalTunnelInterfaceName(new GetExternalTunnelInterfaceNameInputBuilder().setSourceNode(sourceNode).setDestinationNode(dstNode).setTunnelType(tunType).build());
        RpcResult<GetExternalTunnelInterfaceNameOutput> rpcResult = output.get();
        if (rpcResult.isSuccessful()) {
            tunnelInterfaceName = rpcResult.getResult().getInterfaceName();
            LOG.debug("Tunnel interface name: {} for sourceNode: {} and dstNode: {}", tunnelInterfaceName, sourceNode, dstNode);
        } else {
            LOG.warn("RPC call to ITM.GetExternalTunnelInterfaceName failed with error: {}", rpcResult.getErrors());
        }
    } catch (NullPointerException | InterruptedException | ExecutionException e) {
        LOG.error("Failed to get external tunnel interface name for sourceNode: {} and dstNode: {}", sourceNode, dstNode, e);
    }
    return tunnelInterfaceName;
}
Also used : GetExternalTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ExecutionException(java.util.concurrent.ExecutionException) GetExternalTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInputBuilder)

Aggregations

GetExternalTunnelInterfaceNameOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutput)6 ExecutionException (java.util.concurrent.ExecutionException)4 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)4 GetExternalTunnelInterfaceNameInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInputBuilder)4 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)4 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)2 GetExternalTunnelInterfaceNameInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInput)2 GetExternalTunnelInterfaceNameOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutputBuilder)2 BigInteger (java.math.BigInteger)1 ExternalTunnelList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList)1 ExternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)1 ExternalTunnelKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey)1