Get-schema rpc call returns error

I’m trying to retrieve module schema via NETCONF’s get-schema rpc call on ConfD basic.
I’m sure that the IETF NETCONF MONITORING YANG module is loaded into ConfD at runtime.

<DEBUG> 16-Mar-2016::18:00:15.388 tony confd[31783]: - Loading file /home/tony/CONFD/etc/confd/ietf-netconf-monitoring.fxs

In addition, the schemas that I’m retrieving have their YANG files and fxs files both located in ConfD’s loadpath. I did use the --addloadpath argument when starting ConfD ( -addloadpath /home/tony/CONFD/etc/confd/).

I was trying to use rpc call ( get-schema-rpc.xml ) and netconf-console:

>  <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
>       <get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
>       <identifier>tailf-aaa</identifier>
>       </get-schema>
>     </rpc>

netconf-console --rpc get-schema-rpc.xml

netconf-console --get-schema=ietf-yang-types

However, I always getting the same rpc error reply:

> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
>   <rpc-error>
>     <error-type>application</error-type>
>     <error-tag>invalid-value</error-tag>
>     <error-severity>error</error-severity>
>     <error-path xmlns:ncm="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
>     /nc:rpc/ncm:get-schema
>   </error-path>
>     <error-message xml:lang="en">/get-schema/identifier: inconsistent value</error-message>
>     <error-info>
>       <bad-element>get-schema</bad-element>
>     </error-info>
>   </rpc-error>
> </rpc-reply>

What is the problem here. How to get the schema from the Confd.

Thanks

You should ensure that the YANG-files is in the load path:
/confd/confd-6.1.1/bin/confd -c confd.conf --addloadpath /confd/confd-6.1.1/etc/confd
–addloadpath /confd/confd-6.1.1/src/confd/yang

There is an error in your rpc xml-file, as mentioned in the docs for netconf-console the <rpc> </rpc> tags are automatically added:

--rpc=RPC           Takes a filename (or '-' for standard input) as
                    argument. The contents of the file is a single NETCONF
                    rpc operation (w/o the surrounding <rpc>).

$ cat get-schema.xml

<get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
  <identifier>item-inet-types</identifier>
</get-schema>

$ netconf-console --rpc=get-schema.xml

<?xml version="1.0" encoding="UTF-8"?> <![CDATA[module ietf-inet-types {

namespace “urn:ietf:params:xml:ns:yang:ietf-inet-types”;
prefix “inet”;

organization
“IETF NETMOD (NETCONF Data Modeling Language) Working Group”;

I am facing the same issue and the instructions did not help.
I have checked that the capability is there as well as the ietf-netconf-monitoring yang and fxs.
Any other ideas?

Refer to this posting for the instructions.

Let’s try a concrete example. If you run the intro/1-2-3-start-query-model example, you should be able to run the NETCONF get-schema query for the dhcpd module as follows:

$ netconf-console --get-schema=dhcpd
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><![CDATA[module dhcpd {

  namespace "http://tail-f.com/ns/example/dhcpd";
  prefix dhcpd;

  import ietf-inet-types {
    prefix inet;
  }

  import tailf-xsd-types {
    prefix xs;
  }

  typedef loglevel {
    type enumeration {
        enum kern;
        enum mail;
        enum local7;
    }
  }

  grouping subNet {
    list subNet {
      key "net mask";
      leaf net {
        type inet:ipv4-address;
      }
      leaf mask {
        type inet:ipv4-address;
      }
      container range {
        presence "";
        leaf dynamicBootP {
          type boolean;
          default false;
          description "Enable BOOTP for this instance.";
        }
        leaf lowAddr {
          type inet:ipv4-address;
          mandatory true;
          description "Enable BOOTP for this instance.";
        }
        leaf hiAddr {
          type inet:ipv4-address;
          description "Enable BOOTP for this instance.";
        }
      }
      leaf routers {
        type string;
      }
      leaf maxLeaseTime {
        type xs:duration;
        default PT7200S;
      }
    }
  }



  container dhcp {
    leaf defaultLeaseTime {
      type xs:duration;
      default PT600S;
    }
    leaf maxLeaseTime {
      type xs:duration;
      default PT7200S;
    }
    leaf logFacility {
      type loglevel;
      default local7;
    }
    container SubNets {
      uses subNet;
    }
    container SharedNetworks {
      list sharedNetwork {
        key name;
        max-elements 1024;
        leaf name {
          type string;
        }
        container SubNets {
          uses subNet ;
        }
      }
    }
  }
}
]]></data>
</rpc-reply>

To perform get-schema on the ietf-yang-types module, you will need to modify the Makefile to add an additional loadpath at $(CONFD_DIR)/src/confd/yang as follows:

CONFD_FLAGS = --addloadpath $(CONFD_DIR)/etc/confd --addloadpath $(CONFD_DIR)/src/confd/yang

With the above change in your Makefile, you should see the following line when you do make start:

confd -c confd.conf --addloadpath $CONFD_DIR/etc/confd --addloadpath $CONFD_DIR/src/confd/yang

When you perform the get-schema query on the ietf-yang-types module with the modified Makefile, you should see the following:

$ netconf-console --get-schema=ietf-yang-types
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><![CDATA[module ietf-yang-types {

  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
  prefix "yang";

  organization
   "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
   "WG Web:   <http://tools.ietf.org/wg/netmod/>
    WG List:  <mailto:netmod@ietf.org>

    WG Chair: David Kessens
              <mailto:david.kessens@nsn.com>

    WG Chair: Juergen Schoenwaelder
              <mailto:j.schoenwaelder@jacobs-university.de>

    Editor:   Juergen Schoenwaelder
              <mailto:j.schoenwaelder@jacobs-university.de>";

  description
   "This module contains a collection of generally useful derived
    YANG data types.
...
  typedef dotted-quad {
    type string {
      pattern
        '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
      + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
    }
    description
      "An unsigned 32-bit number expressed in the dotted-quad
       notation, i.e., four octets written as decimal numbers
       and separated with the '.' (full stop) character.";
  }
}
]]></data>
</rpc-reply>

Thank you. That was really helpful. In my case I needed to make the addition in confd.conf to load also the path where the yang modules were.