2b657be84d33ff178b78e70c3e3be869dc9b8aba
[externalapi/nbi.git] / src / test / resources / karatetest / features / 01--ServiceInventory.feature
1 # new feature
2 # Tags: optional
3     
4 Feature: Service Inventory
5
6 Background:
7 * url nbiBaseUrl
8 * def Context = Java.type('org.onap.nbi.test.Context');
9 * call Context.startServers();
10
11     
12 Scenario: testServiceResourceGetInventory
13 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
14 And params {serviceSpecification.name : 'vFW' , relatedParty.id : '6490'}
15 When method get
16 Then status 200
17 And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', hasStarted : 'yes', type : 'service-instance', @type : 'serviceONAP' }
18 And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
19 And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
20 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' }
21 And match $.supportingResource == '#[2]'
22
23 Scenario: testServiceResourceGetInventoryWithStatus
24 Given url 'http://localhost:8080/nbi/api/v3/service/405c8c00-44b9-4303-9f27-6797d22ca096?serviceSpecification.name=AnsibleService&relatedParty.id=6490'
25 When method get
26 Then status 200
27 And match $.state == 'Active'
28
29 Scenario: testServiceResourceGetInventoryWithoutRelationShipList
30 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList'
31 And params {serviceSpecification.name:'vFW',relatedParty.id:'6490'}
32 When method get
33 Then status 200
34 And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' , hasStarted : 'yes' , type : 'service-instance' , @type : 'serviceONAP' }
35 And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
36 And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
37 And match $.supportingResource == '#[0]'
38
39 Scenario: testServiceResourceGetInventoryWithServiceSpecId
40 Given path 'service','e4688e5f-61a0-4f8b-ae02-a2fbde623bcb'
41 And params {serviceSpecification.id:'1e3feeb0-8e36-46c6-862c-236d9c626439', relatedParty.id:'6490'}
42 When method get
43 Then status 200
44 And match $ contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01', hasStarted : 'yes', type : 'service-instance', @type : 'serviceONAP' }
45 And match $.relatedParty contains { role : 'ONAPcustomer' , id : '6490' }
46 And match $.serviceSpecification contains { id : '98d95267-5e0f-4531-abf8-f14b90031dc5' , invariantUUID : '709d157b-52fb-4250-976e-7133dff5c347' , @type : 'ONAPservice' }
47 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' }
48 And match $.supportingResource == '#[2]'
49
50
51 Scenario: testServiceInventoryFind
52 Given path 'service'
53 And params {serviceSpecification.name : 'vFW' , relatedParty.id : '6490' }
54 When method get
55 Then status 200
56 And match $ == '#[1]'
57 And match $[0] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' }
58 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
59 And match $[0].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
60
61 Scenario: testServiceInventoryFindWithServiceSpecId
62 Given path 'service'
63 And params {serviceSpecification.id : '1e3feeb0-8e36-46c6-862c-236d9c626439' , relatedParty.id : '6490'}
64 When method get
65 Then status 200
66 And match $ == '#[1]'
67 And match $[0] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' }
68 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
69 And match $[0].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
70
71 Scenario: testServiceInventoryFindWithoutParameter
72 Given path 'service'
73 And params {relatedParty.id:'6490'}
74 When method get
75 Then status 200
76 And match $ == '#[2]'
77 And match $[0] contains { id : 'vfw-service-id' , name : 'vfw-service-name' }
78 And match $[0].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
79 And match $[0].serviceSpecification contains { name : 'vFW-service-2VF-based' , id : '9vfw-service-modek-version-id' }
80 And match $[1] contains { id : 'e4688e5f-61a0-4f8b-ae02-a2fbde623bcb' , name : 'NewFreeRadius-service-instance-01' }
81 And match $[1].relatedParty  contains { role : 'ONAPcustomer' , id : '6490' }
82 And match $[1].serviceSpecification contains { name : 'vFW' , id : '98d95267-5e0f-4531-abf8-f14b90031dc5' }
83
84
85
86
87
88
89
90