首页 > 解决方案 > 在 Opendaylight 中安装自定义功能或模块?

问题描述

我最近创建了一个基本的 HelloWorld ODL 模块,正如step out here一样,我能够让它工作。即,我可以针对它运行安静的 POST 命令并得到我的“你好”回复。

{
    "output": {
        "greeting": "Hello Andrew"
    }
}

现在,我想做的是将此模块安装到从集成发行版 repos编译的实际 ODL 中。

我遵循的步骤是:

  1. 成功创建 HelloWorld ODL 模块并从 HelloWorld karaf 子文件夹中运行 karaf

  2. 知道mvn install针对 Hello 项目会将此模块发布到我的本地.m2/repository/org/opendaylight/hello存储库中,我继续进行实际的 ODL 集成/发行版

  3. 在 ODL 的features/repos/index/pom.xml文件中,我添加了以下配置文件:

    <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>
    
  4. 然后我mvn install在 ODL 上成功运行,并且在该配置文件上没有错误。(注意:如果我在该配置文件部分输入任何内容,mvn install将会失败)

一切都说了又做了,ODL karaf 确实启动了,我可以对它运行 rest 命令……但是,纯粹针对 HelloWorld 模块工作的相同 POST 命令在集成发行版 ODL 中不起作用。相反,我收到此错误消息:

{
    "errors": {
        "error": [
            {
                "error-type": "protocol",
                "error-tag": "unknown-element",
                "error-message": "The module named 'hello' does not exist."
            }
        ]
    }
}

在某些方面,这个问题是对我之前的问题的扩展:完整 OpenDaylight 集成分发包的源代码。所以在这里把它们联系在一起。

更新:我在这里创建了一个与此问题相反的问题:Procedure to add features to OpenDaylight application

笔记:

标签: opendaylight

解决方案


ODL Integration 发行版默认不安装任何 karaf 功能,因此一旦您开始发行版,请检查您的项目功能是否已安装(例如 feature:list -i)。如果不是,只需安装它(例如 feature:install )。


推荐阅读