From 90e318d450e18075e991671c31ac87259a695e1e Mon Sep 17 00:00:00 2001 From: Ruoyu Date: Thu, 22 Nov 2018 03:42:09 +0000 Subject: [PATCH] Return flavor-id in OOF response Add flavor-id in OOF response Change-Id: I56d33eef06504f66c41b793d93d132b21a27b0dc Issue-ID: OPTFRA-401 Signed-off-by: Ruoyu --- conductor/conductor/data/plugins/inventory_provider/hpa_utils.py | 4 ++-- conductor/conductor/data/service.py | 6 +++++- conductor/conductor/solver/service.py | 4 ++-- conductor/pom.xml | 4 ++-- pom.xml | 2 +- run-dockers.sh | 2 +- version.properties | 2 +- 7 files changed, 14 insertions(+), 10 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 @@ org.onap.optf.has - 1.2.4-SNAPSHOT + 1.2.5-SNAPSHOT optf-has org.onap.optf.has optf-has-conductor - 1.2.4-SNAPSHOT + 1.2.5-SNAPSHOT optf-has-conductor Homing Allocation Service/Conductor diff --git a/pom.xml b/pom.xml index f78a091..2e671a1 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ optf-has optf-has - 1.2.4-SNAPSHOT + 1.2.5-SNAPSHOT Homing Allocation Service diff --git a/run-dockers.sh b/run-dockers.sh index 220e9bf..f6836c6 100755 --- a/run-dockers.sh +++ b/run-dockers.sh @@ -4,7 +4,7 @@ BUILD_ARGS="--no-cache" ORG="onap" -VERSION="1.2.4" +VERSION="1.2.5" PROJECT="optf-has" DOCKER_REPOSITORY="nexus3.onap.org:10003" IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}" diff --git a/version.properties b/version.properties index c61a792..901aa18 100644 --- a/version.properties +++ b/version.properties @@ -19,7 +19,7 @@ major=1 minor=2 -patch=4 +patch=5 base_version=${major}.${minor}.${patch} -- 2.16.6