Questions tagged [ietf-restconf]

RESTCONF is an HTTP (RFC7230) based protocol for configuring data defined in YANG (RFC6020/RFC7950) using the datastore concepts defined in NETCONF (RFC6241). Use this tag for questions related to the RESTCONF protocol and tools that leverage it.

RESTCONF is a protocol that closely relates to NETCONF protocol and YANG data modeling language. It has been developed by the same IETF workgroup that developed NETCONF and was published as RFC8040 in January 2017.

NETCONF defines configuration datastores and a set of Create, Retrieve, Update, Delete (CRUD) operations that can be used to access these datastores. You can learn more about it by reading its tag wiki - ietf-netconf. The YANG language defines the syntax and semantics of datastore content, configuration, state data, RPC operations, and event notifications. Learn more about the latter by reading its tag wiki - ietf-netmod-yang.

RESTCONF uses HTTP methods to provide CRUD operations on a conceptual datastore containing YANG-defined data, which is compatible with a server which implements NETCONF datastores.

Configuration data and state data are exposed as resources that can be retrieved with the GET method. Resources representing configuration data can be modified with the DELETE, PATCH, POST, and PUT methods. Data is encoded with either XML (W3C.REC-xml-20081126) or JSON (RFC7159).

Data-model specific RPC operations defined with the YANG "rpc" or "action" statements can be invoked with the POST method. Data-model specific event notifications defined with the YANG "notification" statement can be accessed.

Here are a couple of examples of communication via RESTCONF (request-response pairs):

GET /restconf/data/ietf-restconf-monitoring:restconf-state/
    capabilities  HTTP/1.1
Host: example.com
Accept: application/yang-data+xml

HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:02:00 GMT
Server: example-server
Cache-Control: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang-data+xml

<capabilities
    xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
 <capability>
  urn:ietf:params:restconf:capability:defaults:1.0?
     basic-mode=explicit
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:with-defaults:1.0
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:depth:1.0
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:fields:1.0
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:filter:1.0
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:start-time:1.0
 </capability>
 <capability>
  urn:ietf:params:restconf:capability:stop-time:1.0
 </capability>
 <capability>
  http://example.com/capabilities/myparam
 </capability>
</capabilities>
POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1
Host: example.com
Content-Type: application/yang-data+json

{
  "example-jukebox:artist" : {
    "name" : "Foo Fighters"
  }
}

HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 17:02:00 GMT
Server: example-server
Location: https://example.com/restconf/data/
   example-jukebox:jukebox/library/artist=Foo%20Fighters
Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT
ETag: "b3830f23a4c"

Learn more by reading:

30 questions
2
votes
2 answers

Is there a default media type for GET and other methods

Is there any default media type when the query is not specified with any supported media types in RESTCONF ?
Suma
  • 241
  • 1
  • 2
  • 12
1
vote
1 answer

How to connect to cisco CSR1000 restconf

I am learning restconf on CISCO router CSR1000v on GNS3 emulator. Am trying to authenticate with the router using below command curl -k https://192.168.1.102/restconf/ -u "admin:admin" -v But the connection is being refused, and giving below…
Alexander
  • 99
  • 7
1
vote
4 answers

Modifying a config in Opendaylight

I am needing to modify my Openflow configurations in my Opendaylight (0.11.x sodium) system. I follow the documentation which has helped guide is in creating new configs deleting configs replacing configs but I am not seeing an example or…
E.S.
  • 2,733
  • 6
  • 36
  • 71
1
vote
0 answers

NETCONF vs RESTCONF Vs gRPC

For network automation, I see that NETCONF, RESTCONF and gRPC are available. Can someone tell me which one should be chosen for a typical router and respective use cases. Can you please share the known issues or challenges with respective approach…
Brema
  • 43
  • 1
  • 1
  • 6
1
vote
1 answer

Add data if 'config false' YANG

Can i sent POST(not PUT or PATCH) command if the config statement is false? How? module system { namespace "system:uri"; prefix "sys"; leaf id { config false; type string; } } It's possible to define the leaf as a read-only in…
1
vote
1 answer

Non readable - YANG

There is a way to define non readable data in yang? module system{ leaf name{ type string; } leaf password{ type string; } } So in this case 'password' is the non readable data.
Shira E
  • 25
  • 5
1
vote
0 answers

Using postman to access OpenDaylight's REStconf API and configure a YANG Module sitting on a NETCONF Server

I am running OpenDaylight Neon with Postman 7.2.0. I have a NETCONF server sitting on a netopeer2 Docker. Since I can get the operational datastore of the server with GET…
SiSc
  • 163
  • 9
1
vote
0 answers

Is it legal to POST/PUT/PATCH list and leaf-list in RESTCONF?

This is a follow-up question of this post. From @predi's answer I know that it is legal to GET a URL whose target resource is a list or leaf-list and DELETE can't use such URL. That is to say, given the following YANG definitions: list machine { …
password636
  • 981
  • 1
  • 7
  • 18
1
vote
1 answer

relative path of an xpath expression inside a YANG list

I have the following YANG model: list machines { key "name"; leaf "name" { type string; } leaf link { type leafref { …
password636
  • 981
  • 1
  • 7
  • 18
1
vote
0 answers

JSON encoding of payload to RESTCONF server for multiple resources creation

Is it possible to send a single request of creating multiple resources at the top-level to a RESTCONF server? For example, consider the following YANG module: module example-foomod { namespace "http://example.com/foomod"; prefix "foomod"; …
password636
  • 981
  • 1
  • 7
  • 18
1
vote
1 answer

How to update configurations on a NETCONF enabled device?

My device yang is as shown below - module router { yang-version 1; namespace "urn:sdnhub:odl:tutorial:router"; prefix router; description "Router configuration"; revision "2015-07-28" { description "Initial version."; …
1
vote
1 answer

What is Restconf in opendaylight?

I am beginner in field of opendaylight and mininet. I want to know about restconf and rest.
A_Gupta
  • 87
  • 9
1
vote
1 answer

accessing a specific leaf-list entry using yang restconf

It is clear to me how to refer to a list item (restconf draft) but it is not clear how to refer to a specific leaf-list entry. For example, given the following definition: module x { container y { leaf-list z; } } and if I have the…
user19937
  • 587
  • 1
  • 7
  • 25
0
votes
0 answers

Add meter to Openflow node in Opendaylight

I am trying to add a meter over rest in Opendaylight to configure the bandwidth of a particular flow entry. I am not able to do this at this time. I do not know what the problem is. Is it the node below that I have specified incorrectly? I am using…
Herms
  • 1
  • 2
0
votes
1 answer

RestConf in Cisco Device uri Keypath not found for /ip/prefix-lists/prefixes/name

I am trying to execute below restconf API Get Request and getting error "uri keypath not found". The Path is present in Yang module https:///restconf/data/Cisco-IOS-XE-native:native/ip/prefix-lists/prefixes/name --- Response { …
Alok Kumar
  • 49
  • 10
1
2