ONOS's northbound API has an extension capability which allows applications to use extended features of devices. The idea is to allow devices to expose non-standard features, and to support them in ONOS without polluting the API with device-specific features.
There are two main categories of APIs that can be extended: selectors and treatments.
Extensions are not supplied by the core; instead they are brought by the driver for the devices that implements them. Applications are not compiled directly against the extension types. This allows them to be added in a completely dynamic way without the ONOS core needing to have any knowledge of the extensions.
There are two behaviors that need to be implemented by drivers that want to provide extensions. They are ExtensionTreatmentResolver and ExtensionTreatmentInterpreter.
The ExtensionTreatmentResolver behavior is used by applications that want to get a reference to an extension object. Calls to the resolver should return instances of an extension if the driver supports that extension.
The ExtensionTreatmentInterpreter is used by the ONOS core to map extensions to the actual OF messages that need to be sent to switches.
These behaviours need to be added to the driver definition of the driver in onos-drivers.xml:
Treatment extensions are supported through the ExtensionTreatment class. The DefaultTreatmentBuilder has an extension() method where applications can supply the ExtensionTreatments that they have received from the driver's ExtensionTreatmentResolver behavior. There is a generic setProperty API on ExtensionTreatment that allows an application to add values that might be needed by the extension.
Selector extensions are supported through the ExtensionSelector class. The extension selector framework is a mirror image of the treatment framework.