Ejemplo n.º 1
0
'''
import network_3
import link
import threading
from time import sleep

# configuration parameters
router_queue_size = 0  # 0 means unlimited
# give the network_3 sufficient time to transfer all packets before quitting
simulation_time = 10

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

    # create network_3 nodes
    client_1 = network_3.Host(1)
    object_L.append(client_1)
    client_2 = network_3.Host(2)
    object_L.append(client_2)

    server_1 = network_3.Host(3)
    object_L.append(server_1)
    server_2 = network_3.Host(4)
    object_L.append(server_2)

    table_a = [
        (2, 3), (3, 4)
    ]  #first tuple entry is output port, second address to forward to

    router_a = network_3.Router(name='A',
                                intf_count=4,
Ejemplo n.º 2
0
##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 20  #give the network sufficient time to transfer all packets before quitting

if __name__ == '__main__':
    # Router Tables
    table_A = {1: 0, 2: 1}
    table_B = {1: 0}
    table_C = {2: 0}
    table_D = {1: 0, 2: 1}

    object_L = []  #keeps track of objects, so we can kill their threads

    #create network nodes
    # Host 1
    client1 = network.Host(1)
    object_L.append(client1)

    # Host 2
    client2 = network.Host(2)
    object_L.append(client2)

    # Host 3
    server1 = network.Host(3)
    object_L.append(server1)

    # Host 4
    server2 = network.Host(4)
    object_L.append(server2)

    # Router A
Ejemplo n.º 3
0
# modified by Keely Wiesbeck and Alex Harry
import network_3
import link_3
import threading
from time import sleep

##configuration parameters
router_queue_size = 0  # 0 means unlimited
simulation_time = 10  # give the network sufficient time to transfer all packets before quitting

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

    # create network nodes

    host_1 = network_3.Host(1)
    object_L.append(host_1)
    host_2 = network_3.Host(2)
    object_L.append(host_2)
    # in router forward {i is the in interface, x is the out interface} what i will determine where to route to
    # created routing tables, pass into the routers
    # 0 (host 1)is the first in interface passes to out interface 0 (Router B)
    # {host to end/or start at: out interface}
    routing_table_a = {3: 0, 4: 1, 0: 0, 1: 1}
    router_a = network_3.Router(routing_table_a, name='A', intf_count=2, max_queue_size=router_queue_size)
    object_L.append(router_a)
    routing_table_b = {3: 0, 4: 0}
    router_b = network_3.Router(routing_table_b, name='B', intf_count=1, max_queue_size=router_queue_size)
    object_L.append(router_b)
    routing_table_c = {3: 0, 4: 0}
    router_c = network_3.Router(routing_table_c, name='C', intf_count=1, max_queue_size=router_queue_size)
Ejemplo n.º 4
0
import threading
from time import sleep
import sys
from numpy import inf
from typing import *

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 15  #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 = network.Host('H1')
    object_L.append(host_1)
    host_2 = network.Host('H2')
    object_L.append(host_2)

    #create routers and cost tables for reaching neighbors

    # ROUTER A, neighbors H1, RB, RC
    cost_D = {
        'H1': {
            0: 1
        },
        'RB': {
            1: 1
        },
        'RC': {
Ejemplo n.º 5
0
        segments[i] = segment

        # SEGMENT NUMBER
        i += 1
        # ============================================================================ #

    # return dictionary of segments
    return segments


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

    #create network nodes
    client1 = network_3.Host(1)
    object_L.append(client1)
    client2 = network_3.Host(2)
    object_L.append(client2)
    client3 = network_3.Host(3)
    object_L.append(client3)
    client4 = network_3.Host(4)
    object_L.append(client4)
    router_a = network_3.Router(name='A',
                                intf_count=2,
                                max_queue_size=router_queue_size,
                                routing_table=routing_table[0])
    object_L.append(router_a)
    router_b = network_3.Router(name='B',
                                intf_count=1,
                                max_queue_size=router_queue_size,
Ejemplo n.º 6
0
import link_3
import network_3
import threading
from time import sleep

##configuration parameters

router_queue_size = 0  #0 means unlimited
simulation_time = 40  #give the network sufficient time to transfer all packets before quitting

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

    #create network nodes    These are changed to correspond with the files for part 2 of the assignment
    #DL: New hosts added with more specific addresses to them for routing tables
    host_1 = network_3.Host(1271)
    host_2 = network_3.Host(1272)
    host_3 = network_3.Host(1291)
    host_4 = network_3.Host(1292)
    #DL: Adding the new hosts to the object list
    object_L.append(host_1)
    object_L.append(host_2)
    object_L.append(host_3)
    object_L.append(host_4)

    #DL: Setting up the 4 router network
    router_a = network_3.Router(name='A',
                                intf_count=2,
                                max_queue_size=router_queue_size)
    router_b = network_3.Router(name='B',
                                intf_count=1,
Ejemplo n.º 7
0
from time import sleep

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 1  #give the network sufficient time to transfer all packets before quitting

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

    #create network nodes

    table = {"A": ["B", "C"], "B": ["D"], "C": ["D"], "D": ["3", "4"]}

    #HOSTS

    client_1 = network.Host(1)
    client_2 = network.Host(2)
    client_3 = network.Host(3)
    client_4 = network.Host(4)

    object_L.append(client_1)
    object_L.append(client_2)
    object_L.append(client_3)
    object_L.append(client_4)

    #ROUTERS

    router_a = network.Router(name='A',
                              intf_count=2,
                              max_queue_size=router_queue_size,
                              routing_dictionary=table["A"])
Ejemplo n.º 8
0
# configuration parameters
router_queue_size = 0  # 0 means unlimited
# give the network_3 sufficient time to transfer all packets before quitting
simulation_time = 10

if __name__ == '__main__':
    object_L = []  # keeps track of objects, so we can kill their threads
    #first tuple entry is output port, second address to forward to
    table_a = [(2, 3), (3, 4)]
    table_b = [(1, 3)]
    table_c = [(1, 4)]
    table_d = [(2, 3), (3, 4)]

    # create network_3 nodes
    host1 = network_3.Host(1)
    object_L.append(host1)
    host2 = network_3.Host(2)
    object_L.append(host2)
    router_a = network_3.Router(name='A',
                                intf_count=4,
                                max_queue_size=router_queue_size,
                                forward_table=table_a)
    host3 = network_3.Host(3)
    object_L.append(host3)
    host4 = network_3.Host(4)
    object_L.append(host4)
    router_b = network_3.Router(name='B',
                                intf_count=2,
                                max_queue_size=router_queue_size,
                                forward_table=table_b)
Ejemplo n.º 9
0
@author: mwitt_000
'''
import network_3
import link_3
import threading
from time import sleep

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 5  #give the network sufficient time to transfer all packets before quitting

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

    #create network nodes
    client1 = network_3.Host(1)  #need to add 4 clients
    object_L.append(client1)
    client2 = network_3.Host(2)  #need to add 4 clients
    object_L.append(client2)
    client3 = network_3.Host(3)  #need to add 4 clients
    object_L.append(client3)
    client4 = network_3.Host(4)  #need to add 4 clients
    object_L.append(client4)
    router_a = network_3.Router(name='A',
                                intf_count=2,
                                max_queue_size=router_queue_size,
                                fTable={
                                    1: 0,
                                    2: 1
                                })
    object_L.append(router_a)
