# How to use services of Openflow plugins like IController ?

I am using the OpenDaylight Base Edition 1.0,

I am facing a problem related to openflow. I am trying to write an application in opendaylight using openflow plugins in AD-SAL. As per my requirement and understanding, I need the IController service. I have put protocolplugins.openflow version 0.4.1 in dependency and in plugins I have imported package ‘org.opendaylight.controller.protocolplugin.openflow.core’ for IController interface definition. I also have registered the dependent IController service in Activator.

When I trying to run my bundle, in OSGI the ‘org.opendaylight.controller.protocol_plugin.openflow.core’ package is not getting resolved. From what I could understand, is not being exported by any other bundle. I tried using ‘org.sdnhub.odl.openflow10’ as a replacement from [http://sdnhub.org/releases/opendaylight-adsal-of-plugins/], but I am getting error in addMessageListner() signature in IController.

Q1) I am on the right understanding that ‘org.opendaylight.controller.protocol_plugin.openflow.core’ is not exposed by any bundle in the base edition?

Q2) Should I use org.sdnhub.odl.openflow10 as a openflow plugin.

Q3) I've used the addMessageListner() as:

controller.addMessageListener(OFType.GET_CONFIG_REPLY, configHandler);


where configHandler type is IMessageListener

and used org.opendaylight.controller.protocol_plugin.openflow.core.IController

and In org.sdnhub.odl.openflow10 addMessageListner() is defined as:

public void addMessageListener(OFType type, IMessageListener listener) {
IMessageListener currentListener = this.messageListeners.get(type);
if (currentListener != null) {
logger.warn("{} is already listened by {}", type,
currentListener);
}
this.messageListeners.put(type, listener);
logger.debug("{} is now listened by {}", type, listener);
}

edit retag close merge delete

Sort by » oldest newest most voted

In OSGi, every import-package must have a corresponding matching export-package from a bundle that wishes to export a service. In this case, you are trying to have your dependency directly on org.opendaylight.controller.protocolplugin.openflow.core and hence importing this package with the hope to use the IController service.

But, the protocolplugin.openflow bundle doesn't "export" this service via its "export-package". This is because, according the OpenDaylight design, all the south-bound plugins are supposed to be exposed only through the SAL layer. And hence, an application should ideally not be directly dependent on the southbound plugin. Rather, you must look for a SAL service that will satisfy your needs.

If you still want your application to talk only with Openflow plugin (in this case to parse an OpenFlow message directly), then you have other options such as writing your bundle as an OSGi fragment. But that gets into an use-case specific mode and we would need more info to get you to the right place.

In any case, the general rule of thumb is to not depend directly on the south-bound plugin as much as possible and always look for a corresponding "export-package" to make sure the dependent services are being exported.

more

Hi madhu, Thanks a lot for the explanation. We got the concepts now. Could you please help us on the Below Problem, it will be very helpful : https://ask.opendaylight.org/question/585/how-to-insert-flows-into-a-specific-table-for-an-openflow-switch-in-adsal/

( 2014-08-27 08:56:34 -0700 )edit

Sure. Glad to help. I replied to your other question. BTW, if an answer helps solve your question, then please accept it so that others in the community can make effective use of ask.opendaylight.org

( 2014-08-28 11:56:09 -0700 )edit

## Stats

Asked: 2014-07-10 21:58:43 -0700

Seen: 243 times

Last updated: Jul 26 '14