2 # -------------------------------------------------------------------------
3 # Copyright (C) 2020 Wipro Limited.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
23 from conductor.data.plugins.inventory_provider.candidates.candidate import Candidate
24 from conductor.data.plugins.inventory_provider.candidates.slice_profiles_candidate import SliceProfilesCandidate
26 class TestCandidates(unittest.TestCase):
34 def test_slice_profiles_candidate(self):
35 id = str(uuid.uuid4())
36 expected_candidate = {
39 "core_reliability": 99.99,
41 "coverage_area_ta_list": "City: Chennai",
42 "inventory_provider": "generator",
43 "inventory_type": "slice_profiles",
45 "ran_coverage_area_ta_list": "City: Chennai",
47 "ran_reliability": 99.99,
52 info = Candidate.build_candidate_info("generator", "slice_profiles", 1.0, "true", id)
53 subnet_requirements = {"core": {"latency": 15, "reliability": 99.99},
54 "ran": {"latency": 10, "reliability": 99.99, "coverage_area_ta_list": "City: Chennai"}
57 candidate = SliceProfilesCandidate(info=info, subnet_requirements=subnet_requirements,
58 default_fields={"creation_cost": 0.9})
60 self.assertEqual(expected_candidate, candidate.convert_nested_dict_to_dict())