Inter-IoT_network API Reference

Network Controller API

API Endpoint
http://192.168.1.8:8080/
Request Content-Types: application/json, application/x-www-form-urlencoded
Response Content-Types: application/json
Schemes: http
Version: 1.0.0

Switches

List Switches

GET /stats/switches

Retrieve the list of all switches within the virtual network.

200 OK

Switches ID list

Switch Basic Description

GET /stats/desc/{id}

Retrieve basic information of the sought switch.

id: integer
in path

Switch ID

200 OK

Switch Info

400 Bad Request

Invalid ID

Flows

Flow information

GET /stats/flow/{id}

Retrieve info about a specific flow in the switch.

id: integer
in path

Switch ID

200 OK

Flow information

Addition of a new flow entry

POST /stats/flowentry/add

Flow entry description

Access-Control-Allow-Origin: string
in header

(no description)

Request Example
{
  "dpid": 1,
  "cookie": 1,
  "cookie_mask": 1,
  "table_id": 0,
  "idle_timeout": 30,
  "hard_timeout": 30,
  "priority": 1111,
  "buffer_id": 1,
  "flags": 1,
  "match": {
    "in_port": "integer",
    "dl_src": "string",
    "dl_dst": "string",
    "dl_type": "string",
    "nw_src": "string",
    "nw_dst": "string",
    "ipv6_src": "string",
    "ipv6_dst": "string",
    "nw_proto": "string",
    "tp_src": "integer",
    "tp_dst": "integer",
    "ip_dscp": "integer"
  },
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}
200 OK

OK

405 Method Not Allowed

Invalid input

Modify flow entry in a switch

POST /stats/flowentry/modify

Flow entry description

Request Example
{
  "dpid": 1,
  "cookie": 1,
  "cookie_mask": 1,
  "table_id": 0,
  "idle_timeout": 30,
  "hard_timeout": 30,
  "priority": 1111,
  "buffer_id": 1,
  "flags": 1,
  "match": {
    "in_port": "integer",
    "dl_src": "string",
    "dl_dst": "string",
    "dl_type": "string",
    "nw_src": "string",
    "nw_dst": "string",
    "ipv6_src": "string",
    "ipv6_dst": "string",
    "nw_proto": "string",
    "tp_src": "integer",
    "tp_dst": "integer",
    "ip_dscp": "integer"
  },
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}
200 OK

OK

405 Method Not Allowed

Invalid input

POST /stats/flowentry/delete

Delete flow entry in a switch

Flow entry deletion

Request Example
{
  "dpid": 1,
  "cookie": 1,
  "cookie_mask": 1,
  "table_id": 0,
  "idle_timeout": 30,
  "hard_timeout": 30,
  "priority": 1111,
  "buffer_id": 1,
  "flags": 1,
  "match": {
    "in_port": "integer",
    "dl_src": "string",
    "dl_dst": "string",
    "dl_type": "string",
    "nw_src": "string",
    "nw_dst": "string",
    "ipv6_src": "string",
    "ipv6_dst": "string",
    "nw_proto": "string",
    "tp_src": "integer",
    "tp_dst": "integer",
    "ip_dscp": "integer"
  },
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}
200 OK

OK

405 Method Not Allowed

Invalid input

Tables

Table information

GET /stats/table/{id}

Retrieve info about a specific table in the switch.

id: integer
in path

Switch ID

200 OK

Table information

Table features information

GET /stats/tablefeatures/{id}

Retrieve info about features of a specific table in the switch.

id: integer
in path

Switch ID

200 OK

Table features information

Ports

Port information

GET /stats/port/{id}

Retrieve info about a specific port in a switch.

id: integer
in path

Switch ID

200 OK

Port information

Port information

GET /stats/port/{id}/{port}

Retrieve info about a specific port in a switch.

id: integer
in path

Switch ID

port: integer
in path

Port ID

200 OK

All Ports information

Modify port description

