Reference Guide

Table Of Contents
In the following code examples, it is assumed that a reference to the controller service
implementation has been stored in the field
cs:
private ControllerService cs = ...;
Datapath Information
Information about datapaths that have connected to the controller is available; either all connected
datapaths, or a datapath with a given ID:
getAllDataPathInfo() : Set<DataPathInfo>
getDataPathInfo(DataPathId) : DataPathInfo
The DataPathInfo API provides information about a datapath:
the datapath ID
the negotiated protocol version
the time at which the datapath connected to the controller
the time at which the last message was received from the datapath
the list of OpenFlow-enabled ports
the reported number of buffers
the reported number of tables
the set of capabilities
the remote (IP) address of the connection
the remote (TCP) port of the connection
a textual description
the manufacturer
the hardware version
the software version
the serial number
a device type identifier
The following listing shows an example of how to use Datapath information:
Datapath Information Example:
DataPathId dpid = DataPathId.valueOf("00:00:00:00:00:00:00:01");
DataPathInfo dpi;
try {
dpi = cs.getDataPathInfo(dpid);
log.info("Datapath with ID {} is connected", dpid);
log.info("Negotiated protocol version is {}", dpi.negotiated());
for (Port p: dpi.ports()) {
...
}
} catch (NotFoundException e) {
log.warn("Datapath with ID {} is not connected", dpid);
}
35