1. 解压安装OpenDayLight控制器(本次实验统一使用Beryllium版本)
安装Java环境

透过各种通路下载OpenDayLight 0.4.4-Beryllium-SR4
2. 启动并安装插件
- 安装插件
在distribution-karaf-0.4.4-Beryllium-SR4/bin目录下运行 ./karaf
于是安装
opendaylight-user@root>feature:install odl-restconf opendaylight-user@root>feature:install odl-l2switch-switch-ui opendaylight-user@root>feature:install odl-openflowplugin-all opendaylight-user@root>feature:install odl-mdsal-apidocs opendaylight-user@root>feature:install odl-dlux-core opendaylight-user@root>feature:install odl-dlux-node opendaylight-user@root>feature:install odl-dlux-yangui

3. 用Python脚本搭建如下拓扑,连接OpenDayLight控制器

注意事项:
- 新建的py脚本文件权限要改为可执行
- 要求提交控制器端的拓扑图
先在浏览器中输入http://127.0.0.1:8181/index.html进入ODL图形化界面
脚本代码为:

脚本建立后,
运行
sudo mn --custom /home/ubuntu/FZUSDNlab/odllab.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13
再在mininet终端pingall

于是在控制器UI(OpenDaylight Dlux)中显示的拓扑图如下:

4. 在控制器提供的WEB UI中下发流表使h2 20s内ping不通h3,20s后恢复
在控制器UI里
Yang UI>Opendaylight-inventory>config>nodes>table>flow





以上设置完后,打开mininet终端,运行
h2 ping h3
在Ping的期间点击本段图1中的"Send",下发流表
于是:

Preview:
http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/13
{
"flow": [
{
"id": "13",
"match": {
"in-port": "2",
"ethernet-match": {
"ethernet-type": {
"type": "0x0800"
}
},
"ipv4-destination": "10.0.0.3/32"
},
"instructions": {
"instruction": [
{
"order": "0",
"apply-actions": {
"action": [
{
"order": "0",
"drop-action": {}
}
]
}
}
]
},
"hard-timeout": "20",
"cookie": "2",
"table_id": "0"
}
]
}
5. 借助Postman通过OpenDayLight的北向接口下发流表,再利用OpenDayLight北向接口查看已下发的流表。
下载安装好Postman后,将以上Preview中的URL贴入下图所示区域,消息方式选PUT,TYPE选择Basic Auth,在"Authorization"一栏中将用户名及密码填入

在“Body”栏中将消息格式设置成json,上传方式设置为raw

将Preview的其他部分填入

最后改变消息方式为GET,点击Send查看刚刚下发的流表
