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
0
votes
0 answers

Unable to get data using requests.get while it works with curl

Im trying to get response using RESTCONF. When i use CURL as: curl -X GET -H "Accept: application/yang-data+json" -H "Content-Type: application/yang-data+json" -k https://user:pass@IP/api/data/switch:opm/port={1,2} I get output perfectly…
dem
  • 29
  • 1
  • 7
0
votes
1 answer

RESTCONF/Yangdata endpoints not working properly with URL encoding

Lets take this URL for example https:///restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1 If i send a request to a similar endpoint using the internal library we've been using the server doesn't understand it since the = is…
Akash
  • 331
  • 1
  • 2
  • 6
0
votes
1 answer

Sort and count words in xml output python script

I'm trying to sort and count every word from the output of the i.find().text command, but I can't find a way to do it without hardcoded filter words in the array. Used strings: from xml.etree import ElementTree as ET root =…
jamreg
  • 9
  • 6
0
votes
2 answers

How activate OSPF in a router Cisco-IOS-XE using RESTCONF?

I'm trying to activate OSPF routing protocol in a router using a python script with restconf. I send the request to this url https://(router ip)/restconf/data/Cisco-IOS-XE-ospf-native-router:10 but i get this return message: { …
0
votes
1 answer

How to get the specific child element from the parent in restconf

How to get the specific child element from the the parent in restconf, but at the same time to get all the parent's child in restconf? for example: my module module system{ leaf name{ type string; } leaf version{ type string; …
Shira E
  • 25
  • 5
0
votes
1 answer

ODL - Toaster example - DataTreeChangeListener - Can I intercept GETs/READs?

I have been following the steps for the "Toaster" example for OpenDaylight. At https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Toaster_Step-By-Step#Part_3:_Add_some_configuration_data_-_My_toast_is_too_light.21 - I can use…
JohnK
  • 318
  • 3
  • 11
0
votes
0 answers

RESTconf Operations with curl

I am trying to do GET, DELETE and PUT operations on a OpenDaylight Database. On my ubuntu 14.04 with OpenDaylight 3.0.3, I used curl out of the terminal: GET works pretty well with curl -u admin:admin -X GET…
SiSc
  • 163
  • 9
0
votes
0 answers

How to exclude module name in leaf value of Identityref during ODL validation?

I have YANG model and JSON object which will be verified by ODL (see bellow). I need to exclude module name from JSON to verify. When I exclude module name from identityref ("type": "center-car-sale-type:sedan") and send only identityref name…
0
votes
1 answer

Accessing Individual leaf in leaf in list of yang

I want to access value of leaf of list in yang module? Ex module abc { list xyz{ key a; leaf a{ type int }, leaf b{ type string }, leaf c{ type string …
0
votes
1 answer

Does OpenDaylight RESTCONF support HTTP PUT or POST methods?

I am using opendaylight(oxygen) as a controller connecting to openvswitch(2.9.0) on ubuntu(18.40). I was trying to add flow to OVS by DLUX-Yangman, but I found that there is only a Get method to choose, no Put, Post, or Delete. Currently, I have…
0
votes
2 answers

How to configure swagger UI of Restconf in Opendaylight

Recently, I updated ODL project from Boron to Carbon. Before when I open one API in the UI, those details defined in Yang model of each rpc wasn't showed in "Response Class". After the upgrade, all the details are showed up, which takes time to…
HAO
  • 85
  • 8
0
votes
1 answer

yang path expressions to refer to data nodes and schema nodes etc

consider the following yang module module mod { yang-version 1; namespace "http://example.com/mod"; prefix m; revision "2016-09-09" { description "Initial revision."; } container foo { description 'container…
user19937
  • 587
  • 1
  • 7
  • 25
0
votes
1 answer

Adding Flows to push MPLS via RESTCONF API of ODL controller

I'm a beginner in SDN and ODL and I am trying to add OpenFlow flows to OVS switches in mininet but the flows are not being reflected when I check the packets in Wireshark. Here's my scenario. 3 switches with a linear topology and 3 hosts connected:…
Bilal
  • 1
  • 3
-1
votes
1 answer

I need to get some information form the cisco device. It is cisco-ios-xe device

I have a CISCO device. The device is configured with the WebUI. Which have many details? But I am not able to get these following details from there. CPU Load Temperature Device details. Memory use Alarms I have tried many times to get those above…
Anshu
  • 1,277
  • 2
  • 13
  • 28
-1
votes
1 answer

AWS authentication failed using HTTPS request

I'm deploying CSR 1000v on an EC2 instance in AWS. This is my python code for authentication in order to use RESTCONF which is already enabled in the router. import requests import pprint from aws_requests_auth.aws_auth import AWSRequestsAuth def…
1
2