RYU REST API

[Topoplogy]

H1---S1---H2

 

# REST API

#

 

# Retrieve the switch stats

#

# get the list of all switches

# GET /stats/switches

#

curl -X GET http://127.0.0.1:8080/stats/switches

 

# get the desc stats of the switch

# GET /stats/desc/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/desc/1

 

# Update the switch stats

#

# add a flow entry

# POST /stats/flowentry/add

#

curl -X POST -d '{"dpid":"0000000000000001", "priority":"32765","actions":[{"type":"OUTPUT","port":2}],"match":{"in_port":1}}' http://127.0.0.1:8080/stats/flowentry/add

curl -X POST -d '{"dpid":"0000000000000001", "priority":"32765","actions":[{"type":"OUTPUT","port":1}],"match":{"in_port":2}}' http://127.0.0.1:8080/stats/flowentry/add

 

# get flows desc stats of the switch

# GET /stats/flowdesc/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/flowdesc/1

Or

 

# get flows desc stats of the switch filtered by the fields

# POST /stats/flowdesc/<dpid>

#

curl -X POST http://127.0.0.1:8080/stats/flowdesc/1

or

 

# get flows stats of the switch

# GET /stats/flow/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/flow/1

Or

 

# get flows stats of the switch filtered by the fields

# POST /stats/flow/<dpid>

#

curl -X POST http://127.0.0.1:8080/stats/flow/1

 

# get aggregate flows stats of the switch

# GET /stats/aggregateflow/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/aggregateflow/1

Or

 

# get aggregate flows stats of the switch filtered by the fields

# POST /stats/aggregateflow/<dpid>

#

curl -X POST http://127.0.0.1:8080/stats/aggregateflow/1

 

# get table stats of the switch

# GET /stats/table/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/table/1

Or

 

# get table features stats of the switch

# GET /stats/tablefeatures/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/tablefeatures/1

 

# get ports stats of the switch

# GET /stats/port/<dpid>[/<port>]

# Note: Specification of port number is optional

#

curl -X GET http://127.0.0.1:8080/stats/port/1

curl -X GET http://127.0.0.1:8080/stats/port/1/1

Or

Before we get the queue status, we need to set the queues at s1-eth2. We set two queues. The max rate for queue0 is 5Mbps. The max rate for queue1 is 10Mbps.

# get queues stats of the switch

# GET /stats/queue/<dpid>[/<port>[/<queue_id>]]

# Note: Specification of port number and queue id are optional

#       If you want to omitting the port number and setting the queue id,

#       please specify the keyword "ALL" to the port number

#       e.g. GET /stats/queue/1/ALL/1

#

curl -X GET http://127.0.0.1:8080/stats/queue/1  dpid=1

curl -X GET http://127.0.0.1:8080/stats/queue/1/2   dpid=1, port=2 (s1-eth2)

curl -X GET http://127.0.0.1:8080/stats/queue/1/2/0 dpid=1, port=2, queue_id=0

 

# get queues config stats of the switch

# GET /stats/queueconfig/<dpid>[/<port>]

# Note: Specification of port number is optional

#

curl -X GET http://127.0.0.1:8080/stats/queueconfig/1/2

 

 

 

# get meter features stats of the switch

# GET /stats/meterfeatures/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/meterfeatures/1

 

# get meter config stats of the switch

# GET /stats/meterconfig/<dpid>[/<meter_id>]

# Note: Specification of meter id is optional

#

# get meter desc stats of the switch

# GET /stats/meterdesc/<dpid>[/<meter_id>]

# Note: Specification of meter id is optional

#

# get meters stats of the switch

# GET /stats/meter/<dpid>[/<meter_id>]

# Note: Specification of meter id is optional

#

# get group features stats of the switch

# GET /stats/groupfeatures/<dpid>

#

curl -X GET http://127.0.0.1:8080/stats/groupfeatures/1

 

# get groups desc stats of the switch

# GET /stats/groupdesc/<dpid>[/<group_id>]

# Note: Specification of group id is optional (OpenFlow 1.5 or later)

#

curl -X GET http://127.0.0.1:8080/stats/groupdesc/1

# get groups stats of the switch

# GET /stats/group/<dpid>[/<group_id>]

# Note: Specification of group id is optional

#

curl -X GET http://127.0.0.1:8080/stats/group/1

 

# get ports description of the switch

# GET /stats/portdesc/<dpid>[/<port_no>]

# Note: Specification of port number is optional (OpenFlow 1.5 or later)

curl -X GET http://127.0.0.1:8080/stats/portdesc/1

 

# modify all matching flow entries

# POST /stats/flowentry/modify

#

Original flow tables

curl -X POST -d '{"dpid":"0000000000000001", "priority":"32765","actions":[{"type":"DROP"}],"match":{"in_port":1}}' http://127.0.0.1:8080/stats/flowentry/modify 

 

# modify flow entry strictly matching wildcards and priority

# POST /stats/flowentry/modify_strict

#

# delete all matching flow entries

# POST /stats/flowentry/delete

#

curl -X POST -d '{"dpid":"0000000000000001","match":{"in_port":1}}' http://127.0.0.1:8080/stats/flowentry/delete

 

# delete flow entry strictly matching wildcards and priority

# POST /stats/flowentry/delete_strict

#

# delete all flow entries of the switch

# DELETE /stats/flowentry/clear/<dpid>

#

curl -X DELETE http://127.0.0.1:8080/stats/flowentry/clear/1

# add a meter entry

# POST /stats/meterentry/add

#

curl -X POST -d '{"dpid": "1", "meter_id":1, "flags":"KBPS","bands":[{"type":"DROP", "rate":6000}]}' http://127.0.0.1:8080/stats/meterentry/add

 

# modify a meter entry

# POST /stats/meterentry/modify

#

curl -X POST -d '{"dpid": "1", "meter_id":1, "flags":"KBPS","bands":[{"type":"DROP", "rate":2000}]}' http://127.0.0.1:8080/stats/meterentry/modify

 

# delete a meter entry

# POST /stats/meterentry/delete

#

curl -X POST -d '{"dpid": "1", "meter_id":1, "flags":"KBPS","bands":[{"type":"DROP", "rate":2000}]}' http://127.0.0.1:8080/stats/meterentry/delete

 

# add a group entry

# POST /stats/groupentry/add

#

curl -X POST -d '{"dpid": "1", "group_id":1, "buckets":[{"actions":[{"type":"OUTPUT", "port":1}]},{"actions":[{"type":"OUTPUT","port":2}]}]}' http://127.0.0.1:8080/stats/groupentry/add

 

# modify a group entry

# POST /stats/groupentry/modify

#

curl -X POST -d '{"dpid": "1", "group_id":1, "buckets":[{"actions":[{"type":"OUTPUT", "port":2}]},{"actions":[{"type":"OUTPUT","port":3}]}]}' http://127.0.0.1:8080/stats/groupentry/modify

 

# delete a group entry

# POST /stats/groupentry/delete

#

curl -X POST -d '{"dpid": "1", "group_id":1}' http://127.0.0.1:8080/stats/groupentry/delete

 

# modify behavior of the physical port

# POST /stats/portdesc/modify

#

# modify role of controller

# POST /stats/role

#

#

# send a experimeter message

# POST /stats/experimenter/<dpid>

 

Dr. Chih-Heng Ke (smallko@gmail.com)

Department of Computer Science and Information Engineering,

National Quemoy University, Kinmen, Taiwan.