Page MenuHomeVyOS Platform

Add openconfig RESTCONF API
Open, NormalPublicFEATURE REQUEST

Description

Add openconfig RESTCONF compatible API based on the YANG model.

Example of endpoints by YANG module openconfig-interfaces

http://localhost:5000/restconf/data/openconfig-interfaces:interfaces
http://localhost:5000/restconf/data/openconfig-interfaces:interfaces/interface=eth0
http://localhost:5000/restconf/data/openconfig-interfaces:interfaces/interface=eth0/state/counters
http://localhost:5000/restconf/data/openconfig-interfaces:interfaces/interface=eth0/state/mtu

YANG model interfaces

/opt/openconfig/yang_modules # pyang openconfig-interfaces.yang -f tree --tree-depth=5
module: openconfig-interfaces
  +--rw interfaces
     +--rw interface* [name]
        +--rw name             -> ../config/name
        +--rw config
        |  +--rw name?            string
        |  +--rw type             identityref
        |  +--rw mtu?             uint16
        |  +--rw loopback-mode?   oc-opt-types:loopback-mode-type
        |  +--rw description?     string
        |  +--rw enabled?         boolean
        +--ro state
        |  +--ro name?            string
        |  +--ro type             identityref
        |  +--ro mtu?             uint16
        |  +--ro loopback-mode?   oc-opt-types:loopback-mode-type
        |  +--ro description?     string
        |  +--ro enabled?         boolean
        |  +--ro ifindex?         uint32
        |  +--ro admin-status     enumeration
        |  +--ro oper-status      enumeration
        |  +--ro last-change?     oc-types:timeticks64
        |  +--ro logical?         boolean
        |  +--ro management?      boolean
        |  +--ro cpu?             boolean
        |  +--ro counters
        |     +--ro in-octets?             oc-yang:counter64
        |     +--ro in-pkts?               oc-yang:counter64
        |     +--ro in-unicast-pkts?       oc-yang:counter64
        |     +--ro in-broadcast-pkts?     oc-yang:counter64
        |     +--ro in-multicast-pkts?     oc-yang:counter64
        |     +--ro in-errors?             oc-yang:counter64
        |     +--ro in-discards?           oc-yang:counter64
        |     +--ro out-octets?            oc-yang:counter64
        |     +--ro out-pkts?              oc-yang:counter64
        |     +--ro out-unicast-pkts?      oc-yang:counter64
        |     +--ro out-broadcast-pkts?    oc-yang:counter64
        |     +--ro out-multicast-pkts?    oc-yang:counter64
        |     +--ro out-discards?          oc-yang:counter64
        |     +--ro out-errors?            oc-yang:counter64
        |     +--ro last-clear?            oc-types:timeticks64
        |     +--ro in-unknown-protos?     oc-yang:counter64
        |     +--ro in-fcs-errors?         oc-yang:counter64
        |     +--ro carrier-transitions?   oc-yang:counter64
        |     +--ro resets?                oc-yang:counter64
        +--rw hold-time
        |  +--rw config
        |  |  +--rw up?     uint32
        |  |  +--rw down?   uint32
        |  +--ro state
        |     +--ro up?     uint32
        |     +--ro down?   uint32
        +--rw subinterfaces
           +--rw subinterface* [index]
              +--rw index     -> ../config/index
              +--rw config
              |     ...
              +--ro state
                    ...
/opt/openconfig/yang_modules #

Expected example of response

sever@sever:~$ curl http://localhost:5000/restconf/data/openconfig-interfaces:interfaces
{
    "openconfig-interfaces:interfaces": {
        "interface": [
            {
                "name": "eth0",
                "config": {
                    "name": "eth0",
                    "mtu": 1504,
                    "description": "WAN interface",
                    "enabled": true
                }
            },
       ...
        ]
    }
}

The API MUST be written with the RFC 8040 specification.

The PoC https://github.com/sever-sever/openconfig-restconf-api

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Related Objects

StatusSubtypeAssignedTask
OpenFEATURE REQUESTNone
OpenFEATURE REQUESTNone

Event Timeline

dmbaturin triaged this task as Normal priority.Jan 9 2024, 6:07 PM
dmbaturin edited projects, added VyOS Rolling; removed Restricted Project.Mon, Oct 14, 9:15 AM
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin changed Issue type from Unspecified (please specify) to Feature (new functionality).