router_c = network_3.Router(name='C', intf_count=2, max_queue_size=router_queue_size, forward_t=table_c) object_L.append(router_c) table_d = [(2, 3), (3, 4)] router_d = network_3.Router(name='D', intf_count=4, max_queue_size=router_queue_size, forward_t=table_d) object_L.append(router_d) # create a Link Layer to keep track of links between network_3 nodes link_layer = link.LinkLayer() object_L.append(link_layer) # add all the links # link parameters: from_node, from_intf_num, to_node, to_intf_num, mtu # connect client 1 to router a link_layer.add_link(link.Link(client_1, 0, router_a, 0, 50)) # connect client 2 to router a link_layer.add_link(link.Link(client_2, 0, router_a, 1, 50)) #Upper port values are OUTPUT ports else input link_layer.add_link(link.Link(router_a, 2, router_b, 0, 50)) # connect a to b link_layer.add_link(link.Link(router_b, 1, router_d, 0, 50)) # connect b to d link_layer.add_link(link.Link(router_a, 3, router_c, 0,
import link from tornado.ioloop import IOLoop import base import ethernet import http import ip import rtp import tcp import udp import util import video if __name__ == "__main__": root = link.LinkLayer() sh = shell.CommandShell(root) if len(sys.argv) == 2: graph = sys.argv[1] v = {"root": root} execfile(graph, v) elif len(sys.argv) > 2: print "Only one argument allowed (graph file to load)" sys.exit(1) #tap = driver.FakeTap() tap = driver.Tap() tap.mitm() try: