Reference Guide
Table Of Contents
- 1 Introduction
- 2 Establishing Your Test and Development Environments
- 3 Developing Applications
- Introduction
- Authentication
- REST API
- Audit Logging
- Alert Logging
- Configuration
- High Availability
- OpenFlow
- Metrics Framework
- GUI
- SKI Framework - Overview
- SKI Framework - Navigation Tree
- SKI Framework - Hash Navigation
- SKI Framework - View Life-Cycle
- SKI Framework - Live Reference Application
- UI Extension
- Introduction
- Controller Teaming
- Distributed Coordination Service
- Persistence
- Backup and Restore
- Device Driver Framework
- 4 Application Security
- 5 Including Debian Packages with Applications
- 6 Sample Application
- Application Description
- Creating Application Development Workspace
- Application Generator (Automatic Workspace Creation)
- Creating Eclipse Projects
- Updating Project Dependencies
- Building the Application
- Installing the Application
- Application Code
- 7 Testing Applications
- 8 Built-In Applications
- Appendix A
- Appendix B
- Bibliography
print("Match : {}", fs.getMatch());
// Note: this is one area where we need to be cognizant of the version:
if (fs.getVersion() == ProtocolVersion.V_1_0)
print("Actions : {}", fs.getActions());
else
print("Instructions : {}", fs.getInstructions());
}
Sending Messages
Applications may construct and send messages to datapaths via the “send” methods:
•
send(OpenflowMessage, DataPathId) : MessageFuture
•
send(List<OpenflowMessage>, DataPathId) : List<MessageFuture>
The returned MessageFuture(s) allow the caller to choose whether to wait synchronously (block
until the outcome of the request is known), or whether to do some other work and then check on
the result of the request later.
When a message is sent to a datapath, the corresponding MessageFuture encapsulates the state
of that request. Initially the future’s result is UNSATISFIED. Once the outcome is determined, the
future is “satisfied” with one of the following results:
•
SUCCESS—the request was a success; the reply message is available via reply().
•
SUCCESS_NO_REPLY—the request was a success; there is no associated reply.
•
OFM_ERROR—the request failed; the datapath issued an error, available via reply().
•
EXCEPTION—the request failed due to an exception; available via cause().
•
TIMEOUT—the request timed-out waiting for a response from the datapath.
The following listing shows a code example that attaches a timestamp payload to an
ECHO_REQUEST message, then retrieves the timestamp payload from the ECHO_REPLY sent back
by the datapath:
ECHO_REQUEST and ECHO_REPLY Example:
private static final ProtocolVersion PV = ProtocolVersion.V_1_3;
private static final int SIZE_OF_LONG = 8;
private static final String E_ECHO_FAILED =
"Failed to send Echo Request: {}";
private static final long REQUEST_TIMEOUT_MS = 5000;
private void latencyTest(DataPathId dpid) {
byte[] timestamp = new byte[SIZE_OF_LONG];
ByteUtils.setLong(timestamp, 0, System.currentTimeMillis());
OpenflowMessage msg = createEchoRequest(timestamp);
try {
MessageFuture future = cs.send(msg, dpid);
future.await(REQUEST_TIMEOUT_MS); // BLOCKS
if (future.isSuccess()) {
long now = System.currentTimeMillis();
long then = retrieveTimestamp(future.reply());
38