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