From 349bbf794dbc34a96755ae40e98b8ba83a074a02 Mon Sep 17 00:00:00 2001 From: krishnaa96 Date: Thu, 14 May 2020 18:22:46 +0530 Subject: Handle has exceptions for slice selection Issue-ID: OPTFRA-754 Signed-off-by: krishnaa96 Change-Id: I66904680a4b9a2bc69c144f05b95fb4f999d0e93 --- test/apps/slice_selection/nsi_error_response.json | 37 ++++++++++++++++++++-- .../slice_selection/test_remote_opt_processor.py | 6 ++-- 2 files changed, 38 insertions(+), 5 deletions(-) (limited to 'test') 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() -- cgit 1.2.3-korg