Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-739

Fix the comparing wrong QNames

XMLWordPrintable

      After invoking routed RPC via Karaf CLI command from the node that did not registrate this RPC, we get error message:

      Error executing command: org.opendaylight.controller.remote.rpc.RemoteDOMRpcException: Exception during invoking RPC
      

      Stack trace from karaf logs after invoking routed buy-car rpc:

      org.opendaylight.controller.sal-clustering-commons - 4.0.10 | Failed to invoke RPC (urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)buy-car
      java.lang.IllegalArgumentException: Unexpected RPC (urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)buy-car input ImmutableContainerNode{identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)buy-car, body=[ImmutableLeafNode{identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)person, body=/(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:people?revision=2014-08-18)people/person/person[{(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:people?revision=2014-08-18)id=localhost/people/person_id_21}]}, ImmutableLeafNode{identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)car-id, body=localhost/cars/car_id_21}, ImmutableLeafNode{identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)person-id, body=localhost/people/person_id_21}]}
          at com.google.common.base.Preconditions.checkArgument(Preconditions.java:443) ~[bundleFile:?]
          at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcImplementationAdapter.deserialize(BindingDOMRpcImplementationAdapter.java:81) ~[bundleFile:?]
          at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcImplementationAdapter.invokeRpc(BindingDOMRpcImplementationAdapter.java:64) ~[bundleFile:?]
          at org.opendaylight.mdsal.dom.broker.DOMRpcRouter$OperationInvocation.invokeRoutedRpc(DOMRpcRouter.java:618) ~[bundleFile:?]
          at org.opendaylight.mdsal.dom.broker.DOMRpcRouter$OperationInvocation.invoke(DOMRpcRouter.java:593) ~[bundleFile:?]
          at org.opendaylight.mdsal.dom.broker.DOMRpcRouter$RpcServiceFacade.invokeRpc(DOMRpcRouter.java:503) ~[bundleFile:?]
          at org.opendaylight.mdsal.dom.spi.ForwardingDOMRpcService.invokeRpc(ForwardingDOMRpcService.java:29) ~[bundleFile:?]
          at org.opendaylight.controller.remote.rpc.OpsInvoker.execute(OpsInvoker.java:89) ~[bundleFile:?]
          at org.opendaylight.controller.remote.rpc.OpsInvoker.handleReceive(OpsInvoker.java:74) ~[bundleFile:?]
          at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:24) [bundleFile:?] 
      

       

      Error occurs in checkArgument method:

      checkArgument(inputQname.equals(container.getIdentifier().getNodeType()), "Unexpected RPC %s input %s", rpcType, input);
      

      It's because first comparing QName is:

      {identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)input
      

      and second comparing QName is:

      {identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)buy-car
      

      The real cause of this error:

      When ExecuteRpc message is sent with LazySerializedContainerNode as 'input' parameter, during serialization is invoked its getIdentifier() method that returns NodeIdentfier of rpc, not input.

      So OpsInvoker receives the message with incorrect ContainerNode as 'input' parameter:

      ImmutableContainerNode{identifier=(urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase?revision=2014-08-18)buy-car, body=[ImmutableLeafNode{identifier=...
      

      and after invoking getIdentifier() in the downstream checkArgument, it returns that NodeIdentifier of buy-car rpc.

       

      We need to inject rpc input Qname into LazySerializedContainerNode to get NodeIdentifier of rpc input from getIdentifier() method.

            dominik.vrbovsky Dominik Vrbovský
            dominik.vrbovsky Dominik Vrbovský
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: