I have copied one of the sample application int the opendaylight controller and named it as userinfo by changing artifact id in pom file. In this post i will show you how can i add my application while controller is running.
First of all build the bundle by command "mvn install". If everything is well go to command line of controller. But before that let me shed some light on how OSGi works. Life cycle of any app is 1. install 2. resolve 3.uninstall. First and last is self explanatory. A bundle will be in resolved state when all the dependencies are resolved and that's when you can start a service.
osgi> install file:/home/ubuntu/workspace/controller/opendaylight/samples/userinfo
Bundle id is 150
< output omitted>
Version 0.0.1.SNAPSHOT
BundleDescription org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT
Framework org.eclipse.osgi.framework.internal.core.Framework@164e955
ResolutionFailureException org.osgi.framework.BundleException: The state indicates the bundle is resolved
Revisions [org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT]
BundleContext null
BundleId 150
StartLevel 1
SymbolicName org.opendaylight.controller.samples.userinfo
BundleData org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT
KeyHashCode 150
StateChanging null
as you can see once installed osgi gives you a bundle id. now you can start or stop this bundle with this id.
To check currently installed bundle and its id/state say 'ss'
osgi> ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.8.1.v20120830-144521
<OUTPUT ommited>
150 RESOLVED org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT
As you can see state is resolved. Good now let you can start the bundle by giving command 'start 150'. But it will give you error as the controller don't have binaries. For that you need to copy your binary (i.e. jar) to
/home/ubuntu/workspace/controller/opendaylight/distribution/opendaylight/target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight/plugins
ok. Now say start 150 and njoy your code !
To create a simple application click here
/home/ubuntu/workspace/controller/opendaylight/distribution/opendaylight/target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight/plugins
ok. Now say start 150 and njoy your code !
To create a simple application click here
Check leaks in Riyadh*cleaning houses in Riyadh*Insulation of roofs in Riyadh*Disclosures leaks in Riyadh*Move in madinah*Cleaning houses in Riyadh*Roof Insulation in Riyadh*Home Services in Dammam*moving Afesh in Riyadh*Insulation of tanks in Riyadh
ReplyDelete