summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authordhebeha <dhebeha.mj71@wipro.com>2020-09-05 20:16:48 +0530
committerVikas Varma <vikas.varma@att.com>2020-09-18 19:34:01 +0000
commitedf98746a52408386efab26143778198b0efd3c5 (patch)
treeadc101beb879a57547cc828283803bfe7c5fd89b /test
parentf9b3575cae2b521ba8c6b6b30b15c89bd8a1cb48 (diff)
Add support to process NSI selection request
Issue-ID: OPTFRA-802 Signed-off-by: dhebeha <dhebeha.mj71@wipro.com> Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com> Change-Id: I85d951061abc697714425bd223b89102d4f2ede9
Diffstat (limited to 'test')
-rw-r--r--test/apps/slice_selection/new_solution_conductor_response.json90
-rw-r--r--test/apps/slice_selection/new_solution_nsi_response.json77
-rw-r--r--test/apps/slice_selection/no_recomm_nsi_response.json32
-rw-r--r--test/apps/slice_selection/not_shared_nsi_request.json31
-rw-r--r--test/apps/slice_selection/not_shared_nsi_response.json37
-rw-r--r--test/apps/slice_selection/nsi_error_response.json35
-rw-r--r--test/apps/slice_selection/nsi_selection_request.json71
-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_request.json7
-rw-r--r--test/apps/slice_selection/shared_solution_conductor_response.json102
-rw-r--r--test/apps/slice_selection/shared_solution_nsi_response.json57
-rw-r--r--test/apps/slice_selection/shared_solution_nssi_response.json15
-rw-r--r--test/apps/slice_selection/slice_policies.txt9
-rw-r--r--test/apps/slice_selection/subnet_policies.txt5
-rw-r--r--test/apps/slice_selection/test_remote_opt_processor.py80
-rw-r--r--test/conductor/test_conductor_calls.py10
-rw-r--r--test/conductor/test_conductor_translation.py23
-rw-r--r--test/policy-local-files/slice-selection-files/opt_policy_nsi_reuse.json38
-rw-r--r--test/policy-local-files/slice-selection-files/opt_policy_nssi.json37
-rw-r--r--test/policy-local-files/slice-selection-files/query_policy_nsi.json44
-rw-r--r--test/policy-local-files/slice-selection-files/query_policy_nssi.json32
-rw-r--r--test/policy-local-files/slice-selection-files/threshold_policy_nsi.json46
-rw-r--r--test/policy-local-files/slice-selection-files/threshold_policy_nssi.json46
-rw-r--r--test/policy-local-files/slice-selection-files/vnf_policy_nsi_non_shared_case.json76
-rw-r--r--test/policy-local-files/slice-selection-files/vnf_policy_nsi_shared_case.json90
-rw-r--r--test/policy-local-files/slice-selection-files/vnf_policy_nssi_shared.json37
-rw-r--r--test/test_ConductorApiBuilder.py12
28 files changed, 765 insertions, 434 deletions
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()
-
diff --git a/test/conductor/test_conductor_calls.py b/test/conductor/test_conductor_calls.py
index d342fa5..8b4411d 100644
--- a/test/conductor/test_conductor_calls.py
+++ b/test/conductor/test_conductor_calls.py
@@ -35,6 +35,10 @@ class TestConductorCalls(unittest.TestCase):
self.osdf_config = DotDict(config_loader.all_configs(**self.config_spec))
self.lp = self.osdf_config.core.get('osdf_temp', {}).get('local_policies', {}
).get('placement_policy_files_vcpe')
+ self.template_fields = {
+ 'location_enabled': True,
+ 'version': '2017-10-10'
+ }
def tearDown(self):
pass
@@ -46,7 +50,8 @@ class TestConductorCalls(unittest.TestCase):
demands = req_json['placementInfo']['placementDemands']
request_parameters = req_json['placementInfo']['requestParameters']
service_info = req_json['serviceInfo']
- conductor.request(req_info, demands, request_parameters, service_info, True, self.osdf_config, policies)
+ conductor.request(req_info, demands, request_parameters, service_info, self.template_fields,
+ self.osdf_config, policies)
def test_request_vfmod(self):
req_json = json_from_file("./test/placement-tests/request_vfmod.json")
@@ -55,7 +60,8 @@ class TestConductorCalls(unittest.TestCase):
demands = req_json['placementInfo']['placementDemands']
request_parameters = req_json['placementInfo']['requestParameters']
service_info = req_json['serviceInfo']
- conductor.request(req_info, demands, request_parameters, service_info, True, self.osdf_config, policies)
+ conductor.request(req_info, demands, request_parameters, service_info, self.template_fields,
+ self.osdf_config, policies)
if __name__ == "__main__":
diff --git a/test/conductor/test_conductor_translation.py b/test/conductor/test_conductor_translation.py
index 8b6c0a1..2a600e4 100644
--- a/test/conductor/test_conductor_translation.py
+++ b/test/conductor/test_conductor_translation.py
@@ -40,6 +40,9 @@ class TestConductorTranslation(unittest.TestCase):
self.request_vfmod_json = json_from_file(parameter_data_file)
self.policies = [json_from_file(policy_data_path + '/' + name) for name in valid_policies_files]
+ self.optimization_policies = [json_from_file(policy_data_path + '/'
+ + "slice-selection-files/opt_policy_nsi_reuse.json")]
+
def tearDown(self):
pass
@@ -58,6 +61,26 @@ class TestConductorTranslation(unittest.TestCase):
res = tr.gen_demands(self.request_vfmod_json['placementInfo']['placementDemands'], vnf_policies)
assert res is not None
+ def test_gen_optimization_policy(self):
+ expected = [{
+ "goal": "minimize",
+ "operation_function": {
+ "operator": "sum",
+ "operands": [
+ {
+ "function": "attribute",
+ "params": {
+ "attribute": "creation_cost",
+ "demand": "embb-nst"
+ }
+ }
+ ]
+ }
+ }]
+ self.assertEqual(expected,
+ tr.gen_optimization_policy(self.request_vfmod_json['placementInfo']['placementDemands'],
+ self.optimization_policies))
+
if __name__ == "__main__":
unittest.main()
diff --git a/test/policy-local-files/slice-selection-files/opt_policy_nsi_reuse.json b/test/policy-local-files/slice-selection-files/opt_policy_nsi_reuse.json
new file mode 100644
index 0000000..33dbfee
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/opt_policy_nsi_reuse.json
@@ -0,0 +1,38 @@
+{
+ "OSDF_FRANKFURT.minimizeCost_URLLC": {
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.minimizeCost_URLLC",
+ "policy-version": 1
+ },
+ "properties": {
+ "geography": [],
+ "identity": "optimization",
+ "goal": "minimize",
+ "operation_function": {
+ "operator": "sum",
+ "operands": [
+ {
+ "function": "attribute",
+ "params": {
+ "attribute": "creation_cost",
+ "demand": "embb-nst"
+ }
+ }
+ ]
+ },
+ "resources": [
+ "embb-nst"
+ ],
+ "scope": [
+ "REUSE",
+ "SHARED"
+ ],
+ "services": [
+ "embb-nst"
+ ]
+ },
+ "type": "onap.policies.optimization.resource.OptimizationPolicy",
+ "type_version": "2.0.0",
+ "version": "1.0.0"
+ }
+}
diff --git a/test/policy-local-files/slice-selection-files/opt_policy_nssi.json b/test/policy-local-files/slice-selection-files/opt_policy_nssi.json
new file mode 100644
index 0000000..2b7cbf8
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/opt_policy_nssi.json
@@ -0,0 +1,37 @@
+{
+ "OSDF_FRANKFURT.minimizeCost_URLLC": {
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.minimizeCost_URLLC",
+ "policy-version": 1
+ },
+ "properties": {
+ "geography": [],
+ "identity": "optimization",
+ "goal": "minimize",
+ "operation_function": {
+ "operator": "sum",
+ "operands": [
+ {
+ "function": "attribute",
+ "params": {
+ "attribute": "latency",
+ "demand": "embb-cn"
+ }
+ }
+ ]
+ },
+ "resources": [
+ "embb-cn"
+ ],
+ "scope": [
+ "SHARED"
+ ],
+ "services": [
+ "embb-cn"
+ ]
+ },
+ "type": "onap.policies.optimization.resource.OptimizationPolicy",
+ "type_version": "2.0.0",
+ "version": "1.0.0"
+ }
+}
diff --git a/test/policy-local-files/slice-selection-files/query_policy_nsi.json b/test/policy-local-files/slice-selection-files/query_policy_nsi.json
new file mode 100644
index 0000000..49b1ca6
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/query_policy_nsi.json
@@ -0,0 +1,44 @@
+
+ {
+ "OSDF_GUILIN.queryPolicy_URLLC":{
+ "type":"onap.policies.optimization.service.QueryPolicy",
+ "version":"1.0.0",
+ "type_version":"1.0.0",
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.queryPolicy_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "scope":[
+ "OSDF_GUILIN"
+ ],
+ "services":[
+ "embb-nst"
+ ],
+ "geography":[],
+ "identity":"queryPolicy_URLLC",
+ "queryProperties":[
+ {
+ "attribute":"latency",
+ "attribute_location":"latency"
+ },
+ {
+ "attribute":"reliability",
+ "attribute_location":"reliability"
+ },
+ {
+ "attribute":"an_latency",
+ "attribute_location":"an_latency"
+ },
+ {
+ "attribute":"cn_latency",
+ "attribute_location":"cn_latency"
+ },
+ {
+ "attribute":"tn_bh_latency",
+ "attribute_location":"tn_bh_latency"
+ }
+ ]
+ }
+ }
+ }
diff --git a/test/policy-local-files/slice-selection-files/query_policy_nssi.json b/test/policy-local-files/slice-selection-files/query_policy_nssi.json
new file mode 100644
index 0000000..5e5893b
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/query_policy_nssi.json
@@ -0,0 +1,32 @@
+
+ {
+ "OSDF_GUILIN.queryPolicy_URLLC":{
+ "type":"onap.policies.optimization.service.QueryPolicy",
+ "version":"1.0.0",
+ "type_version":"1.0.0",
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.queryPolicy_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "scope":[
+ "SHARED"
+ ],
+ "services":[
+ "embb-cn"
+ ],
+ "geography":[],
+ "identity":"queryPolicy_URLLC",
+ "queryProperties":[
+ {
+ "attribute":"latency",
+ "attribute_location":"latency"
+ },
+ {
+ "attribute":"reliability",
+ "attribute_location":"reliability"
+ }
+ ]
+ }
+ }
+ }
diff --git a/test/policy-local-files/slice-selection-files/threshold_policy_nsi.json b/test/policy-local-files/slice-selection-files/threshold_policy_nsi.json
new file mode 100644
index 0000000..6e518dd
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/threshold_policy_nsi.json
@@ -0,0 +1,46 @@
+
+ {
+ "OSDF_GUILIN.Threshold_URLLC":{
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.Threshold_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "geography":[
+
+ ],
+ "identity":"Threshold_URLLC",
+ "resources":[
+ "embb-nst"
+ ],
+ "scope":[
+ "OSDF_GUILIN"
+ ],
+ "services":[
+ "embb-nst"
+ ],
+ "thresholdProperties":[
+ {
+ "attribute":"latency",
+ "operator":"lte",
+ "threshold":{
+ "get_param":"latency"
+ },
+ "unit":"ms"
+ },
+ {
+ "attribute":"reliability",
+ "operator":"gte",
+ "threshold":{
+ "get_param":"reliability"
+ },
+ "unit":""
+ }
+ ]
+ },
+ "type":"onap.policies.optimization.resource.ThresholdPolicy",
+ "type_version":"1.0.0",
+ "version":"1.0.0"
+ }
+ }
+
diff --git a/test/policy-local-files/slice-selection-files/threshold_policy_nssi.json b/test/policy-local-files/slice-selection-files/threshold_policy_nssi.json
new file mode 100644
index 0000000..72a24da
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/threshold_policy_nssi.json
@@ -0,0 +1,46 @@
+
+ {
+ "OSDF_GUILIN.Threshold_URLLC":{
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.Threshold_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "geography":[
+
+ ],
+ "identity":"Threshold_URLLC",
+ "resources":[
+ "embb-cn"
+ ],
+ "scope":[
+ "SHARED"
+ ],
+ "services":[
+ "embb-cn"
+ ],
+ "thresholdProperties":[
+ {
+ "attribute":"latency",
+ "operator":"lte",
+ "threshold":{
+ "get_param":"latency"
+ },
+ "unit":"ms"
+ },
+ {
+ "attribute":"reliability",
+ "operator":"gte",
+ "threshold":{
+ "get_param":"reliability"
+ },
+ "unit":""
+ }
+ ]
+ },
+ "type":"onap.policies.optimization.resource.ThresholdPolicy",
+ "type_version":"1.0.0",
+ "version":"1.0.0"
+ }
+ }
+
diff --git a/test/policy-local-files/slice-selection-files/vnf_policy_nsi_non_shared_case.json b/test/policy-local-files/slice-selection-files/vnf_policy_nsi_non_shared_case.json
new file mode 100644
index 0000000..1774780
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/vnf_policy_nsi_non_shared_case.json
@@ -0,0 +1,76 @@
+
+ {
+ "OSDF_GUILIN.vnfPolicy_URLLC":{
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.vnfPolicy_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "identity":"vnf_URLLC",
+ "resources":["embb-nst"],
+ "scope":[
+ "OSDF_GUILIN",
+ "non-shared"
+ ],
+ "services":[
+ "embb-nst"
+ ],
+ "geography":[],
+ "vnfProperties":[
+ {
+ "attributes":{
+ "core":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"cn_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.999
+ ]
+ }
+ },
+ "ran":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"an_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.9
+ ]
+ }
+ },
+ "transport":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"tn_bh_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.99
+ ]
+ }
+ }
+ },
+ "inventoryProvider":"generator",
+ "inventoryType":"slice_profiles",
+ "unique":"true",
+ "defaultAttributes":{
+ "creation-cost" : 0.9
+ }
+ }
+ ]
+ },
+ "type":"onap.policies.optimization.resource.VnfPolicy",
+ "type_version":"1.0.0",
+ "version":"1.0.0"
+ }
+ }
+
diff --git a/test/policy-local-files/slice-selection-files/vnf_policy_nsi_shared_case.json b/test/policy-local-files/slice-selection-files/vnf_policy_nsi_shared_case.json
new file mode 100644
index 0000000..9932cc1
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/vnf_policy_nsi_shared_case.json
@@ -0,0 +1,90 @@
+
+ {
+ "OSDF_GUILIN.vnfPolicy_URLLC":{
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.vnfPolicy_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "identity":"vnf_URLLC",
+ "resources":["embb-nst"],
+ "scope":[
+ "OSDF_GUILIN",
+ "shared"
+ ],
+ "services":[
+ "embb-nst"
+ ],
+ "geography":[],
+ "vnfProperties":[
+ {
+ "attributes":{
+ "modelInvariantId":"bfbg3636-e39c-iidd-0987-27c28f4oo3",
+ "modelVersionId":"bfbg3636-e39c-iidd-0987-27c28f4d33",
+ "environment-context":"shared",
+ "service-role":"nsi"
+ },
+ "inventoryProvider":"aai",
+ "inventoryType":"nsi",
+ "unique":"true",
+ "defaultAttributes":{
+ "creation-cost" : 0.1
+ }
+ },
+ {
+ "attributes":{
+ "core":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"cn_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.999
+ ]
+ }
+ },
+ "ran":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"an_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.9
+ ]
+ }
+ },
+ "transport":{
+ "latency":{
+ "max":{"get_param":"latency"},
+ "min":{"get_param":"tn_bh_latency"},
+ "steps":1
+ },
+ "reliability":{
+ "values":[
+ 99.9,
+ 99.99
+ ]
+ }
+ }
+ },
+ "inventoryProvider":"generator",
+ "inventoryType":"slice_profiles",
+ "unique":"true",
+ "defaultAttributes":{
+ "creation-cost" : 0.9
+ }
+ }
+ ]
+ },
+ "type":"onap.policies.optimization.resource.VnfPolicy",
+ "type_version":"1.0.0",
+ "version":"1.0.0"
+ }
+ }
+
diff --git a/test/policy-local-files/slice-selection-files/vnf_policy_nssi_shared.json b/test/policy-local-files/slice-selection-files/vnf_policy_nssi_shared.json
new file mode 100644
index 0000000..bd12f84
--- /dev/null
+++ b/test/policy-local-files/slice-selection-files/vnf_policy_nssi_shared.json
@@ -0,0 +1,37 @@
+
+ {
+ "OSDF_GUILIN.vnfPolicy_URLLC":{
+ "metadata":{
+ "policy-id":"OSDF_GUILIN.vnfPolicy_URLLC",
+ "policy-version":1
+ },
+ "properties":{
+ "identity":"vnf_URLLC",
+ "resources":["embb-cn"],
+ "scope":[
+ "SHARED"
+ ],
+ "services":[
+ "embb-cn"
+ ],
+ "geography":[],
+ "vnfProperties":[
+ {
+ "attributes":{
+ "modelInvariantId":"bfbg3636-e39c-iidd-0987-27c28f4oo3",
+ "modelVersionId":"bfbg3636-e39c-iidd-0987-27c28f4d33",
+ "environment-context":"shared",
+ "service-role":"nssi"
+ },
+ "inventoryProvider":"aai",
+ "inventoryType":"nssi",
+ "unique":"true"
+ }
+ ]
+ },
+ "type":"onap.policies.optimization.resource.VnfPolicy",
+ "type_version":"1.0.0",
+ "version":"1.0.0"
+ }
+ }
+
diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py
index b3dd97c..34f6989 100644
--- a/test/test_ConductorApiBuilder.py
+++ b/test/test_ConductorApiBuilder.py
@@ -43,6 +43,10 @@ class TestConductorApiBuilder(unittest.TestCase):
parameter_data_file = self.main_dir + "test/placement-tests/request_placement_vfmod.json"
self.request_placement_vfmod_json = json_from_file(parameter_data_file)
self.policies = [json_from_file(policy_data_path + '/' + name) for name in valid_policies_files]
+ self.template_fields = {
+ 'location_enabled': True,
+ 'version': '2017-10-10'
+ }
def test_conductor_api_call_builder(self):
main_dir = self.main_dir
@@ -53,8 +57,8 @@ class TestConductorApiBuilder(unittest.TestCase):
demands = request_json['placementInfo']['placementDemands']
request_parameters = request_json['placementInfo']['requestParameters']
service_info = request_json['serviceInfo']
- templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, True, policies,
- local_config, self.conductor_api_template)
+ templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, self.template_fields,
+ policies, local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json["name"], "yyy-yyy-yyyy")
@@ -66,8 +70,8 @@ class TestConductorApiBuilder(unittest.TestCase):
demands = request_json['placementInfo']['placementDemands']
request_parameters = request_json['placementInfo']['requestParameters']
service_info = request_json['serviceInfo']
- templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, True, policies,
- local_config, self.conductor_api_template)
+ templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, self.template_fields,
+ policies, local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json, self.request_placement_vfmod_json)