Floodlight REST API pre-v1.0

The Floodlight REST API

(info)

This documentation is for pre-v1.0 versions of Floodlight, such as v0.9 and v0.91. Please consider upgrading to Floodlight v1.0, which has separate documentation here.

The REST API is the recommended interface to develop applications utilizing Floodlight supported features.

For the REST calls that use switch DPID, you can obtain it from floodlight UI. After the floodlight is up and running, you can go to your browser and type in a URL as follows

http://192.168.110.2:8080/ui/index.html (Replace 192.168.110.2 with the proper inet address).

While the functions available in this API are evolving, several key functions are supported today. The API is available at port 8080 of the controller.

An example REST call is:

curl http://192.168.110.2:8080/wm/core/controller/switches/json

Other functions available via REST:

URI

Method

Description

Arguments

/wm/core/switch/all/<statType>/json 

GET

Retrieve aggregate stats across all switches

statType: port, queue, flow, aggregate, desc, table, features 

/wm/core/switch/<switchId>/<statType>/json 

GET

Retrieve per switch stats

switchId: Valid Switch DPID (XX:XX:XX:XX:XX:XX:XX:XX) 
statType: port, queue, flow, aggregate, desc, table, features 

/wm/core/controller/switches/json

GET

List of all switch DPIDs connected to the controller

none

/wm/core/controller/summary/json

GET

Controller summary (# of Switches, # of Links, etc)

none

/wm/core/counter/<counterTitle>/json

GET

List of global traffic counters in the controller (across all switches)

counterTitle: "all" or something of the form <DPID>_<COUNTER_NAME>_<SUB_CATEGORY>
ie. 00:00:00:00:00:00:00:01_OFPacketIn_broadcast (SUB_CATEGORY being "broadcast")
00:00:00:00:00:00:00:01_OFPacketIn_L3_ARP (SUB_CATEGORY being "L3_ARP")
L3 sub_categories take the form "L3_<ether-type>", L4 sub_categories take the form "L4_<protocol>"
For more details look at net.floodlightcontroller.counter.CounterStore.java

/wm/core/counter/<switchId>/<counterName>/json

GET

List of traffic counters per switch

switchId: Valid Switch DPID 
CounterTitle: see above

/wm/core/memory/json 

GET

Current controller memory usage

none

/wm/core/health/json

GET

Status/Health of REST API

none

/wm/core/system/uptime/json

GET

Controller uptime

none

/wm/topology/links/json

GET

List all the inter-switch links. Note that these are only for switches connected to the same controller. This is not available in the 0.8 release.

none

/wm/topology/switchclusters/json

GET

List of all switch clusters connected to the controller. This is not available in the 0.8 release.

none

/wm/topology/external-links/json

GET

Show "external" links, i.e., multi-hop links discovered by BDDP instead of LLDP packets

none

/wm/topology/links/json

GET

Show DIRECT and TUNNEL links discovered based on LLDP packets

none

/wm/device/

GET

List of all devices tracked by the controller. This includes MACs, IPs, and attachment points.

Passed as GET parameters: mac (colon-separated hex-encoded), ipv4 (dotted decimal), vlandpid attachment point DPID (colon-separated hex-encoded) and port the attachment point port.

/wm/staticflowentrypusher/json

POST/DELETE

Add/Delete static flow

HTTP POST data (add flow), HTTP DELETE (for deletion)

/wm/staticflowentrypusher/list/<switch>/json

GET

List static flows for a switch or all switches

switch: Valid Switch DPID (XX:XX:XX:XX:XX:XX:XX:XX) or "all"

/wm/staticflowentrypusher/clear/<switch>/json

GET

Clear static flows for a switch or all switches

switch: Valid Switch DPID (XX:XX:XX:XX:XX:XX:XX:XX) or "all"

More information available on How to Use Static Flow Pusher API

 

 

 

/networkService/v1.1/tenants/<tenant>/networks/<network>

PUT/POST/DELETE

Creates a new virtual network. Name and ID are required, gateway is optional.

URI argument: tenant: Currently ignored. network: ID (not name) of the network

HTTP data: {"network": { "gateway": "<IP>", "name": "<Name>" }}
IP: Gateway IP in "1.1.1.1" format, can be null  
Name: Network name as string

/networkService/v1.1/tenants/<tenant>/networks/<network>/ports/<port>/attachment

PUT/DELETE

Attaches a host to a virtual network.

URI argument: tenant: Currently ignored. network: ID (not name) of the network. port: Logical port name

HTTP data: {"attachment": {"id": "<Network ID>", "mac": "<MAC>"}}
Network ID: Network ID as string, the one assigned at create
MAC: MAC address in "XX:XX:XX:XX:XX:XX" format

/networkService/v1.1/tenants/<tenant>/networks

GET

Shows all networks and their gateway, ID, and hosts mac in json format.

URI argument: tenant: Currently ignored.

More information available on Virtual Network Filter REST API

 

 

 

/wm/firewall/module/<op>/json

GET

 

query the status of, enable, and disable the firewall

/wm/firewall/rules/json 

GET/POST/DELETE

GET: None
POST: {"<field 1>":"<value 1>", "<field 2>":"<value 2>", ...}
DELETE: {"<ruleid>":"<int>"}

List all existing rules in json format
Create new firewall rule
Delete a rule by ruleid
"field":"value" pairs below in any order and combination: 
"switchid":"<xx:xx:xx:xx:xx:xx:xx:xx>", "src-inport":"<short>",  
"src-mac": "<xx:xx:xx:xx:xx:xx>", "dst-mac": "<xx:xx:xx:xx:xx:xx>",  
"dl-type": "<ARP or IPv4>", "src-ip": "<A.B.C.D/M>", "dst-ip": "<A.B.C.D/M>",  
"nw-proto": "<TCP or UDP or ICMP>", "tp-src": "<short>", "tp-dst": "<short>",  
"priority": "<int>", "action": "<ALLOW or DENY>" 
"ruleid": "<int>" 

More information available on Firewall REST API

 

 

 

For Floodlight developers, check out how to add new REST APIs to Floodlight services at How to Add Services to a Module