《Cisco VPP SFC》4、ODL SFC 安装

原文地址:https://blog.csdn.net/u010827484/article/details/81222622
1、部署基础环境

1.1 安装 git

sudo apt-get install git

1.2 安装 Maven

sudo apt-get install maven

安装完成后:
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
root@ubuntu:/home/odl#

测试java环境:
root@ubuntu:/home/odl# java -version

2、创建sfc-oxygen目录并下载ODL代码到sfc-oxygen目录,然后切换到oxygen的稳定分支:

git clone https://git.opendaylight.org/gerrit/p/sfc.git  --branch stable/oxygen --single-branch sfc-oxygen

下载完成后:
root@ubuntu:/home/odl# git clone https://git.opendaylight.org/gerrit/p/sfc.git  --branch stable/oxygen --single-branch sfc-oxygen
Cloning into 'sfc-oxygen'...
remote: Finding sources: 100% (26479/26479)
remote: Total 26479 (delta 9512), reused 26193 (delta 9512)
Receiving objects: 100% (26479/26479), 17.90 MiB | 275.00 KiB/s, done.
Resolving deltas: 100% (9512/9512), done.
Checking connectivity... done.
root@ubuntu:/home/odl# cd sfc-oxygen/
root@ubuntu:/home/odl/sfc-oxygen# git branch
* stable/oxygen
root@ubuntu:/home/odl/sfc-oxygen#

3、编译 opendaylight 过程中可能会因为网络的原因下载失败,只需要重新编译就行

设置maven堆空间,有助于编译过程,节约编译时间:

export MAVEN_OPTS=’-Xmx1048m -XX:MaxPermSize=512m’

you can increase the heap space, the -Xmx setting, to greater than 1G if memory is available. When building in maven, the max memory reached will be displayed at the end of the build. You can use this as a guide to determine if more memory would help decrease build times. Approx 1.5G of RAM is needed by the JVM to run the Helium Controller repeatedly and avoid OOM errors.

开始编译:–DskipTests:跳过测试过程,可以节约很多时间
mvn clean install -DskipTests

