SDN第5次上机作业
实验目的
1、搭建如下拓扑并连接控制器
2、下发相关流表和组表实现负载均衡
3、抓包分析验证负载均衡
实验步骤
1.建立以下拓扑,并连接上ODL控制器。
ODL拓扑界面截图
建立拓扑图步骤截图:
建立拓扑图pypthon代码:
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\')
h4 = self.addHost(\'h4\')
sw1 = self.addSwitch(\'s1\')
sw2 = self.addSwitch(\'s2\')
sw3 = self.addSwitch(\'s3\')
sw4 = self.addSwitch(\'s4\')
# add links
self.addLink(sw1,h1, 1, 1)
self.addLink(sw1,sw2, 2, 1)
self.addLink(sw1,sw3, 3, 1)
self.addLink(sw1,sw4, 4, 1)
self.addLink(sw2,sw4, 2, 2)
self.addLink(sw3,sw4, 2, 3)
self.addLink(sw4,h2, 4 ,1)
self.addLink(sw4,h3, 5, 1)
self.addLink(sw4,h4, 6, 1)
topos = {\'mytopo\': (lambda: MyTopo())}