summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authordhebeha <dhebeha.mj71@wipro.com>2020-08-14 11:45:20 +0530
committerdhebeha <dhebeha.mj71@wipro.com>2020-08-14 11:46:13 +0530
commit01cd5da39097c948e4fba94eb785b60452c70af3 (patch)
tree029002a3ca33da6429fb3c94be9cc8c3111c1226 /test
parentf16a36e97aae114d9168eff7a4d273891e00d387 (diff)
Change API layer for NSI selection
Issue-ID: OPTFRA-802 Signed-off-by: dhebeha <dhebeha.mj71@wipro.com> Change-Id: Ia7e36da8d9a4d1f3f8e8eb00a61e6b0b29fbbbf6
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())