use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutputBuilder in project netvirt by opendaylight.
the class TestOdlInterfaceRpcService method getNodeconnectorIdFromInterface.
@Override
public Future<RpcResult<GetNodeconnectorIdFromInterfaceOutput>> getNodeconnectorIdFromInterface(GetNodeconnectorIdFromInterfaceInput input) {
String ifName = input.getIntfName();
// if the ifName is INTERFACE_NAME_NO_EXIST, then an empty response will be returned
GetNodeconnectorIdFromInterfaceOutputBuilder builder = new GetNodeconnectorIdFromInterfaceOutputBuilder();
if (ifName == GeniusProviderTestParams.INTERFACE_NAME) {
builder.setNodeconnectorId(new NodeConnectorId(GeniusProviderTestParams.NODE_CONNECTOR_ID_PREFIX + GeniusProviderTestParams.INTERFACE_NAME));
} else if (ifName == GeniusProviderTestParams.INTERFACE_NAME_INVALID) {
return Futures.immediateFuture(RpcResultBuilder.<GetNodeconnectorIdFromInterfaceOutput>failed().withError(ErrorType.APPLICATION, "Invalid data.").build());
}
return Futures.immediateFuture(RpcResultBuilder.<GetNodeconnectorIdFromInterfaceOutput>success(builder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutputBuilder in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getNodeconnectorIdFromInterface.
@Override
public ListenableFuture<GetNodeconnectorIdFromInterfaceOutput> getNodeconnectorIdFromInterface(GetNodeconnectorIdFromInterfaceInput input) {
String interfaceName = input.getIntfName();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
// TODO as above, simplify the success case later, as we have the failure case below
return Futures.immediateFuture(new GetNodeconnectorIdFromInterfaceOutputBuilder().setNodeconnectorId(nodeConnectorId).build());
}
Aggregations