4894c994d9a9b1d0593d6331a0ea07443f485384
[externalapi/nbi.git] / src / test / resources / karatetest / features / 00--ServiceCatalog.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 Catalog
19
20 Background:
21 * url nbiBaseUrl
22 * def Context = Java.type('org.onap.nbi.test.Context');
23 * call Context.startServers();
24     
25 Scenario: testServiceCatalogGetResourceWithoutTosca
26 Given path 'serviceSpecification','1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca'
27 When method get
28 Then status 206
29 And match $ contains { id : '1e3feeb0-8e36-46c6-862c-236d9c626439' , name : 'vFW' , invariantUUID : 'b58a118e-eeb9-4f6e-bdca-e292f84d17df' , toscaModelURL : '/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439toto/toscaModel' , distributionStatus : 'DISTRIBUTED' , version : '2.0' , lifecycleStatus : 'CERTIFIED' , @type : 'ONAPservice' , attachment : '#array' , relatedParty : '#notnull' , resourceSpecification : '#array' }
30 And match $.relatedParty contains { name : 'Joni Mitchell', role : 'lastUpdater' }
31 And match $.resourceSpecification[0] contains { name : 'vFW-vSINK', resourceInstanceName : 'vFW-vSINK 0', resourceType : 'VF' , resourceInvariantUUID : '18b90934-aa82-456f-938e-e74a07a426f3' , @type : 'ONAPresource', modelCustomizationName : 'vFW-vSINK 0' }
32 And match $.resourceSpecification == '#[2]'
33 And match $.attachment == '#[5]'
34
35 Scenario: testServiceCatalogGetServiceWithToscaInput
36 Given path 'serviceSpecification','462f84e5-f0e5-44c5-ab95-38fb4bf77064'
37 When method get
38 Then status 200
39 And match $ contains { id : '462f84e5-f0e5-44c5-ab95-38fb4bf77064' , name : 'vFW' , invariantUUID : 'b58a118e-eeb9-4f6e-bdca-e292f84d17df' , toscaModelURL : '/sdc/v1/catalog/services/462f84e5-f0e5-44c5-ab95-38fb4bf77064/toscaModel' , distributionStatus : 'DISTRIBUTED' , version : '2.0' , lifecycleStatus : 'CERTIFIED' , @type : 'ONAPservice' , attachment : '#array' , relatedParty : '#notnull' , resourceSpecification : '#array' }
40 And match $.serviceSpecCharacteristic contains
41 """
42 {
43     name : 'vFW_ServiceCharacteristics',
44     description : 'This object describes all the inputs needed from the client to interact with the vFW Service Topology',
45     valueType : 'object',
46     @type : 'ONAPServiceCharacteristic',
47     @schemaLocation : 'null',
48     serviceSpecCharacteristicValue :
49     {
50        valueType : 'object',
51        @schemaLocation : '/serviceSpecification/462f84e5-f0e5-44c5-ab95-38fb4bf77064/specificationInputSchema',
52        @type : 'vFW_ServiceCharacteristic',
53     }
54 }
55 """
56
57
58 Scenario: testServiceCatalogInputSchema
59 Given path 'serviceSpecification','462f84e5-f0e5-44c5-ab95-38fb4bf77064'
60 When method get
61 Then status 200
62 Given path 'serviceSpecification','462f84e5-f0e5-44c5-ab95-38fb4bf77064','specificationInputSchema'
63 When method get
64 Then status 200
65 And match $ contains
66 """
67 {
68   "ServiceCharacteristics" : {
69     "required" : [ "sdwanconnectivity0_name", "sdwanconnectivity0_topology" ],
70     "properties" : {
71       "sdwanconnectivity0_topology" : {
72         "type" : "string",
73         "description" : "full mesh, hub-spoke"
74       },
75       "sdwanconnectivity0_name" : {
76         "type" : "string",
77         "description" : "the name of this VPM object"
78       }
79     }
80   }
81 }
82 """
83
84 Scenario: testServiceCatalogGetServiceWithoutInstanceParamsAndVFModules
85 Given path 'serviceSpecification','82c9fbb4-656c-4973-8c7f-172b22b5fa8f'
86 When method get
87 Then status 200
88 And match $.resourceSpecification contains
89 """
90 [{
91         "id": "35d7887d-3c35-4fb4-aed1-d15b4d9f4ccc",
92         "version": "1.0",
93         "name": "vLB_VSP",
94         "resourceInstanceName": "vLB_VSP 0",
95         "modelCustomizationName": "vLB_VSP 0",
96         "resourceInvariantUUID": "368371e6-1d2f-4f4a-b992-a9053c7c2f1e",
97         "resourceType": "VF",
98         "@type": "ONAPresource",
99         "modelCustomizationId": "86dcf0b6-5f76-4444-8392-23ca325fd1d9"
100 }]
101 """
102
103
104 Scenario: findServiceCatalog
105 Given path 'serviceSpecification'
106 When method get
107 Then status 200
108 And assert response.length == 21
109 And match $[0] contains { id : '446afaf6-79b5-420e-aff8-7551b00bb510' , name : 'FreeRadius-service' , invariantUUID : '7e4781e8-6c6e-41c5-b889-6a321d5f2490' , category : 'Network L4+' , distributionStatus : 'DISTRIBUTED' , version : '1.0' , lifecycleStatus : 'CERTIFIED'  }
110 And match $[0].relatedParty contains { role : 'lastUpdater' }
111
112
113
114 Scenario: findServiceCatalogWithFilter
115 Given path 'serviceSpecification'
116 And params {fields:'name'}
117 When method get
118 Then status 200
119 And assert response.length == 21
120 And match $[0] contains { name : 'FreeRadius-service' }
121
122 Scenario: findServiceCatalogWithoutWiremock
123 * call Context.stopWiremock();
124 Given path 'serviceSpecification','1e3feeb0-8e36-46c6-862c-236d9c626439'
125 When method get
126 Then status 500
127 * call Context.startServers();
128
129