diff options
author | 2018-11-22 03:42:09 +0000 | |
---|---|---|
committer | 2018-11-28 05:51:15 +0000 | |
commit | f61a5685ef90eaa7b1481b04b4686208eeef6431 (patch) | |
tree | 0d251232460a0622960afc99a1b6a593328af0be /conductor | |
parent | 633927402f317714069ae71e0ee766a0d54194ed (diff) |
Return flavor-id in OOF response
Add flavor-id in OOF response
Change-Id: I56d33eef06504f66c41b793d93d132b21a27b0dc
Issue-ID: OPTFRA-401
Signed-off-by: Ruoyu <ruoyu.ying@intel.com>
(cherry picked from commit 90e318d450e18075e991671c31ac87259a695e1e)
Diffstat (limited to 'conductor')
-rw-r--r-- | conductor/conductor/data/plugins/inventory_provider/hpa_utils.py | 4 | ||||
-rw-r--r-- | conductor/conductor/data/service.py | 6 | ||||
-rw-r--r-- | conductor/conductor/solver/service.py | 4 | ||||
-rw-r--r-- | conductor/pom.xml | 4 |
4 files changed, 11 insertions, 7 deletions
diff --git a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py index 26133bc..84d4c87 100644 --- a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py +++ b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py @@ -272,9 +272,9 @@ class HpaMatchProvider(object): req_attr_key, flavor_cfa) if not flavor_feature_attr: flavor_flag = False - if not self._compare_attribute(flavor_feature_attr[0], + elif not self._compare_attribute(flavor_feature_attr[0], req_feature_attr): - flavor_flag = False + flavor_flag = False if not flavor_flag: continue else: diff --git a/conductor/conductor/data/service.py b/conductor/conductor/data/service.py index 07fc873..832b4f8 100644 --- a/conductor/conductor/data/service.py +++ b/conductor/conductor/data/service.py @@ -511,7 +511,9 @@ class DataEndpoint(object): candidate_list[i]["flavor_map"] = {} # Create flavor mapping for label_name to flavor flavor_name = flavor_info.get("flavor-name") + flavor_id = flavor_info.get("flavor-id") candidate_list[i]["flavor_map"][label_name] = flavor_name + candidate_list[i]["flavor_map"]["flavorId"] = flavor_id # Create directives if not exist already if not candidate_list[i].get("all_directives"): candidate_list[i]["all_directives"] = {} @@ -549,9 +551,11 @@ class DataEndpoint(object): directive= {"id": id, "type": type, "directives": ""} + flavor_id_attributes = {"attribute_name": "flavorId", "attribute_value": ""} for ele in directives: if "flavor_directives" in ele.get("type"): flag = True + ele.get("attributes").append(flavor_id_attributes) break else: flag = False @@ -727,4 +731,4 @@ class DataEndpoint(object): # 'note': 'do_something called!', # 'arg': str(arg), # } - # return {'response': res, 'error': False}
\ No newline at end of file + # return {'response': res, 'error': False} diff --git a/conductor/conductor/solver/service.py b/conductor/conductor/solver/service.py index 9d7f13b..8647e4b 100644 --- a/conductor/conductor/solver/service.py +++ b/conductor/conductor/solver/service.py @@ -739,11 +739,11 @@ class SolverService(cotyledon.Service): :param flavor_map: flavor map get :param directives: All the directives get from request ''' - flavor_label = flavor_map.keys() + keys = flavor_map.keys() for ele in directives.get("directives"): for item in ele.get("directives"): if "flavor_directives" in item.get("type"): for attr in item.get("attributes"): attr["attribute_value"] = flavor_map.get(attr["attribute_name"]) \ - if attr.get("attribute_name") in flavor_label else "" + if attr.get("attribute_name") in keys else "" return directives diff --git a/conductor/pom.xml b/conductor/pom.xml index 9d21f26..c1f04a4 100644 --- a/conductor/pom.xml +++ b/conductor/pom.xml @@ -21,13 +21,13 @@ <parent> <groupId>org.onap.optf.has</groupId> - <version>1.2.4-SNAPSHOT</version> + <version>1.2.5-SNAPSHOT</version> <artifactId>optf-has</artifactId> </parent> <groupId>org.onap.optf.has</groupId> <artifactId>optf-has-conductor</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.2.5-SNAPSHOT</version> <name>optf-has-conductor</name> <description>Homing Allocation Service/Conductor</description> |