Ejemplo n.º 1
0
from network_2 import Router, Host
from link_2 import Link, LinkLayer
import threading
from time import sleep
import sys
from copy import deepcopy

##configuration parameters
router_queue_size = 0 #0 means unlimited
simulation_time = 10 #give the network sufficient time to execute transfers

if __name__ == '__main__':
    object_L = [] #keeps track of objects, so we can kill their threads at the end
    
    #create network hosts
    host_1 = Host('H1')
    object_L.append(host_1)
    host_2 = Host('H2')
    object_L.append(host_2)
    host_3 = Host('H3')
    object_L.append(host_3)
    
    # tables for router a 
    encap_tbl_D = {0: ('11', 3), 1: ('12', 2)}    # table used to encapsulate network packets into MPLS frames {(in interface: (out label, out interface)}
    frwd_tbl_D = {}     # table used to forward MPLS frames {(in label, in interface): (out label, out interface)}
    decap_tbl_D = {('21', 3): 1}    # table used to decapsulate network packets from MPLS frames {(in label, in interface): out interface}
    router_a = Router(name='RA', 
                              intf_capacity_L=[500,500,500,500],
                              encap_tbl_D = encap_tbl_D,
                              frwd_tbl_D = frwd_tbl_D,
                              decap_tbl_D = decap_tbl_D, 
Ejemplo n.º 2
0
from link_2 import Link, LinkLayer
import threading
from time import sleep
import sys
from copy import deepcopy

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 10  #give the network sufficient time to execute transfers

if __name__ == '__main__':
    object_L = [
    ]  #keeps track of objects, so we can kill their threads at the end

    #create network hosts
    host_1 = Host('H1')
    object_L.append(host_1)
    host_2 = Host('H2')
    object_L.append(host_2)
    host_3 = Host('H3')
    object_L.append(host_3)

    #create routers and routing tables for connected clients (subnets)
    #encap_tbl_D = {'H1': '1','H2': '2','H3': '3'}    # table used to encapsulate network packets into MPLS frames
    encap_tbl_D = {'H1': '1', 'H2': '2', 'H3': {'2': '4', '3': '3'}}
    #Still need to be able to have source, to send to new route
    frwd_tbl_D = {
        '1': ['99', 'H1', 3],
        '2': ['98', 'H2', 2],
        '3': ['4', 'RB', 0],
        '4': ['5', 'RC', 1]
Ejemplo n.º 3
0
from network_2 import Router, Host
from link_2 import Link, LinkLayer
import threading
from time import sleep
import sys
from copy import deepcopy

##configuration parameters
router_queue_size = 0  # 0 means unlimited
simulation_time = 10  # give the network sufficient time to execute transfers

if __name__ == '__main__':
    object_L = []  # keeps track of objects, so we can kill their threads at the end

    # create network hosts
    host_1 = Host('H1')
    object_L.append(host_1)
    host_2 = Host('H2')
    object_L.append(host_2)
    host_3 = Host('H3')
    object_L.append(host_3)

    # create routers and routing tables for connected clients (subnets)
    # {destination : value that determines whether or not to encapsulate }
    encap_tbl_D = {'H3': '77'}
    # {(intf_in, in_label) : (out_intf, out_label)}
    frwd_tbl_D = {(0, '77'): (2, '77'), (2, '55'): (0, '55'), (1, '77'): (3, '77'), (3, '44'): (1, '44')}
    # {in_label : destination}
    decap_tbl_D = {'55': 'H1', '44': 'H2'}
    router_a = Router(name='RA',
                      intf_capacity_L=[500,500,500,500],
Ejemplo n.º 4
0
from link_2 import Link, LinkLayer
import threading
from time import sleep
import sys
from copy import deepcopy

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 10  #give the network sufficient time to execute transfers

if __name__ == '__main__':
    object_L = [
    ]  #keeps track of objects, so we can kill their threads at the end

    #create network hosts
    host_1 = Host('H1')
    object_L.append(host_1)
    host_2 = Host('H2')
    object_L.append(host_2)
    host_3 = Host('H3')
    object_L.append(host_3)

    #create routers and routing tables for connected clients (subnets)
    # {incoming interface : dst}
    encap_tbl_D = {
        0: "H3",
        1: "H3"
    }  # table used to encapsulate network packets into MPLS frames
    #{(inlabel, in-interface) : (outlabel, out-interface)}
    frwd_tbl_D = {
        ("H3", 0): ("H3", 2),