format["ip_dst_pos"] = 0 format["ip_dst_len"] = 4 format["length"] = 4 rtr_names = [ "bbra_rtr", "bbrb_rtr", "boza_rtr", "bozb_rtr", "coza_rtr", "cozb_rtr", "goza_rtr", "gozb_rtr", "poza_rtr", "pozb_rtr", "roza_rtr", "rozb_rtr", "soza_rtr", "sozb_rtr", "yoza_rtr", "yozb_rtr", ] for rtr_name in rtr_names: f = TF(1) f.load_object_from_file("../work/tf_simple_stanford_backbone/%s.tf" % rtr_name) #OFG = OpenFlow_Rule_Generator(f,ciscoRouter(1).HS_FORMAT()) OFG = OpenFlow_Rule_Generator(f, format) OFG.generate_of_rules("%s.of" % rtr_name)
format["ip_dst_len"] = 4 format["length"] = 4 rtr_names = ["bbra_rtr", "bbrb_rtr", "boza_rtr", "bozb_rtr", "coza_rtr", "cozb_rtr", "goza_rtr", "gozb_rtr", "poza_rtr", "pozb_rtr", "roza_rtr", "rozb_rtr", "soza_rtr", "sozb_rtr", "yoza_rtr", "yozb_rtr", ] if (not os.path.isdir("stanford_openflow_rules")): os.makedirs("stanford_openflow_rules") for rtr_name in rtr_names: f = TF(1) f.load_object_from_file("tf_simple_stanford_backbone/%s.tf"%rtr_name) #OFG = OpenFlow_Rule_Generator(f,ciscoRouter(1).HS_FORMAT()) OFG = OpenFlow_Rule_Generator(f,format) OFG.generate_of_rules("stanford_openflow_rules/%s.of"%rtr_name)
import json import sys rtr_names = [ "atla", "chic", "hous", "kans", "losa", "newy32aoa", "salt", "seat", "wash" ] PORT_TYPE_MULTIPLIER = 10000 SWITCH_ID_MULTIPLIER = 100000 path = sys.argv[1] out_path = sys.argv[2] #path = "i2_tfs" #out_path = "i2_json" table_id = 0 topo = TF(1) topo.load_object_from_file("%s/%s.tf" % (path, "backbone_topology")) topology = {"topology": []} for rule in topo.rules: in_ports = rule["in_ports"] out_ports = rule["out_ports"] for in_port in in_ports: for out_port in out_ports: topology["topology"].append({"src": in_port, "dst": out_port}) topo.save_as_json("%s/%s.json" % (path, "topology")) for rtr in rtr_names: tf = TF(1) tf.load_object_from_file("%s/%s.tf" % (path, rtr)) #tf.save_as_json("%s/%s.tf.json"%(path,rtr)) table_id += 1 tf_in = {"rules": [], "ports": [], "id": table_id * 10}
"input_path": "../examples/stanford/tf_stanford_backbone", "switch_id_multiplier": cisco_router.SWITCH_ID_MULTIPLIER, "port_type_multiplier": cisco_router.PORT_TYPE_MULTIPLIER, "mid_port_type_const": cisco_router.INTERMEDIATE_PORT_TYPE_CONST, } loader = net_loader(settings) (map, inv_map) = loader.load_port_map() #topology f = TF(1) f.load_object_from_file("%s/topology.tf" % settings["input_path"]) #net plumber instance N = NetPlumber(f.length) #adding links for rule in f.rules: input_ports = rule["in_ports"] output_ports = rule["out_ports"] for input_port in input_ports: for output_port in output_ports: N.add_link(input_port, output_port) # add links for intermediate port f = open("%s/port_map.txt" % settings["input_path"], 'r') for line in f:
"hous", "kans", "losa", "newy32aoa", "salt", "seat", "wash" ] PORT_TYPE_MULTIPLIER = 10000 SWITCH_ID_MULTIPLIER = 100000 path = "i2_tfs" out_path = "i2_json_rules" table_id = 0 topo = TF(1) topo.load_object_from_file("%s/%s.tf"%(path,"topology")) topology = {"topology":[]} for rule in topo.rules: in_ports = rule["in_ports"] out_ports = rule["out_ports"] for in_port in in_ports: for out_port in out_ports: topology["topology"].append({"src":in_port,"dst":out_port}) topo.save_as_json("%s/%s.json"%(path,"topology")) for rtr in rtr_names: tf = TF(1) tf.load_object_from_file("%s/%s.tf"%(path,rtr)) tf.save_as_json("%s/%s.tf.json"%(path,rtr)) table_id += 1 tf_in = {"rules":[], "ports":[], "id":table_id*10}
"sozb_rtr", "yoza_rtr", "yozb_rtr", ], "input_path":"../examples/stanford/tf_stanford_backbone", "switch_id_multiplier":cisco_router.SWITCH_ID_MULTIPLIER, "port_type_multiplier":cisco_router.PORT_TYPE_MULTIPLIER, "mid_port_type_const":cisco_router.INTERMEDIATE_PORT_TYPE_CONST, } loader = net_loader(settings) (map,inv_map) = loader.load_port_map() #topology f = TF(1) f.load_object_from_file("%s/topology.tf"%settings["input_path"]) #net plumber instance N = NetPlumber(f.length) #adding links for rule in f.rules: input_ports = rule["in_ports"] output_ports = rule["out_ports"] for input_port in input_ports: for output_port in output_ports: N.add_link(input_port, output_port) # add links for intermediate port f = open("%s/port_map.txt"%settings["input_path"],'r') for line in f: