Search in sources :

Example 1 with GetNodeconnectorIdFromInterfaceOutputBuilder

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());
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) GetNodeconnectorIdFromInterfaceOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutputBuilder) GetNodeconnectorIdFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutput)

Example 2 with GetNodeconnectorIdFromInterfaceOutputBuilder

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());
}
Also used : Collections(java.util.Collections) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) GetNodeconnectorIdFromInterfaceOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutputBuilder)

Aggregations

GetNodeconnectorIdFromInterfaceOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutputBuilder)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 Collections (java.util.Collections)1 GetNodeconnectorIdFromInterfaceOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutput)1