Exemple #1
0
from network_3 import Router, Host
from link_3 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]}     # table used to forward MPLS frames
    decap_tbl_D = {'99':'H1','98':'H2'}    # table used to decapsulate network packets from MPLS frames
    router_a = Router(name='RA', 
                              intf_capacity_L=[500,500, 500, 500],
                              encap_tbl_D = encap_tbl_D,
Exemple #2
0
from link_3 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 = 20  # 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)

    # create routers and routing tables for connected clients (subnets)
    encap_tbl_D = {
    }  # table used to encapsulate network packets into MPLS frames
    frwd_tbl_D = {}  # table used to forward MPLS frames
    decap_tbl_D = {
    }  # table used to decapsulate network packets from MPLS frames
    router_a = Router(name='RA',
                      intf_capacity_L=[500, 500],
                      encap_tbl_D=encap_tbl_D,
                      frwd_tbl_D=frwd_tbl_D,
                      decap_tbl_D=decap_tbl_D,