POST /stats/portdesc/modify

Port description

Request Example
{
  "dpid": 1,
  "port_no": 1,
  "config": 1,
  "mask": 1
}
200 OK

OK

405 Method Not Allowed

Invalid input

Roles

Set a role

POST /stats/role
role: string
in formData

Role

200 OK

OK

405 Method Not Allowed

Invalid input

Queues

Get status of the queue

GET /qos/queue/status/{id}
id: integer
in path

Switch ID

200 OK

Queue status of the switch

type
Response Example (200 OK)
"object"

Retrieve the queue configuration

GET /qos/queue/{id}
id: integer
in path

Queue description

200 OK

Queue description of the switch

type
Response Example (200 OK)
"object"

Set a queue into a port

POST /qos/queue/{id}

Flow information. If OFv1.3 or earlier: 'actions', if OFv1.4 or later: 'instrucions'

id: integer (int64)
in path

Switch ID

Request Example
{
  "dpid": 1,
  "cookie": 1,
  "cookie_mask": 1,
  "table_id": 0,
  "idle_timeout": 30,
  "hard_timeout": 30,
  "priority": 1111,
  "buffer_id": 1,
  "flags": 1,
  "match": {
    "in_port": "integer",
    "dl_src": "string",
    "dl_dst": "string",
    "dl_type": "string",
    "nw_src": "string",
    "nw_dst": "string",
    "ipv6_src": "string",
    "ipv6_dst": "string",
    "nw_proto": "string",
    "tp_src": "integer",
    "tp_dst": "integer",
    "ip_dscp": "integer"
  },
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}
200 OK

Flow Info

400 Bad Request

Invalid ID

404 Not Found

Not found

405 Method Not Allowed

Invalid Input

Delete the configuration of a queue

DELETE /qos/queue/{id}
id: integer
in path

(no description)

200 OK

OK

Rules

Retrieve the rules configuration

GET /qos/rule/{id}
id: integer
in path

Rule Configuration

200 OK

Rule configuration

type
Response Example (200 OK)
"object"

POST /qos/rule/{id}

undefined

id: integer
in path

(no description)

Request Example
{
  "priority": "integer",
  "match": [
    {
      "in_port": "integer",
      "dl_src": "string",
      "dl_dst": "string",
      "dl_type": "string",
      "nw_src": "string",
      "nw_dst": "string",
      "ipv6_src": "string",
      "ipv6_dst": "string",
      "nw_proto": "string",
      "tp_src": "integer",
      "tp_dst": "integer",
      "ip_dscp": "integer"
    }
  ],
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}
200 OK

OK. Qos ID generated

type
integer
Response Example (200 OK)
"integer"

Delete a Qos Rule

DELETE /qos/rule/{id}
id: integer
in path

Switch ID

rule_id: integer integer, all
in formData

integer || all

200 OK

OK

Meters

Retrieve the meters configuration

GET /qos/meter/{id}
id: integer
in path

Meter Configuration

200 OK

Meter configuration

type
Response Example (200 OK)
"object"

POST /qos/meter/{id}

Meter

id: integer
in path

switch ID

Request Example
{
  "meter_id": "integer",
  "bands": {
    "action": "string",
    "flag": "string",
    "burst_size": "integer",
    "rate": "integer",
    "prec_level": "integer"
  }
}
200 OK

OK

Delete a Qos Meter

DELETE /qos/meter/{id}
id: integer
in path

Switch ID

meter_id: integer
in formData

Meter ID

200 OK

OK

Schema Definitions

portdesc: object

dpid: integer
port_no: integer 0
config: integer 0
mask: integer 0
Example
{
  "dpid": 1,
  "port_no": 1,
  "config": 1,
  "mask": 1
}

flowentry: object

