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
Listeners
Application code may wish to be notified of events via a callback mechanism. A number of
methods allow the consumer to register as a listener for certain types of event:
•
Message Listeners – notified when OpenFlow messages arrive from a datapath. At
registration, the listener specifies the message types of interest. Note that one exception to
this is PACKET_IN messages; to hear about these, one must register as a
SequencedPacketListener.
•
Sequenced Packet Listeners – notified when PACKET_IN messages arrive from a datapath.
This mechanism is described in more detail in a following section.
•
Flow Listeners – notified when FLOW_MOD messages are pushed out to datapaths, or when
flow rules are removed from datapaths (either explicitly, or by timeout).
•
Group Listeners – notified when GROUP_MOD messages are pushed out to datapaths.
•
Meter Listeners – notified when METER_MOD messages are pushed out to datapaths.
The following listing shows an example that listens for ECHO_REPLY messages (presumably we
have some other code that is sending ECHO_REQUEST messages), and PORT_STATUS messages.
ECHO_REPLY and PORT_STATUS Example:
private static final Set<MessageType> INTEREST = EnumSet.of(
MessageType.ECHO_REPLY,
MessageType.PORT_STATUS
);
private void initListener() {
cs.addMessageListener(new MyListener(), INTEREST);
}
private class MyListener implements MessageListener {
@Override
public void queueEvent(QueueEvent event) {
log.warn("Message Listener Queue event: {}", event);
}
@Override
public void event(MessageEvent event) {
if (event.type() == OpenflowEventType.MESSAGE_RX) {
OpenflowMessage msg = event.msg();
DataPathId dpid = event.dpid();
switch (msg.getType()) {
case ECHO_REPLY:
handleEchoReply((OfmEchoReply) msg, dpid);
break;
case PORT_STATUS:
handlePortStatus((OfmPortStatus) msg, dpid);
break;
}
36