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