blob: 69d9417203b82ebd6936eb42b65d32722504f23a [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import {createRequest} from './mso.factory';
2
Ittay Stern6f900cc2018-08-29 17:01:32 +03003
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03004describe('Vlantagging', () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +03005 test('should create a correct request', () => {
6 sessionStorage.setItem("msoRequestParametersTestApiValue","GR_API");
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03007 let userInputs_withEcompGeneratedNaming = {
8 "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +03009 "lcpRegion": "AAIAIC25",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030010 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
11 "aicZone": "YYY1",
12 "platformName": "plat1",
Ittay Stern6f900cc2018-08-29 17:01:32 +030013 "lineOfBusiness": "onap"
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030014 };
15 let userInputs_withoutEcompGeneratedNaming = {
16 "instanceName": "New Name",
17 "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +030018 "lcpRegion": "AAIAIC25",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030019 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
20 "aicZone": "YYY1",
21 "platformName": "plat1",
Ittay Stern6f900cc2018-08-29 17:01:32 +030022 "lineOfBusiness": "onap"
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030023 };
24 let service = {
25 "service": {
26 "uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
27 "invariantUuid": "9aa04749-c02c-432d-a90c-18caa361c833",
Ittay Sternf7926712019-07-07 19:23:03 +030028 "name": "vDOROTHEA_srv",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030029 "version": "1.0",
30 "toscaModelURL": null,
31 "category": "Network L4+",
32 "serviceType": "",
33 "serviceRole": "",
Ittay Sternf7926712019-07-07 19:23:03 +030034 "description": "vDOROTHEA_srv",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030035 "serviceEcompNaming": "true",
36 "instantiationType": "A-La-Carte",
37 "inputs": {}
38 },
39 "vnfs": {
Ittay Sternf7926712019-07-07 19:23:03 +030040 "vDOROTHEA 0": {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030041 "uuid": "61535073-2e50-4141-9000-f66fea69b433",
42 "invariantUuid": "fcdf49ce-6f0b-4ca2-b676-a484e650e734",
Ittay Sternf7926712019-07-07 19:23:03 +030043 "description": "vDOROTHEA",
44 "name": "vDOROTHEA",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030045 "version": "0.2",
46 "customizationUuid": "1",
47 "inputs": {},
48 "commands": {},
49 "properties": {
50 "nf_naming": "{ecomp_generated_naming=true}",
51 "multi_stage_design": "false",
52 "oam_vfc_instance_group_function": "oambbb",
53 "availability_zone_max_count": "1",
54 "oam_network_collection_function": "oamaaa",
55 "ecomp_generated_naming": "true",
56 "untr_vfc_instance_group_function": "untrbbb",
57 "untr_network_collection_function": "untraaa"
58 },
59 "type": "VF",
Ittay Sternf7926712019-07-07 19:23:03 +030060 "modelCustomizationName": "vDOROTHEA 0",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030061 "vfModules": {
Ittay Sternf7926712019-07-07 19:23:03 +030062 "vdorothea0..Vdorothea..main..module-0": {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030063 "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
64 "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
65 "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
66 "description": null,
Ittay Sternf7926712019-07-07 19:23:03 +030067 "name": "Vdorothea..main..module-0",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030068 "version": "1",
Ittay Sternf7926712019-07-07 19:23:03 +030069 "modelCustomizationName": "Vdorothea..main..module-0",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030070 "properties": {
71 "minCountInstances": 1,
72 "maxCountInstances": 1,
73 "initialCount": 1,
74 "vfModuleLabel": "main"
75 },
76 "inputs": {},
77 "volumeGroupAllowed": false
78 }
79 },
80 "volumeGroups": {},
81 "vfcInstanceGroups": {
82 "untr_group": {
83 "uuid": "5fca04e2-a889-4579-8338-f60f1bf285fa",
84 "invariantUuid": "fb1e384b-117a-46ae-9ad1-bf2f1ee1e49f",
85 "name": "untr_group",
86 "version": "1",
87 "vfcInstanceGroupProperties": {
88 "vfcParentPortRole": "untr",
89 "networkCollectionFunction": "untraaa",
90 "vfcInstanceGroupFunction": null,
91 "subinterfaceRole": "untr"
92 }
93 },
94 "oam_group": {
95 "uuid": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
96 "invariantUuid": "9384abf9-1231-4da4-bd8d-89e4d2f8a749",
97 "name": "oam_group",
98 "version": "1",
99 "vfcInstanceGroupProperties": {
100 "vfcParentPortRole": "untr",
101 "networkCollectionFunction": "untraaa",
102 "vfcInstanceGroupFunction": null,
103 "subinterfaceRole": "untr"
104 }
105 }
106 }
107 }
108 },
109 "networks": {},
Ittay Sternf7926712019-07-07 19:23:03 +0300110 "collectionResources": {},
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300111 "configurations": {},
112 "serviceProxies": {},
113 "vfModules": {
Ittay Sternf7926712019-07-07 19:23:03 +0300114 "vdorothea0..Vdorothea..main..module-0": {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300115 "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
116 "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
117 "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
118 "description": null,
Ittay Sternf7926712019-07-07 19:23:03 +0300119 "name": "Vdorothea..main..module-0",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300120 "version": "1",
Ittay Sternf7926712019-07-07 19:23:03 +0300121 "modelCustomizationName": "Vdorothea..main..module-0",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300122 "properties": {
123 "minCountInstances": 1,
124 "maxCountInstances": 1,
125 "initialCount": 1,
126 "vfModuleLabel": "main"
127 },
128 "inputs": {},
129 "volumeGroupAllowed": false
130 }
131 },
132 "volumeGroups": {},
133 "pnfs": {}
134 };
135 let serviceInstanceId: string = "6bce7302-70bd-4057-b48e-8d5b99e686ca";
136 let networkInstanceGroups = {
137 "untr_group": {
138 "instance-group": {
139 "instance-group-role": "JZmha7QSS4tJ",
140 "model-invariant-id": "model-id3",
141 "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
142 "id": "AAI-12002-test3-vm230w",
143 "description": "a9DEa0kpY",
144 "instance-group-type": "type",
145 "resource-version": "1520888659539",
146 "instance-group-name": "wKmBXiO1xm8bK",
147 "instance-group-function": "testfunction2",
148 "relationship-list": {
149 "relationship": [
150 {
151 "relationDataList": [
152 {
153 "relationship-key": "cloud-region.cloud-owner",
154 "relationship-value": "AAI-12002-vm230w"
155 },
156 {
157 "relationship-key": "cloud-region.cloud-region-id",
158 "relationship-value": "AAI-region-vm230w"
159 }
160 ],
161 "relatedToPropertyList": [
162 {
163 "property-key": "cloud-region.owner-defined-type",
164 "property-value": null
165 }
166 ],
167 "related-to": "cloud-region",
168 "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w",
169 "relationship-label": "org.onap.relationships.inventory.Uses",
170 "relationship-data": [
171 {
172 "relationship-key": "cloud-region.cloud-owner",
173 "relationship-value": "AAI-12002-vm230w"
174 },
175 {
176 "relationship-key": "cloud-region.cloud-region-id",
177 "relationship-value": "AAI-region-vm230w"
178 }
179 ],
180 "related-to-property": [
181 {
182 "property-key": "cloud-region.owner-defined-type",
183 "property-value": null
184 }
185 ]
186 }
187 ]
188 }
189 }
190 },
191 "oam_group": {
192 "instance-group": {
193 "instance-group-role": "JZmha7QSS4tJ",
194 "model-invariant-id": "model-id3",
195 "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
196 "id": "AAI-12002-test3-vm230w",
197 "description": "a9DEa0kpY",
198 "instance-group-type": "type",
199 "resource-version": "1520888659539",
200 "instance-group-name": "wKmBXiO1xm8bK",
201 "instance-group-function": "testfunction2",
202 "relationship-list": {
203 "relationship": [
204 {
205 "relationDataList": [
206 {
207 "relationship-key": "cloud-region.cloud-owner",
208 "relationship-value": "AAI-12002-vm230w"
209 },
210 {
211 "relationship-key": "cloud-region.cloud-region-id",
212 "relationship-value": "AAI-region-vm230w"
213 }
214 ],
215 "relatedToPropertyList": [
216 {
217 "property-key": "cloud-region.owner-defined-type",
218 "property-value": null
219 }
220 ],
221 "related-to": "cloud-region",
222 "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w",
223 "relationship-label": "org.onap.relationships.inventory.Uses",
224 "relationship-data": [
225 {
226 "relationship-key": "cloud-region.cloud-owner",
227 "relationship-value": "AAI-12002-vm230w"
228 },
229 {
230 "relationship-key": "cloud-region.cloud-region-id",
231 "relationship-value": "AAI-region-vm230w"
232 }
233 ],
234 "related-to-property": [
235 {
236 "property-key": "cloud-region.owner-defined-type",
237 "property-value": null
238 }
239 ]
240 }
241 ]
242 }
243 }
244 }
245 };
246 let expectedResult = {
247 "requestInfo": {
248 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
249 "source": "VID",
250 "requestorId": "az2016",
251 "suppressRollback": false
252 },
Ittay Stern6f900cc2018-08-29 17:01:32 +0300253 "lineOfBusiness": Object({ lineOfBusinessName: "onap" }),
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300254 "cloudConfiguration": {
Ittay Sternf7926712019-07-07 19:23:03 +0300255 "lcpCloudRegionId": "AAIAIC25",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300256 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86"
257 },
258 "platform": Object({ platformName: "plat1" }),
259 "modelInfo": {
260 modelCustomizationId :'1',
261 "modelVersionId": "61535073-2e50-4141-9000-f66fea69b433",
Ittay Sternf7926712019-07-07 19:23:03 +0300262 "modelCustomizationName": "vDOROTHEA 0",
263 "modelName": "vDOROTHEA",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300264 "modelInvariantId": "fcdf49ce-6f0b-4ca2-b676-a484e650e734",
265 "modelType": "vnf",
266 "modelVersion": "0.2"
267 },
268 "requestParameters": {
269 "userParams": [],
270 "testApi": "GR_API"
271 },
272 "relatedInstanceList": [
273 {
274 "relatedInstance": {
275 "instanceId": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
276 "modelInfo": {
277 "modelVersionId": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
Ittay Sternf7926712019-07-07 19:23:03 +0300278 "modelName": "vDOROTHEA_srv",
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300279 "modelInvariantId": "9aa04749-c02c-432d-a90c-18caa361c833",
280 "modelType": "service",
281 "modelVersion": "1.0"
282 }
283 }
284 },
285 {
286 "relatedInstance": {
287 "instanceId": "AAI-12002-test3-vm230w",
288 "modelInfo": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300289 "modelType": "networkInstanceGroup"
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300290 }
291 }
292 },
293 {
294 "relatedInstance": {
295 "instanceId": "AAI-12002-test3-vm230w",
296 "modelInfo": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300297 "modelType": "networkInstanceGroup"
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300298 }
299 }
300 }
301 ]
302 };
303
304
Ittay Sternf7926712019-07-07 19:23:03 +0300305 let actualResult_withEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDOROTHEA 0','1');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300306 expect(actualResult_withEcompGeneratedNaming).toEqual(expectedResult);
307 expectedResult["requestInfo"]["instanceName"] = "New Name";
Ittay Sternf7926712019-07-07 19:23:03 +0300308 let actualResult_withoutEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withoutEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDOROTHEA 0','1');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300309 expect(actualResult_withoutEcompGeneratedNaming).toEqual(expectedResult);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300310 sessionStorage.removeItem("msoRequestParametersTestApiValue");
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300311 });
312});