"rozb_rtr",
             "soza_rtr",
             "sozb_rtr",
             "yoza_rtr",
             "yozb_rtr",
             ],
            "num_layers":3,
            "fwd_engine_layer":2,
            "input_path":"tf_stanford_backbone",
            "switch_id_multiplier":cisco_router.SWITCH_ID_MULTIPLIER,
            "port_type_multiplier":cisco_router.PORT_TYPE_MULTIPLIER,
            "out_port_type_const":cisco_router.OUTPUT_PORT_TYPE_CONST,
            "remove_duplicates":True,
            }

(ntf,ttf,port_map,port_reverse_map) = load_network(settings)

output_port_addition = cisco_router.PORT_TYPE_MULTIPLIER * \
cisco_router.OUTPUT_PORT_TYPE_CONST

#ports that should be used in loop detection test
loop_port_ids = [
#                  port_map["bbra_rtr"]["te7/1"],
#                  port_map["bbrb_rtr"]["te7/1"],
#                  port_map["bbra_rtr"]["te6/3"],
#                  port_map["bbrb_rtr"]["te7/4"],
#                  port_map["bbra_rtr"]["te7/2"],
#                  port_map["bbrb_rtr"]["te1/1"],
#                  port_map["bbra_rtr"]["te6/1"],
#                  port_map["bbrb_rtr"]["te6/3"],
#                  port_map["bbra_rtr"]["te1/4"],
Esempio n. 2
0
g.set_device_types(["Router"])
g.read_graphs_xml("path_to_graphs.xml")
g.read_links_xml("path_to_links.xml")
g.read_nodes_xml("path_to_nodes.xml")

settings = {"rtr_names":g.generate_node_names(),
            "num_layers":3,
            "fwd_engine_layer":2,
            "input_path":"tf_files",
            "switch_id_multiplier":cisco_router.SWITCH_ID_MULTIPLIER,
            "port_type_multiplier":cisco_router.PORT_TYPE_MULTIPLIER,
            "out_port_type_const":cisco_router.OUTPUT_PORT_TYPE_CONST,
            "remove_duplicates":True,
            }

(ntf,ttf,name_to_id,id_to_name) = load_network(settings)

# create all-x packet as input headerspace.
all_x = wildcard_create_bit_repeat(ntf.length,0x3)
# uncomment to set some field
#set_header_field(cisco_router.HS_FORMAT(), all_x, "field", value, right_mask)
#set_header_field(cisco_router.HS_FORMAT(), all_x, "vlan", 92, 0)
test_pkt = headerspace(ntf.length)
test_pkt.add_hs(all_x)

#set some input/output ports
output_port_addition = cisco_router.PORT_TYPE_MULTIPLIER * \
cisco_router.OUTPUT_PORT_TYPE_CONST
#TODO: CHANGE THIS IF YOU WANT TO RUN IT FROM/TO DIFFERENT PORTS
src_port_id = name_to_id["ROUTER NAME"]["PORT NAME"]
dst_port_ids = [name_to_id["ROUTER NAME"]["PORT NAME"]+output_port_addition]
    "rtr_names": [
        "router0",
        "router1",
        "router2",
        "router3",
    ],
    "input_path": "tf_nishant_backbone",
    "num_layers": 3,
    "fwd_engine_layer": 2,
    "switch_id_multiplier": cisco_router.SWITCH_ID_MULTIPLIER,
    "port_type_multiplier": cisco_router.PORT_TYPE_MULTIPLIER,
    "out_port_type_const": cisco_router.OUTPUT_PORT_TYPE_CONST,
    "remove_duplicates": True,
}

(ntf, ttf, port_map, port_reverse_map) = load_network(settings)

output_port_addition = cisco_router.PORT_TYPE_MULTIPLIER * \
cisco_router.OUTPUT_PORT_TYPE_CONST

#ports that should be used in loop detection test
loop_port_ids = [
    #                  port_map["bbra_rtr"]["te7/1"],
    #                  port_map["bbrb_rtr"]["te7/1"],
    #                  port_map["bbra_rtr"]["te6/3"],
    #                  port_map["bbrb_rtr"]["te7/4"],
    #                  port_map["bbra_rtr"]["te7/2"],
    #                  port_map["bbrb_rtr"]["te1/1"],
    #                  port_map["bbra_rtr"]["te6/1"],
    #                  port_map["bbrb_rtr"]["te6/3"],
    #                  port_map["bbra_rtr"]["te1/4"],