提示如下错误:
root@ubuntu:/home/odl/sfc-oxygen# mvn clean install -DskipTests
Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.opendaylight.sfc:sfc-parent:0.7.3-SNAPSHOT: Could not find artifact org.opendaylight.mdsal:binding-parent:pom:0.12.3-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 6, column 11
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.opendaylight.sfc:sfc-parent:0.7.3-SNAPSHOT (/home/odl/sfc-oxygen/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.opendaylight.sfc:sfc-parent:0.7.3-SNAPSHOT: Could not find artifact org.opendaylight.mdsal:binding-parent:pom:0.12.3-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 6, column 11 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
root@ubuntu:/home/odl/sfc-oxygen# 

以上错误原因是ODL编译过程中Maven会下载很多包,但是找不到下载的源需要在当前用户目录加上settings.xml

下载Opendaylight官网提供的settings.xml并保存在当前用户目录:

root@ubuntu:/home/odl/sfc-oxygen# wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml

重新编译 ODL:

root@ubuntu:/home/odl/sfc-oxygen# mvn clean install –DskipTestsWarning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
Downloading: https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/mdsal/binding-parent/0.12.3-SNAPSHOT/maven-metadata.xml
Downloaded: https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/mdsal/binding-parent/0.12.3-SNAPSHOT/maven-metadata.xml (617 B at 0.1 KB/sec)
Downloading: https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/mdsal/binding-parent/0.12.3-SNAPSHOT/binding-parent-0.12.3-20180722.142257-14.pom

出错了…分析错误原因是因为在java环境中没有tools.jar包,查看java安装目录找不到这个包,还是重新装java:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:43 min
[INFO] Finished at: 2018-07-25T04:10:06-07:00
[INFO] Final Memory: 118M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (check-license) on project sfc-parent: Execution check-license of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.8.0 at specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
root@ubuntu:/home/odl/sfc-oxygen#

安装java:

1、卸载现有java
apt-get --purge remove java-common

2、安装java

添加ppa
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

安装oracle-java-installer
sudo apt-get install oracle-java8-installer

设置系统默认jdk
sudo update-java-alternatives -s java-8-oracle

java安装测试
java -version
javac -version

导出JAVA安装目录到环境变量:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/

3、重新安装Maven,卸载java-common时会卸载掉mvn命令,重新安装就可以了
sudo apt-get install maven

又出错了…

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33:17 min
[INFO] Finished at: 2018-07-25T05:17:44-07:00
[INFO] Final Memory: 162M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.24:bower (bower) on project sfc-ui-module: Failed to run task: 'bower install' failed. (error code 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :sfc-ui-module
root@ubuntu:/home/odl/sfc-oxygen# 

分析出错原因,是因为系统没有bower,安装bower后重新编译ODL

root@ubuntu:/home/odl/sfc-oxygen# apt-get install npm
root@ubuntu:/home/odl/sfc-oxygen# npm install bower -g 
npm WARN deprecated bower@1.8.4: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
/usr/local/lib
└── [email protected]

继续出错……

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:37 min
[INFO] Finished at: 2018-07-25T05:55:52-07:00
[INFO] Final Memory: 164M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.24:bower (bower) on project sfc-ui-module: Failed to run task: 'bower install' failed. (error code 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :sfc-ui-module

google后知道mvn使用root编译需要加上如下参数,继续编译

echo '{ "allow_root": true }' > /root/.bowerrc

大概需要2个小时,编译完成

SFC部署

1、进入karaf目录:

/home/odl/sfc-oxygen/karaf/target/assembly

2、删除karaf历史数据:

rm instances/ journal/ data/cache/ -rf

3、启动odl

root@ubuntu:/home/odl/sfc-oxygen/karaf/target/assembly# ./bin/karaf clean
Apache Karaf starting up. Press Enter to open the shell now...
100% [========================================================================]

Karaf started in 1s. Bundle stats: 13 active, 13 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.

opendaylight-user@root>

当前ODL只有基础组件,需要安装SFC环境需要的组件

opendaylight-user@root>feature:list -i
Name                                 │ Version │ Required │ State   │ Repository                           │ Description
─────────────────────────────────────┼─────────┼──────────┼─────────┼──────────────────────────────────────┼──────────────────────────────────────────────────
31c3ba29-4dc2-4fff-a491-3a8393c9ab46 │ 0.0.0   │ x        │ Started │ 3a6a1663-0dfe-4efd-8ae1-127045152b07 │
aries-proxy4.1.5   │          │ Started │ standard-4.1.5                       │ Aries Proxy
aries-blueprint4.1.5   │          │ Started │ standard-4.1.5                       │ Aries Blueprint
feature                              │ 4.1.5   │          │ Started │ standard-4.1.5                       │ Features Support
shell                                │ 4.1.5   │          │ Started │ standard-4.1.5                       │ Karaf Shell
shell-compat4.1.5   │          │ Started │ standard-4.1.5                       │ Karaf Shell Compatibility
deployer                             │ 4.1.5   │          │ Started │ standard-4.1.5                       │ Karaf Deployer
bundle                               │ 4.1.5   │          │ Started │ standard-4.1.5Provide Bundle support
config                               │ 4.1.5   │          │ Started │ standard-4.1.5Provide OSGi ConfigAdmin support
diagnostic                           │ 4.1.5   │          │ Started │ standard-4.1.5Provide Diagnostic support
instance                             │ 4.1.5   │          │ Started │ standard-4.1.5Provide Instance support
jaas                                 │ 4.1.5   │          │ Started │ standard-4.1.5Provide JAAS support
log4.1.5   │          │ Started │ standard-4.1.5Provide Log support
package                              │ 4.1.5   │          │ Started │ standard-4.1.5                       │ Package commands and mbeans
service                              │ 4.1.5   │          │ Started │ standard-4.1.5Provide Service support
system                               │ 4.1.5   │          │ Started │ standard-4.1.5Provide System support
kar                                  │ 4.1.5   │          │ Started │ standard-4.1.5Provide KAR (KARaf archive) support
ssh                                  │ 4.1.5   │          │ Started │ standard-4.1.5Provide a SSHd server on Karaf
management                           │ 4.1.5   │          │ Started │ standard-4.1.5Provide a JMX MBeanServer and a set of MBeans in
wrap                                 │ 0.0.0   │          │ Started │ standard-4.1.5                       │ Wrap URL handler
standard                             │ 4.1.5   │          │ Started │ standard-4.1.5                       │ Wrap feature describing all features part of a st
opendaylight-user@root> 

根据SFC架构,北向接口需要安装restconf相关组件,南向接口需要安装netconf相关组件以及南北向抽象层mdsal的相关组件和提供SFC功能的核心组件:

opendaylight-user@root>feature:install odl-netconf-api odl-netconf-mapping-api odl-netconf-util odl-netconf-netty-util odl-netconf-client odl-sfc-netconf odl-netconf-connector-all odl-netconf-notifications-api odl-mdsal-apidocs odl-mdsal-models odl-mdsal-binding odl-mdsal-binding-runtime odl-mdsal-common odl-mdsal-broker odl-mdsal-clustering-commons odl-mdsal-distributed-datastore odl-mdsal-remoterpc-connector odl-mdsal-broker-local odl-restconf odl-restconf-noauth odl-sfc-model odl-sfc-provider odl-sfc-provider-rest  odl-sfc-ovs odl-sfc-ui odl-sfc-sb-rest odl-sfc-openflow-renderer
opendaylight-user@root>

猜你喜欢

转载自blog.csdn.net/u010827484/article/details/81222622
今日推荐