当前位置: 首页>>代码示例>>Python>>正文


Python topo.link函数代码示例

本文整理汇总了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)
开发者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


注:本文中的sim.topo.link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。