a39ca04d7110026314672d28899478fc4e910f85
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2020  Tech Mahindra
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.scripts
22
23 import static org.junit.Assert.*
24
25 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
26 import org.junit.Before
27 import org.junit.Test
28 import org.mockito.ArgumentCaptor
29 import org.mockito.Captor
30 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
31 import org.slf4j.Logger
32 import org.mockito.Mockito
33 import org.onap.aaiclient.client.aai.AAIObjectType
34 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
35 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
36 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
37
38 import static org.mockito.Mockito.spy
39 import static org.mockito.Mockito.times
40 import static org.mockito.Mockito.verify
41 import static org.mockito.Mockito.when
42 import static org.mockito.ArgumentMatchers.eq
43
44 import javax.ws.rs.NotFoundException
45
46 class DoActivateCoreNSSITest extends MsoGroovyTest {
47
48     DoActivateCoreNSSI doActivate = new DoActivateCoreNSSI()
49     @Before
50     void init() throws IOException {
51         super.init("DoActivateCoreNSSI")
52     }
53
54     @Captor
55     static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
56
57     @Test
58     void testPreProcessRequest(){
59
60         setUpMockdataFromCommonActivateSliceSubnet()
61         doActivate.preProcessRequest(mockExecution)
62
63         Mockito.verify(mockExecution, times(1)).setVariable(eq("oStatus"), captor.capture())
64         def statusValue = captor.getValue()
65         assertEquals("deactivated", statusValue)
66
67         Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture())
68         def sNssai = captor.getValue()
69         assertEquals("01-5B179BD4", sNssai)
70
71         Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
72         List<ExecutionEntity> values = captor.getAllValues()
73         assertNotNull(values)
74     }
75
76     @Test
77     void testGetNetworkInstanceWithSPInstanceAssociatedWithNssiId(){
78
79         setUpMockdataFromCommonActivateSliceSubnet()
80         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
81
82         DoActivateCoreNSSI obj = spy(DoActivateCoreNSSI.class)
83         when(obj.getAAIClient()).thenReturn(client)
84         AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
85         when(client.exists(resourceUri1)).thenReturn(true)
86         AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn())
87         when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1)
88
89         //networkServiceInstanceId
90         when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379")
91
92         AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "206535e7-77c9-4036-9387-3f1cf57b4379")
93         when(client.exists(resourceUri2)).thenReturn(true)
94         AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS())
95         when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2)
96
97         //Check Vnf
98         when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
99         AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "eeb66c6f-36bd-47ad-8294-48f46b1aa912")
100         when(client.exists(resourceUri3)).thenReturn(true)
101         AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
102         when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3)
103
104
105         //Allotted Resources-1
106         //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
107         AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "0d3d3cce-46a8-486d-816a-954e71697c4e")
108         when(client.exists(resourceUri4)).thenReturn(true)
109         AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1())
110         when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4)
111
112         //Allotted Resources-2
113         //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
114         AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "1c7046f2-a5a3-4d7f-9da8-388ee641a795")
115         when(client.exists(resourceUri5)).thenReturn(true)
116         AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2())
117         when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5)
118
119         obj.getNetworkInstanceWithSPInstanceAssociatedWithNssiId(mockExecution)
120
121         Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceId"), captor.capture())
122         assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue())
123
124         Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceName"), captor.capture())
125         assertEquals("nsi_DemoEmbb", captor.getValue())
126
127         Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelInvariantUuid"), captor.capture())
128         assertEquals("848c5656-5594-4d41-84bb-7afc7c64765c", captor.getValue())
129
130         Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture())
131         assertEquals("OE-generic", captor.getValue())
132
133         //VnfId
134         Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture())
135         assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue())
136
137         Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture())
138         List<Map<String, Object>> snssaiList = new ArrayList<>()
139         Map<String, Object> snssaiMap = new LinkedHashMap<>()
140         snssaiMap.put("snssai", "01-5C83F071")
141         snssaiMap.put("status", "activated")
142         snssaiList.add(snssaiMap)
143         Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
144         snssaiMap1.put("snssai", "01-5B179BD4")
145         snssaiMap1.put("status", "activated")
146         snssaiList.add(snssaiMap1)
147         assertEquals(snssaiList, captor.getValue())
148
149         //Verify Project
150         Mockito.verify(mockExecution, times(1)).setVariable(eq("projectName"), captor.capture())
151         assertEquals("Project-generic", captor.getValue())
152
153         Mockito.verify(mockExecution, times(1)).setVariable(eq("tenantId"), captor.capture())
154         assertEquals("3d5819f1542e4ef9a4ccb0bcb278ca10", captor.getValue())
155
156         Mockito.verify(mockExecution, times(1)).setVariable(eq("cloudOwner"), captor.capture())
157         assertEquals("k8scloudowner", captor.getValue())
158
159         Mockito.verify(mockExecution, times(1)).setVariable(eq("lcpCloudRegionId"), captor.capture())
160         assertEquals("k8sregion", captor.getValue())
161
162         Mockito.verify(mockExecution, times(1)).setVariable(eq("platformName"), captor.capture())
163         assertEquals("test", captor.getValue())
164
165         Mockito.verify(mockExecution, times(1)).setVariable(eq("lineOfBusinessName"), captor.capture())
166         assertEquals("LOB-Demonstration", captor.getValue())
167
168     }
169
170     @Test
171     void testPrepareVnfInstanceParamsJson() {
172         List<Map<String, Object>> snssaiList = new ArrayList<>()
173         Map<String, Object> snssaiMap = new LinkedHashMap<>()
174         snssaiMap.put("snssai", "01-5C83F071")
175         snssaiMap.put("status", "activated")
176         snssaiList.add(snssaiMap)
177         Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
178         snssaiMap1.put("snssai", "01-5B179BD4")
179         snssaiMap1.put("status", "activated")
180         snssaiList.add(snssaiMap1)
181
182         when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList)
183
184         String returnedJsonAsString= doActivate.prepareVnfInstanceParamsJson(mockExecution)
185
186         String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}"""
187         assertEquals(expectedJsonAsString, returnedJsonAsString)
188     }
189
190
191     String mockQueryNS() {
192         return """
193    {
194  "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
195  "service-instance-name": "nsi_DemoEmbb",
196  "environment-context": "General_Revenue-Bearing",
197  "workload-context": "Production",
198  "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
199  "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
200  "resource-version": "1599228110527",
201  "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
202  "orchestration-status": "Assigned",
203  "relationship-list": {
204   "relationship": [{
205    "related-to": "owning-entity",
206    "relationship-label": "org.onap.relationships.inventory.BelongsTo",
207    "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
208    "relationship-data": [{
209     "relationship-key": "owning-entity.owning-entity-id",
210     "relationship-value": "OE-generic"
211    }]
212   }, {
213    "related-to": "generic-vnf",
214    "relationship-label": "org.onap.relationships.inventory.ComposedOf",
215    "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
216    "relationship-data": [{
217     "relationship-key": "generic-vnf.vnf-id",
218     "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
219    }],
220    "related-to-property": [{
221     "property-key": "generic-vnf.vnf-name",
222     "property-value": "vfwuctest 0"
223    }]
224   }, {
225    "related-to": "project",
226    "relationship-label": "org.onap.relationships.inventory.Uses",
227    "related-link": "/aai/v19/business/projects/project/Project-generic",
228    "relationship-data": [{
229     "relationship-key": "project.project-name",
230     "relationship-value": "Project-generic"
231    }]
232   }]
233  }
234 }
235   """
236     }
237
238     String mockQueryVnf() {
239
240         return """
241   {
242   "vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912",
243   "vnf-name": "vfwuctest 0",
244   "vnf-type": "vfwuctest/null",
245   "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
246   "prov-status": "PREPROV",
247   "orchestration-status": "ConfigAssigned",
248   "in-maint": false,
249   "is-closed-loop-disabled": false,
250   "resource-version": "1599228155361",
251   "model-invariant-id": "1086e068-c932-4b61-ae3b-2d2eb0cbe3ec",
252   "model-version-id": "7fbb28cf-7dfc-447a-892c-4a3130b371d2",
253   "model-customization-id": "471b3188-e8f2-470b-9f4d-89e74d45445f",
254   "relationship-list": {
255     "relationship": [{
256       "related-to": "tenant",
257       "relationship-label": "org.onap.relationships.inventory.BelongsTo",
258       "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion/tenants/tenant/3d5819f1542e4ef9a4ccb0bcb278ca10",
259       "relationship-data": [{
260         "relationship-key": "cloud-region.cloud-owner",
261         "relationship-value": "k8scloudowner"
262       }, {
263         "relationship-key": "cloud-region.cloud-region-id",
264         "relationship-value": "k8sregion"
265       }, {
266         "relationship-key": "tenant.tenant-id",
267         "relationship-value": "3d5819f1542e4ef9a4ccb0bcb278ca10"
268       }],
269       "related-to-property": [{
270         "property-key": "tenant.tenant-name",
271         "property-value": "onap-tm5g-dev"
272       }]
273     }, {
274       "related-to": "cloud-region",
275       "relationship-label": "org.onap.relationships.inventory.LocatedIn",
276       "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion",
277       "relationship-data": [{
278         "relationship-key": "cloud-region.cloud-owner",
279         "relationship-value": "k8scloudowner"
280       }, {
281         "relationship-key": "cloud-region.cloud-region-id",
282         "relationship-value": "k8sregion"
283       }],
284       "related-to-property": [{
285         "property-key": "cloud-region.owner-defined-type",
286         "property-value": "OwnerType"
287       }]
288     }, {
289       "related-to": "service-instance",
290       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
291       "related-link": "/aai/v19/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vfw-k8s/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
292       "relationship-data": [{
293         "relationship-key": "customer.global-customer-id",
294         "relationship-value": "Demonstration"
295       }, {
296         "relationship-key": "service-subscription.service-type",
297         "relationship-value": "vfw-k8s"
298       }, {
299         "relationship-key": "service-instance.service-instance-id",
300         "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
301       }],
302       "related-to-property": [{
303         "property-key": "service-instance.service-instance-name",
304         "property-value": "vfw-0201"
305       }]
306     }, {
307       "related-to": "platform",
308       "relationship-label": "org.onap.relationships.inventory.Uses",
309       "related-link": "/aai/v19/business/platforms/platform/test",
310       "relationship-data": [{
311         "relationship-key": "platform.platform-name",
312         "relationship-value": "test"
313       }]
314     }, {
315       "related-to": "line-of-business",
316       "relationship-label": "org.onap.relationships.inventory.Uses",
317       "related-link": "/aai/v19/business/lines-of-business/line-of-business/LOB-Demonstration",
318       "relationship-data": [{
319         "relationship-key": "line-of-business.line-of-business-name",
320         "relationship-value": "LOB-Demonstration"
321       }]
322     }]
323   }
324 }
325   """
326     }
327
328     String mockServiceProfile1() {
329         return """
330    {
331   "service-instance-id": "0d3d3cce-46a8-486d-816a-954e71697c4e",
332   "service-instance-name": "DemoEmbb2",
333   "service-role": "e2esliceprofile-service",
334   "environment-context": "01-5C83F071",
335   "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d11e",
336   "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0292",
337   "service-instance-location-id": "39-00",
338   "resource-version": "1593511782269",
339   "orchestration-status": "activated",
340   "relationship-list": {
341     "relationship": [{
342       "related-to": "service-instance",
343       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
344       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
345       "relationship-data": [{
346         "relationship-key": "customer.global-customer-id",
347         "relationship-value": "5GCustomer"
348       }, {
349         "relationship-key": "service-subscription.service-type",
350         "relationship-value": "5G"
351       }, {
352         "relationship-key": "service-instance.service-instance-id",
353         "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
354       }],
355       "related-to-property": [{
356         "property-key": "service-instance.service-instance-name",
357         "property-value": "DemoEmbb"
358       }]
359     }]
360   },
361   "allotted-resources": {
362     "allotted-resource": [{
363       "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
364       "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
365       "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
366       "resource-version": "1593511173712",
367       "type": "Allotted Resource",
368       "allotted-resource-name": "Allotted_DemoEmbb",
369       "relationship-list": {
370         "relationship": [{
371           "related-to": "service-instance",
372           "relationship-label": "org.onap.relationships.inventory.Uses",
373           "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
374           "relationship-data": [{
375             "relationship-key": "customer.global-customer-id",
376             "relationship-value": "5GCustomer"
377           }, {
378             "relationship-key": "service-subscription.service-type",
379             "relationship-value": "5G"
380           }, {
381             "relationship-key": "service-instance.service-instance-id",
382             "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
383           }],
384           "related-to-property": [{
385             "property-key": "service-instance.service-instance-name",
386             "property-value": "nsi_DemoEmbb"
387           }]
388         }]
389       }
390     }]
391   },
392   "slice-profiles": {
393     "slice-profile": [{
394     "profile-id": "31a83df8-5bd0-4df7-a50f-7900476b81a2",
395     "latency": 3,
396     "max-number-of-UEs": 0,
397     "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
398     "ue-mobility-level": "stationary",
399     "resource-sharing-level": "0",
400     "exp-data-rate-UL": 500,
401     "exp-data-rate-DL": 2000,
402     "activity-factor": 0,
403     "e2e-latency": 0,
404     "jitter": 0,
405     "survival-time": 0,
406     "exp-data-rate": 0,
407     "payload-size": 0,
408     "traffic-density": 0,
409     "conn-density": 0,
410     "s-nssai": "01-5C83F071",
411     "resource-version": "1593525640617"
412   }]
413   }
414 }
415
416   """
417     }
418
419     String mockServiceProfile2() {
420         return """
421    {
422   "service-instance-id": "1c7046f2-a5a3-4d7f-9da8-388ee641a795",
423   "service-instance-name": "DemoEmbb",
424   "service-role": "e2esliceprofile-service",
425   "environment-context": "01-5B179BD4",
426   "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d12e",
427   "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0282",
428   "service-instance-location-id": "39-00",
429   "resource-version": "1593511782169",
430   "orchestration-status": "activated",
431   "relationship-list": {
432     "relationship": [{
433       "related-to": "service-instance",
434       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
435       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
436       "relationship-data": [{
437         "relationship-key": "customer.global-customer-id",
438         "relationship-value": "5GCustomer"
439       }, {
440         "relationship-key": "service-subscription.service-type",
441         "relationship-value": "5G"
442       }, {
443         "relationship-key": "service-instance.service-instance-id",
444         "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
445       }],
446       "related-to-property": [{
447         "property-key": "service-instance.service-instance-name",
448         "property-value": "DemoEmbb"
449       }]
450     }]
451   },
452   "allotted-resources": {
453     "allotted-resource": [{
454       "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
455       "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
456       "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
457       "resource-version": "1593511173712",
458       "type": "Allotted Resource",
459       "allotted-resource-name": "Allotted_DemoEmbb",
460       "relationship-list": {
461         "relationship": [{
462           "related-to": "service-instance",
463           "relationship-label": "org.onap.relationships.inventory.Uses",
464           "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
465           "relationship-data": [{
466             "relationship-key": "customer.global-customer-id",
467             "relationship-value": "5GCustomer"
468           }, {
469             "relationship-key": "service-subscription.service-type",
470             "relationship-value": "5G"
471           }, {
472             "relationship-key": "service-instance.service-instance-id",
473             "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
474           }],
475           "related-to-property": [{
476             "property-key": "service-instance.service-instance-name",
477             "property-value": "nsi_DemoEmbb"
478           }]
479         }]
480       }
481     }]
482   },
483   "slice-profiles": {
484     "slice-profile": [{
485     "profile-id": "b86df550-9d70-452b-a5a9-eb8823417255",
486     "latency": 6,
487     "max-number-of-UEs": 0,
488     "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
489     "ue-mobility-level": "stationary",
490     "resource-sharing-level": "0",
491     "exp-data-rate-UL": 500,
492     "exp-data-rate-DL": 1000,
493     "activity-factor": 0,
494     "e2e-latency": 0,
495     "jitter": 0,
496     "survival-time": 0,
497     "exp-data-rate": 0,
498     "payload-size": 0,
499     "traffic-density": 0,
500     "conn-density": 0,
501     "s-nssai": "01-5B179BD4",
502     "resource-version": "1593511356725"
503   }]
504   }
505 }
506   """
507     }
508
509     String mockQuerySliceServiceReturn(){
510         String expect =
511                 """{
512   "service-instance-id": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX",
513   "service-instance-name": "nssi_DemoEmbb",
514   "service-role": "nssi",
515   "environment-context": "cn",
516   "model-invariant-id": "da575e8e-0863-4172-88b3-b3a9ead67895",
517   "model-version-id": "e398c92f-27da-44b9-a717-1dbfc1bdd82e",
518   "service-instance-location-id": "39-00",
519   "resource-version": "1593525640482",
520   "orchestration-status": "activated",
521   "relationship-list": {
522     "relationship": [{
523       "related-to": "service-instance",
524       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
525       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
526       "relationship-data": [{
527         "relationship-key": "customer.global-customer-id",
528         "relationship-value": "5GCustomer"
529       }, {
530         "relationship-key": "service-subscription.service-type",
531         "relationship-value": "5G"
532       }, {
533         "relationship-key": "service-instance.service-instance-id",
534         "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
535       }],
536       "related-to-property": [{
537         "property-key": "service-instance.service-instance-name",
538         "property-value": "nsi_DemoEmbb"
539       }]
540     },
541  {
542       "related-to": "allotted-resource",
543       "relationship-label": "org.onap.relationships.inventory.Uses",
544       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769",
545       "relationship-data": [{
546         "relationship-key": "customer.global-customer-id",
547         "relationship-value": "5GCustomer"
548       }, {
549         "relationship-key": "service-subscription.service-type",
550         "relationship-value": "5G"
551       }, {
552         "relationship-key": "service-instance.service-instance-id",
553         "relationship-value": "0d3d3cce-46a8-486d-816a-954e71697c4e"
554       }, {
555         "relationship-key": "allotted-resource.id",
556         "relationship-value": "d63c241a-4c0b-4294-b4c3-5a57421a1769"
557       }],
558       "related-to-property": [{
559         "property-key": "allotted-resource.description"
560       }, {
561         "property-key": "allotted-resource.allotted-resource-name",
562         "property-value": "Allotted_DemoEmbb_shared"
563       }]
564     }, {
565       "related-to": "allotted-resource",
566       "relationship-label": "org.onap.relationships.inventory.Uses",
567       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/1c7046f2-a5a3-4d7f-9da8-388ee641a795/allotted-resources/allotted-resource/362e46c2-cd84-45e4-a6c1-77f4ef88328d",
568       "relationship-data": [{
569         "relationship-key": "customer.global-customer-id",
570         "relationship-value": "5GCustomer"
571       }, {
572         "relationship-key": "service-subscription.service-type",
573         "relationship-value": "5G"
574       }, {
575         "relationship-key": "service-instance.service-instance-id",
576         "relationship-value": "1c7046f2-a5a3-4d7f-9da8-388ee641a795"
577       }, {
578         "relationship-key": "allotted-resource.id",
579         "relationship-value": "362e46c2-cd84-45e4-a6c1-77f4ef88328d"
580       }],
581       "related-to-property": [{
582         "property-key": "allotted-resource.description"
583       }, {
584         "property-key": "allotted-resource.allotted-resource-name",
585         "property-value": "Allotted_DemoEmbb"
586       }]
587     }
588  ]
589   }
590 }
591                 """
592         return expect
593     }
594
595     void setUpMockdataFromCommonActivateSliceSubnet() {
596
597         String bpmnRequest = """
598       {
599        "serviceInstanceID": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX",
600        "networkType": "an/cn/tn",
601        "globalSubscriberId": "5GCustomer",
602        "subscriptionServiceType": "5G",
603        "additionalProperties": {
604         "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
605         "snssaiList": [
606          "01-5B179BD4"
607         ],
608         "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
609        }
610       }
611     """
612
613         String sliceParams ="""{
614      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
615      "snssaiList": [
616          "01-5B179BD4"
617         ],
618      "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
619     }"""
620
621         when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
622         when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
623         when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX")
624         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
625         when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
626         when(mockExecution.getVariable("operationType")).thenReturn("deactivateInstance")
627         when(mockExecution.getVariable("jobId")).thenReturn("5ad89cf9-0569-4a93-9999-d8324321e2be")
628         when(mockExecution.getVariable("bpmnRequest")).thenReturn(bpmnRequest)
629         when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
630     }
631 }