OpenDaylight开发hello-world项目之代码框架搭建
OpenDaylight开发hello-world项目之开发环境搭建
OpenDaylight开发hello-world项目之开发工具安装
OpenDaylight开发hello-world项目之代码框架搭建
OpenDaylight开发hello-world项目之功能实现
在上一节中将ODL的开发工具都装好,mvn是生成ODL框架的管理器。在本节中使用mvn构建ODL开发的代码框架。
一、生成ODL代码框架
maven工具根据上一节中设置的setting文件生成ODL的框架代码。使用代码框架的好处是不用从零开始写,框架将基础的代码写好,我们只需要关注自己的业务代码。
mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeVersion=1.3.0-Carbon
root@vm:~# mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=https://nexus.opendaylight.org/content/repositories/public -DarchetypeVersion=1.3.2-Carbon
[INFO] Scanning for projects...
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.pom (9 KB at 2.7 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/archetype/maven-archetype/2.4/maven-archetype-2.4.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/archetype/maven-archetype/2.4/maven-archetype-2.4.pom (13 KB at 22.8 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/maven-parent/26/maven-parent-26.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/maven-parent/26/maven-parent-26.pom (39 KB at 46.9 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/apache/apache/16/apache-16.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/apache/apache/16/apache-16.pom (16 KB at 27.5 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar (92 KB at 105.9 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
Define value for property 'groupId': : org.opendaylight.example
Define value for property 'artifactId': : example
[INFO] Using property: version = 0.1.0-SNAPSHOT
Define value for property 'package': org.opendaylight.topology: :
Jul 12, 2019 2:36:35 PM org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
Define value for property 'classPrefix': Topology: :
Define value for property 'copyright': : worker
[INFO] Using property: copyrightYear = 2017
Confirm properties configuration:
groupId: org.opendaylight.topology
artifactId: topology
version: 0.1.0-SNAPSHOT
package: org.opendaylight.topology
classPrefix: Topology
copyright: worker
copyrightYear: 2017
Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: opendaylight-startup-archetype:1.3.2-Carbon
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.opendaylight.topology
[INFO] Parameter: artifactId, Value: topology
[INFO] Parameter: version, Value: 0.1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.opendaylight.topology
[INFO] Parameter: packageInPathFormat, Value: org/opendaylight/topology
[INFO] Parameter: classPrefix, Value: Topology
[INFO] Parameter: package, Value: org.opendaylight.topology
[INFO] Parameter: version, Value: 0.1.0-SNAPSHOT
[INFO] Parameter: copyright, Value: worker
[INFO] Parameter: groupId, Value: org.opendaylight.topology
[INFO] Parameter: artifactId, Value: topology
[INFO] Parameter: copyrightYear, Value: 2017
[WARNING] Don't override file /root/topology/pom.xml
[INFO] project created from Archetype in dir: /root/topology
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:53 min
[INFO] Finished at: 2019-07-12T14:36:59+08:00
[INFO] Final Memory: 16M/38M
[INFO] ------------------------------------------------------------------------
当命令执行结束之后,会生成一个ODL的代码框架。具体内容有如下:

| 文件名 | 功能 |
| api | Yang模型目录 |
| artifacts | 项目组件坐标管理 |
| cli | 部署的配置文件 |
| features | feature组织管理目录 |
| impl | 业务逻辑的代码实现目录 |
| it | 集成测试 |
| karaf | karaf打包目录 |
| pom.xml | maven项目的基本信息描述文件 |
二、编译ODL框架代码
将ODL框架代码编译之后就能运能一个最简单的ODL控制器,该控制器没有任何多余功能。
提示:这个过程会持续半个小时以上时间,并且可能会连接超时而报错,具体长短取决于你的机器性能和网络。确保你在执行这个动作之前是在工程的根目录下。
mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true
参数:
-DskipTests表示不执行测试用例
-Dmaven.javadoc.skip=true表示跳过javadoc
-Dcheckstyle.skip=true表示跳过checkstyle检查
root@vm:~/topology# pwd
/root/example
root@vm:~/topology# mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true
[INFO] Scanning for projects...
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/odlparent/odlparent/1.8.2-Carbon/odlparent-1.8.2-Carbon.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/odlparent/odlparent/1.8.2-Carbon/odlparent-1.8.2-Carbon.pom (77 KB at 26.6 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/odlparent/odlparent-lite/1.8.2-Carbon/odlparent-lite-1.8.2-Carbon.pom
Downloaded: https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/odlparent/odlparent-lite/1.8.2-Carbon/odlparent-lite-1.8.2-Carbon.pom (18 KB at 30.4 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/mdsal/binding-parent/0.10.2-Carbon/binding-parent-0.10.2-Carbon.pom
[INFO] Feature repository discovered recursively: standard-3.0.8
[INFO] Feature repository discovered recursively: enterprise-3.0.8
[INFO] Feature repository discovered recursively: org.ops4j.pax.web-3.2.9
[INFO] Feature repository discovered recursively: spring-3.0.8
[INFO] Feature repository discovered recursively: odl-topology-0.1.0-SNAPSHOT
[INFO] Feature repository discovered recursively: odl-topology-0.1.0-SNAPSHOT
[INFO] Feature repository discovered recursively: odl-yangtools-1.1.2-Carbon
[INFO] Feature repository discovered recursively: odlparent-1.8.2-Carbon
[INFO] Feature repository discovered recursively: odl-netty-4
[INFO] Feature repository discovered recursively: odl-guava-18
[INFO] Feature repository discovered recursively: odl-guava-21
[INFO] Feature repository discovered recursively: odl-lmax-3
[INFO] Feature repository discovered recursively: odl-triemap-0.2
[INFO] Feature repository discovered recursively: odl-mdsal-models-0.10.2-Carbon
[INFO] Feature repository discovered recursively: odl-yangtools-2.2.2-Carbon
[INFO] Feature repository discovered recursively: odl-mdsal-1.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-controller-1.8.2-Carbon
[INFO] Feature repository discovered recursively: odl-akka-all
[INFO] Feature repository discovered recursively: odl-akka-scala-2.11
[INFO] Feature repository discovered recursively: odl-akka-system-2.4
[INFO] Feature repository discovered recursively: odl-akka-clustering-2.4
[INFO] Feature repository discovered recursively: odl-akka-leveldb-0.7
[INFO] Feature repository discovered recursively: odl-akka-persistence-2.4
[INFO] Feature repository discovered recursively: odl-config-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-config-persister-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-config-persister-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-controller-1.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-aaa-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-aaa-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-dlux-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-dlux-0.5.2-Carbon
[INFO] Feature repository discovered recursively: standard-3.0.8
[INFO] Feature repository discovered recursively: org.ops4j.pax.web-3.2.9
[INFO] Feature repository discovered recursively: org.ops4j.pax.cdi-0.11.0
[INFO] Feature repository discovered recursively: odl-yangtools-1.1.2-Carbon
[INFO] Feature repository discovered recursively: odlparent-1.8.2-Carbon
[INFO] Feature repository discovered recursively: odl-mdsal-1.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-yangtools-2.2.2-Carbon
[INFO] Feature repository discovered recursively: odl-mdsal-models-0.10.2-Carbon
[INFO] Feature repository discovered recursively: odl-config-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-config-persister-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-config-persister-0.6.2-Carbon
[INFO] Feature repository discovered recursively: odl-controller-1.8.2-Carbon
[INFO] Feature repository discovered recursively: odl-controller-1.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-aaa-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-aaa-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-dlux-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-dlux-0.5.2-Carbon
[INFO] Feature repository discovered recursively: odl-akka-scala-2.11
[INFO] Feature repository discovered recursively: odl-akka-system-2.4
[INFO] Feature repository discovered recursively: odl-akka-clustering-2.4
[INFO] Feature repository discovered recursively: odl-akka-leveldb-0.7
[INFO] Feature repository discovered recursively: odl-akka-persistence-2.4
[INFO]
[INFO] --- maven-site-plugin:3.6:attach-descriptor (generate-site) @ example-aggregator ---
[INFO] Attaching 'src/site/site.xml' site descriptor with classifier 'site'.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ODL :: org.opendaylight.example :: example-api ..... SUCCESS [ 34.400 s]
[INFO] ODL :: org.opendaylight.example :: example-impl .... SUCCESS [ 3.889 s]
[INFO] ODL :: org.opendaylight.example :: example-cli ..... SUCCESS [ 3.516 s]
[INFO] ODL :: org.opendaylight.example :: example-features SUCCESS [07:59 min]
[INFO] ODL :: org.opendaylight.example :: example-karaf ... SUCCESS [12:00 min]
[INFO] ODL :: org.opendaylight.example :: example-artifacts SUCCESS [ 3.710 s]
[INFO] ODL :: org.opendaylight.example :: example-it ...... SUCCESS [ 18.773 s]
[INFO] example ............................................ SUCCESS [ 25.075 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21:41 min
[INFO] Finished at: 2019-07-29T19:33:48+08:00
[INFO] Final Memory: 210M/888M
[INFO] ------------------------------------------------------------------------
三、编译完成
当编译完成之后,文件夹下会生成target

启动ODL控制器
进入bin目录下,运行./karaf脚本,启动ODL控制器。


查看此时安装的插件,只有简单的UI,命令行,API等。

ODL界面


简单总结一下本篇的内容。本篇主要是下载ODL框架代码,然后编译java源码,生成一个最简单的ODL控制器。本篇还有到ODL的功能开发,所有该ODL只有最简单的插件。
OpenDaylight开发hello-world项目之代码框架搭建的更多相关文章
- 基于.NetCore开发博客项目 StarBlog - (5) 开始搭建Web项目
系列文章 基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客? 基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目 基于.NetC ...
- atitit.研发管理--标准化流程总结---java开发环境与项目部署环境的搭建工具包总结
atitit.研发管理--标准化流程总结---java开发环境与项目部署环境的搭建工具包总结 1. ide系列(只开发环境需要,但部署环境也做好放上,很有用) 1 2. web服务器+sdk+网站程序 ...
- 淘宝(阿里百川)手机客户端开发日记第一篇 android 主框架搭建(一)
android 主框架搭建(一) 1.开发环境:Android Studio 相继点击下一步,直接项目建立完毕(如下图) 图片看的效果如果很小,请放大您的浏览器显示百分比 转载请注明http://w ...
- 【一】Swift 3.0 新浪微博项目实战 -整体框架搭建
最近要接手swift,所以找了个视频跟着做一下实战项目,在此记录一下过程和心得 框架搭建和目录拆分 关键词:MVVM 架构,桥接文件 桥接文件用于引入OC的头文件,Swift就可以正常使用(宏除外). ...
- LayIM.AspNetCore Middleware 开发日记(三)基础框架搭建
前言 在上一篇中简单讲了一些基础知识,例如Asp.Net Core Middleware 的使用,DI的简单使用以及嵌入式资源的使用方法等.本篇就是结合基础知识来构建一个基础框架出来. 那么框架有什么 ...
- 基于 abp vNext 和 .NET Core 开发博客项目 - 使用 abp cli 搭建项目
首先,默认咱们已经有了.net core 3.1的开发环境,如果你没有,快去下载... https://dotnet.microsoft.com/download 由于项目是基于abp vNext开发 ...
- 微信公众账号开发教程(二) 基础框架搭建——转自http://www.cnblogs.com/yank/p/3392394.html
上一章,我们已经初步讲解了微信公众账号开发的基本原理,今天我们来探索设计实现. 首先我们设计了模块层次图,当然图中只是给出一种实现方式,不局限于此.具体见下图. 主要功能介绍如下: 1)请求接口层.处 ...
- OpenDaylight开发hello-world项目之功能实现
OpenDaylight开发hello-world项目之开发环境搭建 OpenDaylight开发hello-world项目之开发工具安装 OpenDaylight开发hello-world项目之代码 ...
- OpenDaylight开发hello-world项目之开发环境搭建
OpenDaylight开发hello-world项目之开发环境搭建 OpenDaylight开发hello-world项目之开发工具安装 OpenDaylight开发hello-world项目之代码 ...
随机推荐
- 如何实现用户的历史记录功能(最多n条)
使用容量为n的队列存储历史记录 使用标准库collections中的deque,它是一个双端循环队列 from collections import deque q = deque([], 5) #参 ...
- VUE组件 之 Drawer 抽屉
注:因为项目中用的是 element-ui 框架,而这个框架并没有抽屉组件,所以自己实现一个. 一.源码地址 https://github.com/imxiaoer/DrawerForVue 二.效果 ...
- 一个diango项目的结构
一个项目的结构 day43项目 .idea 配置 pycharm自动帮配的配置,打开别人的diango项目时要先删了此项 app01 方便在一个大的Django项目中,管理实现不同的业务功能 migr ...
- springboot打包 出错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1
遇到这个问题看了很多博客之后发现:执行这个语句就行了:mvn clean package -Dmaven.test.skip=true 本文链接:https://blog.csdn.net/weixi ...
- 池化技术(二)HikariCP是如何管理数据库连接的?
基于依赖程序的版本信息:HikariCP:3.3.1 驱动程序mysql-connector-java:8.0.17 上一篇:Druid是如何管理数据库连接的 零.类图和流 ...
- Educational Codeforces Round 77 (Rated for Div. 2)
A: 尽可能平均然后剩下的平摊 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int ...
- [译]Vulkan教程(16)图形管道基础之总结
[译]Vulkan教程(16)图形管道基础之总结 Conclusion 总结 We can now combine all of the structures and objects from the ...
- Navicat Premium连接mongodb基本使用和介绍
Navicat premium是一款数据库管理工具,是一个可多重连线资料库的管理工具, 它可以让你以单一程式同时连线到 MySQL.SQLite.Oracle 及 PostgreSQL,mongodb ...
- tensorflow-- Dataset创建数据集对象
tf.data模块包含: experimental 模块 Dataset 类 FixedLengthRecordDataset 类 TFRecordDataset 类 TextLineDataset ...
- Spring Boot可执行Jar包运行原理
目录 1. 打可执行Jar包 2. 可执行Jar包内部结构 3. JarLauncher 4. 简单总结 5. 远程调试 Spring Boot有一个很方便的功能就是可以将应用打成可执行的Jar.那么 ...