SDN厂商流派ODL环境搭建
env:OFM+ODL+Mininet 处理完分离式的组件[ODL OFM Mininet分开安装]以后, 想自己封装一个单虚机的ODL环境,以能快速的deploy一个SDN的环境来做简单的开发和测试使用。 ######################################################################## #Date:2018-03-08 Author:BurlyLuo# #Mail:olaf.luo@foxmail.com Version:v1.0 # ######################################################################## OFM:https://github.com/CiscoDevNet/OpenDaylight-Openflow-App ODL:https://www.opendaylight.org/ Mininet:http://mininet.org/ VirtualBox:http://sw.bos.baidu.com/sw-search-sp/software/6bda11b7d3256/VirtualBox-5.1.30.18389-Win.exe 使用介绍: ------------------------------------------------------------------------------------------------------- SDN.ova 把SDN的工具集成到了单host之上,包含OFM,ODL,Mininet等工具。平台host使用的ubuntu为14.04桌面版, 其中网络使用桥接模式,笔者环境为192.168.35.3的地址[环境为192.168.35.0/24],在实际的使用中可以修改为对应 的网络环境地址。cpu笔者测试使用的是4核心,当然在实际使用中可以更改为2个,memory笔者给的是4096M,在实际 环境中可以做相应的更改,2048M也是ok的。 下载相应的软件包:链接:https://pan.baidu.com/s/1klz_FBIK_L7wYBvUcKcqJg 密码:5ppf 1.解压得到SDN.ova包以后,导入到virtualBox虚机中。初始的信息在导入的时候可以做更改,包含名称,CPU,memory 都可以做相应的更改。修改完以后,点击导入即可。 2.导入完成以后,打开桌面,用户名/密码:hive/hive。进入桌面以后,打开Terminal,ifconfig以后可以看到对应的 192.168.35.3,根据自己的环境,去更改为你环境中的地址即可。编辑文件:nano /etc/network/interface 3. 启动ODL模块步骤为: hive@hive:~$ sudo -i [sudo] password for hive: //密码为:hive root@hive:~# cd distribution-karaf-0.3.4-Lithium-SR4/bin/ root@hive:~/distribution-karaf-0.3.4-Lithium-SR4/bin# ./karaf Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 ________ ________ .__ .__ .__ __ \_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_ / | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\ / | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > 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> #在firefox中输入URL即可进入ODL GUI #用户名/密码 admin/admin http://ODL_地址:8181/index.html http://192.168.35.3:8181/index.html
ODL效果截图:
4.启动Mininet模块
sudo mn --topo tree,3 --controller ‘remote,ip=ODL地址,port=6653‘ --switch ovsk,protocols=OpenFlow13
root@hive:~# sudo mn --topo tree,3 --controller ‘remote,ip=192.168.35.3,port=6653‘ --switch ovsk,protocols=OpenFlow13
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 h5 h6 h7 h8
*** Adding switches:
s1 s2 s3 s4 s5 s6 s7
*** Adding links:
(s1, s2) (s1, s5) (s2, s3) (s2, s4) (s3, h1) (s3, h2) (s4, h3) (s4, h4) (s5, s6) (s5, s7) (s6, h5) (s6, h6) (s7, h7) (s7, h8)
*** Configuring hosts
h1 h2 h3 h4 h5 h6 h7 h8
*** Starting controller
c0
*** Starting 7 switches
s1 s2 s3 s4 s5 s6 s7 ...
*** Starting CLI:
mininet>
在ODL GUI中点击reload就可以发现我们刚才启动的7台OpenFlow交换机。
执行pingall以后可以在ODL GUI中reload就可以发现host
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 h5 h6 h7 h8
h2 -> h1 h3 h4 h5 h6 h7 h8
h3 -> h1 h2 h4 h5 h6 h7 h8
h4 -> h1 h2 h3 h5 h6 h7 h8
h5 -> h1 h2 h3 h4 h6 h7 h8
h6 -> h1 h2 h3 h4 h5 h7 h8
h7 -> h1 h2 h3 h4 h5 h6 h8
h8 -> h1 h2 h3 h4 h5 h6 h7
*** Results: 0% dropped (56/56 received)
mininet>
Mininet效果截图:
5.启动OFM
hive@hive:~$ sudo -i
[sudo] password for hive:
root@hive:~# cd OpenDayLight-OpenFlow-App/
root@hive:~/OpenDayLight-OpenFlow-App# ll
total 40
drwxr-xr-x 5 root root 4096 3月 8 11:53 ./
drwx------ 27 root root 4096 3月 8 12:10 ../
drwxr-xr-x 8 root root 4096 3月 7 12:26 .git/
-rw-r--r-- 1 root root 420 3月 7 12:26 Gruntfile.js
-rw-r--r-- 1 root root 587 3月 7 12:26 License
drwxr-xr-x 4 root root 4096 3月 7 12:26 node_modules/
drwxr-xr-x 5 root root 4096 3月 7 12:26 ofm/
-rw-r--r-- 1 root root 132 3月 7 12:26 package.json
-rw-r--r-- 1 root root 7219 3月 7 12:26 README.md
----------------------------------------------------
在此我们要修改一下环境因子:
修改原则:Update BASEURL to match SDN Controller IP address or leave as localhost if supported on local machine
需要修改的位置我做了标记
hive@hive:~$ sudo -i
[sudo] password for hive:
root@hive:~# cd OpenDayLight-OpenFlow-App/ofm/src/common/config/
root@hive:~/OpenDayLight-OpenFlow-App/ofm/src/common/config# ls
env.module.js
root@hive:~/OpenDayLight-OpenFlow-App/ofm/src/common/config# less env.module.js
define([‘angularAMD‘], function(ng) {
‘use strict‘;
var config = angular.module(‘config‘, [])
.constant(‘ENV‘, {
baseURL: "http://192.168.35.3:", //这里要修改为ODL的地址//
adSalPort: "8181",
mdSalPort : "8181",
ofmPort : "8181",
configEnv : "ENV_DEV",
odlUserName: ‘admin‘,
odlUserPassword: ‘admin‘,
getBaseURL : function(salType){
if(salType!==undefined){
var urlPrefix = "";
if(this.configEnv==="ENV_DEV"){
urlPrefix = this.baseURL;
}else{
urlPrefix = window.location.protocol+"//"+window.location.hostname+":";
}
if(salType==="AD_SAL"){
return urlPrefix + this.adSalPort;
}else if(salType==="MD_SAL"){
return urlPrefix + this.mdSalPort;
}else if(salType==="CONTROLLER"){
return urlPrefix + this.ofmPort;
}
}
//default behavior
return "";
// aaaUrl: "/aaa",
// appUrl: "/APP",
//// controllerUrl: "/controller",
// controllerUrl: "",
// configEnv : "ENV_DEV",
// odlUserName: ‘admin‘,
// odlUserPassword: ‘admin‘,
//
// getBaseURL : function(serviceType){
// if(serviceType!==undefined) {
// var urlPrefix = window.location.protocol + "//" + window.location.hostname;
// var removeHttp = "://";
// var urlParts = urlPrefix.split(removeHttp);
// var host = urlParts[1];
// var baseUrl = window.location.protocol + "//" + host + ‘:8181‘;
//
// if (serviceType === null) {
// return baseUrl;
// }else if (serviceType === "AAA") {
// return baseUrl + this.aaaUrl;
// }else if (serviceType === "APP") {
// return baseUrl + this.appUrl;
// }else if (serviceType === "AUTH") {
// return baseUrl + "/controller-auth";
// }else if (serviceType === "CONTROLLER") {
// return baseUrl + this.controllerUrl;
// }else if (serviceType === "LOGS") {
// return baseUrl + "/log-aggregator";
// }else if (serviceType === "METRICS") {
// return baseUrl + "/metrics-aggregator/";
// }else if (serviceType === "PATHMAN") {
// return baseUrl + "/pathman";
// }else {
// return baseUrl;
// }
// }
// return window.location.protocol + "//" + window.location.hostname + ‘:8181‘;
}
});
return config;
});
root@hive:~/OpenDayLight-OpenFlow-App/ofm/src/common/config#
此时启动OFM
----------------------------------------------------
root@hive:~/OpenDayLight-OpenFlow-App# grunt
Running "connect:def" (connect) task
Waiting forever...
Started connect web server on http://localhost:9000
看到此界面之后,我们在浏览器中访问:
http://ODL_地址:9000
http://192.168.35.3:9000
-------------------------------------------------------------------------------------------------------
OFM效果截图: