aboutsummaryrefslogtreecommitdiffstats
path: root/test/apps/slice_selection
diff options
context:
space:
mode:
Diffstat (limited to 'test/apps/slice_selection')
-rw-r--r--test/apps/slice_selection/conductor_error_response.json18
-rw-r--r--test/apps/slice_selection/new_solution_conductor_response.json47
-rw-r--r--test/apps/slice_selection/new_solution_nsi_response.json35
-rw-r--r--test/apps/slice_selection/no_rec.json18
-rw-r--r--test/apps/slice_selection/no_recomm_conductor_response.json18
-rw-r--r--test/apps/slice_selection/no_recomm_nsi_response.json7
-rw-r--r--test/apps/slice_selection/nsi_error_response.json6
-rw-r--r--test/apps/slice_selection/nsi_request.json31
-rw-r--r--test/apps/slice_selection/nsi_selection_invalid_request.json80
-rw-r--r--test/apps/slice_selection/nsi_selection_request.json84
-rw-r--r--test/apps/slice_selection/nssi_conductor_response.json53
-rw-r--r--test/apps/slice_selection/nssi_error_response.json7
-rw-r--r--test/apps/slice_selection/nssi_selection_invalid_request.json23
-rw-r--r--test/apps/slice_selection/nssi_selection_request.json27
-rw-r--r--test/apps/slice_selection/shared_solution_conductor_response.json53
-rw-r--r--test/apps/slice_selection/shared_solution_nsi_response.json17
-rw-r--r--test/apps/slice_selection/shared_solution_nssi_response.json15
-rw-r--r--test/apps/slice_selection/slice_policies.txt5
-rw-r--r--test/apps/slice_selection/subnet_policies.txt5
-rw-r--r--test/apps/slice_selection/test_remote_opt_processor.py165
20 files changed, 714 insertions, 0 deletions
diff --git a/test/apps/slice_selection/conductor_error_response.json b/test/apps/slice_selection/conductor_error_response.json
new file mode 100644
index 0000000..95a9750
--- /dev/null
+++ b/test/apps/slice_selection/conductor_error_response.json
@@ -0,0 +1,18 @@
+{
+ "plans": [
+ {
+ "status": "error",
+ "message": "Some error message",
+ "name": "Plan Name 1",
+ "links": [
+ [
+ {
+ "href": "http://conductor:8091/v1/plans/plan_id",
+ "rel": "self"
+ }
+ ]
+ ],
+ "id": "plan_id"
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/new_solution_conductor_response.json b/test/apps/slice_selection/new_solution_conductor_response.json
new file mode 100644
index 0000000..897aa2b
--- /dev/null
+++ b/test/apps/slice_selection/new_solution_conductor_response.json
@@ -0,0 +1,47 @@
+{
+ "plans":[
+ {
+ "status":"done",
+ "id":"plan_id",
+ "name":"Plan Name 1",
+ "links":[
+ [
+ {
+ "href":"http://conductor:8091/v1/plans/plan_id",
+ "rel":"self"
+ }
+ ]
+ ],
+ "recommendations":[
+ {
+ "embb-nst":{
+ "inventory_provider":"generator",
+ "candidate": {
+ "candidate_id":"1a636c4d-5e76-427e-bfd6-241a947224b0",
+ "latency":20,
+ "inventory_provider":"generator",
+ "max_number_of_ues":100,
+ "ue_mobility_level":"stationary",
+ "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
+ }
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/new_solution_nsi_response.json b/test/apps/slice_selection/new_solution_nsi_response.json
new file mode 100644
index 0000000..52624b6
--- /dev/null
+++ b/test/apps/slice_selection/new_solution_nsi_response.json
@@ -0,0 +1,35 @@
+{
+ "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestStatus": "completed",
+ "statusMessage": "",
+ "solutions": [
+ {
+ "existingNSI": false,
+ "newNSISolution": {
+ "sliceProfiles": [
+ {
+ "domainType": "AN",
+ "resourceSharingLevel": "shared",
+ "latency": 10,
+ "reliability": 99.99,
+ "uEMobilityLevel": "stationary",
+ "maxNumberofUEs": 100
+ },
+ {
+ "domainType": "CN",
+ "resourceSharingLevel": "shared",
+ "latency": 5,
+ "reliability": 99.99
+ },
+ {
+ "domainType": "TN-BH",
+ "resourceSharingLevel": "shared",
+ "latency": 5,
+ "reliability": 99.99
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/no_rec.json b/test/apps/slice_selection/no_rec.json
new file mode 100644
index 0000000..855afac
--- /dev/null
+++ b/test/apps/slice_selection/no_rec.json
@@ -0,0 +1,18 @@
+{
+ "plans": [
+ {
+ "id": "d8c07237-5f66-4aa6-871c-a04221d99458",
+ "links": [
+ [
+ {
+ "href": "https://oof-has-api:8091/v1/plans/d8c07237-5f66-4aa6-871c-a04221d99458",
+ "rel": "self"
+ }
+ ]
+ ],
+ "message": "Plan d8c07237-5f66-4aa6-871c-a04221d99458 search failed, no recommendations found by machine dev-oof-has-solver-65d478b6d-ql5fp",
+ "name": "d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "status": "not found"
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/no_recomm_conductor_response.json b/test/apps/slice_selection/no_recomm_conductor_response.json
new file mode 100644
index 0000000..f23af87
--- /dev/null
+++ b/test/apps/slice_selection/no_recomm_conductor_response.json
@@ -0,0 +1,18 @@
+{
+ "plans":[
+ {
+ "status":"done",
+ "id":"plan_id",
+ "name":"Plan Name 1",
+ "links":[
+ [
+ {
+ "href":"http://conductor:8091/v1/plans/plan_id",
+ "rel":"self"
+ }
+ ]
+ ],
+ "recommendations": []
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/no_recomm_nsi_response.json b/test/apps/slice_selection/no_recomm_nsi_response.json
new file mode 100644
index 0000000..e36a243
--- /dev/null
+++ b/test/apps/slice_selection/no_recomm_nsi_response.json
@@ -0,0 +1,7 @@
+{
+ "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestStatus":"completed",
+ "statusMessage":"",
+ "solutions": []
+}
diff --git a/test/apps/slice_selection/nsi_error_response.json b/test/apps/slice_selection/nsi_error_response.json
new file mode 100644
index 0000000..9dc5300
--- /dev/null
+++ b/test/apps/slice_selection/nsi_error_response.json
@@ -0,0 +1,6 @@
+{
+ "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestStatus":"error",
+ "statusMessage":"Some error message"
+}
diff --git a/test/apps/slice_selection/nsi_request.json b/test/apps/slice_selection/nsi_request.json
new file mode 100644
index 0000000..72b2c8b
--- /dev/null
+++ b/test/apps/slice_selection/nsi_request.json
@@ -0,0 +1,31 @@
+{
+ "serviceProfile": {
+ "latency": 2,
+ "security": "High",
+ "reliability": 99.9999,
+ "trafficDensity": 1,
+ "connDensity": 100000,
+ "expDataRate": 50,
+ "jitter": 1,
+ "survivalTime": 0,
+ "resourceSharingLevel":"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/nsi_selection_invalid_request.json b/test/apps/slice_selection/nsi_selection_invalid_request.json
new file mode 100644
index 0000000..3ecd1e3
--- /dev/null
+++ b/test/apps/slice_selection/nsi_selection_invalid_request.json
@@ -0,0 +1,80 @@
+{
+ "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
+ },
+ "NSSTInfo":[
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa2",
+ "invariantUUID":"2fa85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-an-nf"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa3",
+ "invariantUUID":"4fa85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-cn"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa4",
+ "invariantUUID":"5ta85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-fh"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa5",
+ "invariantUUID":"6ya85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-mh"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa7",
+ "invariantUUID":"7ua85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-bh"
+ }
+ ],
+ "preferReuse":true,
+ "subnetCapabilities":[
+ {
+ "domainType":"AN-NF",
+ "capabilityDetails":{
+ "blob":"content"
+ }
+ },
+ {
+ "domainType":"CN",
+ "capabilityDetails":{
+ "blob":"content"
+ }
+ },
+ {
+ "domainType":"TN-FH",
+ "capabilityDetails":{
+ "blob":"content"
+ }
+ },
+ {
+ "domainType":"TN-MH",
+ "capabilityDetails":{
+ "blob":"content"
+ }
+ },
+ {
+ "domainType":"TN-BH",
+ "capabilityDetails":{
+ "blob":"content"
+ }
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/nsi_selection_request.json b/test/apps/slice_selection/nsi_selection_request.json
new file mode 100644
index 0000000..39fb925
--- /dev/null
+++ b/test/apps/slice_selection/nsi_selection_request.json
@@ -0,0 +1,84 @@
+{
+ "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"
+ },
+ "NSSTInfo":[
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa2",
+ "invariantUUID":"2fa85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-an-nf"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa3",
+ "invariantUUID":"4fa85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-cn"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa4",
+ "invariantUUID":"5ta85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-fh"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa5",
+ "invariantUUID":"6ya85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-mh"
+ },
+ {
+ "UUID":"3fa85f64-5717-4562-b3fc-2c963f66afa7",
+ "invariantUUID":"7ua85f64-5717-4562-b3fc-2c963f66afa6",
+ "name":"embb-tn-bh"
+ }
+ ],
+ "preferReuse":false,
+ "subnetCapabilities":[
+ {
+ "domainType":"AN",
+ "capabilityDetails":{
+ "latency": "4",
+ "reliability": "99.9",
+ "maxNumberofUEs": "10",
+ "maxThroughput": "50",
+ "termDensity": "60"
+ }
+ },
+ {
+ "domainType":"CN",
+ "capabilityDetails":{
+ "latency": "3",
+ "reliability": "99.9",
+ "maxNumberofUEs": "10",
+ "maxThroughput": "50",
+ "termDensity": "60"
+ }
+ },
+ {
+ "domainType":"TN-BH",
+ "capabilityDetails":{
+ "latency": "2",
+ "reliability": "99.9",
+ "maxNumberofUEs": "10",
+ "maxThroughput": "50",
+ "termDensity": "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_invalid_request.json b/test/apps/slice_selection/nssi_selection_invalid_request.json
new file mode 100644
index 0000000..57e0184
--- /dev/null
+++ b/test/apps/slice_selection/nssi_selection_invalid_request.json
@@ -0,0 +1,23 @@
+{
+ "sliceProfile": {
+ "blob": "content"
+ },
+ "requestInfo": {
+ "transactionId": "t670f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestId": "r450f1ee-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,
+ "addtnlArgs": {
+ "blob": "content"
+ }
+ },
+ "NSSTInfo": {
+ "UUID": "y7785f64-5717-4562-b3fc-2c963f66afa6",
+ "name": "embb-cn"
+ }
+}
diff --git a/test/apps/slice_selection/nssi_selection_request.json b/test/apps/slice_selection/nssi_selection_request.json
new file mode 100644
index 0000000..61ee563
--- /dev/null
+++ b/test/apps/slice_selection/nssi_selection_request.json
@@ -0,0 +1,27 @@
+{
+ "sliceProfile": {
+ "latency":5,
+ "security":"High",
+ "reliability":99.999,
+ "resourceSharingLevel":"shared"
+ },
+ "requestInfo": {
+ "transactionId": "t670f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestId": "r450f1ee-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,
+ "addtnlArgs": {
+ "blob": "content"
+ }
+ },
+ "NSSTInfo": {
+ "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
new file mode 100644
index 0000000..a187fef
--- /dev/null
+++ b/test/apps/slice_selection/shared_solution_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-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"
+ }
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/apps/slice_selection/shared_solution_nsi_response.json b/test/apps/slice_selection/shared_solution_nsi_response.json
new file mode 100644
index 0000000..ff83dfc
--- /dev/null
+++ b/test/apps/slice_selection/shared_solution_nsi_response.json
@@ -0,0 +1,17 @@
+{
+ "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
+ "requestStatus": "completed",
+ "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
new file mode 100644
index 0000000..7eb55de
--- /dev/null
+++ b/test/apps/slice_selection/slice_policies.txt
@@ -0,0 +1,5 @@
+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
new file mode 100644
index 0000000..7c2d191
--- /dev/null
+++ b/test/apps/slice_selection/test_remote_opt_processor.py
@@ -0,0 +1,165 @@
+# -------------------------------------------------------------------------
+# Copyright (C) 2020 Wipro Limited.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
+
+import json
+import unittest
+from requests import RequestException, Response
+
+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
+import osdf.config.loader as config_loader
+from mock import patch, MagicMock
+import json
+from osdf.logging.osdf_logging import error_log, debug_log
+from osdf.adapters.policy.interface import get_policies
+
+
+class TestRemoteOptProcessor(unittest.TestCase):
+ def setUp(self):
+ self.config_spec = {
+ "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_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'
+ error_response_file = main_dir + 'test/apps/slice_selection/nsi_error_response.json'
+
+ 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/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)
+ 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()
+
+ # 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()
+ 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()
+ 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()
+
+ # 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()
+ 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)
+
+ response = Response()
+ response._content = json.dumps(conductor_error_response).encode()
+ self.patcher_req = patch('osdf.adapters.conductor.conductor.request',
+ side_effect=RequestException(response=response))
+ 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()
+
+ 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',
+ return_value=shared_solution_conductor_response)
+ self.Mock_req = self.patcher_req.start()
+ 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()