Re: Executing command in the OVSwitch


Thanks Sam for the pointers, I decided to go the plugin way. I did the required imports in my java file and add dependencies in the pom files and features but I am getting tests failures (for missing org.opendaylight.controller.sal.core and I got same error for other packages and was able to resolve them by adding dependencies, but these two are persisting. In the maven repo I can find "dependencymanager" and not "dm" as claimed. I was also thinking that maven will resolve these indirect dependencies automatically and I don't have to do it for all dependencies that plugin.api has. Please let me know how to go about this. Another concern is about support for MD-SAL, my plugin is MD-SAL based and I posted above question in our internal forum, and someone replied "OVSDB works with AD-SAL only", will the java interface work for me? 

Unresolved constraint in bundle org.opendaylight.sanitycheck.impl [183]: Unable to resolve 183.0: missing requirement [183.0] osgi.wiring.package; (&(osgi.wiring.package=org.opendaylight.ovsdb.plugin.api)(version>=1.1.0)(!(version>=2.0.0))) [caused by: Unable to resolve 188.0: missing requirement [188.0] osgi.wiring.package; (&(osgi.wiring.package=org.opendaylight.controller.sal.core)(version>=0.9.0)(!(version>=1.0.0)))]
at org.apache.felix.framework.Felix.resolveBundleRevision(


On Thu, Mar 5, 2015 at 8:30 AM, Sam Hague <shague@...> wrote:

you would need to look at the code to find the usage. The plugin interface would be the simplest and most complete today. There are multiple examples of how to use the interface listed below.

api: ovsdb/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/*.java
- ovsdb/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/plugin/
Look at printCache(). That method shows how to use the OvsdbConfigurationService api getTables(). This will dump the whole db.

- ovsdb/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/
Looking at the SouthboundHandler in nodeAdded() you would get a callback that indicates an ovsdb node is connected. After that you can retrieve all the whole db.
There also also callbacks like rowAdded and rowUpdated which correspond to a new row and updated rows in the db.

- ovsdb/plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/
monitorTables(): shows how to setup a monitor and get callbacks when any change is made to the db. Use this to build a cache. Though it is easier to just use the OvsdbListenerService and get the updates or request the whole db using getTables

mdsal: look for monitor code: ovsdb/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/
Similar to the previous comment, you can build your own cache of the db.

Thanks, Sam

----- Original Message -----
> From: "Magreth Mushi" <mjmushi@...>
> To: "Sam Hague" <shague@...>
> Cc: ovsdb-dev@...
> Sent: Thursday, March 5, 2015 5:58:05 AM
> Subject: Re: [ovsdb-dev] Executing command in the OVSwitch
> Thank you Sam, java plugin sounds promising. Is there any documentation on
> how I can go about this? or any of the options you have mentioned?
> Best,
> Magreth
> Sent from my mobile device.
> On Mar 4, 2015 11:10 PM, "Sam Hague" <shague@...> wrote:
> > Magreth,
> >
> > you can get the whole ovsdb db. The ovsdb project has multiple methods to
> > retrieve the db. There is a northbound REST api, there is a java plugin
> > interface, there is a mdsal interface in the works and you could write an
> > app listening in on the library.
> >
> > Using the plugin interface will work today and give you the whole ovsdb
> > db. Using the mdsal interface would give you a much smaller subset and is a
> > work in progress. You could lift out the monitor piece of the mdsal code
> > and build a local cache of the db also.
> >
> > Thanks, Sam
> >
> > ----- Original Message -----
> > > From: "Magreth Mushi" <mjmushi@...>
> > > To: ovsdb-dev@...
> > > Sent: Wednesday, March 4, 2015 9:12:12 PM
> > > Subject: [ovsdb-dev] Executing command in the OVSwitch
> > >
> > > Hi,
> > >
> > > I am running opendaylight controller and mininet network; I have
> > developed
> > > MD-SAL plugin and at this point I would like to get switch config by
> > > executing " ovs-vsctl show" from the plugin. Is there anyway I can do
> > this?
> > > In the conventional network I usually use a script that ssh into the
> > device
> > > and execute the equivalent command (e.g show run) using expect4j(in
> > java) or
> > > pexpect(in Python). Is there any equivalent strategy in ODL?
> > >
> > > Thanks
> > > --Magreth
> > >
> > > _______________________________________________
> > > ovsdb-dev mailing list
> > > ovsdb-dev@...
> > >
> > >
> >


Join to automatically receive all group messages.