Defining a new NETCONF RPC

Trying to get a new RPC running. I add this yang:
module testrpc {
namespace “”;
prefix testrpc;

  import ietf-inet-types {
    prefix inet;

  import tailf-common {
    prefix tailf;

  organization "Test";

  contact "";

  rpc testrpc {
    tailf:exec "/bin/uname";
    output {
      leaf res {
        type string;

I compile with source confd/confdrc; confdc -c testrpc.yang and copy the fxs into the load path of my confd instance.

I add <capability></capability> to /confdConfig/netconf/capabilities` and restart confd.

Now I issue netconf-console --proto=tcp --port=2022 --host= -u myuser -p mypassword testrpc.xml where testrpc.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <testrpc xmlns=""/>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">

My response in netconf-console is:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
    <error-path xmlns:testrpc=""     xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <error-message xml:lang="en">application protocol error</error-message>

The logs from the confd instance show:
confd Bad result from external command "/bin/uname": "Linux\n"

Can someone help me out? Is there a requirement on how the output should be formatted to be accepted as an RPC reply, or am I missing something else? The example was chosen to have a short succinct reply string to test creating RPCs that run serverside commands.

TIA&BR /Erik

Yes, see the section “11.3. Action as an Executable” in the UG. The output should be “tag-value” pairs just like the input. If you change “/bin/uname” to the path of a script that does

echo res `/bin/uname`

(where ‘res’ is of course the name you have defined for the output parameter) it should work.

1 Like

That was exactly it. I was stuck in 15.5 where I didn’t get that detail. Thank you.