from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController,CPULimitedHost
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
class Mytopo(Topo):
def init(self):
Topo.__init__(self)
s=[]
for i in range(1):
sw = self.addSwitch('s{}'.format(i+1))
s.append(sw)
count=1
for i in range(3):
host = self.addHost('h{}'.format(count))
self.addLink(s[0],host)
count += 1
topos = {'mytopo': (lambda:Mytopo())}
来源:https://www.cnblogs.com/wangerfu/p/11901637.html