2019 SDN上机第4次作业
一.安装OpenDayLight控制器,启动并安装插件
作业链接
OpenDayLight是java实现的,因此需要先配置java环境,参考链接
OpenDaylight官网
OpenDaylight Beryllium版本下载地址,本次实验请安装下面这个版本↓↓↓↓↓
OpenDayLightBeryllium版本0.4.4
![](https://img2018.cnblogs.com/blog/1797686/201911/1797686-20191122233002088-2076845766.png)
![](https://img2018.cnblogs.com/blog/1797686/201911/1797686-20191122233438483-866408951.png)
二.用Python脚本搭建如下拓扑
![](https://img2018.cnblogs.com/blog/1797686/201911/1797686-20191122233512053-1335037613.png)
代码如下:
from mininet.topo import Topo
class MyTopo(Topo):
def __init__(self):
# initilaize topology
Topo.__init__(self)
# add hosts and switches
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
s1 = self.addSwitch('s1')
# add links
self.addLink(h1, s1, 1, 1)
self.addLink(h2, s1, 1, 2)
self.addLink(h3, s1, 1, 3)
topos = {'mytopo': (lambda: MyTopo())}
pingall的结果:
三. ODL DLUX下发流表实现hardtimeout
ODL内部设置:
a.依次点击Yang UI>Opendaylight-inventory>config>nodes>table>flow:
b.ODL具体设置:
get要改成put,node/openflow:1,table/0,flow/不超过1024,flow id为1,in-port为2,type为0x0800(2048),目的地址为10.0.0.3/32
c.instruction list中order为0,action list中order为0
d.hard-timeout为20 priority为20
h2 ping h3:
实验结果:h2在20s内ping不通h3,20s后恢复
四.借助Postman调用ODL北向接口下发
安装postman,并直接解压,进入postman界面:
借助Postman,将JSON报文复制到Body内,将其Send,完成北向接口下发流表:
使用get可以调用接口查看流表: