diff options
author | krishna moorthy <krishna.moorthy6@wipro.com> | 2020-08-27 04:59:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-27 04:59:46 +0000 |
commit | 053c09a2ed1a8fc8aeef3f8185902634feec8000 (patch) | |
tree | c8c548ebc0c9f08416d92d604fd866cc741104b3 /test | |
parent | 8d566ba1186b78b4ba134a9b5b8cdc106c2a06ee (diff) | |
parent | b712a135c2d84f5b6361583e75a0cb25493b4585 (diff) |
Merge "Add API layer for NSSI selection"
Diffstat (limited to 'test')
-rw-r--r-- | test/apps/slice_selection/nssi_selection_invalid_request.json | 23 | ||||
-rw-r--r-- | test/apps/slice_selection/nssi_selection_request.json | 24 | ||||
-rw-r--r-- | test/test_api_validation.py | 11 |
3 files changed, 58 insertions, 0 deletions
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..1a49a8b --- /dev/null +++ b/test/apps/slice_selection/nssi_selection_request.json @@ -0,0 +1,24 @@ +{ + "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", + "invariantUUID": "9fh85f64-5717-4562-b3fc-2c963f66afa6", + "name": "embb-cn" + } +} diff --git a/test/test_api_validation.py b/test/test_api_validation.py index 50941e9..37f1321 100644 --- a/test/test_api_validation.py +++ b/test/test_api_validation.py @@ -23,6 +23,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 +from apps.slice_selection.models.api.nssi_selection_request import NSSISelectionAPI class TestReqValidation(unittest.TestCase): @@ -47,6 +48,16 @@ class TestReqValidation(unittest.TestCase): req_json = json.loads(open(req_file).read()) self.assertRaises(DataError, lambda: NSISelectionAPI(req_json).validate()) + def test_req_nssi_validation(self): + req_file = "./test/apps/slice_selection/nssi_selection_request.json" + req_json = json.loads(open(req_file).read()) + self.assertEqual(NSSISelectionAPI(req_json).validate(), None) + + def test_req_invalid_nssi(self): + req_file = "./test/apps/slice_selection/nssi_selection_invalid_request.json" + req_json = json.loads(open(req_file).read()) + self.assertRaises(DataError, lambda: NSSISelectionAPI(req_json).validate()) + def test_req_failure(self): req_json = {} self.assertRaises(DataError, lambda: PlacementAPI(req_json).validate()) |