一、手动拷贝方式

1. 将Hello项目生成的发布包拷贝至ODL发布版本的

 Hello项目(mvn clean install)后,Hello的feature存在于karaf/target/assembly/system目录下,更进一步\karaf\target\assembly\system\org\opendaylight

 

其中,org\opendaylight为输入的groupId的值

2. 安装Hello组件:

(1) 启动OpenDayLight: 

D:\CODE\distribution-karaf-0.6.0-Carbon\bin>karaf
Apache Karaf starting up. Press Enter to open the shell now...
100% [========================================================================]

Karaf started in 26s. Bundle stats: 296 active, 296 total

________ ________ .__ .__ .__ __
\_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_
/ | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\
/ | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ |
\_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__|
\/|__| \/ \/ \/ \/\/ /_____/ \/


Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.

(2). 将Hello 仓库添加到featue list中:

opendaylight-user@root>feature:repo-add mvn:org.opendaylight.hello/hello-features/0.1.0-SNAPSHOT/xml/features
Adding feature url mvn:org.opendaylight.hello/hello-features/0.1.0-SNAPSHOT/xml/features

其中斜体部分的值在:D:\CODE\odlexample\hello\hello\karaf\target\assembly\etc\org.apache.karaf.features.cfg 文件的最后部分:

featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.hello/hello-features/0.1.0-SNAPSHOT/xml/features

 

(3). 查看hello是否已安装:

opendaylight-user@root>feature:list|grep hello
odl-hello-api | 0.1.0-SNAPSHOT | | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: api
odl-hello | 0.1.0-SNAPSHOT | | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello
odl-hello-rest | 0.1.0-SNAPSHOT | | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: REST
odl-hello-ui | 0.1.0-SNAPSHOT | | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: UI
odl-hello-cli | 0.1.0-SNAPSHOT | | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: CLI
opendaylight-user@root>feature:list -i | grep hello

(4). 安装Hello:

opendaylight-user@root>feature:install odl-hello-ui
opendaylight-user@root>feature:list -i | grep hello
odl-hello-api | 0.1.0-SNAPSHOT | x | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: api
odl-hello | 0.1.0-SNAPSHOT | x | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello
odl-hello-rest | 0.1.0-SNAPSHOT | x | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: REST
odl-hello-ui | 0.1.0-SNAPSHOT | x | odl-hello-0.1.0-SNAPSHOT | OpenDaylight :: hello :: UI

如果要将hello移除feature list,使用 feature:repo-remove mvn:org.opendaylight.hello/hello-features/0.1.0-SNAPSHOT/xml/features

移除后,查不到,装不上

opendaylight-user@root> feature:repo-remove mvn:org.opendaylight.hello/hello-features/0.1.0-SNAPSHOT/xml/features
opendaylight-user@root>feature:list -i | grep hello
opendaylight-user@root>feature:list|grep hello
opendaylight-user@root>feature:install odl-hello-ui
Error executing command: Can't install feature odl-hello-ui/0.0.0:
null

二、 编译方式:

   参考链接:http://www.sdnlab.com/17863.html

 

posted on 2017-08-04 21:08  水共禾刀  阅读(2632)  评论(0编辑  收藏  举报