org.opendaylight.yangtools.yang.common.RpcResult.isSuccessful()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.opendaylight.yangtools.yang.common.RpcResult.isSuccessful方法的一些代码示例,展示了RpcResult.isSuccessful的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RpcResult.isSuccessful方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.common.RpcResult
类名称:RpcResult
方法名:isSuccessful

RpcResult.isSuccessful介绍

[英]Returns whether or not processing of the call was successful.
[中]返回呼叫处理是否成功。

代码示例

代码示例来源:origin: org.opendaylight.netvirt/vpnmanager-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if(!result.isSuccessful()) {
      LOG.warn("Rpc call to {} failed", msgFormat, getErrorText(result.getErrors()));
    } else {
      LOG.debug("Successful RPC Result - {}", msgFormat);
    }
  }
});

代码示例来源:origin: org.opendaylight.netvirt/natservice-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if (result.isSuccessful()) {
      LOG.debug("NAT Service : Successfully removed the label for the prefix {} from VPN {}", externalIp, vpnName);
    } else {
      LOG.error("NAT Service : Error in removing the label for prefix {} from VPN {}, {}", externalIp, vpnName, result.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.netvirt/natservice-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if (result.isSuccessful()) {
      LOG.debug("NAT Service : Successfully removed the label for the prefix {} from VPN {}", externalIp, vpnName);
    } else {
      LOG.error("NAT Service : Error in removing the label for prefix {} from VPN {}, {}", externalIp, vpnName, result.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.netvirt/natservice-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if(result.isSuccessful()) {
      LOG.info("Successfully installed custom FIB routes for prefix {}", externalIp);
    } else {
      LOG.error("Error in rpc call to create custom Fib entries for prefix {} in DPN {}, {}", externalIp, dpnId, result.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.netvirt/natservice-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if(result.isSuccessful()) {
      LOG.debug("Successfully removed the label for the prefix {} from VPN {}", externalIp, vpnName);
    } else {
      LOG.error("Error in removing the label for prefix {} from VPN {}, {}", externalIp, vpnName, result.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.vpnservice/alivenessmonitor-impl

@Override
  public void onSuccess(RpcResult<Void> result) {
    if(result.isSuccessful()) {
      LOG.debug("Created IdPool for Aliveness Monitor Service");
    } else {
      LOG.error("RPC to create Idpool failed {}", result.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.openflowplugin/openflowplugin

@Override
  public ListenableFuture<RpcResult<UpdateFlowOutput>> apply(RpcResult<UpdateFlowOutput> input) throws Exception {
    if (input.isSuccessful()) {
      return chainFlowMods(ofFlowModInputs, index + 1, taskContext, cookie);
    } else {
      LOG.warn("Flowmod failed. Any chained flowmods are ignored. xid:{}",
          ofFlowModInputs.get(index).getXid());
      return Futures.immediateFuture(input);
    }
  }
}

代码示例来源:origin: org.opendaylight.openflowplugin/openflowplugin

/**
 *
 * @param input rpc result input
 * @param result results
 * @param <E> rpc result input type
 * @return rpc result
 */
protected static <E> RpcResult<E> assembleRpcResult(RpcResult<?> input, E result) {
  Collection<RpcError> errors = input.getErrors();
  return Rpcs.getRpcResult(input.isSuccessful(), result, errors);
}

代码示例来源:origin: org.opendaylight.vpnservice/vpnmanager-impl

public static void releaseId(IdManagerService idManager, String poolName, String idKey) {
  ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
  try {
    Future<RpcResult<Void>> result = idManager.releaseId(idInput);
    RpcResult<Void> rpcResult = result.get();
    if(!rpcResult.isSuccessful()) {
      LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors());
    }
  } catch (InterruptedException | ExecutionException e) {
    LOG.warn("Exception when getting Unique Id for key {}", idKey, e);
  }
}

代码示例来源:origin: org.opendaylight.netvirt/vpnmanager-impl

public static void releaseId(IdManagerService idManager, String poolName, String idKey) {
  ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
  try {
    Future<RpcResult<Void>> result = idManager.releaseId(idInput);
    RpcResult<Void> rpcResult = result.get();
    if (!rpcResult.isSuccessful()) {
      LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors());
    }
  } catch (InterruptedException | ExecutionException e) {
    LOG.warn("Exception when getting Unique Id for key {}", idKey, e);
  }
}

代码示例来源:origin: org.opendaylight.netide/shim

@Override
public void onSuccess(RpcResult<E> rpcReply) {
  if (rpcReply.isSuccessful()) {
    E result = rpcReply.getResult();
    sendOpenFlowMessageToCore(coreConnector, result, ofVersion, xId, datapathId, moduleId);
  } else {
    for (RpcError rpcError : rpcReply.getErrors()) {
      LOG.info("SHIM RELAY: error in communication with switch: {}", rpcError.getMessage());
    }
  }
}

代码示例来源:origin: org.opendaylight.netvirt/fibmanager-impl

static void releaseId(IdManagerService idManager, String poolName, String idKey) {
  ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
  try {
    Future<RpcResult<Void>> result = idManager.releaseId(idInput);
    RpcResult<Void> rpcResult = result.get();
    if(!rpcResult.isSuccessful()) {
      LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors());
    }
  } catch (InterruptedException | ExecutionException e) {
    LOG.warn("Exception when getting Unique Id for key {}", idKey, e);
  }
}

代码示例来源:origin: org.opendaylight.netvirt/elanmanager-impl

private void createIdPool() throws Exception {
  CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(ElanConstants.ELAN_ID_POOL_NAME)
      .setLow(ElanConstants.ELAN_ID_LOW_VALUE).setHigh(ElanConstants.ELAN_ID_HIGH_VALUE).build();
  Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
  if (result != null && result.get().isSuccessful()) {
    LOG.debug("ELAN Id Pool is created successfully");
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

@Override
public void onSuccess(final RpcResult<?> result) {
  if (result.isSuccessful()) {
    callback.onSuccess((Output) result.getResult());
  } else {
    //FIXME: It's not suitable to do this way here. It's better for
    // 'onFailure' to accept Collection<RpcError> as input.
    result.getErrors().forEach(e -> callback.onFailure(e.getCause()));
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-common

/**
 * Returns a builder from another RpcResult.
 *
 * @param other the other RpcResult.
 */
public static <T> RpcResultBuilder<T> from(final RpcResult<T> other) {
  return new RpcResultBuilder<>(other.isSuccessful(), other.getResult())
                         .withRpcErrors(other.getErrors());
}

代码示例来源:origin: org.opendaylight.controller/sal-netconf-connector

@Override
  public DOMRpcResult apply(final RpcResult<NetconfMessage> input) {
    if (input.isSuccessful()) {
      return transformer.toRpcResult(input.getResult(), type);
    } else {
      // TODO check whether the listener sets errors properly
      return new DefaultDOMRpcResult(input.getErrors());
    }
  }
});

代码示例来源:origin: org.opendaylight.controller/sal-binding-broker-impl

private DOMRpcResult transform(final RpcResult<?> input) {
  if (input.isSuccessful()) {
    final Object inputData = input.getResult();
    if (inputData instanceof DataContainer) {
      return new DefaultDOMRpcResult(codec.toNormalizedNodeRpcData((DataContainer) inputData));
    } else {
      return new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
    }
  }
  return new DefaultDOMRpcResult(input.getErrors());
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

private DOMRpcResult transform(final RpcResult<?> input) {
    if (input.isSuccessful()) {
      final Object inputData = input.getResult();
      if (inputData instanceof DataContainer) {
        return new DefaultDOMRpcResult(codec.toNormalizedNodeRpcData((DataContainer) inputData));
      }

      return new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
    }
    return new DefaultDOMRpcResult(input.getErrors());
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

private DOMRpcResult transform(final RpcResult<?> input) {
  if (input.isSuccessful()) {
    final Object inputData = input.getResult();
    if (inputData instanceof DataContainer) {
      return new DefaultDOMRpcResult(codec.toNormalizedNodeOperationData((TreeNode) inputData));
    } else {
      return new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
    }
  }
  return new DefaultDOMRpcResult(input.getErrors());
}

代码示例来源:origin: org.opendaylight.openflowplugin/openflowplugin

@Override
  public RpcResult<UpdateMeterOutput> apply(final RpcResult<Void> inputArg) {
    UpdateMeterOutputBuilder meterModOutput = new UpdateMeterOutputBuilder();
    BigInteger bigIntXid = BigInteger.valueOf(input.getXid());
    meterModOutput.setTransactionId(new TransactionId(bigIntXid));
    UpdateMeterOutput result = meterModOutput.build();
    RpcResult<UpdateMeterOutput> rpcResult = RpcResultBuilder
        .<UpdateMeterOutput>status(inputArg.isSuccessful()).withResult(result)
        .withRpcErrors(inputArg.getErrors()).build();
    return rpcResult;
  }
});

相关文章

微信公众号

最新文章

更多