aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin
diff options
context:
space:
mode:
authorPaira, Saurav(sp694w) <sp694w@att.com>2020-05-07 12:54:40 +0000
committerSaurav Paira <sp694w@att.com>2020-05-18 17:13:58 +0000
commita726d7aa14e0ae841ede2dbdbc1a825290bf1452 (patch)
tree94d81ad88c66a413e044d93e24dcbd0c30e77496 /ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin
parent6b6ac70007ba2b52c6beb8c0d22453a628c891f3 (diff)
Add Naming Service & IP Assign custom resource resolution capability
Issue-ID: CCSDK-2185 Signed-off-by: Paira, Saurav(sp694w) <sp694w@att.com> Change-Id: I70550fe9582b2db0a70c7b66591438b674173411
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt284
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt354
2 files changed, 638 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
new file mode 100644
index 000000000..e252b4153
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
@@ -0,0 +1,284 @@
+/*
+ * Copyright © 2019 AT&T.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.capabilities
+
+import com.fasterxml.jackson.databind.node.NullNode
+import io.mockk.coEvery
+import io.mockk.every
+import io.mockk.mockk
+import io.mockk.mockkObject
+import kotlinx.coroutines.runBlocking
+import org.junit.Before
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.CapabilityResourceResolutionProcessor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignments
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceDefinitions
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
+
+/**
+ * @author saurav.paira
+ */
+
+class IpAssignResolutionCapabilityTest {
+ val log = logger(IpAssignResolutionCapabilityTest::class)
+
+ @Before
+ fun setup() {
+
+ mockkObject(BluePrintDependencyService)
+
+ val blueprintWebClientService = mockk<BlueprintWebClientService>()
+ // Create mock Response
+ val mockResponse = BlueprintWebClientService.WebClientResponse(
+ 200, """{
+ "fixed_ipv4_Address_01" : "10.10.10.11",
+ "fixed_ipv4_Address_02" : "10.10.10.12",
+ "fixed_ipv4_Address_03" : "10.10.10.13"
+ }
+ """.trimMargin()
+ )
+ every { blueprintWebClientService.exchangeResource(any(), any(), any()) } returns mockResponse
+
+ val restLibPropertyService = mockk<BluePrintRestLibPropertyService>()
+ every { restLibPropertyService.blueprintWebClientService("ipassign-ms") } returns blueprintWebClientService
+ every { BluePrintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService
+ }
+
+ @Test
+ fun testIpAssignResolutionCapability() {
+ runBlocking {
+ val componentFunctionScriptingService = mockk<ComponentFunctionScriptingService>()
+ coEvery {
+ componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(any(), any(), any())
+ } returns IpAssignResolutionCapability()
+
+ coEvery {
+ componentFunctionScriptingService.cleanupInstance(any(), any())
+ } returns mockk()
+
+ val raRuntimeService = mockk<ResourceAssignmentRuntimeService>()
+ every { raRuntimeService.bluePrintContext() } returns mockk()
+ every { raRuntimeService.getInputValue("fixed_ipv4_Address_01") } returns NullNode.getInstance()
+ every { raRuntimeService.getInputValue("fixed_ipv4_Address_02") } returns NullNode.getInstance()
+ every { raRuntimeService.getInputValue("fixed_ipv4_Address_03") } returns NullNode.getInstance()
+
+ every { raRuntimeService.getResolutionStore("CloudRegionId") } returns "cloud-123".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("IpServiceName") } returns "MobilityPlan".asJsonPrimitive()
+
+ every { raRuntimeService.putResolutionStore(any(), any()) } returns Unit
+ every { raRuntimeService.putDictionaryStore(any(), any()) } returns Unit
+
+ val capabilityResourceResolutionProcessor =
+ CapabilityResourceResolutionProcessor(componentFunctionScriptingService)
+ capabilityResourceResolutionProcessor.raRuntimeService = raRuntimeService
+
+ capabilityResourceResolutionProcessor.resourceDictionaries = resourceDefinitions()
+ // log.info("ResourceAssignments Definitions : ${ capabilityResourceResolutionProcessor.resourceDictionaries.asJsonString(true)} ")
+ val resourceAssignments = resourceAssignments()
+ val resourceAssignmentList = resourceAssignments.values.toMutableList()
+ // log.info("ResourceAssignments Assignments : ${resourceAssignmentList.asJsonString(true)} ")
+ capabilityResourceResolutionProcessor.resourceAssignments = resourceAssignmentList
+
+ var status = capabilityResourceResolutionProcessor.applyNB(resourceAssignments["fixed_ipv4_Address_01"]!!)
+ assertTrue(status, "failed to execute capability source")
+ assertEquals(
+ "10.10.10.11".asJsonPrimitive(), resourceAssignments["fixed_ipv4_Address_01"]!!.property!!.value,
+ "assigned value miss match"
+ )
+
+ status = capabilityResourceResolutionProcessor.applyNB(resourceAssignments["fixed_ipv4_Address_02"]!!)
+ assertTrue(status, "failed to execute capability source")
+ assertEquals(
+ "10.10.10.12".asJsonPrimitive(), resourceAssignments["fixed_ipv4_Address_02"]!!.property!!.value,
+ "assigned value miss match"
+ )
+
+ status = capabilityResourceResolutionProcessor.applyNB(resourceAssignments["fixed_ipv4_Address_03"]!!)
+ assertTrue(status, "failed to execute capability source")
+ assertEquals(
+ "10.10.10.13".asJsonPrimitive(), resourceAssignments["fixed_ipv4_Address_03"]!!.property!!.value,
+ "assigned value miss match"
+ )
+
+ val resoulutionSummary =
+ ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries)
+ log.info(resoulutionSummary.asJsonType().toPrettyString())
+ assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
+
+ val summaries = JacksonUtils.jsonNode(resoulutionSummary)["resolution-summary"]
+ val list = JacksonUtils.getListFromJsonNode(summaries, ResolutionSummary::class.java)
+ val ipAddress = list.filter { it.name == "fixed_ipv4_Address_01" }
+
+ assertEquals(list.size, 5)
+ assertNotNull(ipAddress[0].keyIdentifiers)
+ assertNotNull(ipAddress[0].requestPayload)
+ }
+ }
+
+ /** Test dictionaries */
+
+ /** Test dictionaries */
+ private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> {
+ return BluePrintTypes.resourceDefinitions {
+ resourceDefinition("CloudRegionId", "Cloud Region Id Resource Definition") {
+ tags("CloudRegionId")
+ updatedBy("saurav.paira@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("IpServiceName", "Ip Service Name Resource Definition") {
+ tags("IpServiceName")
+ updatedBy("saurav.paira@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("fixed_ipv4_Address_01", "fixed_ipv4_Address_01 Resource Definition") {
+ tags("fixed_ipv4_Address_01")
+ updatedBy("saurav.paira@att.com")
+ property("string", true)
+ sources {
+ sourceCapability("ipassign-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(IpAssignResolutionCapability::class)
+ keyDependencies(
+ arrayListOf(
+ "CloudRegionId",
+ "IpServiceName"
+ )
+ )
+ }
+ }
+ }
+ }
+ resourceDefinition("fixed_ipv4_Address_02", "fixed_ipv4_Address_02 Resource Definition") {
+ tags("fixed_ipv4_Address_01")
+ updatedBy("saurav.paira@att.com")
+ property("string", true)
+ sources {
+ sourceCapability("ipassign-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(IpAssignResolutionCapability::class)
+ keyDependencies(
+ arrayListOf(
+ "CloudRegionId",
+ "IpServiceName"
+ )
+ )
+ }
+ }
+ }
+ }
+ resourceDefinition("fixed_ipv4_Address_03", "fixed_ipv4_Address_03 Resource Definition") {
+ tags("fixed_ipv4_Address_03")
+ updatedBy("saurav.paira@att.com")
+ property("string", true)
+ sources {
+ sourceCapability("ipassign-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(IpAssignResolutionCapability::class)
+ keyDependencies(
+ arrayListOf(
+ "CloudRegionId",
+ "IpServiceName"
+ )
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private fun resourceAssignments(): MutableMap<String, ResourceAssignment> {
+ return BluePrintTypes.resourceAssignments {
+ resourceAssignment(
+ name = "CloudRegionId", dictionaryName = "CloudRegionId",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "IpServiceName", dictionaryName = "IpServiceName",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "fixed_ipv4_Address_01", dictionaryName = "fixed_ipv4_Address_01",
+ dictionarySource = "ipassign-ms"
+ ) {
+ property("string", true, "")
+ dependencies(
+ arrayListOf(
+ "CloudRegionId",
+ "IpServiceName"
+ )
+ )
+ }
+ resourceAssignment(
+ name = "fixed_ipv4_Address_02", dictionaryName = "fixed_ipv4_Address_02",
+ dictionarySource = "ipassign-ms"
+ ) {
+ property("string", true, "")
+ dependencies(
+ arrayListOf(
+ "fixed_ipv4_Address_01"
+ )
+ )
+ }
+ resourceAssignment(
+ name = "fixed_ipv4_Address_03", dictionaryName = "fixed_ipv4_Address_03",
+ dictionarySource = "ipassign-ms"
+ ) {
+ property("string", true, "")
+ dependencies(
+ arrayListOf(
+ "fixed_ipv4_Address_02"
+ )
+ )
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
new file mode 100644
index 000000000..ee53f8a04
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
@@ -0,0 +1,354 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.capabilities
+
+import com.fasterxml.jackson.databind.node.NullNode
+import io.mockk.coEvery
+import io.mockk.every
+import io.mockk.mockk
+import io.mockk.mockkObject
+import kotlinx.coroutines.runBlocking
+import org.junit.Before
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.CapabilityResourceResolutionProcessor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignments
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceDefinitions
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
+
+/**
+ * @author brindasanth
+ */
+
+class NamingResolutionCapabilityTest {
+
+ private val log = logger(NamingResolutionCapabilityTest::class)
+
+ @Before
+ fun setup() {
+
+ mockkObject(BluePrintDependencyService)
+
+ val blueprintWebClientService = mockk<BlueprintWebClientService>()
+ // Create mock Response
+ val mockResponse = BlueprintWebClientService.WebClientResponse<String>(
+ 200, """{
+ "vf-module-name" : "dlsst001dbcx-adsf-Base-01",
+ "vnfc-name" : "dlsst001dbcx"
+ }
+ """.trimMargin()
+ )
+ every { blueprintWebClientService.exchangeResource(any(), any(), any()) } returns mockResponse
+
+ val restLibPropertyService = mockk<BluePrintRestLibPropertyService>()
+ every { restLibPropertyService.blueprintWebClientService("naming-ms") } returns blueprintWebClientService
+ every { BluePrintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService
+ }
+
+ @Test
+ fun testNamingResolutionCapability() {
+ runBlocking {
+ val componentFunctionScriptingService = mockk<ComponentFunctionScriptingService>()
+ coEvery {
+ componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(any(), any(), any())
+ } returns NamingResolutionCapability()
+
+ coEvery {
+ componentFunctionScriptingService.cleanupInstance(any(), any())
+ } returns mockk()
+
+ val raRuntimeService = mockk<ResourceAssignmentRuntimeService>()
+ every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>()
+ every { raRuntimeService.getInputValue("vf-module-name") } returns NullNode.getInstance()
+ every { raRuntimeService.getInputValue("vnfc-name") } returns NullNode.getInstance()
+
+ every { raRuntimeService.getResolutionStore("policy-instance-name") } returns "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("naming-code") } returns "dbc".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("vnf-name") } returns "vnf-123".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("vf-module-label") } returns "adsf".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("vf-module-type") } returns "base".asJsonPrimitive()
+ every { raRuntimeService.getResolutionStore("cloud-region-id") } returns "region-123".asJsonPrimitive()
+
+ every { raRuntimeService.putResolutionStore(any(), any()) } returns Unit
+ every { raRuntimeService.putDictionaryStore(any(), any()) } returns Unit
+
+ val capabilityResourceResolutionProcessor =
+ CapabilityResourceResolutionProcessor(componentFunctionScriptingService)
+ capabilityResourceResolutionProcessor.raRuntimeService = raRuntimeService
+
+ capabilityResourceResolutionProcessor.resourceDictionaries = resourceDefinitions()
+ // log.info("ResourceAssignments Definitions : ${ capabilityResourceResolutionProcessor.resourceDictionaries.asJsonString(true)} ")
+ val resourceAssignments = resourceAssignments()
+ val resourceAssignmentList = resourceAssignments.values.toMutableList()
+ // log.info("ResourceAssignments Assignments : ${resourceAssignmentList.asJsonString(true)} ")
+ capabilityResourceResolutionProcessor.resourceAssignments = resourceAssignmentList
+
+ val bulkSequenced =
+ BulkResourceSequencingUtils.process(capabilityResourceResolutionProcessor.resourceAssignments)
+ // log.info("Bulk Sequenced : ${bulkSequenced} ")
+ val resourceAssignment1 = resourceAssignments["vf-module-name"]
+ var status = capabilityResourceResolutionProcessor.applyNB(resourceAssignment1!!)
+ assertTrue(status, "failed to execute capability source")
+ assertEquals(
+ "dlsst001dbcx-adsf-Base-01".asJsonPrimitive(), resourceAssignment1.property!!.value,
+ "assigned value miss match"
+ )
+
+ val resourceAssignment2 = resourceAssignments["vnfc-name"]
+ status = capabilityResourceResolutionProcessor.applyNB(resourceAssignment2!!)
+ assertTrue(status, "failed to execute capability source")
+ assertEquals(
+ "dlsst001dbcx".asJsonPrimitive(), resourceAssignment2.property!!.value,
+ "assigned value miss match"
+ )
+
+ val resoulutionSummary =
+ ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries)
+ log.info(resoulutionSummary.asJsonType().toPrettyString())
+ assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
+
+ val summaries = JacksonUtils.jsonNode(resoulutionSummary)["resolution-summary"]
+ val list = JacksonUtils.getListFromJsonNode(summaries, ResolutionSummary::class.java)
+ val vnfModuleName = list.filter { it.name == "vf-module-name" }
+
+ assertEquals(list.size, 9)
+ assertNotNull(vnfModuleName[0].keyIdentifiers)
+ assertNotNull(vnfModuleName[0].requestPayload)
+ }
+ }
+
+ /** Test dictionaries */
+ private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> {
+ return BluePrintTypes.resourceDefinitions {
+ resourceDefinition("naming-code", "naming-code Resource Definition") {
+ tags("naming-code")
+ updatedBy("brindasanth@onap.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("naming-type", "naming-type Resource Definition") {
+ tags("naming-type")
+ updatedBy("brindasanth@onap.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("cloud-region-id", "cloud-region-id Resource Definition") {
+ tags("cloud-region-id")
+ updatedBy("brindasanth@onap.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("policy-instance-name", "policy-instance-name Resource Definition") {
+ tags("policy-instance-name")
+ updatedBy("sp694w@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("vnf-name", "vnf-name Resource Definition") {
+ tags("vnf-name")
+ updatedBy("sp694w@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("vf-module-label", "vf-module-label Resource Definition") {
+ tags("vf-module-label")
+ updatedBy("sp694w@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("vf-module-type", "vf-module-type Resource Definition") {
+ tags("vf-module-type")
+ updatedBy("sp694w@att.com")
+ property("string", true)
+ sources {
+ sourceInput("input", "") {}
+ }
+ }
+ resourceDefinition("vf-module-name", "vf-module-name Resource Definition") {
+ tags("vf-module-name")
+ updatedBy("brindasanth@onap.com")
+ property("string", true) {
+ metadata("naming-type", "VF-MODULE")
+ }
+ sources {
+ sourceCapability("naming-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(NamingResolutionCapability::class)
+ keyDependencies(
+ arrayListOf(
+ "policy-instance-name",
+ "naming-code",
+ "vnf-name",
+ "vf-module-label",
+ "vf-module-type"
+ )
+ )
+ }
+ }
+ }
+ }
+ resourceDefinition("vnfc-name", "vnfc-name Resource Definition") {
+ tags("vnfc-name")
+ updatedBy("brindasanth@onap.com")
+ property("string", true) {
+ metadata("naming-type", "VNFC")
+ }
+
+ sources {
+ sourceCapability("naming-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(NamingResolutionCapability::class)
+ keyDependencies(
+ arrayListOf("vf-module-name")
+ )
+ }
+ }
+ }
+ }
+ resourceDefinition("ra-dict-name-3", "ra-dict-name-3 Resource Definition") {
+ tags("ra-dict-name-3")
+ updatedBy("brindasanth@onap.com")
+ property("string", true)
+ sources {
+ sourceCapability("naming-ms", "") {
+ definedProperties {
+ type("internal")
+ scriptClassReference(NamingResolutionCapability::class)
+ keyDependencies(
+ arrayListOf("vf-module-name")
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private fun resourceAssignments(): MutableMap<String, ResourceAssignment> {
+ return BluePrintTypes.resourceAssignments {
+ resourceAssignment(
+ name = "naming-code", dictionaryName = "naming-code",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "naming-type", dictionaryName = "naming-type",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "cloud-region-id", dictionaryName = " cloud-region-id",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "policy-instance-name", dictionaryName = " policy-instance-name",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "vnf-name", dictionaryName = " vnf-name",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "vf-module-label", dictionaryName = " vf-module-label",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "vf-module-type", dictionaryName = " vf-module-type",
+ dictionarySource = "input"
+ ) {
+ property("string", true, "")
+ dependencies(arrayListOf())
+ }
+ resourceAssignment(
+ name = "vf-module-name", dictionaryName = "vf-module-name",
+ dictionarySource = "naming-ms"
+ ) {
+ property("string", true, "")
+ dependencies(
+ arrayListOf(
+ "policy-instance-name",
+ "naming-code",
+ "vnf-name",
+ "vf-module-label",
+ "vf-module-type"
+ )
+ )
+ }
+ resourceAssignment(
+ name = "vnfc-name", dictionaryName = "vnfc-name",
+ dictionarySource = "naming-ms"
+ ) {
+ property("string", true, "")
+ dependencies(
+ arrayListOf(
+ "vf-module-name"
+ )
+ )
+ }
+ }
+ }
+}