cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
14448
Views
27
Helpful
7
Replies

Difference between REST and RESTCONF

mmalysz
Cisco Employee
Cisco Employee

What is the difference between REST and RESTCONF.

According to NSO NB Guide:

REST API:

It tries to follow the RESTCONF Internet Draft [draft-ietf-netconf-restconf] but since it predates the creation of RESTCONF, a number of differences exists.

RESTCONF API:

RESTCONF is a HTTP based protocol, very similar to the NSO REST API. The NSO implementation of RESTCONF is based on the Internet-Draft named: draft-ietf-netconf-restconf-17.

Regards.

1 Accepted Solution

Accepted Solutions

rogaglia
Cisco Employee
Cisco Employee

Hi,

I would say that one main difference is that RESTCONF is fully standard compatible now, while our traditional REST interface is proprietary.

This means that a northbound system could eventually develop a generic RESTCONF interface and use it against NSO and other RESTCONF-compatible systems. This could be a big cost saving opportunity.

On the other side, as you follow the RESTCONF standard, you will have less freedom to innovate new features that may come up.

Roque

View solution in original post

7 Replies 7

alam.bilal
Cisco Employee
Cisco Employee

APIs are autogenerated in NSO from the YANG models. For REST API, the intention was to keep as close to the RESTCONF draft to avoid any major restructure further down the track when RESTCONF solidifies.

Now that RESTCONF is more concrete, NSO team has decided to support it. That is auto-generate APIs are as per RESTCONF conventions.

NSO now supports both the REST API  - as customers are using it, for backward compatibility reasons and also RESTCONF which is recommended when building new interfacing with service-packages in NSO.

The difference between the two appear to cosmetic. For example, an element in a list is referred to as:

REST: /api/running/devices/device/c0

RESTCONF /restconf/data/devices/device=c0

When running actions:

RESTCONF /restconf/operations/devices/device=c0/sync-from

Slight differences in the HTTP headers used (Content-Type, etc).

When I try these (on my 4.7.2 system), I get

 

kjr$ curl -u admin:admin 'http://127.0.0.1:8080/api/running/devices/device/ce0'

<device xmlns="http://tail-f.com/ns/ncs" xmlns:y="http://tail-f.com/ns/rest" xmlns:ncs="http://tail-f.com/ns/ncs">
<name>ce0</name>

<<< SNIP >>>

 

So REST works fine, but when I try

kjr$ curl -u admin:admin 'http://127.0.0.1:8080/restconf/data/devices/device=c0'
<!DOCTYPE html>
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>Not Found</h1>
The requested URL /restconf/data/devices/device=c0 was not found on this server.
<hr>
<address> Server at localhost:8080 </address>
</body>

 

What am I doing wrong?

 

Turns out the solution was simple - restconf was not enabled in my ncs.conf - newbie error :-)

Just to add on running actions with Restconf, as I didn't find any other references around. Here is an example on the url to run an action created under a service with Restconf:

http://{{nso-ip}}:{{nso-port}}/restconf/data/services/bb-ipm:bb-ipm-action/search-internet-package

While in REST looks like:

http://{{nso-ip}}:{{nso-port}}/api/running/services/bb-ipm:bb-ipm-action/_operations/search-internet-package

rogaglia
Cisco Employee
Cisco Employee

Hi,

I would say that one main difference is that RESTCONF is fully standard compatible now, while our traditional REST interface is proprietary.

This means that a northbound system could eventually develop a generic RESTCONF interface and use it against NSO and other RESTCONF-compatible systems. This could be a big cost saving opportunity.

On the other side, as you follow the RESTCONF standard, you will have less freedom to innovate new features that may come up.

Roque

RESTCONF API for the time being is based on draft-ietf-netconf-restconf-17 (according to NSO NB Guide)

However https://tools.ietf.org/rfc/rfc8040.txt  was approved earlier in 2017.

Which version of NSO will be fully alligned to RFC 8040?

Maciej,

The RFP is based on v18 of the draft with just small differences from v17 (which the API is based):

v17 to v18

  o addressed IESG review comments and clarifications

  o addressed Alexey's DISCUSS items

  o made Cache-Control MUST support, not SHOULD support

  o add example for PUT on a datastore

  o add IANA section for "restconf" URN sub-namespace

  o clarify media type file extensions

Roque

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: