-
Bug
-
Resolution: Done
-
High
-
Neon, Fluorine SR1
-
None
-
None
If the action inside yang doesn't contain output, only ok is returned within rpc-reply. But NetconfMessageTransformer reports error when such a message is processed.
For this issue I used the same invokation as in NETCONF-566. The Remove action has no output defined in Yang:
Optional<MountPoint> mountPointOpt = mountPointService.getMountPoint(NETCONF_MOUNTPOINT_II).toJavaUtil();
Optional<ActionService> serviceOpt = mountPointOpt.get().getService(org.opendaylight.controller.md.sal.binding.api.ActionService.class).toJavaUtil();
ActionService actionService = serviceOpt.get();
InstanceIdentifier<ActionExampleList> listId = InstanceIdentifier.builder(ActionExampleList.class, new ActionExampleListKey(2)).build();
Remove action = actionService.getActionHandle(Remove.class);
Preconditions.checkNotNull(action, "Action " + Remove.QNAME + " is not supported on device.");
Input input = new InputBuilder().setForce(true).build();
FluentFuture<RpcResult<Output>> outputFuture = action.invoke((KeyedInstanceIdentifier<ActionExampleList, ActionExampleListKey>) listId, input);
RpcResult<Output> result = outputFuture.get();
But we have problem when parsing the result, the NullPointerException is present:
Exception in thread "pool-13-thread-1" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at org.opendaylight.mdsal.dom.spi.SimpleDOMActionResult.<init>(SimpleDOMActionResult.java:43)
at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer.toActionResult(NetconfMessageTransformer.java:320)
at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer.toActionResult(NetconfMessageTransformer.java:74)
at — ommited custom action service —
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1377)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
As an input inside NetconfMessageTransformer is actionDefinition for Remove action (see attached yang model) and netconf message:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-0">
<ok/>
</rpc-reply>