2019 SDN上机第4次作业

1.解压配置Java环境

sudo gedit ~/.bashrc
在bashrc文件底部添加java路径

2.安装插件


安装feature
feature:install odl-restconf odl-l2switch-switch-ui odl-openflowplugin-all odl-mdsal-apidocs odl-dlux-core odl-dlux-node odl-dlux-yangui

3.用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())}

执行以下命令
sudo mn --custom /home/mowei/1.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13

测试连通性

4.浏览器访问http://127.0.0.1:8181/index.html进入ODL图形化界面


在mininet中使用links查看端口

在Opendaylight下设置相关参数下发流表


h2 ping h3
20s内ping不通,20s后ping通

5.借助Postman通过OpenDayLight的北向接口下发流表,再利用OpenDayLight北向接口查看已下发的流表。


将id改为2,并把url中的flow id也改为2,点击send

改为GET后send查看刚刚下发的流表

posted @ 2019-11-24 18:01  0x06c0  阅读(188)  评论(0编辑  收藏  举报