-
Notifications
You must be signed in to change notification settings - Fork 10
Module Programming Guide
This document explains how to program a user-defined module.
Maybe the easiest way to learn about to module programming is to see the implementation of MacLearning module, which is the most simple IRIS module. As the code of this module has come from the Floodlight, many of its detail is the same. But you should remember following:
- IRIS module should be defined as a subclass of OFModule
- you should override following methods:
- initialize
- handleMEssage
- handleHandshakedEvent
- handleDisconnect
- getModels
- Module name starts with OFM
In initialize method, you normally does following things:
- call registerFilter method that makes your module to receive a specific types of messages.
- call registerModule method that let other module to know that your module is implementing a specific service.
- do other module-specific initialization
Following is a code from OFMLearningMac.initialize().
@Override
protected void initialize() {
registerFilter(
OFType.PACKET_IN,
new OFMFilter() {
@Override
public boolean filter(OFMessage m) {
return true;
}
}
);
}
Above call to registerFilter makes OFMLearningMac module to receive all PACKET_IN messages. The OFMFilter.filter() determines whether m is a message that this module should receive (true or false). In the above, OFMFilter.filter() always returns true. That means this module receives all the PACKET_IN messages.
OpenIRIS Development Team: contact bjlee@etri.re.kr