Exemple #1
0
    # if receive something from RB/C (label 4) transmit to H3
    decap_tbl_D = {'4': 'H3'}
    router_d = Router(name='RD',
                      intf_capacity_L=[500, 500, 500],
                      encap_tbl_D=encap_tbl_D,
                      frwd_tbl_D=frwd_tbl_D,
                      decap_tbl_D=decap_tbl_D,
                      max_queue_size=router_queue_size)
    object_L.append(router_d)

    #create a Link Layer to keep track of links between network nodes
    link_layer = LinkLayer()
    object_L.append(link_layer)

    #add all the links - need to reflect the connectivity in cost_D tables above
    link_layer.add_link(Link(host_1, 0, router_a,
                             0))  # host to router a connections
    link_layer.add_link(Link(host_2, 0, router_a, 1))
    link_layer.add_link(Link(router_a, 2, router_b,
                             0))  # router a to router b connections
    link_layer.add_link(Link(router_a, 3, router_c,
                             0))  # router a to router b connections
    link_layer.add_link(Link(router_b, 1, router_d, 0))  # router b to router d
    link_layer.add_link(Link(router_c, 1, router_d, 1))  # router c to router d
    link_layer.add_link(Link(router_d, 2, host_3, 0))  # host 3 to router d

    #start all the objects
    thread_L = []
    for obj in object_L:
        thread_L.append(threading.Thread(name=obj.__str__(), target=obj.run))

    for t in thread_L:
Exemple #2
0
 decap_tbl_D = {('15', 0): 2, ('18', 1): 2}    # table used to decapsulate network packets from MPLS frames {(in label, in interface): out interface}
 
 router_d = Router(name='RD', 
                           intf_capacity_L=[500,100,500],
                           encap_tbl_D = encap_tbl_D,
                           frwd_tbl_D = frwd_tbl_D,
                           decap_tbl_D = decap_tbl_D,
                           max_queue_size=router_queue_size)
 object_L.append(router_d)
 
 #create a Link Layer to keep track of links between network nodes
 link_layer = LinkLayer()
 object_L.append(link_layer)
 
 #add all the links - need to reflect the connectivity in cost_D tables above
 link_layer.add_link(Link(host_1, 0, router_a, 0))
 link_layer.add_link(Link(host_2, 0, router_a, 1))
 link_layer.add_link(Link(router_a, 2, router_b, 0))
 link_layer.add_link(Link(router_a, 3, router_c, 0))
 link_layer.add_link(Link(router_b, 1, router_d, 0))
 link_layer.add_link(Link(router_c, 1, router_d, 1))
 link_layer.add_link(Link(router_d, 2, host_3, 0))
 
 #start all the objects
 thread_L = []
 for obj in object_L:
     thread_L.append(threading.Thread(name=obj.__str__(), target=obj.run)) 
 
 for t in thread_L:
     t.start()
 
Exemple #3
0
 frwd_tbl_D = {0:1, 1:1}
 decap_tbl_D = {0:{0:1}, 2:{1:1}}
 router_D = Router(name='RD',
                   intf_capacity_L=[500,500,500],
                   encap_tbl_D = encap_tbl_D,
                   frwd_tbl_D = frwd_tbl_D,
                   decap_tbl_D = decap_tbl_D,
                   max_queue_size=router_queue_size)
 object_L.append(router_D)
 
 #create a Link Layer to keep track of links between network nodes
 link_layer = LinkLayer()
 object_L.append(link_layer)
 
 #add all the links - need to reflect the connectivity in cost_D tables above
 link_layer.add_link(Link(host_1, 0, router_a, 0))
 link_layer.add_link(Link(host_2, 0, router_a, 2))
 link_layer.add_link(Link(router_a, 1, router_b, 0))
 link_layer.add_link(Link(router_a, 3, router_C, 0))
 link_layer.add_link(Link(router_b, 1, router_D, 0))
 link_layer.add_link(Link(router_C, 1, router_D, 2))
 link_layer.add_link(Link(router_D, 1, host_3, 0))
 
 #start all the objects
 thread_L = []
 for obj in object_L:
     thread_L.append(threading.Thread(name=obj.__str__(), target=obj.run)) 
 
 for t in thread_L:
     t.start()