Return flavor-id in OOF response 32/73332/5 1.2.5
authorRuoyu <ruoyu.ying@intel.com>
Thu, 22 Nov 2018 03:42:09 +0000 (03:42 +0000)
committerRuoyu <ruoyu.ying@intel.com>
Wed, 28 Nov 2018 02:16:25 +0000 (02:16 +0000)
Add flavor-id in OOF response

Change-Id: I56d33eef06504f66c41b793d93d132b21a27b0dc
Issue-ID: OPTFRA-401
Signed-off-by: Ruoyu <ruoyu.ying@intel.com>
conductor/conductor/data/plugins/inventory_provider/hpa_utils.py
conductor/conductor/data/service.py
conductor/conductor/solver/service.py
conductor/pom.xml
pom.xml
run-dockers.sh
version.properties

index 26133bc..84d4c87 100644 (file)
@@ -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:
index 07fc873..832b4f8 100644 (file)
@@ -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}
index 9d7f13b..8647e4b 100644 (file)
@@ -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
index 9d21f26..c1f04a4 100644 (file)
 
     <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>
diff --git a/pom.xml b/pom.xml
index f78a091..2e671a1 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
     <artifactId>optf-has</artifactId>
 
     <name>optf-has</name>
-    <version>1.2.4-SNAPSHOT</version>
+    <version>1.2.5-SNAPSHOT</version>
     <description>Homing Allocation Service</description>
 
     <modules>
index 220e9bf..f6836c6 100755 (executable)
@@ -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}"
index c61a792..901aa18 100644 (file)
@@ -19,7 +19,7 @@
 
 major=1
 minor=2
-patch=4
+patch=5
 
 base_version=${major}.${minor}.${patch}