Datapaths

Sample request 

List all datapaths:

GET /sdn/v2.0/of/datapaths

There is no request body for this API.

Sample response 

{
   "datapaths":[
      {
         "capabilities":[
            "flow_stats",
            "table_stats",
            "port_stats",
            "group_stats",
            "port_blocked"
         ],
         "device_ip":"140.1.1.1",
         "device_port":62075,
         "dpid":"00:64:74:46:a0:ff:07:00",
         "last_message":"2013-10-16T23:54:35.576Z",
         "negotiated_version":"1.3.0",
         "num_buffers":0,
         "num_tables":3,
         "ready":"2013-10-16T21:17:02.652Z"
      }
   ]
}

Response codes 

Datapaths/{dpid}

Sample request 

Get a datapath by its dpid:

GET /sdn/v2.0/of/datapaths/{dpid}

There is no request body for this API.

Sample response 

{
   "datapath":{
      "capabilities":[
         "flow_stats",
         "table_stats",
         "port_stats",
         "group_stats",
         "port_blocked"
      ],
      "device_ip":"140.1.1.1",
      "device_port":62075,
      "dpid":"00:64:74:46:a0:ff:07:00",
      "last_message":"2013-10-16T23:55:27.598Z",
      "negotiated_version":"1.3.0",
      "num_buffers":0,
      "num_tables":3,
      "ready":"2013-10-16T21:17:02.652Z"
   }
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/controllers

Sample request 

List controllers and their roles on the datapath with the given dpid:

GET /sdn/v2.0/of/datapaths/{dpid}/controllers

There is no request body for this API.

Sample response 

{
   "controllers":{
      "master":"192.168.0.1",
      "slaves":[
         "192.168.0.2",
         "192.168.0.3"
      ]
   }
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/features/meter

Sample request 

List meter features for given datapath:

GET /sdn/v2.0/of/datapaths/{dpid}/features/meter

There is no request body for this API.

Sample response 

{
   "meter_features":{
      "flags":[
         "kbps",
         "pktps",
         "stats"
      ],
      "max_bands_per_meter":2,
      "max_color_value":8,
      "max_meters":126,
      "types":[
         "drop"
      ]
   },
   "version":"1.3.0"
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/features/group

Sample request 

List group features for given datapath:

GET /sdn/v2.0/of/datapaths/{dpid}/features/group

There is no request body for this API.

Sample response 

{
   "group_features":{
      "actions":[
         {
            "all":[
               "output"
            ]
         },
         {
            "select":[
               "output"
            ]
         }
      ],
      "capabilities":[
         "select_liveness"
      ],
      "max_groups":[
         {
            "all":32
         },
         {
            "select":32
         }
      ],
      "types":[
         "all",
         "select"
      ]
   },
   "version":"1.3.0"
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/ports

Sample request 

List all ports for the given dpid:

GET /sdn/v2.0/of/datapaths/{dpid}/ports

There is no request body for this API.

Sample response 

{
    "ports": [
        {
            "advertised_features": [], 
            "config": [], 
            "current_features": [
                "rate_1gb_fd", 
                "rate_1tb_fd"
            ], 
            "current_speed": 3567587328, 
            "id": 23, 
            "mac": "74:46:a0:ff:07:29", 
            "max_speed": 3567587328, 
            "name": "23", 
            "peer_features": [], 
            "state": [
                "live"
            ], 
            "supported_features": [
                "rate_10mb_hd", 
                "rate_10mb_fd", 
                "rate_100mb_hd", 
                "rate_100mb_fd", 
                "rate_1gb_fd", 
                "rate_1tb_fd"
            ]
        }, 
        {
            "advertised_features": [], 
            "config": [], 
            "current_features": [
                "rate_1gb_fd", 
                "rate_1tb_fd"
            ], 
            "current_speed": 3567587328, 
            "id": 24, 
            "mac": "74:46:a0:ff:07:28", 
            "max_speed": 3567587328, 
            "name": "24", 
            "peer_features": [], 
            "state": [
                "live"
            ], 
            "supported_features": [
                "rate_10mb_hd", 
                "rate_10mb_fd", 
                "rate_100mb_hd", 
                "rate_100mb_fd", 
                "rate_1gb_fd", 
                "rate_1tb_fd"
            ]
        }, 
        {
            "advertised_features": [], 
            "config": [], 
            "current_features": [], 
            "id": "LOCAL", 
            "mac": "74:46:a0:ff:07:00", 
            "name": "local", 
            "peer_features": [], 
            "state": [], 
            "supported_features": []
        }
    ], 
    "version": "1.3.0"
} 

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/ports/{port id}

Sample request 

Get a port:

GET /sdn/v2.0/datapaths/{dpid}/ports/{port id}

Sample response 

The response includes port statistics grouped by datapaths.

{
    "port": {
        "advertised_features": [], 
        "config": [], 
        "current_features": [
            "rate_1gb_fd", 
            "rate_1tb_fd"
        ], 
        "current_speed": 3567587328, 
        "id": 23, 
        "mac": "74:46:a0:ff:07:29", 
        "max_speed": 3567587328, 
        "name": "23", 
        "peer_features": [], 
        "state": [
            "live"
        ], 
        "supported_features": [
            "rate_10mb_hd", 
            "rate_10mb_fd", 
            "rate_100mb_hd", 
            "rate_100mb_fd", 
            "rate_1gb_fd", 
            "rate_1tb_fd"
        ]
    }, 
    "version": "1.3.0"
} 

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/ports/{port id}/action

This API is asynchronous.

Sample request 

Enable port (request body has "enable" text):

POST /sdn/v2.0/datapaths/{dpid}/ports/{port id}/action

Disable port (request body has "disable" text):

POST /sdn/v2.0/datapaths/{dpid}/ports/{port id}/action

Sample response 

There is no sample response data.

Location header: /sdn/v2.0/datapaths/{dpid}/ports/{port id}

Response codes 

  • Normal: Accepted (202)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/meters

List meters

Sample request 

List all meters:

GET /sdn/v2.0/of/datapaths/{dpid}/meters

There is no request body.

Sample response 

{
    "meters": [
        {
            "bands": [
                {
                    "burst_size": 1000, 
                    "mtype": "drop", 
                    "rate": 1500
                }, 
                {
                    "burst_size": 1000, 
                    "mtype": "dscp_remark", 
                    "prec_level": 1, 
                    "rate": 100
                }
            ], 
            "flags": [
                "kbps", 
                "burst", 
                "stats"
            ], 
            "id": 1
        }
    ], 
    "version": "1.3.0"
} 

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Create meter

Sample request 

Create a meter with the given id:

POST /sdn/v2.0/of/datapaths/{dpid}/meters

Sample request body:

{
    "version": "1.3.0",
    "meter": {
        "id": 1, 
        "command": "add", 
        "flags": [
            "kbps",
            "burst",
            "stats"
        ],
        "bands": [
            {
                "burst_size": 1000,
                "rate": 1500,
                "mtype": "drop"
            },
            {
                "burst_size": 1000,
                "rate": 100,
                "mtype": "dscp_remark",
                "prec_level": 1
            }
        ]
    }
} 

Sample response 

{
    "meter": {
        "bands": [
            {
                "burst_size": 1000, 
                "mtype": "drop", 
                "rate": 1500
            }, 
            {
                "burst_size": 1000, 
                "mtype": "dscp_remark", 
                "prec_level": 1, 
                "rate": 100
            }
        ], 
        "flags": [
            "kbps", 
            "burst", 
            "stats"
        ], 
        "id": 1
    }, 
    "version": "1.3.0"
} 

Location header: /sdn/v2.0/of/datapaths/{dpid}/meters/{meter_id}

Response codes 

  • Normal: Created (201)

  • Error: Bad Request (400), Unauthorized (401), Service Unavailable (503)

Datapaths/{dpid}/meters/{meter id}

Get meter info

Sample request 

Get a meter by its ID:

GET /sdn/v2.0/of/datapaths/{dpid}/meters/{meter_id}

There is no request body.

Sample response 

{
    "meter": {
        "bands": [
            {
                "burst_size": 1000, 
                "mtype": "drop", 
                "rate": 1500
            }, 
            {
                "burst_size": 1000, 
                "mtype": "dscp_remark", 
                "prec_level": 1, 
                "rate": 100
            }
        ], 
        "flags": [
            "kbps", 
            "burst", 
            "stats"
        ], 
        "id": 1
    }, 
    "version": "1.3.0"
} 

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Update meter

Sample request 

Update a meter with the given id:

PUT /sdn/v2.0/of/datapaths/{dpid}/meters/{meter_id}

Sample request body:

{
   "version":"1.3.0",
   "meter":{
      "id":1,
      "command":"modify",
      "flags":[
         "kbps",
         "burst",
         "stats"
      ],
      "bands":[
         {
            "burst_size":1000,
            "rate":1500,
            "mtype":"drop"
         },
         {
            "burst_size":2000,
            "rate":200,
            "mtype":"dscp_remark",
            "prec_level":1
         }
      ]
   }
}

Sample response 

{
    "meter": {
        "bands": [
            {
                "burst_size": 1000, 
                "mtype": "drop", 
                "rate": 1500
            }, 
            {
                "burst_size": 2000, 
                "mtype": "dscp_remark", 
                "prec_level": 1, 
                "rate": 200
            }
        ], 
        "flags": [
            "kbps", 
            "burst", 
            "stats"
        ], 
        "id": 1
    }, 
    "version": "1.3.0"
}

Response codes 

  • Normal: OK (200)

  • Error: Bad Request (400), Unauthorized (401), Service Unavailable (503)

Delete meter

Sample request 

Delete a meter with the given id:

DELETE /sdn/v2.0/of/datapaths/{dpid}/meters/{meter_id}

There is no request body.

Sample response 

There is no response body.

Response codes 

  • Normal: No Content (204)

  • Error: Unauthorized (401), Service Unavailable (503)

Datapaths/{dpid}/flows

List flows

Sample request 

List flows:

GET /sdn/v2.0/of/datapaths/{dpid}/flows

List flows for a given table_id:

GET /sdn/v2.0/of/datapaths/{dpid}/flows?table_id=200

There is no request body.

Sample response 

{
    "flows": [
        {
            "byte_count": 0, 
            "cookie": "0xffff000000000000", 
            "duration_nsec": 488000000, 
            "duration_sec": 10019, 
            "flow_mod_flags": [
                "send_flow_rem"
            ], 
            "hard_timeout": 0, 
            "idle_timeout": 0, 
            "instructions": [
                {
                    "apply_actions": [
                        {
                            "output": "CONTROLLER"
                        }
                    ]
                }
            ], 
            "match": [], 
            "packet_count": 0, 
            "priority": 0, 
            "table_id": 200
        }
    ], 
    "version": "1.3.0"
} 

Response codes 

  • Normal: OK (200)

  • Error: Bad Request (400), Unauthorized (401), Not Found (404), Service Unavailable (503)

Add a flow

Sample request 

Add a flow:

POST /sdn/v2.0/of/datapaths/{dpid}/flows

Sample request: 

{
   "flow":{
      "priority":30000,
      "table_id":200,
      "idle_timeout":60,
      "match":[
         {
            "ipv4_src":"10.0.0.1"
         },
         {
            "ipv4_dst":"10.0.0.22"
         },
         {
            "ip_proto":"tcp"
         },
         {
            "eth_type":"ipv4"
         },
         {
            "tcp_dst":"80"
         }
      ],
      "instructions":[
         {
            "apply_actions":[
               {
                  "output":1
               }
            ]
         }
      ]
   }
}

Sample response 

There is no response data.

Location header: /sdn/v2.0/of/datapaths/{dpid}/flows

Response codes 

  • Normal: Created (201)

  • Error: Bad Request (400), Unauthorized (401), Not Found (404), Service Unavailable (503)

Update a flow

Sample request 

Update a flow:

PUT /sdn/v2.0/of/datapaths/{dpid}/flows

Refer to sample request in flow create. However, if the given flow match and priority are not found, a 404 error will be returned.

Sample response 

There is no response data.

Response codes 

  • Normal: No Content (204)

  • Error: Bad Request (400), Unauthorized (401), Not Found (404), Service Unavailable (503)

Delete a flow

Sample request 

Delete a flow:

DELETE /sdn/v2.0/of/datapaths/{dpid}/flows

Sample request: 

{
   "flow":{
      "priority":30000,
      "table_id":200,
      "match":[
         {
            "ipv4_src":"10.0.0.1"
         },
         {
            "ipv4_dst":"10.0.0.22"
         },
         {
            "ip_proto":"tcp"
         },
         {
            "eth_type":"ipv4"
         },
         {
            "tcp_dst":"80"
         }
      ]
   }
}

Sample response 

There is no response data.

Response codes 

  • Normal: No Content (204)

  • Error: Bad Request (400), Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/groups

List groups

Sample request 

List all groups for the given dpid:

GET /sdn/v2.0/of/datapaths/{dpid}/groups

There is no request data.

Sample response 

{
    "groups": [
        {
            "buckets": [
                {
                    "actions": [
                        {
                            "output": 24
                        }
                    ], 
                    "watch_group": "ANY", 
                    "watch_port": "ANY", 
                    "weight": 0
                }
            ], 
            "id": 1, 
            "type": "all"
        }
    ], 
    "version": "1.3.0"
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Add new group

Sample request 

Add a new group for the given dpid:

POST /sdn/v2.0/of/datapaths/{dpid}/groups
{
    "version": "1.3.0",
    "group": {
        "id": 1,
        "type": "all",
        "command": "add",
        "buckets": [
            {
                "weight": 0,
                "watch_group": "ANY",
                "watch_port": "ANY",
                "actions": [
                    {"output": 24}
                ]
            }
        ]
    }
}

Sample response 

{
    "version": "1.3.0",
    "group": {
        "id": 1,
        "type": "all",
        "buckets": [{
            "weight": 0,
            "watch_group": "ANY",
            "watch_port": "ANY",
            "actions": [{"output": 24}]
        }]
    }
}

Response codes 

  • Normal: Created (201)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Datapaths/{dpid}/groups/{group id}

Get group information

Sample request 

Get group information for the given dpid and group_id:

GET /sdn/v2.0/of/datapaths/{dpid}/groups/{group_id}

There is no request data.

Sample response 

{
    "group": {
        "buckets": [
            {
                "actions": [
                    {
                        "output": 24
                    }
                ], 
                "watch_group": "ANY", 
                "watch_port": "ANY", 
                "weight": 0
            }
        ], 
        "id": 1, 
        "type": "all"
    }, 
    "version": "1.3.0"
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Update group information

Sample request 

Update group information for the given dpid and group_id:

PUT /sdn/v2.0/of/datapaths/{dpid}/groups/{group_id}
{
    "version": "1.3.0",
    "group": {
        "id": 1,
        "type": "select",
        "command": "modify",
        "buckets": [
            {
                "weight": 1,
                "watch_group": "ANY",
                "watch_port": "ANY",
                "actions": [
                    {"output": 24}
                ]
            }
        ]
    }
}

Sample response 

{
   "version":"1.3.0",
   "group":{
      "id":1,
      "type":"select",
      "buckets":[
         {
            "weight":1,
            "watch_group":"ANY",
            "watch_port":"ANY",
            "actions":[
               {
                  "output":24
               }
            ]
         }
      ]
   }
}

Response codes 

  • Normal: OK (200)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)

Delete group

Sample request 

Delete group for the given dpid and group_id:

DELETE /sdn/v2.0/of/datapaths/{dpid}/groups/{group_id}

There is no request data.

Sample response 

There is no response data.

Response codes 

  • Normal: No Content (204)

  • Error: Unauthorized (401), Not Found (404), Service Unavailable (503)