本文整理汇总了Python中sim.topo.link函数的典型用法代码示例。如果您正苦于以下问题:Python link函数的具体用法?Python link怎么用?Python link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:huangshan108,项目名称:cs168-projects,代码行数:28,代码来源:small_weight_graph.py
示例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)
开发者ID:Garyguo2011,项目名称:DistanceVectorRouting,代码行数:30,代码来源:base_weight.py
示例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)
开发者ID:Carrotizer,项目名称:Carrots-and-Durians-2,代码行数:8,代码来源:compatibility_test.py
示例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)
开发者ID:bhaviksingh,项目名称:EE122,代码行数:13,代码来源:learning_switch_learns.py
示例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)
开发者ID:roterdam,项目名称:networking-1,代码行数:13,代码来源:learning_switch_learns.py
示例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)
开发者ID:pyc3,项目名称:project1,代码行数:25,代码来源:candy.py
示例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)
开发者ID:huangshan108,项目名称:cs168-projects,代码行数:23,代码来源:small_cycle.py
示例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)
开发者ID:qkw24,项目名称:CS168-Project-1,代码行数:23,代码来源:linear_failure.py
示例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)
开发者ID:huangshan108,项目名称:cs168-projects,代码行数:24,代码来源:no_change.py
示例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)
开发者ID:alexgtom,项目名称:ee122,代码行数:13,代码来源:implicit_withdrawal_1.py
示例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)
开发者ID:Garyguo2011,项目名称:DistanceVectorRouting,代码行数:49,代码来源:section.py
示例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)
开发者ID:Carrotizer,项目名称:Carrots-and-Durians-2,代码行数:6,代码来源:implicit_withdrawal_test.py
示例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)
开发者ID:ziranshang,项目名称:cs168_proj1,代码行数:30,代码来源:loop2.py
示例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)
开发者ID:LeBenHL,项目名称:EE122Project1,代码行数:32,代码来源:candy.py
示例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)
开发者ID:roterdam,项目名称:networking-1,代码行数:5,代码来源:poison_reverse_test.py
示例16: 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)
开发者ID:skxu,项目名称:project1,代码行数:5,代码来源:poison_reverse_test.py
示例17: create
def create (switch_type = FakeEntity, host_type = FakeEntity, n = 2):
global expectedUpdate1
global expectedSender1
global waittime
print "Creating routers..."
RIPRouter.create('A')
RIPRouter.create('B')
RIPRouter.create('C')
RIPRouter.create('D')
RIPRouter.create('E')
RIPRouter.create('F')
RIPRouter.create('G')
RIPRouter.create('H')
RIPRouter.create('I')
RIPRouter.create('J')
createExpectedDict()
FakeEntity.create('Z', expectedUpdate1, expectedSender1, {})
print "Case 1: A-B-Z"
topo.link(A, B) #A - B - Z
topo.link(B, Z)
time.sleep(waittime)
if(failed):
return
print "Case 2: A B-Z"
topo.unlink(A, B) #A B - Z
time.sleep(waittime)
if(failed):
return
print "Case 3: A-B Z"
topo.unlink(B, Z)
time.sleep(waittime/2)
topo.link(A, B) #A - B Z
time.sleep(waittime)
if(failed):
return
print "Case 4: A-B-C-D-E-Z"
topo.link(E, Z) #A - B - C - D - E - Z
topo.link(B, C)
topo.link(C, D)
time.sleep(waittime)
topo.link(D, E)
time.sleep(waittime)
if(failed):
return
print "Case 5: Circle(A,E)-Z"
topo.link(E, A) #A - B - C - D - E - Z
time.sleep(waittime) # \_____________/
if(failed):
return
print "Case 6: Clique(A,E)-Z"
#topo.link(A, B)
topo.link(A, C)
topo.link(A, D)
#topo.link(A, E)
#topo.link(B, C)
topo.link(B, D) # ---A---
topo.link(B, E) # / / \ \
time.sleep(waittime) # B--|---|-E -- Z
#topo.link(C, D) # \ |/ \| /
topo.link(C, E) # C-----D
#topo.link(D, E) # Clique
time.sleep(waittime)
if(failed):
return
print "Case 7: Centralize(A,{B,C,D,E,Z}"
#topo.unlink(A, B)
#topo.unlink(A, C)
#topo.unlink(A, D)
#topo.unlink(A, E)
topo.unlink(E, Z)
topo.unlink(B, C)
topo.unlink(B, D) # Z
topo.unlink(B, E) # |
topo.unlink(C, D) # B -- A -- E
topo.unlink(C, E) # / \
topo.unlink(D, E) # C D
time.sleep(waittime)
topo.link(A, Z)
time.sleep(waittime)
if(failed):
return
print "Case 8: Centralize(A,Circle(B-E,Z))"
topo.link(B, C)
topo.link(C, D)
topo.link(D, E)
time.sleep(waittime) # ---Z---
topo.link(E, Z) # / | \
time.sleep(waittime/2) # B -- A -- E
topo.link(Z, B) # \ / \ /
time.sleep(waittime) # C-----D
#.........这里部分代码省略.........
开发者ID:alexgtom,项目名称:ee122,代码行数:101,代码来源:tsao.py
示例18: create
def create (switch_type = Hub, host_type = BasicHost):
"""
Creates a topology with loops that looks like:
h1a -- s1-----s2 -- h2a
| \ / |
| s3 |
| / \ |
h1b -- s4-----s5 -- 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)
topo.link(s4, h1b)
topo.link(s2, h2a)
topo.link(s5, h2b)
topo.link(s1, s2)
topo.link(s2, s5)
topo.link(s5, s4)
topo.link(s4, s1)
topo.link(s3, s1)
topo.link(s3, s2)
topo.link(s3, s4)
topo.link(s3, s5)
开发者ID:jgera,项目名称:RoutingProtocols,代码行数:34,代码来源:Benchmark_Scenario.py
示例19: 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('x')
switch_type.create('y')
switch_type.create('z')
host_type.create('h1')
host_type.create('h2')
ReceiveEntity.create('sneakylistener', [x, z] , [h2, 1], 5)
topo.link(x, y, 2)
topo.link(y, z, 1)
topo.link(x, z, 7)
topo.link(h1, x, 1)
topo.link(h2, sneakylistener, 1)
topo.link(z, sneakylistener, 1)
开发者ID:Garyguo2011,项目名称:DistanceVectorRouting,代码行数:24,代码来源:simple_change_weight.py
示例20: 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)
开发者ID:roterdam,项目名称:networking-1,代码行数:6,代码来源:hop_count_test.py
注:本文中的sim.topo.link函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论