Open jean-christophe-manciot opened 6 years ago
Jean-Christophe,
Apologies for the long delay in getting back to you. Unfortunately, I was on vacation when this query arrived, so getting back to it now.
The general form for a URL for a query against the openconfig-interfaces model for config content should look like:
https://ip_address/restconf/data/openconfig-interfaces:interfaces?content=config
The YANG module name is used to scope the top-level node interfaces
in the openconfig-interfaces
model.
I can confirm that the two examples you show above would, indeed, generate 400: Bad request
.
With respect to host discovery, we try to support what you see defined in Section 3.1 of RFC 8040. For example, on a CSR1Kv running IOS-XE 16.6.1, I can do a query like:
GET /.well-known/host-meta?depth=unbounded HTTP/1.1
Authorization: Basic dmFncmFudDp2YWdyYW50
Host: **********
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.12.6) GCDHTTPRequest
...and get back:
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 12 Jul 2017 23:13:49 GMT
Content-Type: application/xrd+xml
Content-Length: 107
Connection: close
Vary: Accept-Encoding
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='restconf' href='/restconf'/>
</XRD>
I can then dispatch a query such as:
GET /restconf?depth=unbounded HTTP/1.1
Authorization: Basic dmFncmFudDp2YWdyYW50
Accept: application/yang-data+json
Host: **********
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.12.6) GCDHTTPRequest
And see:
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 12 Jul 2017 23:14:48 GMT
Content-Type: application/yang-data+json
Transfer-Encoding: chunked
Connection: close
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Vary: Accept-Encoding
Pragma: no-cache
{"restconf":{"data":{},"operations":{},"yang-library-version":"2016-06-21"}}
This tells me that the device, under /restconf
, supports the data
and operations
subtrees, along with supporting the IETF YANG Library model. To discover more details of model support, I then need to use the IETF YANG Library together data. For example, if I wanted to get a list of the modules the device claims to support, I might use the query:
GET /restconf/data/ietf-yang-library:modules-state/module?content=nonconfig&fields=name HTTP/1.1
Authorization: Basic dmFncmFudDp2YWdyYW50
Accept: application/yang-data+json
Host: **********
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.12.6) GCDHTTPRequest
...which would give me a response something like (again, from a CSR1Kv as I don't have a NX-OS device to hand):
(PS partial response only)
HTTP/1.1 200 OK
Server: nginx
Content-Type: application/yang-data+json
Pragma: no-cache
Transfer-Encoding: Identity
Date: Wed, 12 Jul 2017 23:24:05 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Connection: close
{
"ietf-yang-library:module": [
{
"name": "ATM-FORUM-TC-MIB"
},
{
"name": "ATM-MIB"
},
{
"name": "ATM-TC-MIB"
},
{
"name": "BGP4-MIB"
},
[...elided...]
Hope this helps. Please feel free to get back to me with any further queries.
Cheers,
Einar
Thanks a lot for your clear & detailed answer @einarnn
Jean-Christophe,
After talking to the NX-OS team, only the "content" option is supported. We are looking at what the roadmap may be for the others, namely:
4.8.2. The "depth" Query Parameter ........................54
4.8.3. The "fields" Query Parameter .......................55
4.8.4. The "filter" Query Parameter .......................56
4.8.5. The "insert" Query Parameter .......................57
4.8.6. The "point" Query Parameter ........................57
4.8.7. The "start-time" Query Parameter ...................58
4.8.8. The "stop-time" Query Parameter ....................58
4.8.9. The "with-defaults" Query Parameter ................59
IIRC, the start-time
and stop-time
options apply to RFC5277, which is not currently supported on NX-OS.
I'm afraid at this time I don't have a timescale for when we will have a public roadmap. Are there any of the above URL options that are particularly interesting to you for your use cases?
Cheers,
Einar
@einarnn
The depth
and fields
options are definitely needed.
I don't have enough Yang/RESTconf experience to prioritize the importance of the other query parameters.
@einarnn
On IOS-XE 16.6.1
, GET /.well-known/host-meta?depth=unbounded
is successful.
However, on NX-OS 7.0(3)I7(6)
& 9.2(3)
GET /.well-known/host-meta
and GET /.well-known/host-meta?depth=unbounded
both lead to:
HTTP Error 404: Not Found
This is a fundamental issue as this feature must be supported, according to RFC 6415.
Is /.well-known/host-meta
replaced by another URI or is it just not implemented?
@jean-christophe-manciot, I’ve passed this issue on to the NX-OS engineering team responsible for RESTCONF.
NX-OS 9kv 7.0(3)I6(1)
Hello @einarnn I'm having a hard time figuring out the URI(s) which must be used to attain the openconfig resources supported by this device. Using yang-explorer, I can confirm that it does support openconfig:
I can also GET all vendor specific data returned by
http://ip_address/restconf/data/Cisco-NX-OS-device:System?content=config
: Cisco-NX-OS-device:System.ymlBut what URI should I use to GET the openconfig data? I tried all sorts of URIs, including
http://ip_address/restconf/data/Cisco-NX-OS-device:Openconfig?content=config
http://ip_address/restconf/data/Openconfig?content=config
Each time, I receive a
400: Bad Request
.Generally speaking, is there a method to automatically discover the URI of any Yang resource on any Cisco platform?