Fix issues in Slice selection 17/122617/1
authorkrishnaa96 <krishna.moorthy6@wipro.com>
Wed, 14 Jul 2021 06:53:17 +0000 (12:23 +0530)
committerkrishnaa96 <krishna.moorthy6@wipro.com>
Wed, 14 Jul 2021 07:45:59 +0000 (13:15 +0530)
Issue-ID: OPTFRA-983
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I0dc22bc4bc65853b6693b603554e4dc99717d176

apps/slice_selection/optimizers/conductor/remote_opt_processor.py
osdf/adapters/conductor/conductor.py

index 3c140c5..68c9409 100644 (file)
@@ -52,7 +52,8 @@ class SliceSelectionOptimizer(Thread):
 
         try:
             if self.model_type == 'NSSI' \
-                    and self.request_json['sliceProfile'].get('resourceSharingLevel', "") == 'not-shared':
+                    and self.request_json['sliceProfile'].get('resourceSharingLevel', "") \
+                    in ['not-shared', 'non-shared']:
                 final_response = self.response_processor.get_slice_selection_response([])
 
             else:
@@ -97,7 +98,7 @@ class SliceSelectionOptimizer(Thread):
         except RequestException as e:
             resp = e.response.json()
             error = resp['plans'][0]['message']
-            if "Unable to find any" in error:
+            if isinstance(error, list) and "Unable to find any" in error[0]:
                 return self.response_processor.get_slice_selection_response([])
             error_log.error('Error from conductor {}'.format(error))
             return self.response_processor.process_error_response(error)
index 6749c2c..49c123d 100644 (file)
@@ -71,7 +71,7 @@ def request(req_info, demands, request_parameters, service_info, template_fields
             if resp["plans"][0].get("status") in ["error"]:
                 raise RequestException(response=raw_resp, request=raw_resp.request)
 
-            if resp["plans"][0].get("status") in ["done", "not found"]:
+            if resp["plans"][0].get("status") in ["done", "not found", "solved"]:
                 return resp
             new_url = resp['plans'][0]['links'][0][0]['href']  # TODO(krishna): check why a list of lists