admin管理员组

文章数量:1650771

背景

在自动化部署的项目中,我们启动了karaf之后,可能需要安装feature。但是如果登陆到控制器的console界面可能不符合自动化的理念,因此需要实现在karaf启动之后自动安装feature,而且这个feature是我们自己写的feature,这个feature需要满足的要求是,可以通过repo:add方法添加进来。具体添加方法请参考我的博客的另一篇文章。

第一步拷贝文件

将编译好的文件夹拷贝到控制器当中。具体操作,请参考我的另一篇文章

Opendaylight将自己写的feature添加到控制器当中

第二步设置feature系统启动时安装

请参考我的另一篇文章

在Opendaylight中karaf启动的时候自动安装feature

如下所示

#
# Comma separated list of features to install at startup
#
featuresBoot = 7237c9d7-5798-488f-9baf-a4c725ddc392,odl-mdsal-clustering,features-zzz

第三步修改配置文件

在org.apache.karaf.features.cfg文件中,我们不难发现,有一个XML文件,这个XML文件就在/etc/文件夹下。

打开这个文件,添加两行

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache/xmlns/features/v1.5.0" name="468a2880-68cf-42ab-b039-c16e806d69a4">
    <repository>mvn:org.apache.karaf.features/framework/4.2.2/xml/features</repository>
    <repository>mvn:org.opendaylight.integration/features-index/0.10.1/xml/features</repository>
    <repository>mvn:org.apache.karaf.features/standard/4.2.2/xml/features</repository>
    <repository>mvn:com.xxx.yyy/features-zzz/0.2.0/xml/features</repository>
    <feature name="7237c9d7-5798-488f-9baf-a4c725ddc392" version="0.0.0">
        <feature version="4.2.2" dependency="false">framework</feature>
        <feature version="4.2.2" dependency="false">standard</feature>
        <feature version="4.2.2" dependency="false">ssh</feature>
        <feature version="0.2.0" dependency="false">features-zzz</feature>
        <bundle>mvn:org.apache.aries.quiesce/org.apache.aries.quiesce.api/1.0.0</bundle>
        <bundle>mvn:org.osgi/org.osgi.service.event/1.3.1</bundle>
        <bundle>mvn:org.apache.felix/org.apache.felix.metatype/1.2.2</bundle>
        <bundle>mvn:org.opendaylight.odlparent/karaf.branding/4.0.10</bundle>
        <bundle>mvn:org.opendaylight.odlparent/bcpkix-framework-ext/4.0.10</bundle>
        <bundle>mvn:org.opendaylight.odlparent/bcprov-framework-ext/4.0.10</bundle>
    </feature>
</features>

 

启动控制器,查看结果

 

本文标签: Opendaylightkaraffeature