本文整理汇总了Java中org.opendaylight.yangtools.yang.common.RpcResultBuilder.newWarning方法的典型用法代码示例。如果您正苦于以下问题:Java RpcResultBuilder.newWarning方法的具体用法?Java RpcResultBuilder.newWarning怎么用?Java RpcResultBuilder.newWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.common.RpcResultBuilder
的用法示例。
在下文中一共展示了RpcResultBuilder.newWarning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRpcErrors
import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public Collection<RpcError> getRpcErrors() {
final Collection<RpcError> rpcErrors = new ArrayList<>();
for (final RpcErrorData ed: rpcErrorDataList) {
final RpcError rpcError = ed.severity == ErrorSeverity.ERROR
? RpcResultBuilder.newError(ed.errorType, ed.tag, ed.message, ed.applicationTag,
ed.info, ed.cause) :
RpcResultBuilder.newWarning(ed.errorType, ed.tag, ed.message, ed.applicationTag,
ed.info, ed.cause);
rpcErrors.add(rpcError);
}
return rpcErrors;
}
示例2: setUp
import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
final RpcError rpcError = RpcResultBuilder.newError(
RpcError.ErrorType.RPC, "error", "error message");
final RpcError rpcWarning = RpcResultBuilder.newWarning(
RpcError.ErrorType.RPC, "warning", "warning message");
rpcErrors = new ArrayList<>();
rpcErrors.add(rpcError);
rpcErrors.add(rpcWarning);
exception = new RpcErrorsException(ERROR_MESSAGE, rpcErrors);
}
示例3: deleteEVPN
import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public Future<RpcResult<DeleteEVPNOutput>> deleteEVPN(DeleteEVPNInput input) {
DeleteEVPNOutputBuilder opBuilder = new DeleteEVPNOutputBuilder();
SettableFuture<RpcResult<DeleteEVPNOutput>> result = SettableFuture.create();
List<RpcError> errorList = new ArrayList<>();
int failurecount = 0;
int warningcount = 0;
List<Uuid> vpns = input.getId();
for (Uuid vpn : vpns) {
RpcError error;
String msg;
VpnInstance vpnInstance = VpnHelper.getVpnInstance(dataBroker, vpn.getValue());
if (vpnInstance != null) {
neutronvpnManager.removeVpn(vpn);
} else {
msg = String.format("EVPN with vpnid: %s does not exist", vpn.getValue());
LOG.warn(msg);
error = RpcResultBuilder.newWarning(RpcError.ErrorType.PROTOCOL, "invalid-value", msg);
errorList.add(error);
warningcount++;
}
}
if (failurecount != 0) {
result.set(RpcResultBuilder.<DeleteEVPNOutput>failed().withRpcErrors(errorList).build());
} else {
List<String> errorResponseList = new ArrayList<>();
if (!errorList.isEmpty()) {
for (RpcError rpcError : errorList) {
String errorResponse = String.format("ErrorType: %s, ErrorTag: %s, ErrorMessage: %s", rpcError
.getErrorType(), rpcError.getTag(), rpcError.getMessage());
errorResponseList.add(errorResponse);
}
} else {
errorResponseList.add("Deletion of EVPN operation successful");
}
opBuilder.setResponse(errorResponseList);
result.set(RpcResultBuilder.<DeleteEVPNOutput>success().withResult(opBuilder.build()).build());
}
return result;
}
示例4: makeToasterInUseError
import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
private RpcError makeToasterInUseError() {
return RpcResultBuilder.newWarning(APPLICATION, "in-use", "Toaster is busy", null, null, null);
}
示例5: deleteL3VPN
import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
/**
* It handles the invocations to the neutronvpn:deleteL3VPN RPC method.
*/
@Override
public Future<RpcResult<DeleteL3VPNOutput>> deleteL3VPN(DeleteL3VPNInput input) {
DeleteL3VPNOutputBuilder opBuilder = new DeleteL3VPNOutputBuilder();
SettableFuture<RpcResult<DeleteL3VPNOutput>> result = SettableFuture.create();
List<RpcError> errorList = new ArrayList<>();
int failurecount = 0;
int warningcount = 0;
List<Uuid> vpns = input.getId();
for (Uuid vpn : vpns) {
RpcError error;
String msg;
try {
InstanceIdentifier<VpnInstance> vpnIdentifier =
InstanceIdentifier.builder(VpnInstances.class)
.child(VpnInstance.class, new VpnInstanceKey(vpn.getValue())).build();
Optional<VpnInstance> optionalVpn =
SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION,
vpnIdentifier);
if (optionalVpn.isPresent()) {
removeVpn(vpn);
} else {
msg = String.format("VPN with vpnid: %s does not exist", vpn.getValue());
LOG.warn(msg);
error = RpcResultBuilder.newWarning(ErrorType.PROTOCOL, "invalid-value", msg);
errorList.add(error);
warningcount++;
}
} catch (ReadFailedException ex) {
msg = String.format("Deletion of L3VPN failed when deleting for uuid %s", vpn.getValue());
LOG.error(msg, ex);
error = RpcResultBuilder.newError(ErrorType.APPLICATION, msg, ex.getMessage());
errorList.add(error);
failurecount++;
}
}
// if at least one succeeds; result is success
// if none succeeds; result is failure
if (failurecount + warningcount == vpns.size()) {
result.set(RpcResultBuilder.<DeleteL3VPNOutput>failed().withRpcErrors(errorList).build());
} else {
List<String> errorResponseList = new ArrayList<>();
if (!errorList.isEmpty()) {
for (RpcError rpcError : errorList) {
String errorResponse = String.format("ErrorType: %s, ErrorTag: %s, ErrorMessage: %s", rpcError
.getErrorType(), rpcError.getTag(), rpcError.getMessage());
errorResponseList.add(errorResponse);
}
} else {
errorResponseList.add("Operation successful with no errors");
}
opBuilder.setResponse(errorResponseList);
result.set(RpcResultBuilder.<DeleteL3VPNOutput>success().withResult(opBuilder.build()).build());
}
return result;
}