SDN第三次上机作业
创建以下拓扑(可采用任意方式)
创建拓扑代码
#! /usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController,CPULimitedHost
from mininet.link import TCLink
class MyTopo(Topo):
def __init__(self):
Topo.__init__(self)
# add switch
sw1 = self.addSwitch('sw1')
sw2 = self.addSwitch('sw2')
# add host
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
h4 = self.addHost('h4')
h5 = self.addHost('h5')
h6 = self.addHost('h6')
self.addLink(sw1, h1, 1, 1)
self.addLink(sw1, h2, 2, 1)
self.addLink(sw1, h3, 3, 1)
self.addLink(sw2, h4, 1, 1)
self.addLink(sw2, h5, 2, 1)
self.addLink(sw2, h6, 3, 1)
self.addLink(sw1, sw2, 4, 4)
topos = { 'mytopo': ( lambda: MyTopo() ) }
拓扑正确性验证
利用OVS命令下发流表,实现VLAN功能
利用OVS命令查看流表