NETCONF monitoring RPC calls are not available through the restconf/operations
resource. If your goal is to retrieve schemas, it’s done differently with RESTCONF.
Section 3.7. Schema Resource
in the RESTCONF draft describe how it’s done:
First the client must get the path to the schema.
$ curl -i -X GET -H "Accept: application/yang-data+xml" -u admin:admin http://localhost:38008/restconf/data/ietf-yang-library:modules-state/module=tailf-netconf-monitoring,2016-11-24
HTTP/1.1 200 OK
Server:
Date: Fri, 13 Jan 2017 17:56:40 GMT
Last-Modified: Fri, 01 Jan 1971 06:00:00 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Etag: 1484-322591-164902
Content-Type: application/yang-data+xml
Transfer-Encoding: chunked
Pragma: no-cache
<module xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library" xmlns:yanglib="urn:ietf:params:xml:ns:yang:ietf-yang-library">
<name>tailf-netconf-monitoring</name>
<revision>2016-11-24</revision>
<schema>http://localhost:8008/restconf/tailf/modules/tailf-netconf-monitoring/2016-11-24</schema>
<namespace>http://tail-f.com/yang/netconf-monitoring</namespace>
<conformance-type>implement</conformance-type>
</module>
Then the schema is the retrieved with a separate GET request using the URL from the tag (NOTE that I have to edit the port number because I forward my port from a VM):
$ curl -i -X GET -H "Accept: application/yang-data+xml" -u admin:admin http://localhost:38008/restconf/tailf/modules/tailf-netconf-monitoring/2016-11-24
HTTP/1.1 200 OK
Server:
Date: Fri, 13 Jan 2017 17:58:53 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Type: application/yang
Transfer-Encoding: chunked
Pragma: no-cache
module tailf-netconf-monitoring {
namespace "http://tail-f.com/yang/netconf-monitoring";
prefix tncm;
import ietf-yang-types {
prefix yang;
}
import ietf-netconf-monitoring {
prefix ncm;
}
import tailf-common {
prefix tailf;
}
organization "Tail-f Systems";
description
"This module augments ietf-netconf-monitoring with extra
monitoring data.";
revision 2016-11-24 {
description
"Released as part of ConfD-6.3.
Added /netconf-state/datastores/datastore/transaction-lock.";
}
...
If your goal is to invoke RPC-operations, it’s done like this:
$ curl -i -X POST -T rpc-math2.xml -H "Content-Type: application/yang-data+xml" -u admin:admin http://localhost:38008/restconf/operations/math2
HTTP/1.1 100 Continue
Server:
Allow: GET, POST, OPTIONS, HEAD
Content-Length: 0
HTTP/1.1 200 OK
Server:
Date: Fri, 13 Jan 2017 19:25:35 GMT
Allow: GET, POST, OPTIONS, HEAD
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Length: 72
Content-Type: application/yang-data+xml
Vary: Accept-Encoding
Pragma: no-cache
<output xmlns='http://example.com/math'>
<result>5</result>
</output>
Where rpc-math2.xml
looks like this:
$ cat rpc-math2.xml
<input>
<add>
<operand>2</operand>
<operand>3</operand>
</add>
</input>
… and the example I use is examples.confd/netconf_extensions/simple_rpc
with RESTCONF enabled.
Available RPC-operations can be listed through the operations resource (NOTE: math2 and math3 but no get-schema):
$ curl -i -X GET -H "Accept: application/yang-data+xml" -u admin:admin http://localhost:38008/restconf/operations
HTTP/1.1 200 OK
Server:
Date: Fri, 13 Jan 2017 19:30:49 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Length: 308
Content-Type: application/yang-data+xml
Vary: Accept-Encoding
Pragma: no-cache
<restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<operations>
<math:math3 xmlns:math="http://example.com/math">/restconf/operations/math-rpc:math3</math:math3>
<math:math2 xmlns:math="http://example.com/math">/restconf/operations/math-rpc:math2</math:math2>
</operations>
</restconf>