当前位置: 首页>>代码示例>>Java>>正文


Java RpcResultBuilder.success方法代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.common.RpcResultBuilder.success方法的典型用法代码示例。如果您正苦于以下问题:Java RpcResultBuilder.success方法的具体用法?Java RpcResultBuilder.success怎么用?Java RpcResultBuilder.success使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yangtools.yang.common.RpcResultBuilder的用法示例。


在下文中一共展示了RpcResultBuilder.success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNatTranslationsOnRouter

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<GetNatTranslationsOnRouterOutput>> getNatTranslationsOnRouter(
        GetNatTranslationsOnRouterInput input) {
    RpcResultBuilder<GetNatTranslationsOnRouterOutput> rpcResultBuilder = null;
    long routerId = NatUtil.getVpnId(dataBroker, input.getRouterUuid().getValue());
    if (routerId == NatConstants.INVALID_ID) {
        String errMsg = String.format("404 Not Found - No Router found with UUID {%s}",
                input.getRouterUuid().getValue());
        rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnRouterOutput>failed()
                .withError(RpcError.ErrorType.APPLICATION, errMsg);
        return Futures.immediateFuture(rpcResultBuilder.build());
    }

    List<RouterNat> routerNatList = constructNatInformation(input.getRouterUuid(), routerId);

    GetNatTranslationsOnRouterOutputBuilder output = new GetNatTranslationsOnRouterOutputBuilder()
            .setRouterNat(routerNatList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:NatRpcServiceImpl.java

示例2: getAclPortStatistics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<GetAclPortStatisticsOutput>> getAclPortStatistics(GetAclPortStatisticsInput input) {
    LOG.trace("Get ACL port statistics for input: {}", input);
    RpcResultBuilder<GetAclPortStatisticsOutput> rpcResultBuilder;

    if (this.securityGroupMode != SecurityGroupMode.Stateful) {
        rpcResultBuilder = RpcResultBuilder.failed();
        rpcResultBuilder.withError(ErrorType.APPLICATION, "operation-not-supported",
                "Operation not supported for ACL " + this.securityGroupMode + " mode");
        return Futures.immediateFuture(rpcResultBuilder.build());
    }
    // Default direction is Both
    Direction direction = input.getDirection() == null ? Direction.Both : input.getDirection();

    List<AclPortStats> lstAclInterfaceStats = AclLiveStatisticsHelper.getAclPortStats(direction,
            input.getInterfaceNames(), this.odlDirectStatsService, this.dataBroker);

    GetAclPortStatisticsOutputBuilder output =
            new GetAclPortStatisticsOutputBuilder().setAclPortStats(lstAclInterfaceStats);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:AclLiveStatisticsRpcServiceImpl.java

示例3: getAllFabrics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public List<FabricId> getAllFabrics()
{
    Future<RpcResult<GetAllFabricsOutput>> result = this.fabService.getAllFabrics();
    try {
        RpcResult<GetAllFabricsOutput> output = result.get();
        RpcResultBuilder.<GetAllFabricsOutput>success();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: rmLneLayer3: fabService.getAllFabrics rpc success");
            return output.getResult().getFabricId();
        } else {
            LOG.error("fabService.getAllFabrics RPC failed");
            return Collections.EMPTY_LIST;
        }
    } catch (Exception e) {
        LOG.error("ERROR: fabService.getAllFabrics RPC failed.", e);
    }

    return Collections.EMPTY_LIST;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:20,代码来源:VContainerNetNodeServiceProvider.java

示例4: getFlowStatistics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
    LOG.info("getFlowStatistics rpc input = {}", input);

    List<FlowAndStatisticsMapList> flowStatsList = new ArrayList<>();
    FlowAndStatisticsMapList portIngressFlowStats1 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_TABLE,
            AclConstants.CT_STATE_TRACKED_NEW_DROP_PRIORITY, 1, 5, 5);
    FlowAndStatisticsMapList portIngressFlowStats2 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_TABLE,
            AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 10, 10);

    FlowAndStatisticsMapList portEgressFlowStats1 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_TABLE,
            AclConstants.CT_STATE_TRACKED_NEW_DROP_PRIORITY, 1, 15, 15);
    FlowAndStatisticsMapList portEgressFlowStats2 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_TABLE,
            AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 20, 20);

    if (input.getTableId() == null || input.getTableId() == NwConstants.EGRESS_ACL_FILTER_TABLE) {
        flowStatsList.add(portIngressFlowStats1);
        flowStatsList.add(portIngressFlowStats2);
    }
    if (input.getTableId() == null || input.getTableId() == NwConstants.INGRESS_ACL_FILTER_TABLE) {
        flowStatsList.add(portEgressFlowStats1);
        flowStatsList.add(portEgressFlowStats2);
    }

    GetFlowStatisticsOutput output =
            new GetFlowStatisticsOutputBuilder().setFlowAndStatisticsMapList(flowStatsList).build();

    RpcResultBuilder<GetFlowStatisticsOutput> rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output);
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:32,代码来源:TestOdlDirectStatisticsService.java

