예제 #1
0
 def get_explorer(ext_anns: dict,
                  static_routes=None,
                  example="paper_example.json"):
     if static_routes is None:
         static_routes = []
     parser = InputParser(get_test_input_file(example))
     parser._load_data()
     problem = parser._problems_from_data(parser.data,
                                          ext_anns_data=ext_anns)[0]
     problem.static_routes = static_routes
     return Explorer(problem)
예제 #2
0
    def test_ecmp(self):
        flow = Flow(4, "XYZ")
        explorer = Explorer(
            InputParser(get_test_input_file("ecmp.json")).get_problems()[0])
        next_hops = PaperExampleFwGraphsTest.compute_next_hops(flow, explorer)
        fw_graph = PaperExampleFwGraphsTest.get_fw_graph(flow, explorer)

        self.cmp_next_hops(next_hops["XYZ"], {
            0: "R-ext_0",
            1: "R-0",
            2: "R-0",
            3: "R-0",
            4: "R-0",
            5: "R-0"
        })
        self.assertEqual(
            "[src: 4, dst: XYZ, next: [[-1], [2], [0], [1, 5], [3], [2]]]",
            str(fw_graph))
예제 #3
0
    def test_asymmetric_2(self):
        flow = Flow(0, "XYZ")
        explorer = Explorer(
            InputParser(
                get_test_input_file("asymmetric_alt.json")).get_problems()[0])
        next_hops = PaperExampleFwGraphsTest.compute_next_hops(flow, explorer)
        fw_graph = PaperExampleFwGraphsTest.get_fw_graph(flow, explorer)

        self.assertEqual(explorer._igp_provider.get_igp_cost(1, 4), 6)

        self.cmp_next_hops(next_hops["XYZ"], {
            0: "R-4",
            1: "R-4",
            2: "R-4",
            3: "R-4",
            4: "R-ext_4",
            5: "R-4"
        })
        self.assertEqual(
            "[src: 0, dst: XYZ, next: [[2], [], [5], [4], [-1], [3]]]",
            str(fw_graph))
예제 #4
0
 def test_ecmp(self):
     problem = InputParser(get_test_input_file("ecmp.json")).get_problems()[0]
     self.compare_to_reference(problem, "ecmp.txt")
예제 #5
0
 def test_nsfnet_alt_(self):
     problem = InputParser(get_test_input_file("Nsfnet_alt.json")).get_problems()[0]
     self.compare_to_reference(problem, "Nsfnet_alt.txt")
예제 #6
0
 def test_parsing_normal(self):
     parser = InputParser(get_test_input_file("example.json"))
     p = parser.get_problems()[0]
예제 #7
0
 def test_parsing_properties(self):
     parser = InputParser(get_test_input_file("different_properties.json"))
     p = parser.get_problems()[0]
예제 #8
0
 def test_parsing_separate_query(self):
     parser = InputParser(get_test_input_file("example_topology_only.json"),
                          get_test_input_file("example_query_only.json"))
     p = parser.get_problems()[0]
예제 #9
0
 def test_overview_example(self):
     flow = Flow(3, "XYZ")
     problem = InputParser(
         get_test_input_file("overview_example.json")).get_problems()[0]
     e = Explorer(problem)
     sol = e.explore_all()