Extending the NETCONF Server in Confd

Hi ,
I am working on Confd 7.2.2
My requirement is to extend Confd’s NETCONF Server and customize rpc reply.

I found the example in below link
http://66.218.245.39/doc/html/ch15.html#ug.netconf_agent.extend

I tried option 1: 15.5.1, where it says
“As an executable program which is started by ConfD for each new RPC. The XML is passed as-is from ConfD to the program, and the resulting XML is generated by the program.”

I am using a shell script as an executable like below, however i observed Confd never passes the input XML to the executable

module junos-rpc {
namespace “urn:juniper-rpc”;
prefix jrpc;

import tailf-common {
prefix tailf;
}
import ietf-inet-types {
prefix inet;
}
import ietf-yang-types {
prefix yang;
}

rpc get-interface-information {
description
“Show interface information”;
input {
// input leafs
}
output {
uses interface-information;
}
tailf:exec “./get-interface-information.sh” {
tailf:raw-xml;
}
}
}

I tried python executable also instead of shell script and i noticed the same problem there also.

Please let me know if i am missing something.

As the ConfD UG describes, input and output statments should not be used when passing raw XML.

  rpc math {
    tailf:exec "/usr/bin/math" {
      tailf:raw-xml;
    }
  }

Thanks for the response.
So it looks like i have to use option 2 as input and output structure can’t be changed.

Option 2 is 15.5.2. RPC as an Executable, ConfD Translates the XML.

However in the example it is not clear when the output is a nested structure like below then how to populate it from the shell script or python script

container interface-information {
list physical-interface {
key name;
leaf name {
type string;
}
// other leafs here
}
// few more lists/leafs here
}

The UG you are referring to is an old 6.4 version of the ConfD UG that someone made available on some server.
See ConfD 7.3.2 UG Chapter 13.3 “Action as an Executable” for more details. (chapter 11.3 in the old UG you point to).

Got it, thank you for the help.