本文整理汇总了Java中org.opendaylight.yangtools.yang.common.RpcResultBuilder.failed方法的典型用法代码示例。如果您正苦于以下问题:Java RpcResultBuilder.failed方法的具体用法?Java RpcResultBuilder.failed怎么用?Java RpcResultBuilder.failed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.common.RpcResultBuilder
的用法示例。
在下文中一共展示了RpcResultBuilder.failed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例3: 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());
}