Ejemplo n.º 10
0
@author: mwitt_000
'''
import network_3
import link_3
import threading
from time import sleep

##configuration parameters
router_queue_size = 0 #0 means unlimited
simulation_time = 2 #give the network sufficient time to transfer all packets before quitting

if __name__ == '__main__':
    object_L = [] #keeps track of objects, so we can kill their threads
    
    #create network nodes
    client_a = network_3.Host(1)
    client_b = network_3.Host(2)
    object_L.append(client_a)
    object_L.append(client_b)
    server = network_3.Host(3)
    object_L.append(server)
    router_a = network_3.Router(name='A', intf_count=2, max_queue_size=router_queue_size, outgoing_l_mtu=50, routing_table={1: 0, 2: 1})
    router_b = network_3.Router(name='B', intf_count=1, max_queue_size=router_queue_size, outgoing_l_mtu=50, routing_table={1: 0, 2: 0})
    router_c = network_3.Router(name='C', intf_count=1, max_queue_size=router_queue_size, outgoing_l_mtu=50, routing_table={1: 0, 2: 0})
    router_d = network_3.Router(name='D', intf_count=2, max_queue_size=router_queue_size, outgoing_l_mtu=50, routing_table={1: 0, 2: 0})
    object_L.append(router_a)
    object_L.append(router_b)
    object_L.append(router_c)
    object_L.append(router_d)
    
    #create a Link Layer to keep track of links between network nodes
Ejemplo n.º 11
0
simulation_time = 50 #give the network sufficient time to transfer all packets before quitting




if __name__ == '__main__':

    routing_table_A = ['B' , 'C']
    routing_table_B = ['D']
    routing_table_C = ['D']
    routing_table_D = ['3','4']

    object_L = [] #keeps track of objects, so we can kill their threads

    #create network nodes
    host_1 = network_3.Host(1) #Host 1
    object_L.append(host_1)

    host_2 = network_3.Host(2) #Host 2
    object_L.append(host_2)

    host_3 = network_3.Host(3) #Host 3
    object_L.append(host_3)

    host_4 = network_3.Host(4) #Host 4
    object_L.append(host_4)

    router_a = network_3.Router(name='A', intf_count=2, max_queue_size=router_queue_size, rtable=routing_table_A) #Router A
    object_L.append(router_a)

    router_b = network_3.Router(name='B', intf_count=1, max_queue_size=router_queue_size, rtable=routing_table_B) #Router B
Ejemplo n.º 12
0
import network_3
import link_3
import threading
from time import sleep
import sys

##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 = network_3.Host('H1')
    object_L.append(host_1)
    host_2 = network_3.Host('H2')
    object_L.append(host_2)
    host_3 = network_3.Host('H3')
    object_L.append(host_3)

    #create routers and cost tables for reaching neighbors
    cost_D = {
        'H1': {
            0: 1
        },
        'H2': {
            1: 1
        },
        'RB': {
Ejemplo n.º 13
0
from time import sleep

##configuration parameters
router_queue_size = 0  #0 means unlimited
simulation_time = 6  #give the network sufficient time to transfer all packets before quitting

if __name__ == '__main__':
    object_L = []  #keeps track of objects, so we can kill their threads
    mtu = 30
    #routing table configuration
    routing_table = [[['A', 0], ['B', 0], ['D', 0]],
                     [['A', 1], ['C', 0], ['D', 0]]]

    #create network nodes
    #part 3, add hosts, etc. (and make sure to start the threads)
    host1 = network_3.Host(1)  #host1 has address 1
    object_L.append(host1)
    host2 = network_3.Host(2)  #host2 has address 2
    object_L.append(host2)
    host3 = network_3.Host(3)  #host3 has address 3
    object_L.append(host3)
    router_a = network_3.Router(name='A',
                                intf_count=2,
                                outf_count=2,
                                max_queue_size=router_queue_size,
                                routing_table=routing_table)
    router_b = network_3.Router(name='B',
                                intf_count=1,
                                outf_count=1,
                                max_queue_size=router_queue_size,
                                routing_table=routing_table)
Ejemplo n.º 14
0
@author: mwitt_000
'''
import network_3
import link_3
import threading
from time import sleep

