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());
}
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());
}
Aggregations