aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apps/slice_selection/nsi_selection_invalid_request.json80
-rw-r--r--test/apps/slice_selection/nsi_selection_request.json85
-rw-r--r--test/test_api_validation.py11
3 files changed, 176 insertions, 0 deletions
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..9c4fcda
--- /dev/null
+++ b/test/apps/slice_selection/nsi_selection_request.json
@@ -0,0 +1,85 @@
+{
+ "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":{
+ "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":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/test_api_validation.py b/test/test_api_validation.py
index 73d03cd..50941e9 100644
--- a/test/test_api_validation.py
+++ b/test/test_api_validation.py
@@ -22,6 +22,7 @@ from schematics.exceptions import DataError
from apps.placement.models.api.placementRequest import PlacementAPI
from apps.placement.models.api.placementResponse import PlacementResponse
+from apps.slice_selection.models.api.nsi_selection_request import NSISelectionAPI
class TestReqValidation(unittest.TestCase):
@@ -36,6 +37,16 @@ class TestReqValidation(unittest.TestCase):
req_json = json.loads(open(req_file).read())
self.assertEqual(PlacementAPI(req_json).validate(), None)
+ def test_req_nsi_validation(self):
+ req_file = "./test/apps/slice_selection/nsi_selection_request.json"
+ req_json = json.loads(open(req_file).read())
+ self.assertEqual(NSISelectionAPI(req_json).validate(), None)
+
+ def test_req_invalid_nsi(self):
+ req_file = "./test/apps/slice_selection/nsi_selection_invalid_request.json"
+ req_json = json.loads(open(req_file).read())
+ self.assertRaises(DataError, lambda: NSISelectionAPI(req_json).validate())
+
def test_req_failure(self):
req_json = {}
self.assertRaises(DataError, lambda: PlacementAPI(req_json).validate())