Пример #1
0
 def python_check_loops(simulation):
   import topology_loader.topology_loader as hsa_topo
   import headerspace.applications as hsa
   # Warning! depends on python Hassell -- may be really slow!
   NTF = hsa_topo.generate_NTF(simulation.topology.live_switches)
   TTF = hsa_topo.generate_TTF(simulation.topology.live_links)
   loops = hsa.detect_loop(NTF, TTF, simulation.topology.live_switches)
   violations = [ str(l) for l in loops ]
   violations = list(set(violations))
   return violations
Пример #2
0
 def python_check_loops(simulation):
     import topology_loader.topology_loader as hsa_topo
     import headerspace.applications as hsa
     # Warning! depends on python Hassell -- may be really slow!
     NTF = hsa_topo.generate_NTF(simulation.topology.live_switches)
     TTF = hsa_topo.generate_TTF(simulation.topology.live_links)
     loops = hsa.detect_loop(NTF, TTF, simulation.topology.live_switches)
     violations = [str(l) for l in loops]
     violations = list(set(violations))
     return violations
Пример #3
0
 def python_check_loops(simulation, check_liveness_first=True):
   import topology_loader.topology_loader as hsa_topo
   import headerspace.applications as hsa
   if check_liveness_first and simulation.controller_manager.all_controllers_down():
     return simulation.controller_manager.cids
   # Warning! depends on python Hassell -- may be really slow!
   NTF = hsa_topo.generate_NTF(simulation.topology.live_switches)
   TTF = hsa_topo.generate_TTF(simulation.topology.live_links)
   loops = hsa.detect_loop(NTF, TTF, simulation.topology.live_switches)
   violations = [ str(l) for l in loops ]
   violations = list(set(violations))
   return violations
Пример #4
0
 def python_check_loops(simulation, check_liveness_first=True):
     import topology_loader.topology_loader as hsa_topo
     import headerspace.applications as hsa
     if check_liveness_first:
         simulation.controller_manager.check_controller_status()
         if simulation.controller_manager.all_controllers_down():
             return simulation.controller_manager.cids
     # Warning! depends on python Hassell -- may be really slow!
     NTF = hsa_topo.generate_NTF(simulation.topology.live_switches)
     TTF = hsa_topo.generate_TTF(simulation.topology.live_links)
     loops = hsa.detect_loop(NTF, TTF, simulation.topology.live_switches)
     violations = [str(l) for l in loops]
     violations = list(set(violations))
     return violations
Пример #5
0
 def test_python_loop(self):
     topo = self._create_loopy_network()
     NTF = hsa_topo.generate_NTF(topo.switches)
     TTF = hsa_topo.generate_TTF(topo.network_links)
     loops = hsa.detect_loop(NTF, TTF, topo.switches)
     self.assertTrue(loops != [])
Пример #6
0
 def test_python_loop(self):
     topo = self._create_loopy_network()
     NTF = hsa_topo.generate_NTF(topo.switches)
     TTF = hsa_topo.generate_TTF(topo.network_links)
     loops = hsa.detect_loop(NTF, TTF, topo.switches)
     self.assertTrue(loops != [])
Пример #7
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."
Пример #8
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."