Unable to RPC to netconf server

asked 2016-03-01 02:53:35 -0700

vmehmeri gravatar image

Hello Netconf experts,

I am having problems sending an RPC to a netconf server, which is running on netopeer inside a docker container.

I'm using the "turing-machine" example from netopeer which has an RPC defined in its yang model, and a callback function defined in a c file. I've compiled and installed this example as dictated by their tutorial and loaded it inside a docker container.

I am able to connect to the my "turing" device, set and get its configuration. For example, if I open the browser to: http://localhost:8181/restconf/config... I get the following content:

< data >< turing-machine >< transition-function >< delta >< label >bla< /label >< input >< state >0< /state >< symbol >0< /symbol >< /input >< /delta >< /transition-function >< /turing-machine >< /data >"

(those are some data that I posted previously via curl). All good.

But, when I try to call the device's rpc, this is what I get:

l -u admin:admin -vX POST http://localhost:8181/restconf/operat... -d @turing.json --header "Content-Type: application/yang.data+json"

HTTP/1.1 400 Bad Request {"errors":{"error":[{"error-type":"protocol","error-tag":"invalid-value","error-message":"URI has bad format. Possible reasons:\n 1. \"turing-machine:initialize\" was not found in parent data node.\n 2. \"turing-machine:initialize\" is behind mount point. Then it should be in format \"/yang-ext:mount/turing-machine:initialize\"."}]}}

Below is a snippet from turing-machine.yang:

module turing-machine { namespace "http://example.net/turing-machine"; prefix "tm"; description "Data model for the Turing Machine."; revision 2013-12-27 { description "Initial revision."; }


container turing-machine { (...) }

rpc initialize { input { leaf tape-content { type string; default ""; description "The string with which the tape shall be initialized. The leftmost symbol will be at tape coordinate 0."; } } }

and the content of turing.json: { "input" : { "turing-machine:tape-content" : "bla" } }

If I send the exact same post via firefox's REST client, this is the error that I get:

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"><error><error-type>protocol</error-type><error-tag>invalid-value</error-tag><error-message>Content must be empty.</error-message></error></errors>

If I remove the content, I get another:

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 500 Server Error</title> </head> <body>


Problem accessing /restconf/operations/network-topology:network-topology/topology/topology-netconf/node/turing1/yang-ext:mount/turing-machine:initialize. Reason:

    Server Error

Caused by:

java.lang.IllegalStateException: RPC RpcDefinitionImpl[qname=(http://example.net/turing-machine?revision=2013-12-27)initialize, path=AbsoluteSchemaPath{path=[(http://example.net/turing-machine?revision=2013-12-27)initialize]}, input=container input, output=null] doesn't need input value!
    at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.invokeRpc(RestconfImpl.java:614)
    at org.opendaylight.controller.sal.restconf.impl.StatisticsRestconfServiceWrapper.invokeRpc(StatisticsRestconfServiceWrapper.java:87)
    at org.opendaylight.controller.sal.rest.impl.RestconfCompositeWrapper.invokeRpc(RestconfCompositeWrapper.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java ...
edit retag flag offensive close merge delete