diff options
author | krishnaa96 <krishna.moorthy6@wipro.com> | 2021-04-08 14:14:48 +0530 |
---|---|---|
committer | krishnaa96 <krishna.moorthy6@wipro.com> | 2021-04-08 14:14:48 +0530 |
commit | 7ef613de6d9cd794fd10ae43d98ffa9312418e68 (patch) | |
tree | 7fb698b06166d0227b6dc8c04347df4c5a11ed18 /test/apps | |
parent | aafb48a95fe5ace431ebe607cab660fddde8c2cc (diff) |
Update AAI query to DSL query - Slice termination
Issue-ID: OPTFRA-936
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I7a2bba7d23645c8bff9f503361a93fd3ac3ebc3a
Diffstat (limited to 'test/apps')
4 files changed, 28 insertions, 27 deletions
diff --git a/test/apps/nxi_termination/nssi_failure_output.json b/test/apps/nxi_termination/nssi_failure_output.json index 5ada892..f300c53 100644 --- a/test/apps/nxi_termination/nssi_failure_output.json +++ b/test/apps/nxi_termination/nssi_failure_output.json @@ -3,6 +3,6 @@ "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", "requestStatus": "success", "terminateResponse": false, - "reason": "4115d3c8-dd59-45d6-b09d-e756dee9b518 is not available in AAI" + "reason": "" }
\ No newline at end of file diff --git a/test/apps/nxi_termination/nxi_failure_output1.json b/test/apps/nxi_termination/nxi_failure_output1.json index b363e86..4cce5eb 100644 --- a/test/apps/nxi_termination/nxi_failure_output1.json +++ b/test/apps/nxi_termination/nxi_failure_output1.json @@ -3,7 +3,7 @@ "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", "requestStatus": "success", "terminateResponse": false, - "reason": "cdad9f49-4201-4e3a-aac1-b0f27902c299 is not available in AAI" + "reason": "" } diff --git a/test/apps/nxi_termination/nxi_failure_output2.json b/test/apps/nxi_termination/nxi_failure_output2.json index 5d430bc..f18b73c 100644 --- a/test/apps/nxi_termination/nxi_failure_output2.json +++ b/test/apps/nxi_termination/nxi_failure_output2.json @@ -3,5 +3,5 @@ "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", "requestStatus": "success", "terminateResponse": false, - "reason": "Associated to more than one" + "reason": "" }
\ No newline at end of file diff --git a/test/apps/nxi_termination/test_remote_opt_processor_termination.py b/test/apps/nxi_termination/test_remote_opt_processor_termination.py index 4fa8170..9fbc27b 100644 --- a/test/apps/nxi_termination/test_remote_opt_processor_termination.py +++ b/test/apps/nxi_termination/test_remote_opt_processor_termination.py @@ -69,73 +69,74 @@ class TestRemoteOptProcessor(unittest.TestCase): exception_response_json1 = json_from_file(exception_response_file1) #nsi success scenario - self.patcher_req=patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles',return_value=service_profile_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) self.Mock_req = self.patcher_req.start() - self.assertEquals(success_output_json, process_nxi_termination_opt(request_json,osdf_config)) + self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() #nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', return_value=failure_service_profile_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=3) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json1, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() + request_json["requestInfo"]["addtnlArgs"] = {} + #nsi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', - return_value=[]) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=0) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() # nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', - return_value=failure_service_profile_json2) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json2, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() # # # nssi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', return_value=success_rel_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - # nssi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=[]) + # nssi failure scenario + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=2) self.Mock_req = self.patcher_req.start() - self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals(nssi_failure_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - # nssi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=failure_rel_json) + nssi_request_json["requestInfo"]["addtnlArgs"] = {} + + # nssi success scenario + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=0) self.Mock_req = self.patcher_req.start() - self.assertEquals(nssi_failure_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() # nssi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=failure_rel_json2) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json2, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', side_effect=AAIException("Error response recieved from AAI for the request")) self.Mock_req = self.patcher_req.start() - self.assertEquals(exception_response_json1, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals("failure", process_nxi_termination_opt(nssi_request_json, osdf_config).get('requestStatus')) self.patcher_req.stop() - - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', side_effect=AAIException("Request exception was encountered")) self.Mock_req = self.patcher_req.start() self.assertEquals("failure", process_nxi_termination_opt(nssi_request_json, osdf_config).get('requestStatus')) self.patcher_req.stop() - - if __name__ == "__main__": unittest.main()
\ No newline at end of file |