##configuration parameters
router_queue_size = 0  # 0 means unlimited
simulation_time = 1  # give the network sufficient time to transfer all packets before quitting

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

    #create network nodes
    client1 = network_3.Host(1)
    object_L.append(client1)
    client2 = network_3.Host(2)
    object_L.append(client2)
    server3 = network_3.Host(3)
    object_L.append(server3)
    server4 = network_3.Host(4)
    object_L.append(server4)

    convergingRoutingTable = {'0001': 0, '0002': 1}
    singleRouteRoutingTable = {'0001': 0, '0002': 0}

    router_a = network_3.Router(name='A',
                                intf_count=2,
                                max_queue_size=router_queue_size,
                                routingTable=convergingRoutingTable)
Ejemplo n.º 15
0
import threading
from time import sleep

import link_3

import network_3

##configuration parameters
router_queue_size = 0 #0 means unlimited
simulation_time = 5 #give the network sufficient time to transfer all packets before quitting

if __name__ == '__main__':
    object_L = [] #keeps track of objects, so we can kill their threads
    
    #create network nodes
    tablet = network_3.Host(1)
    object_L.append(tablet)
    client = network_3.Host(2)
    object_L.append(client)
    server = network_3.Host(3)
    object_L.append(server)

    #Router Configurations!
    table_a = [(0, 3, 0), (1, 3, 1)] # From Host 1 to Host 3, send to router B, From Host 2 to 3 send to C.
    table_b = [(0, 3, 0)]  # Recieve on interface 0 for 3 send 0
    table_c = [(1, 3, 0)]
    table_d = [(0, 3, 0), (1, 3, 0)] # Send everything to port 0.


    router_a = network_3.Router(name='A', intf_count=2, max_queue_size=router_queue_size, routing_table=table_a)
    object_L.append(router_a)