Exemplo n.º 1
0
 def test_attribute(self):
     candidate = {
         "canidate_id": "1234",
         "candidate_type": "nsi",
         "latency": 5,
         "reliability": 99.9
     }
     decisions = {"urllc": candidate}
     decision_path = DecisionPath()
     decision_path.decisions = decisions
     params = {"demand": "urllc", "attribute": "latency"}
     attribute = Attribute("attribute")
     args = attribute.get_args_from_params(decision_path, Parser(), params)
     self.assertEqual(5, attribute.compute(*args))
Exemplo n.º 2
0
    def setUp(self):

        self.parser = Parser()
        self.parserExpected = {
                               "demands": {},
                               "locations": {},
                               "obj_func_param": {},
                               "cei": "null",
                               "region_gen": "null",
                               "region_group": {},
                               "request_id": "null",
                               "request_type": "null",
                               "objective": "null",
                               "constraints": {}
                              }
        self.test_parser_template = self.parser.parse_template()
Exemplo n.º 3
0
    def test_objective(self):

        expected = [10, 0.6]
        candidate_core = {
            "candidate_id": "12345",
            "candidate_type": "nssi",
            "latency": 10,
            "throughput": 200
        }
        candidate_ran = {
            "candidate_id": "12345",
            "candidate_type": "nssi",
            "latency": 15,
            "throughput": 300
        }
        candidate_transport = {
            "candidate_id": "12345",
            "candidate_type": "nssi",
            "latency": 8,
            "throughput": 400
        }

        decisions = {
            "urllc_core": candidate_core,
            "urllc_ran": candidate_ran,
            "urllc_transport": candidate_transport
        }

        decision_path = DecisionPath()
        decision_path.decisions = decisions
        request = Parser()

        actual = []
        for objective_function in self.objective_functions:
            objective = GenericObjective(objective_function)
            objective.compute(decision_path, request)
            actual.append(decision_path.cumulated_value)

        self.assertEqual(expected, actual)