From edf98746a52408386efab26143778198b0efd3c5 Mon Sep 17 00:00:00 2001 From: dhebeha Date: Sat, 5 Sep 2020 20:16:48 +0530 Subject: Add support to process NSI selection request Issue-ID: OPTFRA-802 Signed-off-by: dhebeha Signed-off-by: krishnaa96 Change-Id: I85d951061abc697714425bd223b89102d4f2ede9 --- .../new_solution_conductor_response.json | 90 +++++------------- .../slice_selection/new_solution_nsi_response.json | 77 ++++++---------- .../slice_selection/no_recomm_nsi_response.json | 32 +------ .../slice_selection/not_shared_nsi_request.json | 31 ------- .../slice_selection/not_shared_nsi_response.json | 37 -------- test/apps/slice_selection/nsi_error_response.json | 35 +------ .../slice_selection/nsi_selection_request.json | 71 +++++++------- .../slice_selection/nssi_conductor_response.json | 53 +++++++++++ test/apps/slice_selection/nssi_error_response.json | 7 ++ .../slice_selection/nssi_selection_request.json | 7 +- .../shared_solution_conductor_response.json | 102 +++++++-------------- .../shared_solution_nsi_response.json | 57 ++---------- .../shared_solution_nssi_response.json | 15 +++ test/apps/slice_selection/slice_policies.txt | 9 +- test/apps/slice_selection/subnet_policies.txt | 5 + .../slice_selection/test_remote_opt_processor.py | 80 ++++++++++++---- 16 files changed, 280 insertions(+), 428 deletions(-) delete mode 100644 test/apps/slice_selection/not_shared_nsi_request.json delete mode 100644 test/apps/slice_selection/not_shared_nsi_response.json create mode 100644 test/apps/slice_selection/nssi_conductor_response.json create mode 100644 test/apps/slice_selection/nssi_error_response.json create mode 100644 test/apps/slice_selection/shared_solution_nssi_response.json create mode 100644 test/apps/slice_selection/subnet_policies.txt (limited to 'test/apps') diff --git a/test/apps/slice_selection/new_solution_conductor_response.json b/test/apps/slice_selection/new_solution_conductor_response.json index fea3544..897aa2b 100644 --- a/test/apps/slice_selection/new_solution_conductor_response.json +++ b/test/apps/slice_selection/new_solution_conductor_response.json @@ -14,78 +14,32 @@ ], "recommendations":[ { - "URLLC_Core_1":{ - "inventory_provider":"aai", - "candidate":{ - "exp_data_rate":0, - "conn_density":0, - "coverage_area_ta_list":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "activity_factor":0, - "cs_availability":null, + "embb-nst":{ + "inventory_provider":"generator", + "candidate": { "candidate_id":"1a636c4d-5e76-427e-bfd6-241a947224b0", - "area_traffic_cap_dl":null, "latency":20, - "service_area_dimension":null, - "domain":"cn", - "e2e_latency":0, - "area_traffic_cap_ul":null, - "inventory_provider":"aai", - "exp_data_rate_ul":100, - "max_number_of_ues":0, + "inventory_provider":"generator", + "max_number_of_ues":100, "ue_mobility_level":"stationary", - "candidate_type":"nssi", - "traffic_density":0, - "payload_size":0, - "exp_data_rate_dl":100, - "jitter":0, - "survival_time":0, - "resource_sharing_level":"0", - "inventory_type":"nssi", - "reliability":null, - "cost":1.0, - "nsi_name":"nsi_test_0211", - "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", - "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", - "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", - "instance_name":"nssi_test_0211" + "candidate_type":"slice_profiles", + "resource_sharing_level":"shared", + "inventory_type":"slice_profiles", + "reliability": 99.99, + "AN_latency": 10, + "AN_ue_mobility_level": "stationary", + "AN_max_number_of_ues": 100, + "AN_reliability": 99.99, + "AN_resource_sharing_level":"shared", + "CN_latency": 5, + "CN_reliability": 99.99, + "CN_resource_sharing_level":"shared", + "TN-BH_reliability": 99.99, + "TN-BH_latency": 5, + "TN-BH_resource_sharing_level":"shared", + "cost":1.0 } - }, - "URLLC_Ran_1":{ - "inventory_provider":"aai", - "candidate":{ - "exp_data_rate":0, - "conn_density":0, - "coverage_area_ta_list":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "activity_factor":0, - "cs_availability":null, - "candidate_id":"490c68b0-639c-11ea-bc55-0242ac130003", - "area_traffic_cap_dl":null, - "latency":15, - "service_area_dimension":null, - "domain":"cn", - "e2e_latency":0, - "area_traffic_cap_ul":null, - "inventory_provider":"aai", - "exp_data_rate_ul":100, - "max_number_of_ues":0, - "ue_mobility_level":"stationary", - "candidate_type":"nssi", - "traffic_density":0, - "payload_size":0, - "exp_data_rate_dl":100, - "jitter":0, - "survival_time":0, - "resource_sharing_level":"0", - "inventory_type":"nssi", - "reliability":null, - "cost":1.0, - "nsi_name":"nsi_test_0212", - "nsi_id": "0cf2caed-c0e2-4a9d-8590-6a871e86f178", - "nsi_model_version_id": "a841af61-3c77-4310-ae63-61e1cbf7fe9b", - "nsi_model_invariant_id": "4e5351fe-0877-4c2e-bf75-ccb149f34a77", - "instance_name":"nssi_test_ran_0211" - } - } + } } ] } diff --git a/test/apps/slice_selection/new_solution_nsi_response.json b/test/apps/slice_selection/new_solution_nsi_response.json index 02023ce..2ecb543 100644 --- a/test/apps/slice_selection/new_solution_nsi_response.json +++ b/test/apps/slice_selection/new_solution_nsi_response.json @@ -1,56 +1,35 @@ { - "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "requestStatus":"completed", - "statusMessage":"", - "solutions":{ - "sharedNSISolutions":[ - - ], - "newNSISolutions":[ - { - "matchLevel":"", - "NSTInfo":{"invariantUUID": "fda3c1e8-7653-4acd-80ef-f5755c1d3859", - "UUID": "a6906768-1cae-4e78-acd1-d753ac61f3e8", - "NSTName": "URLLC_1" - }, - "NSSISolutions":[ + "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", + "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", + "requestStatus": "completed", + "statusMessage": "", + "solutions": [ + { + "existingNSI": false, + "newNSISolution": { + "slice_profiles": [ { - "sliceProfile":{ - "latency":20, - "coverageAreaTAList":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "uEMobilityLevel":"stationary", - "resourceSharingLevel":"0", - "expDataRateUL":100, - "expDataRateDL":100 - }, - "NSSTInfo":{ - "NSSTName":"URLLC_Core_1" - }, - "NSSISolution":{ - "NSSIName":"nssi_test_0211", - "NSSIId":"1a636c4d-5e76-427e-bfd6-241a947224b0" - } + "domainType": "AN", + "resourceSharingLevel": "shared", + "latency": 10, + "reliability": 99.99, + "uEMobilityLevel": "stationary", + "maxNumberOfUEs": 100 }, { - "sliceProfile":{ - "latency":15, - "coverageAreaTAList":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "uEMobilityLevel":"stationary", - "resourceSharingLevel":"0", - "expDataRateUL":100, - "expDataRateDL":100 - }, - "NSSTInfo":{ - "NSSTName":"URLLC_Ran_1" - }, - "NSSISolution":{ - "NSSIName":"nssi_test_ran_0211", - "NSSIId":"490c68b0-639c-11ea-bc55-0242ac130003" - } + "domainType": "CN", + "resourceSharingLevel": "shared", + "latency": 5, + "reliability": 99.99 + }, + { + "domainType": "TN-BH", + "resourceSharingLevel": "shared", + "latency": 5, + "reliability": 99.99 } ] } - ] - } -} + } + ] +} \ No newline at end of file diff --git a/test/apps/slice_selection/no_recomm_nsi_response.json b/test/apps/slice_selection/no_recomm_nsi_response.json index daf151d..e36a243 100644 --- a/test/apps/slice_selection/no_recomm_nsi_response.json +++ b/test/apps/slice_selection/no_recomm_nsi_response.json @@ -3,35 +3,5 @@ "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", "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" - } - } - ] - } - ] - } + "solutions": [] } diff --git a/test/apps/slice_selection/not_shared_nsi_request.json b/test/apps/slice_selection/not_shared_nsi_request.json deleted file mode 100644 index 1e22f41..0000000 --- a/test/apps/slice_selection/not_shared_nsi_request.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "serviceProfile": { - "latency": 2, - "security": "High", - "reliability": 99.9999, - "trafficDensity": 1, - "connDensity": 100000, - "expDataRate": 50, - "jitter": 1, - "survivalTime": 0, - "resourceSharingLevel": "non-shared" - }, - "serviceInfo":{ - "serviceInstanceId": "209fb01e-60ca-4325-b074-c5ad4e0499f8", - "serviceName": "" - }, - "requestInfo": { - "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", - "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", - "callbackUrl": "http://0.0.0.0:9000/osdfCallback/", - "sourceId": "SO", - "timeout": 5 - }, - "NSTInfoList": [ - { - "modelInvariantId": "fda3c1e8-7653-4acd-80ef-f5755c1d3859", - "modelVersionId": "a6906768-1cae-4e78-acd1-d753ac61f3e8", - "modelName": "URLLC_1" - } - ] -} diff --git a/test/apps/slice_selection/not_shared_nsi_response.json b/test/apps/slice_selection/not_shared_nsi_response.json deleted file mode 100644 index 873ad2e..0000000 --- a/test/apps/slice_selection/not_shared_nsi_response.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "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": "non-shared" - } - } - ] - } - ] - } -} diff --git a/test/apps/slice_selection/nsi_error_response.json b/test/apps/slice_selection/nsi_error_response.json index f022779..9dc5300 100644 --- a/test/apps/slice_selection/nsi_error_response.json +++ b/test/apps/slice_selection/nsi_error_response.json @@ -1,37 +1,6 @@ { "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851", "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "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" - } - } - ] - } - ] - } + "requestStatus":"error", + "statusMessage":"Some error message" } diff --git a/test/apps/slice_selection/nsi_selection_request.json b/test/apps/slice_selection/nsi_selection_request.json index 9c4fcda..acd23a2 100644 --- a/test/apps/slice_selection/nsi_selection_request.json +++ b/test/apps/slice_selection/nsi_selection_request.json @@ -1,23 +1,22 @@ { - "serviceProfile": { - "latency": 2, - "security": "High", - "reliability": 99.9999, - "trafficDensity": 1, - "connDensity": 100000, - "expDataRate": 50, - "jitter": 1, - "survivalTime": 0, - "resourceSharingLevel":"shared" - }, - "requestInfo": { - "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", - "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", - "callbackUrl": "http://0.0.0.0:9000/osdfCallback/", - "sourceId": "SO", - "timeout": 5 - }, - "NSTInfo":{ + "serviceProfile":{ + "latency":5, + "security":"High", + "reliability":99.999, + "resourceSharingLevel":"shared" + }, + "requestInfo":{ + "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", + "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851", + "callbackUrl": "http://0.0.0.0:9000/osdfCallback/", + "callbackHeader":{ + "blob":"content" + }, + "sourceId":"d290f1ee-6c54-4b01-90e6-d701748f0851", + "timeout":5, + "numSolutions":1 + }, + "NSTInfo":{ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa1", "invariantUUID":"7ua85f64-5717-4562-b3fc-2c963f66afa6", "name":"embb-nst" @@ -49,36 +48,36 @@ "name":"embb-tn-bh" } ], - "preferReuse":true, + "preferReuse":false, "subnetCapabilities":[ { - "domainType":"AN-NF", + "domainType":"AN", "capabilityDetails":{ - "blob":"content" + "latency": "4", + "reliability": "99.9", + "maxNumberOfUEs": "10", + "maxThroughput": "50", + "terminalDensity": "60" } }, { "domainType":"CN", "capabilityDetails":{ - "blob":"content" - } - }, - { - "domainType":"TN-FH", - "capabilityDetails":{ - "blob":"content" - } - }, - { - "domainType":"TN-MH", - "capabilityDetails":{ - "blob":"content" + "latency": "3", + "reliability": "99.9", + "maxNumberOfUEs": "10", + "maxThroughput": "50", + "terminalDensity": "60" } }, { "domainType":"TN-BH", "capabilityDetails":{ - "blob":"content" + "latency": "2", + "reliability": "99.9", + "maxNumberOfUEs": "10", + "maxThroughput": "50", + "terminalDensity": "60" } } ] diff --git a/test/apps/slice_selection/nssi_conductor_response.json b/test/apps/slice_selection/nssi_conductor_response.json new file mode 100644 index 0000000..d2edcf5 --- /dev/null +++ b/test/apps/slice_selection/nssi_conductor_response.json @@ -0,0 +1,53 @@ +{ + "plans":[ + { + "status":"done", + "id":"plan_id", + "name":"Plan Name 1", + "links":[ + [ + { + "href":"http://conductor:8091/v1/plans/plan_id", + "rel":"self" + } + ] + ], + "recommendations":[ + { + "embb-cn": { + "inventory_provider": "aai", + "candidate": { + "exp_data_rate": 0, + "conn_density": 0, + "coverage_area_ta_list": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", + "activity_factor": 0, + "cs_availability": null, + "candidate_id": "1a636c4d-5e76-427e-bfd6-241a947224b0", + "area_traffic_cap_dl": null, + "latency": 20, + "service_area_dimension": null, + "e2e_latency": 0, + "area_traffic_cap_ul": null, + "inventory_provider": "aai", + "exp_data_rate_ul": 100, + "max_number_of_ues": 0, + "ue_mobility_level": "stationary", + "candidate_type": "nssi", + "traffic_density": 0, + "payload_size": 0, + "exp_data_rate_dl": 100, + "jitter": 0, + "survival_time": 0, + "resource_sharing_level": "shared", + "inventory_type": "nssi", + "reliability": null, + "cost": 1.0, + "instance_id": "e1041cdc-12da-4f36-b84e-68c380e9cd47", + "instance_name": "nssi_test_0211" + } + } + } + ] + } + ] +} diff --git a/test/apps/slice_selection/nssi_error_response.json b/test/apps/slice_selection/nssi_error_response.json new file mode 100644 index 0000000..70e0596 --- /dev/null +++ b/test/apps/slice_selection/nssi_error_response.json @@ -0,0 +1,7 @@ +{ + "requestId":"r450f1ee-6c54-4b01-90e6-d701748f0851", + "transactionId":"t670f1ee-6c54-4b01-90e6-d701748f0851", + "requestStatus":"completed", + "statusMessage":"", + "solutions": [] +} diff --git a/test/apps/slice_selection/nssi_selection_request.json b/test/apps/slice_selection/nssi_selection_request.json index 1a49a8b..61ee563 100644 --- a/test/apps/slice_selection/nssi_selection_request.json +++ b/test/apps/slice_selection/nssi_selection_request.json @@ -1,6 +1,9 @@ { "sliceProfile": { - "blob": "content" + "latency":5, + "security":"High", + "reliability":99.999, + "resourceSharingLevel":"shared" }, "requestInfo": { "transactionId": "t670f1ee-6c54-4b01-90e6-d701748f0851", @@ -17,7 +20,7 @@ } }, "NSSTInfo": { - "UUID": "y7785f64-5717-4562-b3fc-2c963f66afa6", + "UUID": "a7785f64-5717-4562-b3fc-2c963f66afa6", "invariantUUID": "9fh85f64-5717-4562-b3fc-2c963f66afa6", "name": "embb-cn" } diff --git a/test/apps/slice_selection/shared_solution_conductor_response.json b/test/apps/slice_selection/shared_solution_conductor_response.json index 13ea29c..a187fef 100644 --- a/test/apps/slice_selection/shared_solution_conductor_response.json +++ b/test/apps/slice_selection/shared_solution_conductor_response.json @@ -14,78 +14,38 @@ ], "recommendations":[ { - "URLLC_Core_1":{ - "inventory_provider":"aai", - "candidate":{ - "exp_data_rate":0, - "conn_density":0, - "coverage_area_ta_list":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "activity_factor":0, - "cs_availability":null, - "candidate_id":"1a636c4d-5e76-427e-bfd6-241a947224b0", - "area_traffic_cap_dl":null, - "latency":20, - "service_area_dimension":null, - "domain":"cn", - "e2e_latency":0, - "area_traffic_cap_ul":null, - "inventory_provider":"aai", - "exp_data_rate_ul":100, - "max_number_of_ues":0, - "ue_mobility_level":"stationary", - "candidate_type":"nssi", - "traffic_density":0, - "payload_size":0, - "exp_data_rate_dl":100, - "jitter":0, - "survival_time":0, - "resource_sharing_level":"0", - "inventory_type":"nssi", - "reliability":null, - "cost":1.0, - "nsi_name":"nsi_test_0212", - "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", - "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", - "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", - "instance_name":"nssi_test_0211" + "embb-nst": { + "inventory_provider": "aai", + "candidate": { + "exp_data_rate": 0, + "conn_density": 0, + "coverage_area_ta_list": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", + "activity_factor": 0, + "cs_availability": null, + "candidate_id": "1a636c4d-5e76-427e-bfd6-241a947224b0", + "area_traffic_cap_dl": null, + "latency": 20, + "service_area_dimension": null, + "e2e_latency": 0, + "area_traffic_cap_ul": null, + "inventory_provider": "aai", + "exp_data_rate_ul": 100, + "max_number_of_ues": 0, + "ue_mobility_level": "stationary", + "candidate_type": "nsi", + "traffic_density": 0, + "payload_size": 0, + "exp_data_rate_dl": 100, + "jitter": 0, + "survival_time": 0, + "resource_sharing_level": "shared", + "inventory_type": "nsi", + "reliability": null, + "cost": 1.0, + "instance_id": "f1041cdc-12da-4f36-b84e-68c380e9cd47", + "instance_name": "nsi_test_0211" } - }, - "URLLC_Ran_1":{ - "inventory_provider":"aai", - "candidate":{ - "exp_data_rate":0, - "conn_density":0, - "coverage_area_ta_list":"[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "activity_factor":0, - "cs_availability":null, - "candidate_id":"490c68b0-639c-11ea-bc55-0242ac130003", - "area_traffic_cap_dl":null, - "latency":15, - "service_area_dimension":null, - "domain":"cn", - "e2e_latency":0, - "area_traffic_cap_ul":null, - "inventory_provider":"aai", - "exp_data_rate_ul":100, - "max_number_of_ues":0, - "ue_mobility_level":"stationary", - "candidate_type":"nssi", - "traffic_density":0, - "payload_size":0, - "exp_data_rate_dl":100, - "jitter":0, - "survival_time":0, - "resource_sharing_level":"0", - "inventory_type":"nssi", - "reliability":null, - "cost":1.0, - "nsi_name":"nsi_test_0212", - "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", - "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", - "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", - "instance_name":"nssi_test_ran_0211" - } - } + } } ] } diff --git a/test/apps/slice_selection/shared_solution_nsi_response.json b/test/apps/slice_selection/shared_solution_nsi_response.json index 3e1ad9f..ff83dfc 100644 --- a/test/apps/slice_selection/shared_solution_nsi_response.json +++ b/test/apps/slice_selection/shared_solution_nsi_response.json @@ -1,54 +1,17 @@ { "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", "requestStatus": "completed", - "solutions": { - "newNSISolutions": [], - "sharedNSISolutions": [ - { - "NSIId": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", - "NSIName": "nsi_test_0212", - "NSSIs": [ - { - "NSSIId": "1a636c4d-5e76-427e-bfd6-241a947224b0", - "NSSIName": "nssi_test_0211", - "UUID": "", - "invariantUUID": "", - "sliceProfile": [ - { - "coverageAreaTAList": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "expDataRateDL": 100, - "expDataRateUL": 100, - "latency": 20, - "resourceSharingLevel": "0", - "uEMobilityLevel": "stationary", - "domainType" : "cn" - } - ] - }, - { - "NSSIId": "490c68b0-639c-11ea-bc55-0242ac130003", - "NSSIName": "nssi_test_ran_0211", - "UUID": "", - "invariantUUID": "", - "sliceProfile": [ - { - "coverageAreaTAList": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", - "expDataRateDL": 100, - "expDataRateUL": 100, - "latency": 15, - "resourceSharingLevel": "0", - "uEMobilityLevel": "stationary", - "domainType" : "cn" - - } - ] - } - ], - "UUID": "c3d8a690-f138-4554-89af-9349aeb9b19a", - "invariantUUID": "590b9fcf-6927-495e-a898-a1418dd4820c" + "solutions": [ + { + "existingNSI": true, + "sharedNSISolution": { + "UUID": "3fa85f64-5717-4562-b3fc-2c963f66afa1", + "invariantUUID": "7ua85f64-5717-4562-b3fc-2c963f66afa6", + "NSIName": "nsi_test_0211", + "NSIId": "f1041cdc-12da-4f36-b84e-68c380e9cd47" } - ] - }, + } + ], "statusMessage": "", "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851" } diff --git a/test/apps/slice_selection/shared_solution_nssi_response.json b/test/apps/slice_selection/shared_solution_nssi_response.json new file mode 100644 index 0000000..f3468a4 --- /dev/null +++ b/test/apps/slice_selection/shared_solution_nssi_response.json @@ -0,0 +1,15 @@ +{ + "requestId": "r450f1ee-6c54-4b01-90e6-d701748f0851", + "requestStatus": "completed", + "solutions": [ + { + "UUID": "a7785f64-5717-4562-b3fc-2c963f66afa6", + "invariantUUID": "9fh85f64-5717-4562-b3fc-2c963f66afa6", + "NSSIName": "nssi_test_0211", + "NSSIId": "e1041cdc-12da-4f36-b84e-68c380e9cd47" + + } + ], + "statusMessage": "", + "transactionId": "t670f1ee-6c54-4b01-90e6-d701748f0851" +} diff --git a/test/apps/slice_selection/slice_policies.txt b/test/apps/slice_selection/slice_policies.txt index 55c934b..7eb55de 100644 --- a/test/apps/slice_selection/slice_policies.txt +++ b/test/apps/slice_selection/slice_policies.txt @@ -1,4 +1,5 @@ -subscriber_policy_URLLC_1.json -thresholdPolicy_URLLC_Core_1.json -vnfPolicy_URLLC_Core_1.json -aggregationPolicy_URLLC_1.json +query_policy_nsi.json +threshold_policy_nsi.json +vnf_policy_nsi_shared_case.json +opt_policy_nsi_reuse.json + diff --git a/test/apps/slice_selection/subnet_policies.txt b/test/apps/slice_selection/subnet_policies.txt new file mode 100644 index 0000000..649672d --- /dev/null +++ b/test/apps/slice_selection/subnet_policies.txt @@ -0,0 +1,5 @@ +query_policy_nsi.json +threshold_policy_nsi.json +vnf_policy_nssi_shared.json +opt_policy_nssi.json + diff --git a/test/apps/slice_selection/test_remote_opt_processor.py b/test/apps/slice_selection/test_remote_opt_processor.py index 5321880..7c2d191 100644 --- a/test/apps/slice_selection/test_remote_opt_processor.py +++ b/test/apps/slice_selection/test_remote_opt_processor.py @@ -20,7 +20,7 @@ import json import unittest from requests import RequestException, Response -from apps.slice_selection.optimizers.conductor.remote_opt_processor import process_nsi_selection_opt +from apps.slice_selection.optimizers.conductor.remote_opt_processor import SliceSelectionOptimizer from osdf.adapters.local_data import local_policies from osdf.utils.interfaces import json_from_file, yaml_from_file from osdf.utils.programming_utils import DotDict @@ -37,31 +37,33 @@ class TestRemoteOptProcessor(unittest.TestCase): "deployment": "config/osdf_config.yaml", "core": "config/common_config.yaml" } + slice_spec = "config/slicing_config.yaml" + self.slice_config = config_loader.load_config_file(slice_spec) self.osdf_config = DotDict(config_loader.all_configs(**self.config_spec)) + self.patcher_RestClient = patch( + 'osdf.utils.interfaces.RestClient.request', return_value=MagicMock()) + self.mock_rc = self.patcher_RestClient.start() def tearDown(self): patch.stopall() def test_process_nsi_selection_opt(self): main_dir = "" - request_file = main_dir + 'test/apps/slice_selection/nsi_request.json' + request_file = main_dir + 'test/apps/slice_selection/nsi_selection_request.json' not_shared_request_file = main_dir + 'test/apps/slice_selection/not_shared_nsi_request.json' #response files new_solution_response_file = main_dir + 'test/apps/slice_selection/new_solution_nsi_response.json' shared_solution_response_file = main_dir + 'test/apps/slice_selection/shared_solution_nsi_response.json' no_solution_response_file = main_dir + 'test/apps/slice_selection/no_recomm_nsi_response.json' - not_shared_response_file = main_dir + 'test/apps/slice_selection/not_shared_nsi_response.json' error_response_file = main_dir + 'test/apps/slice_selection/nsi_error_response.json' - not_shared_request_json = json_from_file(not_shared_request_file) - not_shared_response_json = json_from_file(not_shared_response_file) request_json = json_from_file(request_file) new_solution_response_json = json_from_file(new_solution_response_file) shared_solution_response_json = json_from_file(shared_solution_response_file) no_solution_response_json = json_from_file(no_solution_response_file) error_response_json = json_from_file(error_response_file) - policies_path = main_dir + 'test/policy-local-files' + policies_path = main_dir + 'test/policy-local-files/slice-selection-files' slice_policies_file = main_dir + 'test/apps/slice_selection/slice_policies.txt' valid_policies_files = local_policies.get_policy_names_from_file(slice_policies_file) @@ -69,36 +71,41 @@ class TestRemoteOptProcessor(unittest.TestCase): self.patcher_get_policies = patch('osdf.adapters.policy.interface.remote_api', return_value=policies) self.Mock_get_policies = self.patcher_get_policies.start() + # new solution new_solution_conductor_response_file = 'test/apps/slice_selection/new_solution_conductor_response.json' new_solution_conductor_response = json_from_file(new_solution_conductor_response_file) self.patcher_req = patch('osdf.adapters.conductor.conductor.request', return_value=new_solution_conductor_response) self.Mock_req = self.patcher_req.start() - self.assertEquals(new_solution_response_json, process_nsi_selection_opt(request_json, self.osdf_config)) + slice_select_opt = SliceSelectionOptimizer(self.osdf_config, self.slice_config, request_json, 'NSI') + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=new_solution_response_json, noresponse=True) self.patcher_req.stop() + # shared solution + request_json['preferReuse'] = True shared_solution_conductor_response_file = 'test/apps/slice_selection/shared_solution_conductor_response.json' shared_solution_conductor_response = json_from_file(shared_solution_conductor_response_file) self.patcher_req = patch('osdf.adapters.conductor.conductor.request', return_value=shared_solution_conductor_response) self.Mock_req = self.patcher_req.start() - self.assertEquals(shared_solution_response_json, - process_nsi_selection_opt(request_json, self.osdf_config)) + slice_select_opt = SliceSelectionOptimizer(self.osdf_config, self.slice_config, request_json, 'NSI') + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=shared_solution_response_json, noresponse=True) self.patcher_req.stop() - # not-shared solution - self.assertEquals(not_shared_response_json, - process_nsi_selection_opt(not_shared_request_json, self.osdf_config)) + # no recommendation no_solution_conductor_response_file = 'test/apps/slice_selection/no_rec.json' no_solution_conductor_response = json_from_file(no_solution_conductor_response_file) self.patcher_req = patch('osdf.adapters.conductor.conductor.request', return_value=no_solution_conductor_response) self.Mock_req = self.patcher_req.start() - self.assertEquals(no_solution_response_json, - process_nsi_selection_opt(request_json, self.osdf_config)) + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=no_solution_response_json, noresponse=True) self.patcher_req.stop() + # Exception conductor_error_response_file = 'test/apps/slice_selection/conductor_error_response.json' conductor_error_response = json_from_file(conductor_error_response_file) @@ -107,17 +114,52 @@ class TestRemoteOptProcessor(unittest.TestCase): self.patcher_req = patch('osdf.adapters.conductor.conductor.request', 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)) + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=error_response_json, noresponse=True) + self.patcher_req.stop() + + self.patcher_req = patch('osdf.adapters.conductor.conductor.request', + side_effect=Exception("Some error message")) + self.Mock_req = self.patcher_req.start() + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=error_response_json, noresponse=True) self.patcher_req.stop() + def test_process_nssi_selection_opt(self): + main_dir = "" + request_file = main_dir + 'test/apps/slice_selection/nssi_selection_request.json' + # response files + shared_solution_response_file = main_dir + 'test/apps/slice_selection/shared_solution_nssi_response.json' + error_response_file = main_dir + 'test/apps/slice_selection/nssi_error_response.json' + + request_json = json_from_file(request_file) + shared_solution_response_json = json_from_file(shared_solution_response_file) + error_response_json = json_from_file(error_response_file) + + policies_path = main_dir + 'test/policy-local-files/slice-selection-files' + slice_policies_file = main_dir + 'test/apps/slice_selection/subnet_policies.txt' + + valid_policies_files = local_policies.get_policy_names_from_file(slice_policies_file) + policies = [json_from_file(policies_path + '/' + name) for name in valid_policies_files] + self.patcher_get_policies = patch('osdf.adapters.policy.interface.remote_api', + return_value=policies) + self.Mock_get_policies = self.patcher_get_policies.start() + + shared_solution_conductor_response_file = 'test/apps/slice_selection/nssi_conductor_response.json' + shared_solution_conductor_response = json_from_file(shared_solution_conductor_response_file) self.patcher_req = patch('osdf.adapters.conductor.conductor.request', - side_effect=Exception("test_exception")) + return_value=shared_solution_conductor_response) self.Mock_req = self.patcher_req.start() - self.assertEquals('test_exception', - process_nsi_selection_opt(request_json, self.osdf_config).get('statusMessage')) + slice_select_opt = SliceSelectionOptimizer(self.osdf_config, self.slice_config, request_json, 'NSSI') + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=shared_solution_response_json, noresponse=True) self.patcher_req.stop() + request_json['sliceProfile']['resourceSharingLevel'] = "not-shared" + slice_select_opt = SliceSelectionOptimizer(self.osdf_config, self.slice_config, request_json, 'NSSI') + slice_select_opt.process_slice_selection_opt() + self.mock_rc.assert_called_with(json=error_response_json, noresponse=True) + if __name__ == "__main__": unittest.main() - -- cgit 1.2.3-korg