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