Skip to content

Restconf API from YANG Model

jensenzhang edited this page Oct 26, 2017 · 1 revision

Restconf API from YANG Model

Subscribe a list of ports to monitor their speed

Request

POST /restconf/operations/alto-bwmonitor:bwmonitor-subscribe HTTP/1.1
Host: alto.example.com:8181
Accept: application/json
Content-type: application/json

{
  "input": {
    "port-id": [
      "openflow1:1",
      "openflow1:2",
      "openflow2:1",
      "openflow3:1"
    ]
  }
}

Response

HTTP/1.1 200 OK
Content-type: application/json

{
  "output": {
    "result": true
  }
}

Read a special port speed

Request

GET /restconf/operational/alto-bwmonitor:speeds/port/openflow1:1 HTTP/1.1
Host: alto.example.com:8181
Accept: application/json

Response

HTTP/1.1 200 OK
Content-type: application/json

{
  "port-id": "openflow1:1",
  "rx-speed": 128000000,
  "tx-speed": 128000000,
  "avail-bw": 9000000,
  "capacity": 10000000
}

Unsubscribe a list of ports

Request

POST /restconf/operations/alto-bwmonitor:bwmonitor-unsubscribe HTTP/1.1
Host: alto.example.com:8181
Accept: application/json
Content-type: application/json

{
  "input": {
    "port-id": [
      "openflow1:1"
    ]
  }
}

Response

HTTP/1.1 200 OK
Content-type: application/json

{
  "output": {
    "result": true
  }
}

Read speeds by a list of ports

Request

POST /restconf/operations/alto-bwmonitor:bwmonitor-query HTTP/1.1
Host: alto.example.com:8181
Accept: application/json
Content-type: application/json

{
  "input": {
    "port-id": [
      "openflow2:1",
      "openflow3:1"
    ]
  }
}

Response

HTTP/1.1 200 OK
Content-type: application/json

{
  "output": {
    "port-speed": [
      {
        "port-id": "openflow2:1",
        "rx-speed": 128000000,
        "tx-speed": 128000,
        "avail-bw": 9000000,
        "capacity": 10000000
      },
      {
        "port-id": "openflow3:1",
        "rx-speed": 0,
        "tx-speed": 0,
        "avail-bw": 1000000,
        "capacity": 10000000
      }
    ]
  }
}