dpid: integer
cookie: integer
cookie_mask: integer
table_id: integer
idle_timeout: integer
hard_timeout: integer
priority: integer 0 ≤ x ≤ 65533
buffer_id: integer
flags: integer
match: match
actions: action
action
Example
{
  "dpid": 1,
  "cookie": 1,
  "cookie_mask": 1,
  "table_id": 0,
  "idle_timeout": 30,
  "hard_timeout": 30,
  "priority": 1111,
  "buffer_id": 1,
  "flags": 1,
  "match": {
    "in_port": "integer",
    "dl_src": "string",
    "dl_dst": "string",
    "dl_type": "string",
    "nw_src": "string",
    "nw_dst": "string",
    "ipv6_src": "string",
    "ipv6_dst": "string",
    "nw_proto": "string",
    "tp_src": "integer",
    "tp_dst": "integer",
    "ip_dscp": "integer"
  },
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}

queue: object

port_name: string OFPP_ANY

Name of the port

type: string linux-htb, linux-other

linux-htb or linux-other

max_rate: integer

Bandwith max rate of the queue in bps

queues: object
max_rate: integer

Maximum rate of the queue

min_rate: integer

Minimum rate of the queue

Example
{
  "port_name": "eth1",
  "type": "string",
  "max_rate": "integer",
  "queues": {
    "max_rate": "integer",
    "min_rate": "integer"
  }
}

rule: object

priority: integer 0 ≤ x ≤ 65533 1

Priority of the rule between 0 and 65533. When 'priority' has not been set up, priority: 1' is set

match: match
match
actions: action
action
Example
{
  "priority": "integer",
  "match": [
    {
      "in_port": "integer",
      "dl_src": "string",
      "dl_dst": "string",
      "dl_type": "string",
      "nw_src": "string",
      "nw_dst": "string",
      "ipv6_src": "string",
      "ipv6_dst": "string",
      "nw_proto": "string",
      "tp_src": "integer",
      "tp_dst": "integer",
      "ip_dscp": "integer"
    }
  ],
  "actions": [
    [
      {
        "mark": "integer",
        "meter": "integer",
        "queue": "integer"
      }
    ]
  ]
}

match: object

in_port: integer 0 ≤ x ≤ 65535
dl_src: string

xx:xx:xx:xx:xx:xx

dl_dst: string

xx:xx:xx:xx:xx:xx

dl_type: string ARP, IPv4, IPv6
nw_src: string

<A.B.C.D/M>

nw_dst: string

<A.B.C.D/M>

ipv6_src: string

xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/M

ipv6_dst: string

xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/M

nw_proto: string TCP, UDP, IPCM, IPCMv6
tp_src: integer 0 ≤ x ≤ 65535
tp_dst: integer 0 ≤ x ≤ 65535
ip_dscp: integer 0 ≤ x ≤ 63
Example
{
  "in_port": "integer",
  "dl_src": "string",
  "dl_dst": "string",
  "dl_type": "string",
  "nw_src": "string",
  "nw_dst": "string",
  "ipv6_src": "string",
  "ipv6_dst": "string",
  "nw_proto": "string",
  "tp_src": "integer",
  "tp_dst": "integer",
  "ip_dscp": "integer"
}

action: array

:

object
mark: integer 0 ≤ x ≤ 63

, sets the IPv4 ToS/DSCP field to tos.

meter: integer

meter ID, apply meter entry

queue: integer

queue ID, register queue specified by queue-id

Example
[
  {
    "mark": "integer",
    "meter": "integer",
    "queue": "integer"
  }
]

meter: object

Meters declaration. The parameters specified in the bands depend on the flag type.

meter_id: integer
bands: object
action: string DROP, DSCP_REMARK
flag: string KBPS, PKTPS, BURST, STATS
burst_size: integer
rate: integer
prec_level: integer

Number of drop precedence level to add

Example
{
  "meter_id": "integer",
  "bands": {
    "action": "string",
    "flag": "string",
    "burst_size": "integer",
    "rate": "integer",
    "prec_level": "integer"
  }
}