Ejemplo n.º 1
0
            "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]

#start reachability test and print results
st = time()
paths = find_reachability(ntf, ttf, src_port_id, dst_port_ids, test_pkt)
en = time()
print_paths(paths, id_to_name)

print "Found ",len(paths)," paths in ",en-st," seconds."
Ejemplo n.º 2
0
                 port_map["bbrb_rtr"]["te1/3"],
                 port_map["bbra_rtr"]["te1/3"],
                 port_map["bbrb_rtr"]["te7/2"],
                 port_map["bbra_rtr"]["te7/3"],
                 port_map["bbrb_rtr"]["te6/1"],
                 port_map["boza_rtr"]["te2/3"],
                 port_map["coza_rtr"]["te2/3"],
                 port_map["yozb_rtr"]["te1/3"],
                 port_map["yozb_rtr"]["te1/2"],
                 port_map["yoza_rtr"]["te1/1"],
                 port_map["yoza_rtr"]["te1/2"],
                 port_map["bozb_rtr"]["te2/3"],
                 port_map["cozb_rtr"]["te2/3"],
                 port_map["gozb_rtr"]["te2/3"],
                 port_map["pozb_rtr"]["te2/3"],
                 port_map["goza_rtr"]["te2/3"],
                 port_map["poza_rtr"]["te2/3"],
                 port_map["rozb_rtr"]["te2/3"],
                 port_map["sozb_rtr"]["te2/3"],
                 port_map["roza_rtr"]["te2/3"],
                 port_map["soza_rtr"]["te2/3"],
                 ]

st = time()

loops = detect_loop(ntf,ttf,loop_port_ids,None,output_port_addition)
en = time()
print_paths(loops, port_reverse_map)

print "Found ",len(loops)," loops in ",en-st," seconds."
Ejemplo n.º 3
0
            "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]

#start reachability test and print results
st = time()
paths = find_reachability(ntf, ttf, src_port_id, dst_port_ids, test_pkt)
en = time()
print_paths(paths, id_to_name)

print "Found ",len(paths)," paths in ",en-st," seconds."
Ejemplo n.º 4
0
    port_map["bbrb_rtr"]["te1/3"],
    port_map["bbra_rtr"]["te1/3"],
    port_map["bbrb_rtr"]["te7/2"],
    port_map["bbra_rtr"]["te7/3"],
    port_map["bbrb_rtr"]["te6/1"],
    port_map["boza_rtr"]["te2/3"],
    port_map["coza_rtr"]["te2/3"],
    port_map["yozb_rtr"]["te1/3"],
    port_map["yozb_rtr"]["te1/2"],
    port_map["yoza_rtr"]["te1/1"],
    port_map["yoza_rtr"]["te1/2"],
    port_map["bozb_rtr"]["te2/3"],
    port_map["cozb_rtr"]["te2/3"],
    port_map["gozb_rtr"]["te2/3"],
    port_map["pozb_rtr"]["te2/3"],
    port_map["goza_rtr"]["te2/3"],
    port_map["poza_rtr"]["te2/3"],
    port_map["rozb_rtr"]["te2/3"],
    port_map["sozb_rtr"]["te2/3"],
    port_map["roza_rtr"]["te2/3"],
    port_map["soza_rtr"]["te2/3"],
]

st = time()

loops = detect_loop(ntf, ttf, loop_port_ids, None, output_port_addition)
en = time()
print_paths(loops, port_reverse_map)

print "Found ", len(loops), " loops in ", en - st, " seconds."