Make hpa matching case-insensitive 32/78732/1
authorRuoyu Ying <ruoyu.ying@intel.com>
Tue, 19 Feb 2019 14:41:17 +0000 (22:41 +0800)
committerRuoyu Ying <ruoyu.ying@intel.com>
Tue, 19 Feb 2019 15:01:39 +0000 (23:01 +0800)
Make the value of attribute 'mandatory' case insensitive in hpa matching

Change-Id: I46f5454a489507f292fcd2cc3edd6d78e2799af4
Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
Issue-ID: OPTFRA-441

conductor/conductor/data/plugins/inventory_provider/hpa_utils.py
conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json

index 8af2e36..228352e 100644 (file)
@@ -74,7 +74,7 @@ class HpaMatchProvider(object):
         req_filter_list = []
         for capability in CapabilityDataParser.get_item(self.req_cap_list,
                                                         None):
-            if capability.item['mandatory'] == 'True':
+            if capability.item['mandatory'].lower() == 'true':
                 hpa_list = {k: capability.item[k] \
                             for k in hpa_keys if k in capability.item}
                 if hpa_list not in req_filter_list:
@@ -290,9 +290,9 @@ class HpaMatchProvider(object):
                     else:
                         req_flag = True
                         break
-            if not req_flag and capability.item['mandatory'] == 'True':
+            if not req_flag and capability.item['mandatory'].lower() == 'true':
                 return False, 0, None
-            if req_flag and capability.item['mandatory'] == 'False':
+            if req_flag and capability.item['mandatory'].lower() == 'false':
                 score = score + int(capability.item['score'])
         return True, score, directives
 
index ade034e..7c8a226 100644 (file)
@@ -4,7 +4,7 @@
       "hpa-feature": "basicCapabilities",
       "hpa-version": "v1",
       "architecture": "generic",
-      "mandatory": "True",
+      "mandatory": "true",
       "directives": [],
       "hpa-feature-attributes": [
         {