diff options
author | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-03-27 07:07:53 -0700 |
---|---|---|
committer | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-03-28 05:53:28 -0700 |
commit | 0bb996194e6b2c462be39efb12f9f8b1f18f15eb (patch) | |
tree | 19e7279bf6c92cb9241eacba75d36bb77f22f11a | |
parent | 04bf647bc948fed77d2574e0f97ffbab5f857522 (diff) |
Fixing the HPA parameters from Homing Template
Fixed the label to flavorLabel
Fixed the features to flavorProperties
Change-Id: I157afbf5969e9434c29de21c6041e9ede7b511af
Issue-ID: OPTFRA-170
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
6 files changed, 23 insertions, 22 deletions
diff --git a/conductor/conductor/data/service.py b/conductor/conductor/data/service.py index 4948656..5912963 100644 --- a/conductor/conductor/data/service.py +++ b/conductor/conductor/data/service.py @@ -443,7 +443,7 @@ class DataEndpoint(object): error = False candidate_list = arg["candidate_list"] label_name = arg["label_name"] - features = arg["features"] + flavorProperties = arg["flavorProperties"] discard_set = set() for candidate in candidate_list: # perform this check only for cloud candidates @@ -463,7 +463,7 @@ class DataEndpoint(object): results = self.ip_ext_manager.map_method( 'match_hpa', candidate=candidate, - features=features + features=flavorProperties ) if results and len(results) > 0: diff --git a/conductor/conductor/solver/optimizer/constraints/hpa.py b/conductor/conductor/solver/optimizer/constraints/hpa.py index a7e8d3c..9ef37df 100644 --- a/conductor/conductor/solver/optimizer/constraints/hpa.py +++ b/conductor/conductor/solver/optimizer/constraints/hpa.py @@ -54,11 +54,11 @@ class HPA(constraint.Constraint): self.constraint_type, demand_name)) vm_label_list = self.properties.get('evaluate') for vm_demand in vm_label_list: - label_name = vm_demand['label'] - features = vm_demand['features'] + label_name = vm_demand['flavorLabel'] + flavorProperties = vm_demand['flavorProperties'] response = (cei.get_candidates_with_hpa(label_name, _candidate_list, - features)) + flavorProperties)) if response: _candidate_list = response else: diff --git a/conductor/conductor/solver/utils/constraint_engine_interface.py b/conductor/conductor/solver/utils/constraint_engine_interface.py index a662425..43331aa 100644 --- a/conductor/conductor/solver/utils/constraint_engine_interface.py +++ b/conductor/conductor/solver/utils/constraint_engine_interface.py @@ -117,18 +117,19 @@ class ConstraintEngineInterface(object): # response is a list of (candidate, cost) tuples return response - def get_candidates_with_hpa(self, label_name, candidate_list, features): + def get_candidates_with_hpa(self, label_name, candidate_list, + flavorProperties): ''' Returns the candidate_list with an addition of flavor_mapping for matching cloud candidates with hpa constraints. :param label_name: vm_label_name passed from the SO/Policy :param candidate_list: list of candidates to process - :param features: hpa features for this vm_label_name + :param flavorProperties: hpa features for this vm_label_name :return: candidate_list with hpa features and flavor mapping ''' ctxt = {} args = {"candidate_list": candidate_list, - "features": features, + "flavorProperties": flavorProperties, "label_name": label_name} response = self.client.call(ctxt=ctxt, method="get_candidates_with_hpa", diff --git a/conductor/conductor/tests/unit/data/hpa_constraints.json b/conductor/conductor/tests/unit/data/hpa_constraints.json index 9139204..829eaf3 100644 --- a/conductor/conductor/tests/unit/data/hpa_constraints.json +++ b/conductor/conductor/tests/unit/data/hpa_constraints.json @@ -9,7 +9,7 @@ "properties": { "evaluate": [ { - "features": [ + "flavorProperties": [ { "architecture": "generic", "hpa-feature": "basicCapabilities", @@ -80,10 +80,10 @@ "hpa-version": "v1" } ], - "label": "flavor_label_1" + "flavorLabel": "flavor_label_1" }, { - "features": [ + "flavorProperties": [ { "architecture": "generic", "hpa-feature": "basicCapabilities", @@ -150,7 +150,7 @@ "hpa-version": "v1" } ], - "label": "flavor_label_2" + "flavorLabel": "flavor_label_2" } ] } diff --git a/conductor/conductor/tests/unit/data/test_service.py b/conductor/conductor/tests/unit/data/test_service.py index 3f2adde..4b841de 100644 --- a/conductor/conductor/tests/unit/data/test_service.py +++ b/conductor/conductor/tests/unit/data/test_service.py @@ -237,14 +237,14 @@ class TestDataEndpoint(unittest.TestCase): (constraint_id, constraint_info) = \ hpa_json["conductor_solver"]["constraints"][0].items()[0] hpa_constraint = constraint_info['properties'] - features = hpa_constraint['evaluate'][0]['features'] - label_name = hpa_constraint['evaluate'][0]['label'] + flavorProperties = hpa_constraint['evaluate'][0]['flavorProperties'] + label_name = hpa_constraint['evaluate'][0]['flavorLabel'] ext_mock1.return_value = ['aai'] flavor_info = {"flavor-id": "vim-flavor-id1", "flavor-name": "vim-flavor-name1"} hpa_mock.return_value = [flavor_info] self.maxDiff = None - args = generate_args(candidate_list, features, label_name) + args = generate_args(candidate_list, flavorProperties, label_name) hpa_candidate_list = copy.deepcopy(candidate_list) hpa_candidate_list[1]['flavor_map'] = {} hpa_candidate_list[1]['flavor_map'][label_name] = "vim-flavor-name1" @@ -254,7 +254,7 @@ class TestDataEndpoint(unittest.TestCase): hpa_candidate_list2 = list() hpa_candidate_list2.append(copy.deepcopy(candidate_list[0])) - args = generate_args(candidate_list, features, label_name) + args = generate_args(candidate_list, flavorProperties, label_name) hpa_mock.return_value = [] expected_response = {'response': hpa_candidate_list2, 'error': False} self.assertEqual(expected_response, @@ -315,10 +315,10 @@ class TestDataEndpoint(unittest.TestCase): args)) -def generate_args(candidate_list, features, label_name): +def generate_args(candidate_list, flavorProperties, label_name): arg_candidate_list = copy.deepcopy(candidate_list) args = {"candidate_list": arg_candidate_list, - "features": features, + "flavorProperties": flavorProperties, "label_name": label_name} return args diff --git a/conductor/conductor/tests/unit/solver/hpa_constraints.json b/conductor/conductor/tests/unit/solver/hpa_constraints.json index 9139204..829eaf3 100644 --- a/conductor/conductor/tests/unit/solver/hpa_constraints.json +++ b/conductor/conductor/tests/unit/solver/hpa_constraints.json @@ -9,7 +9,7 @@ "properties": { "evaluate": [ { - "features": [ + "flavorProperties": [ { "architecture": "generic", "hpa-feature": "basicCapabilities", @@ -80,10 +80,10 @@ "hpa-version": "v1" } ], - "label": "flavor_label_1" + "flavorLabel": "flavor_label_1" }, { - "features": [ + "flavorProperties": [ { "architecture": "generic", "hpa-feature": "basicCapabilities", @@ -150,7 +150,7 @@ "hpa-version": "v1" } ], - "label": "flavor_label_2" + "flavorLabel": "flavor_label_2" } ] } |