本文整理汇总了Python中sim.topo.link函数的典型用法代码示例。如果您正苦于以下问题:Python link函数的具体用法?Python link怎么用?Python link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1 -- s1 -------- s3 -- h2
| |
---- s4 ------
"""
switch_type.create('s1')
switch_type.create('s3')
switch_type.create('s4')
host_type.create('h1')
host_type.create('h2')
topo.link(s1, s3, 10)
topo.link(s1, s4, 1)
topo.link(s4, s3, 5)
# topo.link(s1, s3)
# topo.link(s1, s4)
# topo.link(s4, s3)
topo.link(h1, s1)
topo.link(s3, h2)
示例2: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1--x ----- y
| |
| a
| |
v ----- z--h2
with link weight x<->y = 5
y<->a = 3
a<->z = 4
z<->v = 1
v<->x = 2
run start()
h1.ping(h2)
expected path: x -> v -> z
"""
switch_type.create('x')
switch_type.create('y')
switch_type.create('z')
host_type.create('h1')
host_type.create('h2')
topo.link(x, y, 2)
topo.link(y, z, 1)
topo.link(x, z, 7)
topo.link(h1, x, 1)
topo.link(h2, z, 1)
示例3: create
def create (switch_type = FakeEntity, host_type = FakeEntity, n = 2):
RIPRouter.create('student')
BasicHost.create('dest')
FakeEntity.create('announcer', None, [dest, 7])
FakeEntity.create('listener', [dest, 8], None)
topo.link(student, announcer)
topo.link(student, listener)
示例4: create
def create (switch_type):
switch_type.create('student')
BasicHost.create('dest')
BasicHost.create('src')
ReceiveEntity.create('announcer1', src)
ReceiveEntity.create('announcer2', dest)
ReceiveEntity.create('announcer3', None)
topo.link(student, announcer1)
topo.link(student, announcer2)
topo.link(student, announcer3)
topo.link(src, announcer1)
topo.link(dest, announcer2)
示例5: create
def create(switch_type):
switch_type.create("student")
BasicHost.create("dest")
BasicHost.create("src")
ReceiveEntity.create("announcer1", src)
ReceiveEntity.create("announcer2", dest)
ReceiveEntity.create("announcer3", None)
topo.link(student, announcer1)
topo.link(student, announcer2)
topo.link(student, announcer3)
topo.link(src, announcer1)
topo.link(dest, announcer2)
示例6: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1a s4--s5 h2a
\ / \ /
s1 s2
/ \ / \
h1b --s3-- h2b
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
switch_type.create('s4')
#switch_type.create('s5')
# host_type.create('h1a')
# host_type.create('h1b')
# host_type.create('h2a')
# host_type.create('h2b')
topo.link(s1, s2)
topo.link(s2, s3)
topo.link(s3, s1)
topo.link(s2, s4)
示例7: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
s1 ------ s2
/ \ / \
h1 --s3-- h2
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
host_type.create('h1')
host_type.create('h2')
topo.link(s1, h1)
topo.link(s2, h2)
topo.link(s1, s3)
topo.link(s3, s2)
topo.link(s1, s2)
示例8: create
def create (switch_type = DVRouter, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1a s4--s5 h2a
\ / \ /
s1 s2--s6--s7
/ \ / \ \
h1b --s3-- s8--s9--h2b
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
host_type.create('h1')
host_type.create('h2')
host_type.create('h3')
topo.link(s1, h1)
topo.link(s2, h2)
topo.link(s3, h3)
topo.link(s1, s2)
topo.link(s2, s3)
示例9: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1 -- s1 ----s2---- s3 --- s4--- h2
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
switch_type.create('s4')
host_type.create('h1')
host_type.create('h2')
topo.link(h1, s1)
topo.link(s1, s2, 2)
topo.link(s2, s3, 2)
topo.link(s3, s4, 2)
topo.link(s4, h2)
示例10: create
def create (switch_type = FakeEntity, host_type = FakeEntity, n = 2):
RIPRouter.create('A')
RIPRouter.create('B')
#RIPRouter.create('C')
#RIPRouter.create('D')
RIPRouter.create('E')
FakeEntity.create('Z', {A: 1}, {})
topo.link(A, B)
#topo.link(B, C)
#topo.link(C, D)
#topo.link(D, E)
topo.link(B, E)
topo.link(B, Z)
示例11: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1--A ----- D--h4
|\ /|
| --C-- |
| |
h2--B ----- E--h3
with link weight A<->B = 2
A<->D = 7
A<->C = 1
B<->E = 5
C<->D = 2
D<->E = 3
h1<->A = 1
h2<->B = 1
h3<->E = 1
h4<->D = 1
run h1.ping(h4)
expected path: A -> C -> D
run h1.ping(h3)
expected path: A -> C -> D -> E
run h2.ping(h4)
expected path: B -> A -> C -> D
"""
switch_type.create('A')
switch_type.create('B')
switch_type.create('C')
switch_type.create('D')
switch_type.create('E')
host_type.create('h1')
host_type.create('h2')
host_type.create('h3')
host_type.create('h4')
topo.link(A, B, 2)
topo.link(A, D, 7)
topo.link(A, C, 1)
topo.link(B, E, 5)
topo.link(C, D, 2)
topo.link(D, E, 3)
topo.link(A, h1, 1)
topo.link(B, h2, 1)
topo.link(E, h3, 1)
topo.link(D, h4, 1)
示例12: create
def create (switch_type = FakeEntity, host_type = FakeEntity, n = 2):
RIPRouter.create('A')
RIPRouter.create('B')
FakeEntity.create('C', {A: 1}, {})
topo.link(A, B)
topo.link(B, C)
示例13: create
def create (switch_type = DVRouter, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1a s3-s4 h2a
\ / \ /
s1 -s5-s6
\ /
--s2--
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
switch_type.create('s4')
switch_type.create('s5')
switch_type.create('s6')
host_type.create('h1a')
host_type.create('h2a')
ReceiveEntity.create('sneakylistener', [s6, s5, s4, s3, s1] , [h1a, 1], 5)
topo.link(sneakylistener, h1a)
topo.link(sneakylistener, s1)
topo.link(s1, s2)
topo.link(s2, s5)
topo.link(s5, s6)
topo.link(s6, h2a)
topo.link(s1, s3)
topo.link(s3, s4)
topo.link(s4, s5)
示例14: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1a s4-1-s5 h2a
\2 /4 2\ /3
s1 s2
/3 \5 3/ \1
h1b --s3-- h2b
"""
switch_type.create('s1')
switch_type.create('s2')
switch_type.create('s3')
switch_type.create('s4')
switch_type.create('s5')
host_type.create('h1a')
host_type.create('h1b')
host_type.create('h2a')
host_type.create('h2b')
topo.link(s1, h1a, 2)
topo.link(s1, h1b, 3)
topo.link(s2, h2a, 3)
topo.link(s2, h2b, 1)
topo.link(s1, s3, 5)
topo.link(s3, s2, 3)
topo.link(s1, s4, 4)
topo.link(s4, s5, 1)
topo.link(s5, s2, 2)
示例15: create
def create(switch_type=FakeEntity, host_type=FakeEntity, n=2):
RIPRouter.create("A")
BasicHost.create("C")
FakeEntity.create("B", {C: 100}, {C: 1})
topo.link(A, B)