summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkrishnaa96 <krishna.moorthy6@wipro.com>2020-05-14 18:22:46 +0530
committerkrishnaa96 <krishna.moorthy6@wipro.com>2020-05-14 18:22:46 +0530
commit349bbf794dbc34a96755ae40e98b8ba83a074a02 (patch)
treea62e3aafc9cc385ed09dcbe619a5790962a19033 /test
parent0227fc0b5a69558cb68fd9977e12558fbb51a203 (diff)
Handle has exceptions for slice selection
Issue-ID: OPTFRA-754 Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com> Change-Id: I66904680a4b9a2bc69c144f05b95fb4f999d0e93
Diffstat (limited to 'test')
-rw-r--r--test/apps/slice_selection/nsi_error_response.json37
-rw-r--r--test/apps/slice_selection/test_remote_opt_processor.py6
2 files changed, 38 insertions, 5 deletions
diff --git a/test/apps/slice_selection/nsi_error_response.json b/test/apps/slice_selection/nsi_error_response.json
index c09bda8..f022779 100644
--- a/test/apps/slice_selection/nsi_error_response.json
+++ b/test/apps/slice_selection/nsi_error_response.json
@@ -1,6 +1,37 @@
{
"requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
"transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
- "requestStatus":"error",
- "statusMessage":"Some error message"
-} \ No newline at end of file
+ "requestStatus":"completed",
+ "statusMessage":"",
+ "solutions":{
+ "sharedNSISolutions":[
+
+ ],
+ "newNSISolutions":[
+ {
+ "matchLevel":"",
+ "NSTInfo":{"invariantUUID": "fda3c1e8-7653-4acd-80ef-f5755c1d3859",
+ "UUID": "a6906768-1cae-4e78-acd1-d753ac61f3e8",
+ "NSTName": "URLLC_1"
+ },
+
+ "NSSISolutions":[
+ {
+ "sliceProfile": {
+ "latency": 2,
+ "security": "High",
+ "reliability": 99.9999,
+ "trafficDensity": 1,
+ "connDensity": 100000,
+ "expDataRate": 50,
+ "jitter": 1,
+ "survivalTime": 0,
+ "domainType":"cn",
+ "resourceSharingLevel":"shared"
+ }
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/test/apps/slice_selection/test_remote_opt_processor.py b/test/apps/slice_selection/test_remote_opt_processor.py
index 136bb71..5321880 100644
--- a/test/apps/slice_selection/test_remote_opt_processor.py
+++ b/test/apps/slice_selection/test_remote_opt_processor.py
@@ -18,7 +18,7 @@
import json
import unittest
-from requests import RequestException
+from requests import RequestException, Response
from apps.slice_selection.optimizers.conductor.remote_opt_processor import process_nsi_selection_opt
from osdf.adapters.local_data import local_policies
@@ -102,8 +102,10 @@ class TestRemoteOptProcessor(unittest.TestCase):
conductor_error_response_file = 'test/apps/slice_selection/conductor_error_response.json'
conductor_error_response = json_from_file(conductor_error_response_file)
+ response = Response()
+ response._content = json.dumps(conductor_error_response).encode()
self.patcher_req = patch('osdf.adapters.conductor.conductor.request',
- side_effect=RequestException(response=json.dumps(conductor_error_response)))
+ side_effect=RequestException(response=response))
self.Mock_req = self.patcher_req.start()
self.assertEquals(error_response_json, process_nsi_selection_opt(request_json, self.osdf_config))
self.patcher_req.stop()