Search in sources :

Example 1 with GetInterfaceFromIfIndexOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder in project genius by opendaylight.

the class InterfaceManagerServiceImpl method getInterfaceFromIfIndex.

@Override
public ListenableFuture<GetInterfaceFromIfIndexOutput> getInterfaceFromIfIndex(GetInterfaceFromIfIndexInput input) {
    Integer ifIndex = input.getIfIndex();
    InstanceIdentifier<IfIndexInterface> id = InstanceIdentifier.builder(IfIndexesInterfaceMap.class).child(IfIndexInterface.class, new IfIndexInterfaceKey(ifIndex)).build();
    Optional<IfIndexInterface> ifIndexesInterface = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, id, dataBroker);
    if (!ifIndexesInterface.isPresent()) {
        throw new IllegalArgumentException("Could not find " + id.toString() + " in OperationalDS for idIndex=" + ifIndex);
    }
    String interfaceName = ifIndexesInterface.get().getInterfaceName();
    // TODO as above, simplify the success case later, as we have the failure case below
    return Futures.immediateFuture(new GetInterfaceFromIfIndexOutputBuilder().setInterfaceName(interfaceName).build());
}
Also used : BigInteger(java.math.BigInteger) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) GetInterfaceFromIfIndexOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder)

Example 2 with GetInterfaceFromIfIndexOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder in project genius by opendaylight.

the class TestOdlInterfaceRpcService method getInterfaceFromIfIndex.

@Override
public Future<RpcResult<GetInterfaceFromIfIndexOutput>> getInterfaceFromIfIndex(GetInterfaceFromIfIndexInput input) {
    RpcResultBuilder<GetInterfaceFromIfIndexOutput> rpcResultBuilder;
    GetInterfaceFromIfIndexOutputBuilder output = new GetInterfaceFromIfIndexOutputBuilder().setInterfaceName(ArpUtilTestUtil.INTERFACE_NAME);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : GetInterfaceFromIfIndexOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Aggregations

GetInterfaceFromIfIndexOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder)2 BigInteger (java.math.BigInteger)1 IfIndexInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface)1 IfIndexInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey)1 GetInterfaceFromIfIndexOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)1