Fix HAS CSIT bugs 57/69957/1
authorDileep Ranganathan <dileep.ranganathan@intel.com>
Sat, 6 Oct 2018 23:06:16 +0000 (16:06 -0700)
committerDileep Ranganathan <dileep.ranganathan@intel.com>
Sat, 6 Oct 2018 23:06:16 +0000 (16:06 -0700)
Homing template with no optimization is throwing List IndexOutofBound
exception. Intitialized triageSolver in RandomPick algorithm.
Used iterator to read K,V pair from flavor_maps.
Labels were wrongly initialized in the VNF_SCORE metric.

Change-Id: Icbf1b9aaa0bb7899980680a55754ea7282810adb
Issue-ID: OPTFRA-366
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
conductor/conductor/common/prometheus_metrics.py
conductor/conductor/solver/optimizer/random_pick.py
conductor/conductor/solver/service.py

index 6798cb1..93034c8 100644 (file)
@@ -59,7 +59,7 @@ VNF_SUB_OPTIMUM = Counter(
 VNF_SCORE = Counter(
     'vnf_scores',
     'HPA Scores of vnf',
-    ['customer_name', 'service_name', 'vnf_name', 'vnfc_name', 'hpa_score']
+    ['customer_name', 'service_name', 'vnf_name', 'hpa_score']
 )
 
 # HPA Matching stats
index 3130d8f..79750a6 100644 (file)
@@ -39,6 +39,7 @@ class RandomPick(search.Search):
 
     def _find_current_best(self, _demand_list, _decision_path, _request):
 
+        self.triageSolver.getSortedDemand(_demand_list)
         for demand in _demand_list:
             # apply the constraints on all candidates first
             _decision_path.current_demand = demand
index bb63d5a..9d7f13b 100644 (file)
@@ -520,7 +520,7 @@ class SolverService(cotyledon.Service):
                                 m_hpa_score = resource.get("hpa_score", 0)
                                 m_svc_name = p.template['parameters'].get(
                                     'service_name', 'N/A')
-                                for vnfc, flavor in resource.get("flavor_map"):
+                                for vnfc, flavor in resource.get("flavor_map").iteritems():
                                     PC.VNF_COMPUTE_PROFILES.labels('ONAP',
                                                                    m_svc_name,
                                                                    demand_name,