Search in sources :

Example 1 with GetTunnelInterfaceNameOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder 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 2 with GetTunnelInterfaceNameOutputBuilder

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

the class ItmManagerRpcService method getTunnelInterfaceName.

@Override
public Future<RpcResult<GetTunnelInterfaceNameOutput>> getTunnelInterfaceName(GetTunnelInterfaceNameInput input) {
    RpcResultBuilder<GetTunnelInterfaceNameOutput> resultBld = null;
    BigInteger sourceDpn = input.getSourceDpid();
    BigInteger destinationDpn = input.getDestinationDpid();
    Optional<InternalTunnel> optTunnel = Optional.absent();
    if (ItmUtils.isTunnelAggregationUsed(input.getTunnelType())) {
        optTunnel = ItmUtils.getInternalTunnelFromDS(sourceDpn, destinationDpn, TunnelTypeLogicalGroup.class, dataBroker);
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: getTunnelInterfaceName {}", optTunnel);
    }
    if (!optTunnel.isPresent()) {
        optTunnel = ItmUtils.getInternalTunnelFromDS(sourceDpn, destinationDpn, input.getTunnelType(), dataBroker);
    }
    if (optTunnel.isPresent()) {
        InternalTunnel tunnel = optTunnel.get();
        GetTunnelInterfaceNameOutputBuilder output = new GetTunnelInterfaceNameOutputBuilder();
        List<String> tunnelInterfaces = tunnel.getTunnelInterfaceNames();
        if (tunnelInterfaces != null && !tunnelInterfaces.isEmpty()) {
            output.setInterfaceName(tunnelInterfaces.get(0));
            resultBld = RpcResultBuilder.success();
            resultBld.withResult(output.build());
        } else {
            resultBld = RpcResultBuilder.failed();
        }
    } else {
        resultBld = RpcResultBuilder.failed();
    }
    return Futures.immediateFuture(resultBld.build());
}
Also used : GetTunnelInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder) TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) BigInteger(java.math.BigInteger) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel)

Aggregations

GetTunnelInterfaceNameOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput)2 GetTunnelInterfaceNameOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder)2 BigInteger (java.math.BigInteger)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