diff options
Diffstat (limited to 'components')
44 files changed, 1105 insertions, 42 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json index ceb705127..df50fea44 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json @@ -90,7 +90,7 @@ }, "inputs": { "script-type": "kotlin", - "script-class-reference": "cba.scripts.capability.cli.Check" + "script-class-reference": "cba.capability.cli.Check" }, "outputs": { "response-data": "", diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Distribution/cba_zip.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Distribution/cba_zip.xml new file mode 100755 index 000000000..c6c3bde71 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Distribution/cba_zip.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> + <!-- create a tar.gz file containing the projects dependencies --> + <id>cba</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>${project.basedir}</directory> + <includes> + <include>Definitions/**</include> + <include>Distribution/**</include> + <include>Environments/**</include> + <include>Plans/**</include> + <include>Others/**</include> + <include>Scripts/**</include> + <include>Templates/**</include> + <include>TOSCA-Metadata/**</include> + <include>pom.xml</include> + </includes> + </fileSet> + </fileSets> +</assembly>
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt index 6b1aae45d..d29abb0d2 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt @@ -14,13 +14,13 @@ * limitations under the License. */ -package cba.scripts.capability.cli +package cba.capability.cli import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor import org.onap.ccsdk.cds.blueprintsprocessor.ssh.sshClientService -import org.onap.ccsdk.cds.controllerblueprints.core.* +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt index 27f9cddcf..2d35e262c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package cba.scripts.capability.cli +package cba.capability.cli import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor @@ -64,10 +64,10 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = } val checkComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(id = "check", description = "") { - operation(description = "") { + definedOperation(description = "") { inputs { type("kotlin") - scriptClassReference("cba.scripts.capability.cli.Check") + scriptClassReference("cba.capability.cli.Check") } outputs { status(getAttribute("status")) diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml new file mode 100644 index 000000000..2cb19bc14 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>cba-parent</artifactId> + <version>0.5.2-SNAPSHOT</version> + </parent> + <groupId>org.onap.ccsdk.cds.components.cba</groupId> + <artifactId>capability_cli</artifactId> + <name>CBA Capability CLI</name> + <description>CBA Capability CLI</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> + <artifactId>cli-executor</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>cba</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <descriptors> + <descriptor>Distribution/cba_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl deleted file mode 100644 index ad03321af..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl +++ /dev/null @@ -1,14 +0,0 @@ -<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> - <node-id>$pnf-id</node-id> - <key-based xmlns="urn:opendaylight:netconf-node-topology"> - <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL_private_key_0</key-id> - <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username> - </key-based> - <host xmlns="urn:opendaylight:netconf-node-topology">$pnf-ipv4-address</host> - <port xmlns="urn:opendaylight:netconf-node-topology">6513</port> - <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> - <protocol xmlns="urn:opendaylight:netconf-node-topology"> - <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name> - </protocol> - <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">5</max-connection-attempts> -</node> diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Distribution/cba_zip.xml b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Distribution/cba_zip.xml new file mode 100755 index 000000000..c6c3bde71 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Distribution/cba_zip.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> + <!-- create a tar.gz file containing the projects dependencies --> + <id>cba</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>${project.basedir}</directory> + <includes> + <include>Definitions/**</include> + <include>Distribution/**</include> + <include>Environments/**</include> + <include>Plans/**</include> + <include>Others/**</include> + <include>Scripts/**</include> + <include>Templates/**</include> + <include>TOSCA-Metadata/**</include> + <include>pom.xml</include> + </includes> + </fileSet> + </fileSets> +</assembly>
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt new file mode 100644 index 000000000..a0ca1676e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt @@ -0,0 +1,62 @@ +/* + * 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 cba.resource.audit + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceDefinitions +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes + +const val SOURCE_SDNO = "SDN-O" +const val SOURCE_SDNC = "SDNC" +const val SOURCE_AAI = "AAI" + +val deviceResourceDefinitions = BluePrintTypes.resourceDefinitions { + // Port Speed Definitions + resourceDefinition(name = "port-speed", description = "Port Speed") { + property(type = "string", required = true) + sources { + sourceCapability(id = SOURCE_SDNO, description = "SDN-O Source") { + definedProperties { + type(BluePrintConstants.SCRIPT_KOTLIN) + scriptClassReference("cba.resource.audit.processor.PortSpeedRAProcessor") + keyDependencies(arrayListOf("device-id")) + } + } + sourceDb(id = SOURCE_SDNC, description = "SDNC Controller") { + definedProperties { + endpointSelector("processor-db") + query("SELECT PORT_SPEED FROM XXXX WHERE DEVICE_ID = :device_id") + inputKeyMapping { + map("device_id", "\$device-id") + } + keyDependencies(arrayListOf("device-id")) + } + } + sourceRest(id = SOURCE_AAI, description = "AAI Source") { + definedProperties { + endpointSelector("aai") + urlPath("/vnf/\$device_id") + path(".\$port-speed") + inputKeyMapping { + map("device_id", "\$device-id") + } + keyDependencies(arrayListOf("device-id")) + } + } + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt new file mode 100644 index 000000000..61783d62f --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt @@ -0,0 +1,83 @@ +/* + * 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 cba.resource.audit + +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute +import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateAttribute +import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTypeComponent +import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions + +class ResourceAuditDefinitions : AbstractBluePrintDefinitions() { + override fun serviceTemplate(): ServiceTemplate { + return defaultServiceTemplate() + } +} + +fun ResourceAuditDefinitions.defaultServiceTemplate() = + serviceTemplate(name = "resource-audit", + version = "1.0.0", + author = "Brinda Santh Muthuramalingam", + tags = "brinda, tosca") { + + topologyTemplate { + + workflow(id = "config-collect", description = "Collect the configuration for Device") { + inputs { + property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "") + property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") { + entrySchema(BluePrintConstants.DATA_TYPE_STRING) + } + } + outputs { + property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { + value(getNodeTemplateAttribute(nodeTemplateId = "config-collector", + attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA)) + } + property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { + value(BluePrintConstants.STATUS_SUCCESS) + } + } + step(id = "config-collector", target = "config-collector", description = "Collect the Configuration") + } + + val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor( + id = "config-collector", description = "Config collector component") { + + definedOperation(description = "Config Collector Operation") { + inputs { + type(BluePrintConstants.SCRIPT_KOTLIN) + scriptClassReference("cba.resource.audit.functions.ConfigCollector") + } + outputs { + status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS)) + responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA)) + } + } + } + nodeTemplate(configCollectorComponent) + } + + nodeType(BluePrintTypes.nodeTypeComponent()) + nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor()) + }
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt new file mode 100644 index 000000000..49d0c7348 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt @@ -0,0 +1,56 @@ +/* + * 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 cba.resource.audit.functions + +import cba.resource.audit.deviceResourceDefinitions +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType +import org.onap.ccsdk.cds.controllerblueprints.core.logger + +class ConfigCollector : AbstractScriptComponentFunction() { + + val log = logger(ConfigCollector::class) + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + + val deviceId = bluePrintRuntimeService.getInputValue("device-id").textValue() + val sources = bluePrintRuntimeService.getInputValue("sources") + + log.info("Processing Config Collection for device($deviceId), for sources($sources)") + deviceResourceDefinitions.forEach { name, resourceDefinition -> + log.info("collecting for the property : $name") + resourceDefinition.sources.forEach { sourceName, source -> + log.info("collecting for the Source : $sourceName") + } + } + + // Set the Attributes + setAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive()) + setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, """{ + "port-speed" : "10MBS" + }""".trimIndent().jsonAsJsonType()) + + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt new file mode 100644 index 000000000..660f5918b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt @@ -0,0 +1,36 @@ +/* + * 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 cba.resource.audit.processor + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment + +class PortSpeedRAProcessor : ResourceAssignmentProcessor() { + val log = logger(PortSpeedRAProcessor::class) + override fun getName(): String { + return "PortSpeedRAProcessor" + } + + override suspend fun processNB(executionRequest: ResourceAssignment) { + log.info("Executing Resource PortSpeedRAProcessor") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..d2f533cbd --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,7 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh +Entry-Definitions: cba.resource.audit.ResourceAuditDefinitions.kt +Template-Name: resource-audit +Template-Version: 1.0.0 +Template-Tags: resource-audit
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml new file mode 100644 index 000000000..6ec41a65b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>cba-parent</artifactId> + <version>0.5.2-SNAPSHOT</version> + </parent> + <groupId>org.onap.ccsdk.cds.components.cba</groupId> + <artifactId>resource-audit</artifactId> + <name>CBA Resource Audit</name> + <description>CBA Resource Audit</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> + <artifactId>resource-resolution</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>cba</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <descriptors> + <descriptor>Distribution/cba_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/README.md b/components/model-catalog/blueprint-model/uat-blueprints/README.md new file mode 100644 index 000000000..d6a335273 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/README.md @@ -0,0 +1,146 @@ +# Acceptance Testing Blueprints + +## What is BP User Acceptance Tests (UATs)? + +UATs aims to fully test the BlueprintsProcessor (BPP) using a blueprint. +The BPP runs in an almost production-like configuration with some minor exceptions: + +- It uses an embedded, in-memory, and initially empty H2 database, running in MySQL/MariaDB compatibility mode; +- All external services are mocked. + +## How it works? + +The UATs are declarative, data-driven tests implemented in YAML 1.1 documents. +This YAML files express: + +- Sequence of requests to be sent to the BPP for every process; +- The expected BPP responses; +- For every used external service: + - The `selector` used internally to instantiate the rest client; + - A variable set of expected requests and corresponding responses. + +The UAT engine will perform the following validations: + +- The BPP responses; +- The payloads in the external services requests and it's content type. + +## Adding your BP to the suite of UATs + +To add a new BP to the UAT suite, all you need to do is: +1. Add your blueprint folder under +CDS project's `components/model-catalog/blueprint-model/uat-blueprints` directory; +2. Create a `Tests/uat.yaml` document under your BP folder. + +## `uat.yaml` reference + +### Skeleton of a basic `uat.yaml` + +```yaml +%YAML 1.1 +--- +processes: + - name: process1 + request: + commonHeader: &commonHeader + originatorId: sdnc + requestId: "123456-1000" + subRequestId: sub-123456-1000 + actionIdentifiers: &assign-ai + blueprintName: configuration_over_restconf + blueprintVersion: "1.0.0" + actionName: config-assign + mode: sync + payload: + # ... + expectedResponse: + commonHeader: *commonHeader + actionIdentifiers: *assign-ai + status: + code: 200 + eventType: EVENT_COMPONENT_EXECUTED + errorMessage: null + message: success + payload: + # ... + stepData: + name: config-assign + properties: + resource-assignment-params: + # ... + status: success + - name: process2 + # ... + +external-services: + - selector: odl + expectations: + - request: + method: GET + path: + response: + status: 200 # optional, 200 is the default value + body: # optional, default is an empty content + # ... + - request: + method: POST + path: + content-type: application/json + body: + # JSON request body + response: + status: 201 +``` + +### Composite URI paths + +In case your YAML document contains many URI path definitions, you'd better keep the duplications +as low as possible in order to ease the document maintenance, and avoid inconsistencies. + +Since YAML doesn't provide a standard mechanism to concatenate strings, +the UAT engine implements an ad-hoc mechanism based on multi-level lists. +Please note that currently this mechanism is only applied to URI paths. + +To exemplify how it works, let's take the case of eliminating duplications when defining multiple OpenDaylight URLs. + +You might starting using the following definitions: +```yaml + nodeId: &nodeId "new-netconf-device" + # ... + - request: + path: &configUri [restconf/config, &nodeIdentifier [network-topology:network-topology/topology/topology-netconf/node, *nodeId]] + # ... + - request: + path: [restconf/operational, *nodeIdentifier] + # ... + - request: + path: [*configUri, &configletResourcePath yang-ext:mount/mynetconf:netconflist] +``` + +The UAT engine will expand the above multi-level lists, resulting on the following URI paths: +```yaml + # ... + - request: + path: restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device + # ... + - request: + path: restconf/operational/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device + # ... + - request: + path: restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/mynetconf:netconflist +``` + +## License + +Copyright (C) 2019 Nordix Foundation. + +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. diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/artifact_types.json new file mode 100644 index 000000000..6ec3b4105 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/artifact_types.json @@ -0,0 +1,22 @@ +{ + "artifact_types" : { + "artifact-directed-graph" : { + "description" : "Directed Graph File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json", "xml" ] + }, + "artifact-mapping-resource" : { + "description" : "Resource Mapping File used along with Configuration template", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json" ] + }, + "artifact-template-velocity" : { + "description" : " Velocity Template used for Configuration", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "vtl" ] + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/data_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/data_types.json new file mode 100644 index 000000000..24f501953 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/data_types.json @@ -0,0 +1,14 @@ +{ + "data_types" : { + "dt-echo-properties" : { + "description" : "Dynamic DataType definition for workflow(echo).", + "version" : "1.0.0", + "properties" : { + "echoed-message" : { + "type" : "string" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-mapping.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-mapping.json new file mode 100644 index 000000000..02f2b496f --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "echoed-message", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "echoed-message", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-test.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-test.json new file mode 100644 index 000000000..3105484ce --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/echo-test.json @@ -0,0 +1,91 @@ +{ + "tosca_definitions_version" : "controller_blueprint_1_0_0", + "metadata" : { + "template_author" : "Rodrigo Ottero", + "author-email" : "rodrigo.ottero@est.tech", + "user-groups" : "ADMIN, OPERATION", + "template_name" : "echo_test", + "template_version" : "1.0.0", + "template_tags" : "echo_test, echo, test, testing" + }, + "imports" : [ { + "file" : "Definitions/data_types.json" + }, { + "file" : "Definitions/relationship_types.json" + }, { + "file" : "Definitions/artifact_types.json" + }, { + "file" : "Definitions/node_types.json" + }, { + "file" : "Definitions/policy_types.json" + } ], + "topology_template" : { + "workflows" : { + "echo" : { + "steps" : { + "activate-process" : { + "description" : "Echo a message", + "target" : "echo-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "echo-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(echo).", + "required" : true, + "type" : "dt-echo-properties" + } + } + } + }, + "node_templates" : { + "echo-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-echo-process" ] + }, + "dependency-node-templates" : [ "echo" ] + }, + "artifacts" : { + "dg-config-assign-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/TEST_echo.xml" + } + } + }, + "echo" : { + "type" : "component-resource-resolution", + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "artifact-prefix-names" : [ "echo" ] + }, + "outputs" : { + "resource-assignment-params" : { + "get_attribute" : [ "SELF", "assignment-params" ] + }, + "status" : "success" + } + } + } + } + }, + "artifacts" : { + "echo-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/echo-template.vtl" + }, + "echo-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Definitions/echo-mapping.json" + } + } + } + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/node_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/node_types.json new file mode 100644 index 000000000..a3fc254b2 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/node_types.json @@ -0,0 +1,129 @@ +{ + "node_types" : { + "component-resource-resolution" : { + "description" : "This is Resource Assignment Component API", + "version" : "1.0.0", + "attributes" : { + "assignment-params" : { + "required" : true, + "type" : "string" + } + }, + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "resolution-key" : { + "description" : "Key for service instance related correlation.", + "required" : false, + "type" : "string" + }, + "occurrence": { + "description": "Number of time to perform the resolution.", + "required": false, + "default": 1, + "type": "integer" + }, + "store-result" : { + "description" : "Whether or not to store the output.", + "required" : false, + "type" : "boolean" + }, + "resource-type" : { + "description" : "Request type.", + "required" : false, + "type" : "string" + }, + "artifact-prefix-names" : { + "description" : "Template , Resource Assignment Artifact Prefix names", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "request-id" : { + "description" : "Request Id, Unique Id for the request.", + "required" : true, + "type" : "string" + }, + "resource-id" : { + "description" : "Resource Id.", + "required" : false, + "type" : "string" + }, + "action-name" : { + "description" : "Action Name of the process", + "required" : false, + "type" : "string" + }, + "dynamic-properties" : { + "description" : "Dynamic Json Content or DSL Json reference.", + "required" : false, + "type" : "json" + } + }, + "outputs" : { + "resource-assignment-params" : { + "required" : true, + "type" : "string" + }, + "status" : { + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "dg-generic" : { + "description" : "This is Generic Directed Graph Type", + "version" : "1.0.0", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + }, + "dependency-node-templates" : { + "description" : "Dependent Step Components NodeTemplate name.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.Workflow" + }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Workflow" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/policy_types.json index 1e44cc70a..1e44cc70a 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/policy_types.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/relationship_types.json index 4ddd7a57c..4ddd7a57c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/relationship_types.json diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/resources_definition_types.json new file mode 100644 index 000000000..4b0cf47e7 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Definitions/resources_definition_types.json @@ -0,0 +1,17 @@ +{ + "echoed-message" : { + "tags" : "echoed-message", + "name" : "echoed-message", + "property" : { + "description" : "echoed-message", + "type" : "string" + }, + "updated-by" : "Rodrigo Ottero <rodrigo.ottero@est.tech>", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Plans/TEST_echo.xml b/components/model-catalog/blueprint-model/uat-blueprints/echo/Plans/TEST_echo.xml new file mode 100644 index 000000000..4305c7dd8 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Plans/TEST_echo.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="CONFIG" version="1.0.0"> + <method rpc="ResourceAssignAndActivate" mode="sync"> + <block atomic="true"> + <execute plugin="echo" method="process"> + <outcome value="failure"> + <return status="failure" /> + </outcome> + <outcome value="success"> + <return status="success" /> + </outcome> + </execute> + </block> + </method> +</service-logic> diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..769d46474 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Rodrigo Ottero +Entry-Definitions: Definitions/echo-test.json +Template-Tags: activation-blueprint diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Templates/echo-template.vtl b/components/model-catalog/blueprint-model/uat-blueprints/echo/Templates/echo-template.vtl new file mode 100644 index 000000000..9e2dcc1e5 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Templates/echo-template.vtl @@ -0,0 +1 @@ +${echoed-message}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/Tests/uat.yaml b/components/model-catalog/blueprint-model/uat-blueprints/echo/Tests/uat.yaml new file mode 100644 index 000000000..116230929 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/Tests/uat.yaml @@ -0,0 +1,34 @@ +%YAML 1.1 +--- +processes: + - name: echo-it + request: + commonHeader: &ch + originatorId: sdnc + requestId: "1234" + subRequestId: "1234-12234" + actionIdentifiers: &ai + blueprintName: echo_test + blueprintVersion: "1.0.0" + actionName: echo + mode: sync + payload: + echo-request: + echo-properties: + echoed-message: &message "Hello World!" + expectedResponse: + commonHeader: *ch + actionIdentifiers: *ai + status: + code: 200 + eventType: EVENT_COMPONENT_EXECUTED + errorMessage: null + message: success + payload: + echo-response: {} + stepData: + name: echo + properties: + resource-assignment-params: + echo: *message + status: success diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json index d185128d5..d185128d5 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json index aa5295e44..aa5295e44 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/config-assign-pnf-mapping.json index fe51488c7..fe51488c7 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/config-assign-pnf-mapping.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/config-deploy-pnf-mapping.json index d87b8d1f1..d87b8d1f1 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/config-deploy-pnf-mapping.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/data_types.json index a0804bb3f..a0804bb3f 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/data_types.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/node_types.json index 8c2c0abea..8c2c0abea 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/node_types.json diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/policy_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/policy_types.json new file mode 100644 index 000000000..1e44cc70a --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/relationship_types.json new file mode 100644 index 000000000..4ddd7a57c --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/relationship_types.json @@ -0,0 +1,3 @@ +{ + "relationship_types" : { } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/resources_definition_types.json index 114eb1992..114eb1992 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/resources_definition_types.json diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Plans/CONFIG_configAssign.xml index 220cba9f7..220cba9f7 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Plans/CONFIG_configAssign.xml diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Plans/CONFIG_configDeploy.xml index fbed3d575..fbed3d575 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Plans/CONFIG_configDeploy.xml diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py index 17dd56104..f8225e0ce 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py @@ -14,8 +14,6 @@ # limitations under the License. # ============LICENSE_END========================================================= -from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import \ - RestconfComponentFunction from java.lang import Exception as JavaException from restconf_client import RestconfClient @@ -39,7 +37,7 @@ class RestconfConfigDeploy(AbstractScriptComponentFunction): try: # mount the device mount_payload = restconf_client.resolve_and_generate_message_from_template_prefix("config-deploy") - restconf_client.mount_device(web_client_service, pnf_id, mount_payload) + restconf_client.mount_device(web_client_service, pnf_id, mount_payload, "application/json") # log the current configuration subtree current_configuration = restconf_client.retrieve_device_configuration_subtree( diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta index 6ac9caf57..6ac9caf57 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Templates/config-assign-restconf-configlet-template.vtl index af91ba00d..af91ba00d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Templates/config-assign-restconf-configlet-template.vtl diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Templates/config-deploy-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Templates/config-deploy-restconf-mount-template.vtl new file mode 100644 index 000000000..8098b05d8 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Templates/config-deploy-restconf-mount-template.vtl @@ -0,0 +1,18 @@ +{ + "node": [ + { + "node-id": "${pnf-id}", + "netconf-node-topology:protocol": { + "name": "TLS" + }, + "netconf-node-topology:host": "${pnf-ipv4-address}", + "netconf-node-topology:key-based": { + "username": "netconf", + "key-id": "ODL_private_key_0" + }, + "netconf-node-topology:port": 6513, + "netconf-node-topology:tcp-only": false, + "netconf-node-topology:max-connection-attempts": 5 + } + ] +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml new file mode 100644 index 000000000..37029e181 --- /dev/null +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml @@ -0,0 +1,126 @@ +%YAML 1.1 +--- +processes: + - name: config-assign + request: + commonHeader: &commonHeader + originatorId: sdnc + requestId: "123456-1000" + subRequestId: sub-123456-1000 + actionIdentifiers: &assign-ai + blueprintName: configuration_over_restconf + blueprintVersion: "1.0.0" + actionName: config-assign + mode: sync + payload: + config-assign-request: + resolution-key: &resKey "RES-KEY 61" + config-assign-properties: + service-instance-id: siid_1234 + pnf-id: &pnfId pnf-id-2019-07-12 + pnf-ipv4-address: &pnfAddress "192.168.100.11" + service-model-uuid: service-model-uuid + pnf-customization-uuid: pnf-customization-uuid + expectedResponse: + commonHeader: *commonHeader + actionIdentifiers: *assign-ai + status: + code: 200 + eventType: EVENT_COMPONENT_EXECUTED + errorMessage: null + message: success + payload: + config-assign-response: {} + stepData: + name: config-assign + properties: + resource-assignment-params: + config-assign: &assignPatch + ietf-restconf:yang-patch: + patch-id: patch-1 + edit: + - edit-id: edit1 + operation: merge + target: / + value: { netconflist: { netconf: [ { netconf-id: "10", netconf-param: "1000" }]}} + - edit-id: edit2 + operation: merge + target: / + value: { netconflist: { netconf: [ { netconf-id: "20", netconf-param: "2000" }]}} + - edit-id: edit3 + operation: merge + target: / + value: { netconflist: { netconf: [ { netconf-id: "30", netconf-param: "3000" }]}} + status: success + - name: config-deploy + request: + commonHeader: *commonHeader + actionIdentifiers: &deploy-ai + actionName: config-deploy + blueprintName: configuration_over_restconf + blueprintVersion: "1.0.0" + mode: sync + payload: + config-deploy-request: + resolution-key: *resKey + config-deploy-properties: + service-instance-id: siid_1234 + pnf-id: *pnfId + pnf-ipv4-address: *pnfAddress + service-model-uuid: service-model-uuid + pnf-customization-uuid: pnf-customization-uuid + expectedResponse: + commonHeader: *commonHeader + actionIdentifiers: *deploy-ai + payload: + config-deploy-response: {} + status: + code: 200 + errorMessage: null + eventType: EVENT_COMPONENT_EXECUTED + message: success + stepData: + name: config-deploy + properties: + response-data: "" + status: success + +external-services: + - selector: sdncodl + expectations: + - request: + method: PUT + path: &configUri [ restconf/config, &nodeIdentifier [network-topology:network-topology/topology/topology-netconf/node, *pnfId]] + content-type: application/json + body: + node: + - node-id: *pnfId + netconf-node-topology:protocol: { name: TLS } + netconf-node-topology:host: *pnfAddress + netconf-node-topology:key-based: + username: netconf + key-id: ODL_private_key_0 + netconf-node-topology:port: 6513 + netconf-node-topology:tcp-only: false + netconf-node-topology:max-connection-attempts: 5 + response: + status: 201 + - request: + method: GET + path: [ restconf/operational, *nodeIdentifier] + response: + body: + node: [ { netconf-node-topology:connection-status: connected }] + - request: + method: GET + path: [*configUri, &configletResourcePath yang-ext:mount/mynetconf:netconflist] + response: + body: {} + - request: + method: PATCH + path: [*configUri, *configletResourcePath] + content-type: application/yang.patch+json + body: *assignPatch + - request: + method: DELETE + path: *configUri diff --git a/components/parent/pom.xml b/components/parent/pom.xml index 3e6f71027..ef030cde5 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -28,15 +28,11 @@ <name>Components Parent</name> <packaging>pom</packaging> <properties> - <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget> - <grpc.version>1.18.0</grpc.version> - <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version> <eelf.version>1.0.0</eelf.version> <guava.version>27.0.1-jre</guava.version> <springfox.swagger2.version>2.9.2</springfox.swagger2.version> <h2database.version>1.4.197</h2database.version> <onap.logger.slf4j>1.2.2</onap.logger.slf4j> - <mockk.version>1.9</mockk.version> <velocity.version>1.7</velocity.version> <jinja.version>2.5.1</jinja.version> </properties> @@ -86,11 +82,6 @@ <version>2.6</version> </dependency> <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-compress</artifactId> - <version>1.15</version> - </dependency> - <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>${velocity.version}</version> @@ -241,10 +232,6 @@ <artifactId>commons-io</artifactId> </dependency> <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-compress</artifactId> - </dependency> - <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <exclusions> diff --git a/components/scripts/python/ccsdk_restconf/restconf_client.py b/components/scripts/python/ccsdk_restconf/restconf_client.py index ec25853f0..927c1fedd 100644 --- a/components/scripts/python/ccsdk_restconf/restconf_client.py +++ b/components/scripts/python/ccsdk_restconf/restconf_client.py @@ -34,18 +34,18 @@ class RestconfClient: self.__component_function = restconf_component_function def web_client_service(self, identifier): - RestconfExecutorExtensionsKt.restconfClientService(self.__component_function, identifier) + return RestconfExecutorExtensionsKt.restconfClientService(self.__component_function, identifier) def resolve_and_generate_message_from_template_prefix(self, artifact_prefix): - return ResourceResolutionExtensionsKt.contentFromResolvedArtifact(self.component_function, artifact_prefix) + return ResourceResolutionExtensionsKt.contentFromResolvedArtifact(self.__component_function, artifact_prefix) def retrieve_resolved_template_from_database(self, key, artifact_template): - return ResourceResolutionExtensionsKt.storedContentFromResolvedArtifact(self.component_function, key, + return ResourceResolutionExtensionsKt.storedContentFromResolvedArtifact(self.__component_function, key, artifact_template) - def mount_device(self, web_client_service, nf_id, mount_payload): + def mount_device(self, web_client_service, nf_id, mount_payload, content_type="application/xml"): self.__log.debug("mounting device {}", nf_id) - headers = {"Content-Type": "application/xml"} + headers = {"Content-Type": content_type} url = self.__base_odl_url + nf_id self.__log.debug("sending mount request, url: {}", url) web_client_service.exchangeResource("PUT", url, mount_payload, headers) @@ -55,6 +55,7 @@ class RestconfClient: counter = 0 url = self.__odl_status_check_url + nf_id self.__log.info("url for ODL status check: {}", url) + # TODO: allow JSON format change expected_result = '"netconf-node-topology:connection-status":"connected"' while counter < self.__odl_status_check_limit: result = web_client_service.exchangeResource("GET", url, "") |