问题
I recently created a basic HelloWorld ODL module as stepped out here, and I am able to make it work. I.e., I can run restful POST commands against it and get my "hello" reply.
{
"output": {
"greeting": "Hello Andrew"
}
}
Now, what I'd like to do is install this module into the actual ODL as compiled from the integration distro repos.
The steps I follow are:
Successfully create the HelloWorld ODL module and run karaf from within the HelloWorld karaf subfolder
Knowing that
mvn install
against the Hello project will publish this module into my local.m2/repository/org/opendaylight/hello
repo, I move on to the actual ODL integration/distroin the
features/repos/index/pom.xml
file in ODL, I add the following profile:<profile> <id>hello</id> <activation> <activeByDefault>true</activeByDefault> </activation> <dependencies> <dependency> <groupId>org.opendaylight.hello</groupId> <artifactId>features-hello</artifactId> <classifier>features</classifier> <version>1.0-SNAPSHOT</version> <type>xml</type> </dependency> </dependencies> </profile>
Then I successfully run
mvn install
on ODL and it does not error on that profile. (Note: if I typo anything in that profile section, themvn install
will fail)
- I am doing everything to ODL v0.11.0 and Sodium 1.2.0 in my application, so I am sure the versions are correct.
All is said and done, the ODL karaf does fire up and I am able to run rest commands against it... however the same POST command that worked purely against the HelloWorld module does not work in the integrated distro ODL. Instead I get this error message back:
{
"errors": {
"error": [
{
"error-type": "protocol",
"error-tag": "unknown-element",
"error-message": "The module named 'hello' does not exist."
}
]
}
}
In some ways, this question is a bit of an extension to my previous one here: Source code of the full OpenDaylight Integration Distribution Bundle. So just linking them together here.
Update: I created an inverse to this question here: Procedure to add features to OpenDaylight application.
Note:
- In the
feature:list
section, I do not see Hello listed
回答1:
ODL Integration distribution does not install any karaf feature by default, so once you start the distribution, check whether your project feature is installed (e.g. feature:list -i). If it is not, just install it (e.g. feature:install ).
来源:https://stackoverflow.com/questions/63060044/install-a-custom-feature-or-module-in-opendaylight