YANG-API protocol published and proposed as new work in the IETF

The YANG-API protocol is a REST-full API to allow WEB application developers to manage networking devices.  It is designed to co-exist with the NETCONF protocol, and other device management access methods such as CLI or WEBui. It was published as an Internet Draft, called draft-bierman-netconf-yang-api-00.txt.

YANG-API

The YANG-API protocol uses HTTP operations to access the server as a hierarchy of conceptual resources. These resources are defined with the YANG data modeling language. The NETCONF protocol and YANG-API protocol use the exact same YANG data modules to define the schema for the message content in each protocol. The actual operations and data format are different in each protocol (e.g., NETCONF <get-config> is like HTTP GET).

YANG-API vs. NETCONF Operations

 YANG-API NETCONF
OPTIONS none
HEAD none
GET get-config, get
POST edit-config (operation=”create”)
PUT edit-config (operation=”replace”)
PATCH edit-config (operation=”merge”)
DELETE edit-config (operation=”delete”)

YANG-API will also allow application developers to access custom <rpc> operations defined in YANG. The HTTP POST operation is used for this purpose. MIME media types are used for different types of conceptual data. For example, an <rpc> operation encoded in JSON is identified with the ContentType of “application/vnd.yang.data+json”.

The following example shows the retrieval of the ‘jukebox’ resource. Note that only 1 depth level is returned by default.

 This example operation would retrieve 2 levels of configuration data
   nodes that exist within the top-level "jukebox" resource.

      GET /yang-api/datastore/jukebox?depth=2 HTTP/1.1
      Host: example.com
      Accept: application/vnd.yang.data+json

   The server might respond:

      HTTP/1.1 200 OK
      Date: Mon, 23 Apr 2012 17:11:30 GMT
      Server: example-server
      Cache-Control: no-cache
      Pragma: no-cache
      Content-Type: application/vnd.yang.data+json

      {
        "jukebox" : {
          "library" : {
            "artist" : {
              "index" : 1,
              "name" : "Foo Fighters"
            }
          },
          "player" : {
            "gap" : 0.5
          }
        }
      }

 

Comments are closed.