1. 解压安装OpenDayLight控制器(本次实验统一使用Beryllium版本)
(1)配置java环境
在终端输入如下命令:
sudo gedit ~/.bashrc
在文件后面添加:
export JAVA_HOME=/usr/local/java/jdk1.8.0_201 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
(2)解压安装OpenDayLight控制器
版本为:0.4.4-Beryllium-SR4
2. 启动并安装插件
(1)进入ODL的文件夹,在终端输入如下命令:
./karaf
(2)安装feature,输入如下面命令:
feature:install odl-restconf feature:install odl-l2switch-switch-ui feature:install odl-openflowplugin-all feature:install odl-mdsal-apidocs feature:install odl-dlux-core feature:install odl-dlux-node feature:install odl-dlux-yangui
(3)打开控制器UI
打开浏览器访问http://127.0.0.1:8181/index.html,登入进入ODL图形化界面
3. 用Python脚本搭建如下拓扑,连接OpenDayLight控制器
(1)Python代码:
from mininet.topo import Topo class Mytopo(Topo): def __init__(self): Topo.__init__(self) sw=self.addSwitch('s1') count=1 for i in range(3): host = self.addHost('h{}'.format(count)) self.addLink(host,sw,1,count) count = count + 1 topos = {'mytopo': (lambda:Mytopo())}
(2)打开ODL
(3)创建拓扑并进行pingall
(4)控制器端的拓扑图
4. 在控制器提供的WEB UI中下发流表使h2 20s内ping不通h3,20s后恢复
(1)打开Yang UI>Opendaylight-inventory>config>nodes>table>flow,分别设置nod、table、flow的值
node/openflow:1
table/0
flow/不超过1024
(2)在mininet中用links查询链路连接情况
(3)设置相关值
(4)在mininet中进行h2 ping h3,点击send,由于设置了前20s不同,icmp_seq会延迟20
5. 借助Postman通过OpenDayLight的北向接口下发流表,再利用OpenDayLight北向接口查看已下发的流表。
下载并解压安装Postman,Postman下载地址
要求提交Postman下发流表及查看流表的截图
(1)安装postman,输入如下命令:
sudo tar -xzf Postman-linux-x64-7.11.0.tar.gz ./Postman/Postman
(2) 通过preview查看刚刚下发的流表项的json格式
http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/1 { "flow": [ { "id": "1", "match": { "in-port": "2", "ethernet-match": { "ethernet-type": { "type": "0x800" } }, "ipv4-destination": "10.0.0.3/32" }, "instructions": { "instruction": [ { "order": "0", "apply-actions": { "action": [ { "order": "0", "drop-action": {} } ] } } ] }, "priority": "65535", "hard-timeout": "20", "cookie": "2", "table_id": "0" } ] }