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项目之代码框架搭建的更多相关文章

  1. 基于.NetCore开发博客项目 StarBlog - (5) 开始搭建Web项目

    系列文章 基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客? 基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目 基于.NetC ...

  2. atitit.研发管理--标准化流程总结---java开发环境与项目部署环境的搭建工具包总结

    atitit.研发管理--标准化流程总结---java开发环境与项目部署环境的搭建工具包总结 1. ide系列(只开发环境需要,但部署环境也做好放上,很有用) 1 2. web服务器+sdk+网站程序 ...

  3. 淘宝(阿里百川)手机客户端开发日记第一篇 android 主框架搭建(一)

    android 主框架搭建(一) 1.开发环境:Android Studio 相继点击下一步,直接项目建立完毕(如下图) 图片看的效果如果很小,请放大您的浏览器显示百分比  转载请注明http://w ...

  4. 【一】Swift 3.0 新浪微博项目实战 -整体框架搭建

    最近要接手swift,所以找了个视频跟着做一下实战项目,在此记录一下过程和心得 框架搭建和目录拆分 关键词:MVVM 架构,桥接文件 桥接文件用于引入OC的头文件,Swift就可以正常使用(宏除外). ...

  5. LayIM.AspNetCore Middleware 开发日记(三)基础框架搭建

    前言 在上一篇中简单讲了一些基础知识,例如Asp.Net Core Middleware 的使用,DI的简单使用以及嵌入式资源的使用方法等.本篇就是结合基础知识来构建一个基础框架出来. 那么框架有什么 ...

  6. 基于 abp vNext 和 .NET Core 开发博客项目 - 使用 abp cli 搭建项目

    首先,默认咱们已经有了.net core 3.1的开发环境,如果你没有,快去下载... https://dotnet.microsoft.com/download 由于项目是基于abp vNext开发 ...

  7. 微信公众账号开发教程(二) 基础框架搭建——转自http://www.cnblogs.com/yank/p/3392394.html

    上一章,我们已经初步讲解了微信公众账号开发的基本原理,今天我们来探索设计实现. 首先我们设计了模块层次图,当然图中只是给出一种实现方式,不局限于此.具体见下图. 主要功能介绍如下: 1)请求接口层.处 ...

  8. OpenDaylight开发hello-world项目之功能实现

    OpenDaylight开发hello-world项目之开发环境搭建 OpenDaylight开发hello-world项目之开发工具安装 OpenDaylight开发hello-world项目之代码 ...

  9. OpenDaylight开发hello-world项目之开发环境搭建

    OpenDaylight开发hello-world项目之开发环境搭建 OpenDaylight开发hello-world项目之开发工具安装 OpenDaylight开发hello-world项目之代码 ...

随机推荐

  1. ArcGIS API for JavaScript小白入门

    简单理解就是:通过js调用arcgis相关的方法和通过html引入css等资源来展示地图,代码如下: <!DOCTYPE html> <html> <head> & ...

  2. V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245.1)

    V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245. ...

  3. nginx 校验及重启

    #查询nginx所在路径 [centos find 查询文件](https://www.cnblogs.com/codeWorldCodeHeart/p/12049262.html) #校验如下 /u ...

  4. 拷贝本地文件到docker容器内部

    #复制本地目录的xxx到镜像内部并且为xxx docker cp /home/xxx targetImage:/home/xxx

  5. docx和doc的区别

    docx和doc这两者间就相差一个字母x,可就是这一个简简单单的x有时候也会引申出很多的问题,比如这个案例,在一次研究生期末考试的考查课上,老师要求每个人事先结合自己的思路以及该课程,写一篇报告总结, ...

  6. pwn-200

    题目连接 https://adworld.xctf.org.cn/media/task/attachments/49bd95c78386423997fa044a9e750015 借鉴 https:// ...

  7. 【转】开发一个这样的 APP 要多长时间?

    作者:蒋国刚 www.cnblogs.com/guogangj/p/4676836.html 呵呵. 这是一个“如有雷同,纯属巧合”的故事,外加一些废话,大家请勿对号入座.开始了…… 我有些尴尬地拿着 ...

  8. [译]Vulkan教程(31)加载模型

    [译]Vulkan教程(31)加载模型 Loading models 加载模型 Introduction 入门 Your program is now ready to render textured ...

  9. [译]Vulkan教程(01)入门

    [译]Vulkan教程(01)入门 接下来我将翻译(https://vulkan-tutorial.com)上的Vulkan教程.这可能是我学习Vulkan的最好方式,但不是最理想的方式. 我会用“d ...

  10. swoole为什么不能代替nginx

    Swoole不能代替Apache和Nginx这些通用的HTTP服务器. 但基于Swoole开发的PHP应用不依赖Apache和Nginx也能提供生产级别的HTTP服务. 有需要学习交流的友人请加入交流 ...