forked from floodlight/floodlight
-
Notifications
You must be signed in to change notification settings - Fork 0
REST API
mscohen02 edited this page Jan 2, 2012
·
2 revisions
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 |
|
| /wm/core/switch/*switchId*/*statType*/json | Retrieve per switch stats |
|
| /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) |
|
| /wm/core/counter/*switchId*/*counterTitle*/json | List of traffic counters per switch |
|
| /wm/core/memory/json | Current controller memory usage | none |
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.