Skip to content
mscohen02 edited this page Jan 2, 2012 · 2 revisions

The Floodlight REST API

Floodlight supports a RESTful API for accessing state. 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 Description Arguments
/wm/core/switch/all/*statType*/json Retrieve aggregate stats across all switches
  • statType*: port, queue, flow, aggregate, desc, table, features, host
/wm/core/switch/*switchId*/*statType*/json Retrieve per switch stats
  • switchId*: Valid Switch DPID (XX:XX:XX:XX:XX:XX:XX:XX) *statType*: port, queue, flow, aggregate, desc, table, features, host
/wm/core/controller/switches/json List of all switch DPIDs connected to the controller none
/wm/core/controller/switchclusters/json List of all switch clusters connected to the controller none
/wm/core/counter/*counterTitle*/json List of global traffic counters in the controller (across all switches)
  • counterTitle*: "all" or something of the form DPID\__Port#_{_}OFEvent{_}{_}L3/4_\_Type. See CounterStore.java for details.
/wm/core/counter/*switchId*/*counterTitle*/json List of traffic counters per switch
  • switchId*: Valid Switch DPID CounterTitle: see above
/wm/core/memory/json Current controller memory usage none

Extending the REST API

The Floodlight REST API is based on [Restlet|http://www.restlet.org]. Its best to walk through the Restlet documentation as a first step. The steps to adding a new Restlet include:

  • Registering a Restlet in net.floodlightcontroller.controller.internal.Controller. You can see the main restlet registered as "restlets.add(new CoreWebRoutable());".
  • Implement a new class like CoreWebRoutable (or extend it directly) that provides getRestlet() and basePath() functions.
  • Implement a class like net.floodlightcontroller.core.web.SwitchStatisticsResource that extends ServerResource() and implements a @Get or @Put function.
The REST API mechanism is Floodlight is not stable / finalized at this point.

Clone this wiki locally