本文整理汇总了Python中mininet.topo.Topo类的典型用法代码示例。如果您正苦于以下问题:Python Topo类的具体用法?Python Topo怎么用?Python Topo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Topo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, n=2, **opts):
Topo.__init__(self, **opts)
# Add hosts and switches
h1 = self.addHost('h1')
h2 = self.addHost('h2')
I1 = self.addSwitch('I1', dpid=toID('00:00:00:00:00:01'))
s2 = self.addSwitch('s2', dpid=toID('00:00:00:00:00:02'))
s3 = self.addSwitch('s3', dpid=toID('00:00:00:00:00:03'))
s4 = self.addSwitch('s4', dpid=toID('00:00:00:00:00:04'))
s5 = self.addSwitch('s5', dpid=toID('00:00:00:00:00:05'))
s6 = self.addSwitch('s6', dpid=toID('00:00:00:00:00:06'))
s7 = self.addSwitch('s7', dpid=toID('00:00:00:00:00:07'))
s8 = self.addSwitch('s8', dpid=toID('00:00:00:00:00:09'))
s9 = self.addSwitch('s9', dpid=toID('00:00:00:00:00:09'))
E2 = self.addSwitch('E2', dpid=toID('00:00:00:00:00:10'))
# links Add
self.addLink(I1, h1)#, 2, 1, intfName1 = 'eth0-h1')
self.addLink(E2, h2)#, 2, 1, intfName1 = 'eth0-h2')
self.addLink(I1, s2)
self.addLink(s2, s3)
self.addLink(s3, s4)
self.addLink(s4, s5)
self.addLink(s5, s6)
self.addLink(s6, s7)
self.addLink(s7, s8)
self.addLink(s8, s9)
self.addLink(s9, E2)
开发者ID:josecastillolema,项目名称:smart-OF-controller,代码行数:28,代码来源:criaLinear10.py
示例2: __init__
def __init__( self, snum, hnum ):
Topo.__init__( self )
swi = {}
hos = {}
# print "reached 1"
snum = int(snum)
hnum = int(hnum)
for x in xrange(snum):
s = self.addSwitch("s" +str(x+1))
swi[x+1]= s
# print "reached 2 "
for x in xrange(hnum):
h = self.addHost("h" +str(x+1))
hos[x+1]= h
# print "reached 3"
for x in xrange(snum):
for y in xrange(x):
self.addLink(swi[x+1],swi[y+1])
# print "reached 4"
sph = hnum/snum
sin = swi.keys()
skey = sin*int(hnum/snum)
# print skey
tmp = sin[:(hnum%snum)]
# print tmp
skey = skey + tmp
skey.sort()
# print skey
i = 1
for x in skey:
self.addLink(swi[x], hos[i])
i = i+1
开发者ID:kavyanerella,项目名称:201301121_cloud_assignments,代码行数:35,代码来源:mininet.py
示例3: __init__
def __init__( self, **opts ):
"Create a topology."
# Initialize Topology
Topo.__init__( self, **opts )
# add nodes, switches first...
NewYork = self.addSwitch( 's0' )
Chicago = self.addSwitch( 's1' )
WashingtonDC = self.addSwitch( 's2' )
Seattle = self.addSwitch( 's3' )
Sunnyvale = self.addSwitch( 's4' )
LosAngeles = self.addSwitch( 's5' )
Denver = self.addSwitch( 's6' )
KansasCity = self.addSwitch( 's7' )
Houston = self.addSwitch( 's8' )
Atlanta = self.addSwitch( 's9' )
Indianapolis = self.addSwitch( 's10' )
# ... and now hosts
NewYork_host = self.addHost( 'h0' )
Chicago_host = self.addHost( 'h1' )
WashingtonDC_host = self.addHost( 'h2' )
Seattle_host = self.addHost( 'h3' )
Sunnyvale_host = self.addHost( 'h4' )
LosAngeles_host = self.addHost( 'h5' )
Denver_host = self.addHost( 'h6' )
KansasCity_host = self.addHost( 'h7' )
Houston_host = self.addHost( 'h8' )
Atlanta_host = self.addHost( 'h9' )
Indianapolis_host = self.addHost( 'h10' )
# add edges between switch and corresponding host
self.addLink( NewYork , NewYork_host )
self.addLink( Chicago , Chicago_host )
self.addLink( WashingtonDC , WashingtonDC_host )
self.addLink( Seattle , Seattle_host )
self.addLink( Sunnyvale , Sunnyvale_host )
self.addLink( LosAngeles , LosAngeles_host )
self.addLink( Denver , Denver_host )
self.addLink( KansasCity , KansasCity_host )
self.addLink( Houston , Houston_host )
self.addLink( Atlanta , Atlanta_host )
self.addLink( Indianapolis , Indianapolis_host )
# add edges between switches
self.addLink( NewYork , Chicago, bw=10, delay='5.82294818601ms')
self.addLink( NewYork , WashingtonDC, bw=10, delay='1.66933354639ms')
self.addLink( Chicago , Indianapolis, bw=10, delay='1.33817152535ms')
self.addLink( WashingtonDC , Atlanta, bw=10, delay='4.43098085052ms')
self.addLink( Seattle , Sunnyvale, bw=10, delay='5.78617273178ms')
self.addLink( Seattle , Denver, bw=10, delay='8.33987030826ms')
self.addLink( Sunnyvale , LosAngeles, bw=10, delay='2.55695492867ms')
self.addLink( Sunnyvale , Denver, bw=10, delay='7.64100479966ms')
self.addLink( LosAngeles , Houston, bw=10, delay='11.2143737889ms')
self.addLink( Denver , KansasCity, bw=10, delay='4.53199947571ms')
self.addLink( KansasCity , Houston, bw=10, delay='5.29499644815ms')
self.addLink( KansasCity , Indianapolis, bw=10, delay='3.7130222434ms')
self.addLink( Houston , Atlanta, bw=10, delay='5.73005892826ms')
self.addLink( Atlanta , Indianapolis, bw=10, delay='3.49428237002ms')
开发者ID:yossisolomon,项目名称:assessing-mininet,代码行数:60,代码来源:Abilene.graphml-generated-Mininet-Topo.py
示例4: __init__
def __init__(self, **opts):
# Initialize topology and default options
Topo.__init__(self, **opts)
# Add switch
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
s31 = self.addSwitch('s31')
s32 = self.addSwitch('s32')
s4 = self.addSwitch('s4')
s5 = self.addSwitch('s5')
s6 = self.addSwitch('s6')
s7 = self.addSwitch('s7')
# Add hosts
h1 = self.addHost('h1', mac='00:00:00:00:01:01', ip='10.0.1.1')
h5 = self.addHost('h5', mac='00:00:00:00:05:01', ip='10.0.5.1')
# Add link
self.addLink(s1, h1)
self.addLink(s5, h5)
self.addLink(s1, s2)
self.addLink(s2, s31)
self.addLink(s2, s32)
self.addLink(s31, s4)
self.addLink(s32, s4)
self.addLink(s4,s5)
self.addLink(s5,s6)
self.addLink(s4,s6)
self.addLink(s5,s7)
self.addLink(s7,s1)
开发者ID:nathankk10,项目名称:floodlight,代码行数:28,代码来源:route.py
示例5: __init__
def __init__(self, hosts=2, bwlimit=10, lat=0.1, **opts):
Topo.__init__(self, **opts)
tor = []
numLeafes = hosts
bw = bwlimit
s = 1
#bw = 10
for i in range(numLeafes):
h = self.addHost('h' + str(i + 1), mac=self.makeMAC(i),
ip="10.0.0." + str(i + 1))
sw = self.addSwitch('s' + str(s), dpid=self.makeDPID(s),
**dict(listenPort=(13000 + s - 1)))
s = s + 1
self.addLink(h, sw, bw=bw, delay=str(lat) + "ms")
tor.append(sw)
toDo = tor # nodes that have to be integrated into the tree
while len(toDo) > 1:
newToDo = []
for i in range(0, len(toDo), 2):
sw = self.addSwitch('s' + str(s), dpid=self.makeDPID(s),
**dict(listenPort=(13000 + s - 1)))
s = s + 1
newToDo.append(sw)
self.addLink(toDo[i], sw, bw=bw, delay=str(lat) + "ms")
if len(toDo) > (i + 1):
self.addLink(toDo[i + 1], sw, bw=bw, delay=str(lat) + "ms")
toDo = newToDo
bw = 1.0 * bw
开发者ID:summonersRift,项目名称:scripts,代码行数:28,代码来源:topology.py
示例6: __init__
def __init__(self):
"""Create custom topo."""
# Initialize topology
Topo.__init__(self)
# Add hosts and switches
host1 = self.addHost('h1', cls=VLANHost, vlan=200)
host2 = self.addHost('h2', cls=VLANHost, vlan=300)
host3 = self.addHost('h3', cls=VLANHost, vlan=200)
host4 = self.addHost('h4', cls=VLANHost, vlan=300)
host5 = self.addHost('h5', cls=VLANHost, vlan=200)
host6 = self.addHost('h6', cls=VLANHost, vlan=300)
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
s3 = self.addSwitch('s3')
self.addLink(s1, s2)
self.addLink(s2, host1)
self.addLink(s2, host2)
self.addLink(s2, host3)
self.addLink(s1, s3)
self.addLink(s3, host4)
self.addLink(s3, host5)
self.addLink(s3, host6)
开发者ID:hhhyang,项目名称:integration-test,代码行数:26,代码来源:vlan_vtn_test.py
示例7: __init__
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
emissor1 = self.addHost( 'h1' )
exibidor1000 = self.addHost( 'h2' )
servidor = self.addHost( 'h3' )
emissor2 = self.addHost( 'h4' )
exibidor1001 = self.addHost( 'h5' )
switch1 = self.addSwitch( 's1' )
switch2 = self.addSwitch( 's2' )
switch3 = self.addSwitch( 's3' )
switch4 = self.addSwitch( 's4' )
# Add links
self.addLink(emissor1, switch1)
self.addLink(exibidor1000, switch1)
self.addLink(switch1, switch4)
self.addLink(switch4, switch2)
self.addLink(switch2, servidor)
self.addLink(switch4, switch3)
self.addLink(switch3, emissor2)
self.addLink(exibidor1001, switch3)
开发者ID:csbatista,项目名称:Message-System-TCP,代码行数:27,代码来源:topology.py
示例8: __init__
def __init__(self, **opts):
Topo.__init__(self, **opts)
#make switchs
self.Iot_1 = self.addSwitch('Iot1')
self.Iot_2 = self.addSwitch('IoT2')
self.Iot_3 = self.addSwitch('IoT3')
self.Iot_left = self.addSwitch('Iot4')
self.Iot_right = self.addSwitch('Iot5')
#make host
self.H_1 = self.addHost('H1')
self.H_2 = self.addHost('H2')
#make link
#self.addLink(self.Iot_1,self.H_1,0,0)
#self.addLink(self.Iot_1,self.Iot_2,1,0)
#self.addLink(self.Iot_2,self.H_2,1,0)
#self.addLink(self.Iot_3,self.H_2,1,1)
#self.addLink(self.Iot_3,self.H_1,0,1)
self.addLink(self.Iot_left,self.H_1)
self.addLink(self.Iot_1,self.Iot_left)
self.addLink(self.Iot_1,self.Iot_2)
self.addLink(self.Iot_2,self.Iot_right)
self.addLink(self.Iot_3,self.Iot_right)
self.addLink(self.Iot_3,self.Iot_left)
self.addLink(self.Iot_right,self.H_2)
开发者ID:clzhao,项目名称:MN-dev,代码行数:25,代码来源:test.py
示例9: __init__
def __init__(self):
# Initialize topology
Topo.__init__(self)
# Create template host, switch, and link
hconfig = {'inNamespace': True}
link_config = {'bw': 100}
host_link_config = {}
# Create switch nodes
self.addSwitch('s1')
self.addSwitch('s2')
# Create host nodes
self.addHost('h1', **hconfig)
self.addHost('h2', **hconfig)
self.addHost('h3', **hconfig)
# Add switch links
self.addLink('s1', 's2', **link_config)
# Add host links
self.addLink('h1', 's1', **link_config)
self.addLink('h2', 's1', **link_config)
self.addLink('h3', 's2', **link_config)
开发者ID:tigarto,项目名称:testbed,代码行数:26,代码来源:topo_test2.py
示例10: __init__
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
Switch1 = self.addSwitch( 's1' )
Switch2 = self.addSwitch( 's2' )
Switch3 = self.addSwitch( 's3' )
Switch4 = self.addSwitch( 's4' )
Host11 = self.addHost( 'h1' )
Host12 = self.addHost( 'h2' )
Host21 = self.addHost( 'h3' )
Host22 = self.addHost( 'h4' )
Host23 = self.addHost( 'h5' )
Service1 = self.addHost( 'srvc1' )
# Add links
self.addLink( Host11, Switch1 )
self.addLink( Host12, Switch1 )
self.addLink( Host21, Switch2 )
self.addLink( Host22, Switch2 )
self.addLink( Host23, Switch2 )
self.addLink( Switch1, Switch2 )
self.addLink( Switch2, Switch4 )
self.addLink( Switch4, Switch3 )
self.addLink( Switch3, Switch1 )
self.addLink( Switch3, Service1 )
self.addLink( Switch4, Service1 )
开发者ID:jgoodyear,项目名称:OpenDaylightCookbook,代码行数:27,代码来源:redirect_test.py
示例11: __init__
def __init__( self, *args, **kwargs ):
Topo.__init__( self, *args, **kwargs )
# Describe Code
# Set up data plane switch - this is the emulated router dataplane
# Note: The controller needs to be configured with the specific driver that
# will be attached to this switch.
# IXP fabric
main_switch = self.addSwitch( 's1' )
# Add node for central Route Server"
route_server = self.addHost('x1', ip = '172.0.255.254/16', mac='08:00:27:89:3b:ff', inNamespace = False)
self.addLink(main_switch, route_server, 1)
# Add node for ARP Proxy"
arp_proxy = self.addHost('x2', ip = '172.0.255.253/16', mac='08:00:27:89:33:ff', inNamespace = False)
self.addLink(main_switch, arp_proxy, 2)
# Add Participants to the IXP
# Each participant consists of 1 quagga router PLUS
# 1 host per network advertised behind quagga
self.addParticipant(fabric=main_switch, name = 'a1', port = 3, mac = '08:00:27:89:3b:9f',
ip = '172.0.0.01/16', networks = ['100.0.0.0/24', '110.0.0.0/24'], AS = 100)
self.addParticipant(fabric=main_switch, name = 'b1', port = 4, mac = '08:00:27:92:18:1f',
ip = '172.0.0.11/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 200)
self.addParticipant(fabric=main_switch, name = 'c1', port = 5, mac='08:00:27:54:56:ea',
ip = '172.0.0.21/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 300)
self.addParticipant(fabric=main_switch, name = 'c2', port = 6, mac = '08:00:27:bd:f8:b2',
ip = '172.0.0.22/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 300)
开发者ID:ckannan,项目名称:iSDX,代码行数:32,代码来源:simple_sdx.py
示例12: __init__
def __init__( self):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
host1 = self.addHost( 'h1', ip="10.0.1.2", defaultRoute = "via 10.0.1.1/24" )
host2 = self.addHost( 'h2', ip="10.0.1.3", defaultRoute = "via 10.0.1.1/24" )
host3 = self.addHost( 'h3', ip="10.0.2.2", defaultRoute = "via 10.0.2.1/24" )
host4 = self.addHost( 'h4', ip="10.0.2.3", defaultRoute = "via 10.0.2.1/24" )
host5 = self.addHost( 'h5', ip="10.0.2.4", defaultRoute = "via 10.0.2.1/24" )
switch1 = self.addSwitch( 's1')
switch2 = self.addSwitch( 's2')
# Add links
self.addLink( host1, switch1 )
self.addLink( host2, switch1 )
self.addLink( host3, switch2 )
self.addLink( host4, switch2 )
self.addLink( host5, switch2 )
self.addLink( switch1, switch2 )
开发者ID:sriragh-karat16,项目名称:router-exercise-openflow,代码行数:25,代码来源:mytopo2.py
示例13: __init__
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
host1 = self.addHost( 'h1' )
host2 = self.addHost( 'h2' )
host3 = self.addHost( 'h3' )
host4 = self.addHost( 'h4' )
host5 = self.addHost( 'h5' )
host6 = self.addHost( 'h6' )
switch1 = self.addSwitch( 's1' )
switch2 = self.addSwitch( 's2' )
switch3 = self.addSwitch( 's3' )
# Add links
self.addLink( host1, switch1, bw=100, delay='5ms' )
self.addLink( host2, switch1, bw=100, delay='5ms' )
self.addLink( host3, switch1, bw=100, delay='5ms' )
self.addLink( host4, switch1, bw=5, delay='10ms' )
self.addLink( host5, switch1, bw=5, delay='10ms' )
self.addLink( host6, switch1, bw=5, delay='10ms' )
self.addLink( switch1, switch2, delay='40ms' )
self.addLink( switch2, switch3, delay='40ms' )
开发者ID:filipholik,项目名称:Lancaster,代码行数:26,代码来源:FWComplexTopo.py
示例14: __init__
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
leftHost = self.addHost( 'h1' )
leftHost1 = self.addHost( 'h2' )
centerHost = self.addHost( 'h3' )
centerHost1 = self.addHost( 'h4' )
rightHost = self.addHost( 'h5' )
rightHost1 = self.addHost( 'h6' )
leftSwitch = self.addSwitch( 's1' )
centerSwitch = self.addSwitch( 's2' )
rightSwitch = self.addSwitch( 's3' )
# Add links
self.addLink( leftHost, leftSwitch )
self.addLink( leftHost1, leftSwitch )
self.addLink( centerHost, centerSwitch)
self.addLink( centerHost1, centerSwitch)
self.addLink( rightHost, rightSwitch)
self.addLink( rightHost1, rightSwitch)
self.addLink( leftSwitch, centerSwitch )
self.addLink( rightSwitch, centerSwitch )
开发者ID:NexusIS,项目名称:nexus-test,代码行数:26,代码来源:topo3Sw2HostPer.py
示例15: __init__
def __init__( self, enable_all = True ):
"Create custom topo."
Topo.__init__( self )
# h1 = self.addHost("h1")
# h2 = self.addHost("h2")
# h3 = self.addHost("h3",
# ip="172.31.3.100/24",
# defaultRoute="gw 172.31.3.1")
# h4 = self.addHost("h4",
# ip="172.31.4.100/24",
# defaultRoute="gw 172.31.4.1")
sA = self.addSwitch("s21")
sB = self.addSwitch("s22")
sC = self.addSwitch("s23")
sD = self.addSwitch("s24")
sE = self.addSwitch("s25")
sF = self.addSwitch("s26")
# self.addLink(h1, sA)
# self.addLink(h2, sB)
# self.addLink(h3, sC)
# self.addLink(h4, sD)
self.addLink(sA, sB)
self.addLink(sA, sC)
self.addLink(sB, sD)
self.addLink(sC, sE)
self.addLink(sD, sF)
self.addLink(sE, sF)
开发者ID:aryantaheri,项目名称:miniexp,代码行数:31,代码来源:core.py
示例16: __init__
def __init__(self, linkopts1, linkopts2, linkopts3, fanout=2, **opts):
# Initialize topology and default options
Topo.__init__(self, **opts)
aggregation = []
edge = []
host = []
self.linkopts = [ linkopts1, linkopts2, linkopts3 ]
# Create core switch
core = self.addSwitch('c1')
# Aggregation switches
for i in irange(1, fanout):
aggregation.append(self.addSwitch('a%s' % (len(aggregation) + 1)))
self.addLink(core, aggregation[-1], **linkopts1)
# Edge switches
for j in irange(1, fanout):
edge.append(self.addSwitch('e%s' % (len(edge) + 1)))
self.addLink(aggregation[-1], edge[-1], **linkopts2)
# Hosts
for k in irange(1, fanout):
host.append(self.addHost('h%s' % (len(host) + 1)))
self.addLink(host[-1], edge[-1], **linkopts3)
开发者ID:junousia,项目名称:coursera,代码行数:26,代码来源:CustomTopo.py
示例17: __init__
def __init__( self ):
# Initialize topology
Topo.__init__( self )
#add switches
s1 = self.addSwitch('s1', dpid="1")
s2 = self.addSwitch('s2', dpid="2")
#add hosts
vm1 = self.addHost('vm1', ip="10.0.0.1", mac="00:00:00:00:00:01")
vm2 = self.addHost('vm2', ip="10.0.0.2", mac="00:00:00:00:00:02")
vm3 = self.addHost('vm3', ip="10.0.0.3", mac="00:00:00:00:00:03")
vm4 = self.addHost('vm4', ip="10.0.0.4", mac="00:00:00:00:00:04")
vm5 = self.addHost('vm5', ip="10.0.0.11", mac="00:00:00:00:01:01")
vm6 = self.addHost('vm6', ip="10.0.0.12", mac="00:00:00:00:01:02")
vm7 = self.addHost('vm7', ip="10.0.0.13", mac="00:00:00:00:01:03")
vm8 = self.addHost('vm8', ip="10.0.0.14", mac="00:00:00:00:01:04")
vmx = self.addHost('vmx', ip="10.0.0.128", mac="00:00:00:00:02:01")
# Add links
self.addLink(s1, s2, port1 = 5, port2 = 5)
self.addLink(vm1, s1, port2 = 1)
self.addLink(vm2, s1, port2 = 2)
self.addLink(vm3, s1, port2 = 3)
self.addLink(vm4, s1, port2 = 4)
self.addLink(vm5, s2, port2 = 1)
self.addLink(vm6, s2, port2 = 2)
self.addLink(vm7, s2, port2 = 3)
self.addLink(vm8, s2, port2 = 4)
self.addLink(vmx, s1, port2 = 6)
开发者ID:blackskygg,项目名称:TrustSDN,代码行数:33,代码来源:mal_vlan.py
示例18: __init__
def __init__(self,**opts):
Topo.__init__(self, **opts)
host1 = self.addHost('h1')
host2 = self.addHost('h2')
host3 = self.addHost('h3')
host4 = self.addHost('h4')
host5 = self.addHost('h5')
host6 = self.addHost('h6')
host7 = self.addHost('h7')
host8 = self.addHost('h8')
host9 = self.addHost('h9')
host10 = self.addHost('h10')
self.switch = {}
for s in range(1,6):
self.switch[s-1] = self.addSwitch('s%s' %(s))
self.addLink(self.switch[0], self.switch[1])
self.addLink(self.switch[0], self.switch[2])
self.addLink(self.switch[0], self.switch[3])
self.addLink(self.switch[4], self.switch[1])
self.addLink(self.switch[4], self.switch[2])
self.addLink(self.switch[4], self.switch[3])
#Adding host
self.addLink(self.switch[0], host1)
self.addLink(self.switch[4], host2)
self.addLink(self.switch[4], host3)
self.addLink(self.switch[4], host4)
self.addLink(self.switch[4], host5)
self.addLink(self.switch[4], host6)
self.addLink(self.switch[4], host7)
self.addLink(self.switch[4], host8)
self.addLink(self.switch[4], host9)
self.addLink(self.switch[4], host10)
开发者ID:deepttt,项目名称:mininet-custom,代码行数:33,代码来源:group.py
示例19: __init__
def __init__( self ):
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
Host1 = self.addHost( 'h1' )
Host2 = self.addHost( 'h2' )
Host3 = self.addHost( 'h3' )
Host4 = self.addHost( 'h4' )
Host5 = self.addHost( 'h5' )
Switch1 = self.addSwitch( 's1' )
Switch2 = self.addSwitch( 's2' )
Switch3 = self.addSwitch( 's3' )
# Add links
self.addLink( Host1, Switch1 )
self.addLink( Host2, Switch1 )
self.addLink( Switch1, Switch2 )
self.addLink( Switch2, Switch3 )
self.addLink( Host3, Switch3 )
self.addLink( Host4, Switch3 )
self.addLink( Host5, Switch3 )
开发者ID:panandr,项目名称:acn-class-2016,代码行数:25,代码来源:custom-topo.py
示例20: __init__
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
leftHost_1 = self.addHost( 'h1' )
midHost_1 = self.addHost( 'h2' )
midHost_2 = self.addHost( 'h3' )
rightHost_1 = self.addHost( 'h4' )
rightHost_2 = self.addHost( 'h5' )
rightHost_3 = self.addHost( 'h6' )
leftSwitch = self.addSwitch( 's1' )
midSwitch = self.addSwitch( 's2' )
rightSwitch = self.addSwitch( 's3' )
# Add links
self.addLink( leftHost_1, leftSwitch )
self.addLink( midHost_1, midSwitch )
self.addLink( midHost_2, midSwitch )
self.addLink( rightHost_1, rightSwitch )
self.addLink( rightHost_2, rightSwitch )
self.addLink( rightHost_3, rightSwitch )
self.addLink( leftSwitch, midSwitch )
self.addLink( midSwitch, rightSwitch )
开发者ID:VarunDelft,项目名称:SDN-RYU-VLAN,代码行数:31,代码来源:Hybrid_VLAN.py
注:本文中的mininet.topo.Topo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论