Improve license scan result
[externalapi/nbi.git] / src / test / resources / karatetest / features / 01--ServiceInventory.feature
1 #    Copyright (c) 2018 Orange
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 #
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.swagger: "2.0"
14
15 # new feature
16 # Tags: optional
17     
18 Feature: Service Inventory
19
20 Background:
21 * url nbiBaseUrl
22 * def Context = Java.type('org.onap.nbi.test.Context');
23 * call Context.startServers();
24     
25 Scenario: testServiceResourceGetInventory
26 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
27 When method get
28 Then status 200
29 And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , href : 'service/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', type : 'service-instance', @type : 'serviceONAP' }
30 And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice', name :'servicename2' }
31 And match $.relatedParty  contains { role : 'ONAPcustomer' , id : 'DemoTest2' }
32 And match $.supportingResource[0] contains { id : 'cb80fbb6-9aa7-4ac5-9541-e14f45de533e' , name : 'NewFreeRadius-VNF-instance-01' , status :  'PREPROV' , modelInvariantId : 'f5993703-977f-4346-a1c9-c1884f8cfd8d' , modelVersionId : '902438f7-1e4c-492d-b7cc-8650e13b8aeb' , @referredType : 'ONAP resource' }
33 And match $.supportingResource == '#[2]'
34
35
36 Scenario: testServiceResourceGetInventoryWithStatus
37 Given path 'service','405c8c00-44b9-4303-9f27-6797d22ca096'
38 When method get
39 Then status 200
40 And match $.state == 'Active'
41 And match $.relatedParty  contains { role : 'ONAPcustomer' , id : 'DemoTest1' }
42 And match $.serviceSpecification contains { id : '0bf5f56a-4506-4e98-ab50-336d73ca4b07' , invariantUUID : 'f3ec9092-5c98-41f1-9fea-96be80abd064' , @type : 'ONAPservice', name :'servicename1' }
43
44
45 Scenario: testServiceResourceGetInventoryWithoutRelationShipList
46 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList'
47 When method get
48 Then status 200
49 And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList' , href : 'service/e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList' , name : 'NewFreeRadius-service-instance-01' , type : 'service-instance' , @type : 'serviceONAP' }
50 And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice', name : 'servicename3' }
51 And match $.relatedParty  contains { role : 'ONAPcustomer' , id : 'DemoTest3' }
52 And match $.supportingResource == '#[0]'
53
54
55 Scenario: testServiceInventoryFind
56 Given path 'service'
57 And params {serviceSpecification.name : 'vFW' , relatedParty.id : '6490' }
58 When method get
59 Then status 200
60 And match $ == '#[1]'
61 And match $[0] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , href : 'service/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' ,  name : 'NewFreeRadius-service-instance-01' }
62 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
63 And match $[0].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
64
65 Scenario: testServiceInventoryFindWithServiceSpecId
66 Given path 'service'
67 And params {serviceSpecification.id : '1e3feeb0-8e36-46c6-862c-236d9c626439' , relatedParty.id : '6490'}
68 When method get
69 Then status 200
70 And match $ == '#[1]'
71 And match $[0] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' ,  href : 'service/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' }
72 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
73 And match $[0].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
74
75 Scenario: testServiceInventoryFindWithoutParameter
76 Given path 'service'
77 And params {relatedParty.id:'6490'}
78 When method get
79 Then status 200
80 And match $ == '#[2]'
81 And match $[0] contains { id : 'vfw-service-id' , href : 'service/vfw-service-id' , name : 'vfw-service-name' }
82 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
83 And match $[0].serviceSpecification contains { name : 'vFW-service-2VF-based' , id : '9vfw-service-modek-version-id' }
84 And match $[1] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' }
85 And match $[1].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
86 And match $[1].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
87
88
89 Scenario: testServiceResourceGetInventoryWithoutWiremock
90 * call Context.stopWiremock();
91 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
92 And params {serviceSpecification.name : 'vFW' , relatedParty.id : '6490'}
93 When method get
94 Then status 500
95 * call Context.startServers();
96
97
98
99
100
101
102