示例5: allocateId

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<AllocateIdOutput>> allocateId(AllocateIdInput input) {
    String key = input.getIdKey();
    long id = IdHelper.getId(key) == null ? AclConstants.PROTO_MATCH_PRIORITY
            : IdHelper.getId(key);
    AllocateIdOutputBuilder output = new AllocateIdOutputBuilder();
    output.setIdValue(id);

    LOG.info("ID allocated for key {}: {}", key, id);

    RpcResultBuilder<AllocateIdOutput> allocateIdRpcBuilder = RpcResultBuilder.success();
    allocateIdRpcBuilder.withResult(output.build());
    return Futures.immediateFuture(allocateIdRpcBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:15,代码来源:AclServiceTestModule.java

示例6: getNatTranslationsOnVpn

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<GetNatTranslationsOnVpnOutput>> getNatTranslationsOnVpn(
        GetNatTranslationsOnVpnInput input) {
    RpcResultBuilder<GetNatTranslationsOnVpnOutput> rpcResultBuilder = null;

    List<Uuid> routerUuidList = NatUtil.getRouterUuIdsForVpn(dataBroker, input.getVpnUuid());
    if (routerUuidList.isEmpty()) {
        String errMsg = String.format("404 Not Found - Invalid external vpn {%s} provided",
                input.getVpnUuid().getValue());
        rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnVpnOutput>failed()
                .withError(RpcError.ErrorType.APPLICATION, errMsg);
        return Futures.immediateFuture(rpcResultBuilder.build());
    }
    List<RouterNat> natRouterList = new ArrayList<RouterNat>();
    for (Uuid routerUuid : routerUuidList) {
        long routerId = NatUtil.getVpnId(dataBroker, routerUuid.getValue());
        if (routerId == NatConstants.INVALID_ID) {
            LOG.warn("getNatTranslationsOnVpn : Invalid RouterID found {}", routerId);
            continue;
        }
        natRouterList.addAll(constructNatInformation(routerUuid, routerId));
    }
    GetNatTranslationsOnVpnOutputBuilder output = new GetNatTranslationsOnVpnOutputBuilder()
            .setRouterNat(natRouterList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:29,代码来源:NatRpcServiceImpl.java

示例7: getAllFabrics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<GetAllFabricsOutput>> getAllFabrics() {

    final SettableFuture<RpcResult<GetAllFabricsOutput>> futureResult = SettableFuture.create();
    final RpcResultBuilder<GetAllFabricsOutput> resultBuilder = RpcResultBuilder.<GetAllFabricsOutput>success();
    final GetAllFabricsOutputBuilder outputBuilder = new GetAllFabricsOutputBuilder();

    ReadOnlyTransaction trans = dataBroker.newReadOnlyTransaction();
    ListenableFuture<Optional<Topology>> readFuture =
            trans.read(LogicalDatastoreType.OPERATIONAL, Constants.DOM_FABRICS_PATH);
    Futures.addCallback(readFuture, new FutureCallback<Optional<Topology>>() {

        @Override
        public void onSuccess(Optional<Topology> result) {
            if (result.isPresent()) {
                List<Node> nodes = result.get().getNode();
                List<FabricId> fabricIds = new ArrayList<>();
                if (nodes != null) {
                    for (Node node : nodes) {
                        FabricNode fnode = node.getAugmentation(FabricNode.class);
                        if (fnode != null) {
                            fabricIds.add(new FabricId(node.getNodeId()));
                        }
                    }
                    outputBuilder.setFabricId(fabricIds);
                }
            }
            futureResult.set(resultBuilder.withResult(outputBuilder.build()).build());

        }

        @Override
        public void onFailure(Throwable th) {
            LOG.debug( "Failed to read network-topology dom", th);
            futureResult.setException(th);
        }
    }, executor);

    return futureResult;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:41,代码来源:FabricManagementAPIProvider.java

示例8: createGateway

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<CreateGatewayOutput>> createGateway(CreateGatewayInput input) {
    final RpcResultBuilder<CreateGatewayOutput> resultBuilder = RpcResultBuilder
            .<CreateGatewayOutput>success();
    CreateGatewayOutputBuilder outputBuilder = new CreateGatewayOutputBuilder();

    final FabricId fabricId = input.getFabricId();
    final NodeId routerId = input.getLogicalRouter();
    final NodeId swId = input.getLogicalSwitch();

    final FabricInstance fabricObj = FabricInstanceCache.INSTANCE.retrieveFabric(fabricId);
    if (fabricObj == null) {
        return Futures.immediateFailedFuture(
                new IllegalArgumentException(String.format("fabric %s does not exist", fabricId)));
    }

    WriteTransaction trans = dataBroker.newWriteOnlyTransaction();

    // add logic port to Router
    TpId tpid1 = createGWPortOnRouter(input, outputBuilder, trans, fabricObj);

    // add logic port to switch
    TpId tpid2 = createGWPortOnSwitch(fabricId, swId, trans);

    // add link
    LinkId linkId = createGatewayLink(routerId, tpid1);
    createLogicLink(fabricId, routerId, swId, trans, tpid1, tpid2, linkId);

    return Futures.transformAsync(trans.submit(), submitResult -> {
        resultBuilder.withResult(outputBuilder);
        return Futures.immediateFuture(resultBuilder.build());
    }, executor);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:34,代码来源:FabricServiceAPIProvider.java

示例9: createLneLayer3

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<CreateLneLayer3Output>> createLneLayer3(CreateLneLayer3Input input) {
    String lrName = input.getName();

    CreateLogicalRouterInputBuilder lrInputBuilder = new CreateLogicalRouterInputBuilder();

    FabricId fabricId = new FabricId(input.getVfabricId());
    lrInputBuilder.setFabricId(fabricId);
    //lrInputBuilder.setName(lrName);


    LOG.debug("FABMGR: createLneLayer3: lrName={}, fabricId={}", lrName, fabricId.getValue());

    final RpcResultBuilder<CreateLneLayer3Output> resultBuilder = RpcResultBuilder.<CreateLneLayer3Output>success();
    Future<RpcResult<CreateLogicalRouterOutput>> result =
            this.fabServiceService.createLogicalRouter(lrInputBuilder.build());
    try {
        RpcResult<CreateLogicalRouterOutput> output = result.get();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: createLneLayer3: createLogicRouter RPC success");
            CreateLneLayer3OutputBuilder builder = new CreateLneLayer3OutputBuilder();
            CreateLogicalRouterOutput createLrOutput = output.getResult();
            NodeId nodeId = createLrOutput.getNodeId();
            builder.setLneId(new VcLneId(nodeId));

            return Futures.immediateFuture(resultBuilder.withResult(builder.build()).build());
        }
    } catch (Exception e) {
        LOG.error("FABMGR: ERROR: createLneLayer3: createLogicRouter RPC failed.", e);
    }

    return Futures.immediateFailedFuture(new IllegalArgumentException("createLogicRouter RPC failed"));
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:34,代码来源:VContainerNetNodeServiceProvider.java

示例10: rmLneLayer2

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<Void>> rmLneLayer2(RmLneLayer2Input input) {
    TenantId tenantId = input.getTenantId();
    VcLneId lswId = input.getLneId();

    VContainerConfigMgr vcMgr = containerMgr.getVcConfigDataMgr(new Uuid(tenantId.getValue()));
    if (vcMgr == null) {
        LOG.error("FABMGR: ERROR: rmLneLayer2: vcMgr is null: {}", tenantId.getValue());
        return Futures.immediateFailedFuture(new IllegalArgumentException("vcMgr is null"));
    }
    vcMgr.getLdNodeConfigDataMgr().releaseL2Resource(input.getVfabricId());

    RmLogicalSwitchInputBuilder inputBuilder = new RmLogicalSwitchInputBuilder();

    FabricId fabricId = new FabricId(input.getVfabricId());
    inputBuilder.setFabricId(fabricId);
    inputBuilder.setNodeId(new NodeId(lswId));

    LOG.debug("FABMGR: rmLneLayer2: fabricId={}, lswId={}", fabricId.getValue(), lswId.getValue());

    final RpcResultBuilder<Void> resultBuilder = RpcResultBuilder.<Void>success();
    Future<RpcResult<Void>> result = this.fabServiceService.rmLogicalSwitch(inputBuilder.build());
    try {
        RpcResult<Void> output = result.get();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: rmLneLayer2: rmLogicSwitch RPC success");
            return result;
        } else {
            return Futures
                .immediateFuture(resultBuilder.withError(ErrorType.RPC, "rmLogicSwitch RPC failed").build());
        }
    } catch (Exception e) {
        LOG.error("FABMGR: ERROR: rmLneLayer2: rmLogicSwitch RPC failed.", e);
    }

    return Futures.immediateFailedFuture(new IllegalArgumentException("rmLogicSwitch RPC failed"));
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:38,代码来源:VContainerNetNodeServiceProvider.java

示例11: rmLneLayer3

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<Void>> rmLneLayer3(RmLneLayer3Input input) {
    VcLneId lrId = input.getLneId();

    RmLogicalRouterInputBuilder inputBuilder = new RmLogicalRouterInputBuilder();

    FabricId fabricId = new FabricId(input.getVfabricId());
    inputBuilder.setFabricId(fabricId);
    inputBuilder.setNodeId(new NodeId(lrId));

    LOG.debug("FABMGR: rmLneLayer3: fabricId={}, lrId={}", fabricId.getValue(), lrId.getValue());

    final RpcResultBuilder<Void> resultBuilder = RpcResultBuilder.<Void>success();
    Future<RpcResult<Void>> result = this.fabServiceService.rmLogicalRouter(inputBuilder.build());
    try {
        RpcResult<Void> output = result.get();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: rmLneLayer3: rmLogicRouter RPC success");
            return result;
        } else {
            return Futures
                .immediateFuture(resultBuilder.withError(ErrorType.RPC, "rmLogicRouter RPC failed").build());
        }
    } catch (Exception e) {
        LOG.error("FABMGR: ERROR: rmLneLayer3: rmLogicRouter RPC failed.", e);
    }

    return Futures.immediateFailedFuture(new IllegalArgumentException("rmLogicRouter RPC failed"));
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:30,代码来源:VContainerNetNodeServiceProvider.java

示例12: createVcontainer

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<CreateVcontainerOutput>> createVcontainer(CreateVcontainerInput input) {
    final RpcResultBuilder<CreateVcontainerOutput> resultBuilder =
            RpcResultBuilder.<CreateVcontainerOutput>success();
    final CreateVcontainerOutputBuilder outputBuilder = new CreateVcontainerOutputBuilder();

    VcontainerConfig vcConfig = input.getVcontainerConfig();
    TenantId tenantId = input.getTenantId();
    TopologyId vcTopologyId = createVcTopology(tenantId, vcConfig);
    outputBuilder.setVcTopologyId(vcTopologyId);

    // TODO: This should be implemented as datastore listener event.
    VContainerConfigMgr vc = new VContainerConfigMgr(tenantId);
    this.vcConfigDataMgrList.put(new Uuid(tenantId.getValue()), vc);
    LOG.debug("FABMGR: createVcontainer: add tenantId: {}", tenantId.getValue());

    List<Vfabric> vfabricList = vcConfig.getVfabric();
    List<NodeId> vfabricIdList = new ArrayList<>();
    if (vfabricList != null && vfabricList.isEmpty() == false) {
        for (Vfabric vfab : vfabricList) {
            VfabricId vfabId = vfab.getVfabricId();
            vfabricIdList.add(new NodeId(vfabId.getValue()));
        }
    }

    vc.getLdNodeConfigDataMgr().addVFabrics(tenantId, vfabricIdList);

    return Futures.immediateFuture(resultBuilder.withResult(outputBuilder.build()).build());
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:30,代码来源:VContainerMgr.java

示例13: sendNeighborSolicitation

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<Void>> sendNeighborSolicitation(SendNeighborSolicitationInput ndInput) {
    RpcResultBuilder<Void> failureBuilder = RpcResultBuilder.failed();
    RpcResultBuilder<Void> successBuilder = RpcResultBuilder.success();
    Ipv6Address targetIpv6Address = null;
    Ipv6Address srcIpv6Address;
    String interfaceName = null;
    String macAddr = null;
    BigInteger dpnId;
    int localErrorCount = 0;

    targetIpv6Address = ndInput.getTargetIpAddress();
    for (InterfaceAddress interfaceAddress : ndInput.getInterfaceAddress()) {
        try {
            interfaceName = interfaceAddress.getInterface();
            srcIpv6Address = interfaceAddress.getSrcIpAddress();

            GetPortFromInterfaceOutput portResult = getPortFromInterface(interfaceName);
            checkNotNull(portResult);
            dpnId = portResult.getDpid();
            Long portid = portResult.getPortno();
            checkArgument(null != dpnId && BigInteger.ZERO != dpnId, DPN_NOT_FOUND_ERROR, interfaceName);

            NodeConnectorRef nodeRef = MDSALUtil.getNodeConnRef(dpnId, portid.toString());
            checkNotNull(nodeRef, NODE_CONNECTOR_NOT_FOUND_ERROR, interfaceName);

            if (interfaceAddress.getSrcMacAddress() != null) {
                macAddr = interfaceAddress.getSrcMacAddress().getValue();
            }
            checkNotNull(macAddr, FAILED_TO_GET_SRC_MAC_FOR_INTERFACE, interfaceName, nodeRef.getValue());
            ipv6NeighborSolicitation.transmitNeighborSolicitation(dpnId, nodeRef, new MacAddress(macAddr),
                                                                  srcIpv6Address, targetIpv6Address);
        } catch (NullPointerException | IllegalArgumentException e) {
            LOG.trace("Failed to send Neighbor Solicitation for {} on interface {}",
                       ndInput.getTargetIpAddress(), interfaceName);
            failureBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE
                    + interfaceName, e);
            successBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE
                    + interfaceName, e);
            localErrorCount++;
        }

    }
    if (localErrorCount == ndInput.getInterfaceAddress().size()) {
        // Failed to send IPv6 Neighbor Solicitation on all the interfaces, return failure.
        return Futures.immediateFuture(failureBuilder.build());
    }

    return Futures.immediateFuture(successBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:51,代码来源:Ipv6NdUtilServiceImpl.java

示例14: getElanInterfaceStatistics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
    public Future<RpcResult<GetElanInterfaceStatisticsOutput>> getElanInterfaceStatistics(
        GetElanInterfaceStatisticsInput input) {
        String interfaceName = input.getInterfaceName();
        LOG.debug("getElanInterfaceStatistics is called for elan interface {}", interfaceName);
        RpcResultBuilder<GetElanInterfaceStatisticsOutput> rpcResultBuilder = null;
        if (interfaceName == null) {
            rpcResultBuilder = RpcResultBuilder.failed();
            return getFutureWithAppErrorMessage(rpcResultBuilder, "Interface name is not provided");
        }
        ElanInterface elanInterface = ElanUtils.getElanInterfaceByElanInterfaceName(dataBroker, interfaceName);
        if (elanInterface == null) {
            rpcResultBuilder = RpcResultBuilder.failed();
            return getFutureWithAppErrorMessage(rpcResultBuilder,
                    String.format("Interface %s is not a ELAN interface", interfaceName));
        }
        String elanInstanceName = elanInterface.getElanInstanceName();
        InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
        //FIXME [ELANBE] Get this API Later
        short tableId = 0;
//        try {
//
//            //tableId = interfaceManager.getTableIdForService(interfaceName, serviceInfo);
//        } catch (InterfaceNotFoundException | InterfaceServiceNotFoundException e) {
//            rpcResultBuilder = RpcResultBuilder.failed();
//            return getFutureWithAppErrorMessage(rpcResultBuilder,
//                String.format("Interface %s or Service %s doesn't exist", interfaceName, serviceInfo));
//        }
        if (!interfaceInfo.isOperational()) {
            LOG.debug("interface {} is down and returning with no statistics", interfaceName);
            rpcResultBuilder = RpcResultBuilder.success();
            return Futures
                    .immediateFuture(rpcResultBuilder.withResult(new GetElanInterfaceStatisticsOutputBuilder()
                            .setStatResult(
                                    new StatResultBuilder().setStatResultCode(ResultCode.NotFound).setByteRxCount(0L)
                                            .setByteTxCount(0L).setPacketRxCount(0L).setPacketTxCount(0L).build())
                            .build()).build());
        }
        rpcResultBuilder = RpcResultBuilder.success();
        return Futures.immediateFuture(rpcResultBuilder
                .withResult(queryforElanInterfaceStatistics(tableId, elanInstanceName, interfaceInfo)).build());
    }
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:43,代码来源:ElanStatisticsImpl.java

示例15: registerEndpoint

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<RegisterEndpointOutput>> registerEndpoint(RegisterEndpointInput input) {

    final RpcResultBuilder<RegisterEndpointOutput> resultBuilder =
            RpcResultBuilder.<RegisterEndpointOutput>success();
    final RegisterEndpointOutputBuilder outputBuilder = new RegisterEndpointOutputBuilder();

    final FabricId fabricid = input.getFabricId();
    final FabricInstance fabricObj = FabricInstanceCache.INSTANCE.retrieveFabric(fabricid);
    if (fabricObj == null) {
        return Futures.immediateFailedFuture(new IllegalArgumentException("fabric is not exist!"));
    }

    Uuid epId = input.getEndpointUuid();
    if (epId == null) {
        epId = new Uuid(UUID.randomUUID().toString());
    }
    final Uuid newepId = epId;


    final InstanceIdentifier<Endpoint> eppath = Constants.DOM_ENDPOINTS_PATH
            .child(Endpoint.class, new EndpointKey(newepId));

    EndpointBuilder epBuilder = new EndpointBuilder();
    epBuilder.setEndpointUuid(newepId);
    epBuilder.setGateway(input.getGateway());
    epBuilder.setIpAddress(input.getIpAddress());
    epBuilder.setLocation(input.getLocation());
    epBuilder.setLogicalLocation(input.getLogicalLocation());
    epBuilder.setMacAddress(input.getMacAddress());
    epBuilder.setPublicIp(input.getPublicIp());
    epBuilder.setOwnFabric(fabricid);

    ReadWriteTransaction trans = dataBroker.newReadWriteTransaction();
    trans.put(LogicalDatastoreType.OPERATIONAL, eppath, epBuilder.build(), true);

    CheckedFuture<Void,TransactionCommitFailedException> future = trans.submit();

    return Futures.transformAsync(future, input1 -> {
        outputBuilder.setEndpointId(newepId);
        return Futures.immediateFuture(resultBuilder.withResult(outputBuilder.build()).build());
    }, executor);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:44,代码来源:EndPointRegister.java


注:本文中的org.opendaylight.yangtools.yang.common.RpcResultBuilder.success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。