summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml5
-rw-r--r--components/model-catalog/blueprint-model/pom.xml38
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta2
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml10
-rwxr-xr-xcomponents/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/pom.xml38
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta4
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml12
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json6
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/pnf_config.json (renamed from components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json)10
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt81
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py78
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta4
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml4
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/artifact_types.json6
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/pnf_config_aai.json (renamed from components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/activation-blueprint.json)10
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/kotlin/RestconfConfigDeploy.kt82
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/python/RestconfConfigDeploy.py78
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta6
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml4
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintManagement.proto8
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json23
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json16
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json22
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json67
-rw-r--r--components/pom.xml37
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt4
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties6
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties11
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt11
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt52
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt23
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt36
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt27
-rwxr-xr-xms/blueprintsprocessor/pom.xml2
-rw-r--r--ms/command-executor/src/main/python/command_executor_server.py4
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt8
-rw-r--r--pom.xml2
45 files changed, 594 insertions, 346 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 60d073f9e..c3cb67cce 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -59,6 +59,11 @@ committers:
company: 'IBM'
id: 'kasingal'
timezone: 'America/New_York'
+ - name: 'Kapil Singal'
+ email: 'ks220y@att.com'
+ company: 'IBM'
+ id: 'ks220y'
+ timezone: 'America/New_York'
repositories:
- ccsdk/cds
tsc:
diff --git a/components/model-catalog/blueprint-model/pom.xml b/components/model-catalog/blueprint-model/pom.xml
new file mode 100644
index 000000000..7e0e3cf9d
--- /dev/null
+++ b/components/model-catalog/blueprint-model/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2018-2019 AT&T Intellectual Property.
+ ~
+ ~ 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.7.0-SNAPSHOT</version>
+ <relativePath>../../../ms/blueprintsprocessor/cba-parent</relativePath>
+ </parent>
+
+ <groupId>org.onap.ccsdk.cds.cba</groupId>
+ <artifactId>blueprint-model</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>CBA - Blueprints</name>
+ <description>CBA - Blueprints</description>
+
+ <modules>
+ <module>test-blueprint</module>
+ </modules>
+</project>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta
index 8f1df9f2a..854c20ba2 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta
@@ -3,4 +3,6 @@ CSAR-Version: 1.0
Created-By: Brinda Santh <brindasanth@in.ibm.com>
Entry-Definitions: Definitions/activation-blueprint.json
Template-Tags: Brinda Santh, activation-blueprint
+Template-Name: baseconfiguration
+Template-Version: 1.0.0
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
index c71449678..ea76d50b9 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2019 IBM.
+ ~ Modification Copyright © 2018-2019 AT&T Intellectual Property.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -18,16 +19,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>cba-parent</artifactId>
+ <groupId>org.onap.ccsdk.cds.cba</groupId>
+ <artifactId>test-blueprint-model</artifactId>
<version>0.7.0-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>
+ <name>CBA - Test Capability CLI</name>
+ <description>CBA - Test Capability CLI</description>
<dependencies>
<dependency>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta
index 9066e4845..8aad13cfd 100755
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta
@@ -3,6 +3,5 @@ CSAR-Version: 1.0
Created-By: Brinda Santh M
Entry-Definitions: Definitions/activation-blueprint.json
Template-Tags: Brinda Santh, activation-blueprint
-
-Name: Plans/ActivateProcess.bpmn
-Content-Type: application/vnd.oasis.bpmn
+Template-Name: capability_python
+Template-Version: 1.0.0
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta
index b8f3a202a..f85c611f8 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta
@@ -3,4 +3,5 @@ CSAR-Version: 1.0
Created-By: Alexis de Talhouët
Entry-Definitions: Definitions/golden-blueprint.json
Template-Tags: test
-Content-Type: application/vnd.oasis.bpmn
+Template-Name: golden
+Template-Version: 1.0.0 \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/pom.xml b/components/model-catalog/blueprint-model/test-blueprint/pom.xml
new file mode 100644
index 000000000..f9dab0227
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2018-2019 AT&T Intellectual Property.
+ ~
+ ~ 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.cba</groupId>
+ <artifactId>blueprint-model</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>test-blueprint-model</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>CBA - Test Blueprints</name>
+ <description>CBA - Test Blueprints</description>
+
+ <modules>
+ <module>capability_cli</module>
+ <module>resource-audit</module>
+ </modules>
+</project>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta
index 17448a835..efaeabf11 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta
@@ -2,4 +2,6 @@ TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Serge Simard <serge@agilitae.com>
Entry-Definitions: Definitions/remote_ansible.json
-Template-Tags: Serge Simard, remote_ansible \ No newline at end of file
+Template-Tags: Serge Simard, remote_ansible
+Template-Name: remote_ansible
+Template-Version: 1.0.0 \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta
index 2c3a91f28..2e3ed2c2e 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta
@@ -3,4 +3,5 @@ CSAR-Version: 1.0
Created-By: Brinda Santh <brindasanth@in.ibm.com>
Entry-Definitions: Definitions/remote_scripts.json
Template-Tags: Brinda Santh, remote_scripts
-Content-Type: application/vnd.oasis.bpmn
+Template-Name: remote_scripts
+Template-Version: 1.0.0
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
index 527e2b62b..5f6c49e0c 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml
+++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2019 IBM.
+ ~ Modification Copyright © 2018-2019 AT&T Intellectual Property.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -16,15 +17,18 @@
-->
<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>
+ <groupId>org.onap.ccsdk.cds.cba</groupId>
+ <artifactId>test-blueprint-model</artifactId>
<version>0.7.0-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>
+
+ <name>CBA - Test Resource Audit</name>
+ <description>CBA - Test Resource Audit</description>
<dependencies>
<dependency>
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json
index aa5295e44..6ec3b4105 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/artifact_types.json
@@ -12,12 +12,6 @@
"derived_from" : "tosca.artifacts.Implementation",
"file_ext" : [ "json" ]
},
- "artifact-script-jython" : {
- "description" : "Jython Script File",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "py" ]
- },
"artifact-template-velocity" : {
"description" : " Velocity Template used for Configuration",
"version" : "1.0.0",
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/pnf_config.json
index 1a7ba559a..62702b7e2 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/pnf_config.json
@@ -4,7 +4,7 @@
"template_author" : "Rodrigo Ottero",
"author-email" : "rodrigo.ottero@est.tech",
"user-groups" : "ADMIN, OPERATION",
- "template_name" : "configuration_over_restconf",
+ "template_name" : "pnf_config",
"template_version" : "1.0.0",
"template_tags" : "pnf, restconf, config, configuration"
},
@@ -124,8 +124,8 @@
"operation_host" : "SELF"
},
"inputs" : {
- "script-type" : "jython",
- "script-class-reference" : "Scripts/python/RestconfConfigDeploy.py",
+ "script-type" : "kotlin",
+ "script-class-reference" : "cba.pnf.config.RestconfConfigDeploy",
"dynamic-properties" : "*config-deploy-properties"
},
"outputs" : {
@@ -144,10 +144,6 @@
"config-deploy-mapping" : {
"type" : "artifact-mapping-resource",
"file" : "Definitions/config-deploy-pnf-mapping.json"
- },
- "component-script" : {
- "type" : "artifact-script-jython",
- "file" : "Scripts/python/RestconfConfigDeploy.py"
}
}
}
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt
new file mode 100644
index 000000000..a2372c9db
--- /dev/null
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt
@@ -0,0 +1,81 @@
+/*
+* ============LICENSE_START=======================================================
+* 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.
+* ============LICENSE_END=========================================================
+ */
+
+
+package cba.pnf.config
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.contentFromResolvedArtifactNB
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfMountDevice
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfApplyDeviceConfig
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfUnMountDevice
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfDeviceConfig
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+
+class RestconfConfigDeploy : AbstractScriptComponentFunction() {
+ private val CONFIGLET_TEMPLATE_NAME = "config-assign"
+ private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist"
+ private val RESTCONF_SERVER_IDENTIFIER = "sdnc"
+ private val log = logger(AbstractScriptComponentFunction::class.java)
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ log.info("Started execution of process method")
+ try {
+ // Extract Resolution key & Device ID
+ val resolutionKey = getDynamicProperties("resolution-key").asText()
+ log.info("resolution_key: $resolutionKey")
+ val deviceID: String = requestPayloadActionProperty("config-deploy-properties")?.get(0)?.get("pnf-id")?.textValue()!!
+ log.info("device_id: $deviceID")
+ val webclientService = restconfClientService(RESTCONF_SERVER_IDENTIFIER)
+
+ try {
+ // Mount the device
+ val mountPayload = contentFromResolvedArtifactNB("config-deploy")
+ log.debug("Mounting Device : $deviceID")
+ restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json"))
+
+ //Log the current configuration for the subtree
+ val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH)
+ log.info("Current configuration subtree : $currentConfig")
+ //Apply configlet
+ restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
+ storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
+ mutableMapOf("Content-Type" to "application/yang.patch+json"))
+
+ } catch (err: Exception) {
+ log.error("an error occurred while configuring device {}", err)
+ } finally {
+ //Un mount device
+ restconfUnMountDevice(webclientService, deviceID, "")
+ }
+ } catch (bpe: BluePrintProcessorException) {
+ log.error("Error looking up server identifier ", bpe)
+ }
+ }
+
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Recover function called!")
+ log.info("Execution request : $executionRequest")
+ log.error("Exception", runtimeException)
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py
deleted file mode 100644
index af0b7e129..000000000
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/python/RestconfConfigDeploy.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# ============LICENSE_START=======================================================
-# 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.
-# ============LICENSE_END=========================================================
-
-from java.lang import Exception as JavaException
-
-from restconf_client import RestconfClient
-from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction
-
-
-class RestconfConfigDeploy(AbstractScriptComponentFunction):
- log = globals()["log"]
- configlet_template_name = "config-assign"
- configlet_resource_path = "/yang-ext:mount/mynetconf:netconflist"
- restconf_server_identifier = "sdnc"
-
- def process(self, execution_request):
-
- self.log.info("Started execution of process method")
- try:
- restconf_client = RestconfClient(self.log, self)
- pnf_id, resolution_key = self.retrieve_parameters(execution_request)
- web_client_service = restconf_client.web_client_service(self.restconf_server_identifier)
-
- 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, "application/json")
-
- # log the current configuration subtree
- current_configuration = restconf_client.retrieve_device_configuration_subtree(
- web_client_service, pnf_id, self.configlet_resource_path)
- self.log.info("Current configuration subtree: {}", current_configuration)
-
- # apply configuration
- configlet = restconf_client.retrieve_resolved_template_from_database(resolution_key, self.configlet_template_name)
- restconf_client.configure_device_json_patch(
- web_client_service, pnf_id, self.configlet_resource_path, configlet)
- except Exception, err:
- self.log.error("an error occurred while configuring device {}", err)
- raise err
- finally:
- restconf_client.unmount_device(web_client_service, pnf_id)
-
- except JavaException, err:
- self.log.error("Java Exception in the script", err)
- raise err
- except Exception, err:
- self.log.error("Python Exception in the script:" + str(err), err)
- raise err
- self.log.info("Ended execution of process method")
-
- def retrieve_parameters(self, execution_request):
- resolution_key = self.getDynamicProperties("resolution-key").asText()
- self.log.info("resolution_key: {}", resolution_key)
- pnf_id = execution_request.payload.get("config-deploy-request").get("config-deploy-properties").get("pnf-id")
- pnf_id = str(pnf_id).strip('\"')
- self.log.info("pnf-id: {}", pnf_id)
- return pnf_id, resolution_key
-
- def recover(self, runtime_exception, execution_request):
- self.log.info("Recover function called!")
- self.log.info("Execution request", execution_request)
- self.log.error("Exception", runtime_exception)
- print self.bluePrintRuntimeService.getBluePrintError().addError(runtime_exception.getMessage())
- return None
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
index ca0637328..096bd7d3f 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
@@ -1,7 +1,7 @@
TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Rodrigo Ottero
-Entry-Definitions: Definitions/activation-blueprint.json
-Template-Name: activation-blueprint
+Entry-Definitions: Definitions/pnf_config.json
+Template-Name: pnf_config
Template-Version: 1.0.0
Template-Tags: activation-blueprint
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
index 518bbe020..85b10c611 100644
--- 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
@@ -8,7 +8,7 @@ processes:
requestId: "123456-1000"
subRequestId: sub-123456-1000
actionIdentifiers: &assign-ai
- blueprintName: configuration_over_restconf
+ blueprintName: pnf_config
blueprintVersion: "1.0.0"
actionName: config-assign
mode: sync
@@ -35,7 +35,7 @@ processes:
commonHeader: *commonHeader
actionIdentifiers: &deploy-ai
actionName: config-deploy
- blueprintName: configuration_over_restconf
+ blueprintName: pnf_config
blueprintVersion: "1.0.0"
mode: sync
payload:
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/artifact_types.json
index aa5295e44..6ec3b4105 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/artifact_types.json
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/artifact_types.json
@@ -12,12 +12,6 @@
"derived_from" : "tosca.artifacts.Implementation",
"file_ext" : [ "json" ]
},
- "artifact-script-jython" : {
- "description" : "Jython Script File",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "py" ]
- },
"artifact-template-velocity" : {
"description" : " Velocity Template used for Configuration",
"version" : "1.0.0",
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/pnf_config_aai.json
index 214f7dd75..3ef585cb4 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/pnf_config_aai.json
@@ -4,7 +4,7 @@
"template_author" : "Rahul Tyagi",
"author-email" : "rahul.tyagi@est.tech",
"user-groups" : "ADMIN, OPERATION",
- "template_name" : "configuration_over_restconf",
+ "template_name" : "pnf_config_aai",
"template_version" : "1.0.0",
"template_tags" : "pnf, restconf, config, configuration"
},
@@ -124,8 +124,8 @@
"operation_host" : "SELF"
},
"inputs" : {
- "script-type" : "jython",
- "script-class-reference" : "Scripts/python/RestconfConfigDeploy.py",
+ "script-type" : "kotlin",
+ "script-class-reference" : "cba.pnf.config.aai.RestconfConfigDeploy",
"dynamic-properties" : "*config-deploy-properties"
},
"outputs" : {
@@ -144,10 +144,6 @@
"config-deploy-mapping" : {
"type" : "artifact-mapping-resource",
"file" : "Definitions/config-deploy-pnf-mapping.json"
- },
- "component-script" : {
- "type" : "artifact-script-jython",
- "file" : "Scripts/python/RestconfConfigDeploy.py"
}
}
}
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/kotlin/RestconfConfigDeploy.kt
new file mode 100644
index 000000000..6a034ab94
--- /dev/null
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/kotlin/RestconfConfigDeploy.kt
@@ -0,0 +1,82 @@
+/*
+* ============LICENSE_START=======================================================
+* 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.
+* ============LICENSE_END=========================================================
+ */
+
+
+package cba.pnf.config.aai
+
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.contentFromResolvedArtifactNB
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfMountDevice
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfApplyDeviceConfig
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfUnMountDevice
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfDeviceConfig
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.restconfClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+
+class RestconfConfigDeploy : AbstractScriptComponentFunction() {
+ private val CONFIGLET_TEMPLATE_NAME = "config-assign"
+ private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist"
+ private val RESTCONF_SERVER_IDENTIFIER = "sdnc"
+ private val log = logger(AbstractScriptComponentFunction::class.java)
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ log.info("Started execution of process method")
+ try {
+ // Extract Resolution key & Device ID
+ val resolutionKey = getDynamicProperties("resolution-key").asText()
+ log.info("resolution_key: $resolutionKey")
+ val deviceID: String = requestPayloadActionProperty("config-deploy-properties")?.get(0)?.get("pnf-id")?.textValue()!!
+ log.info("device_id: $deviceID")
+ val webclientService = restconfClientService(RESTCONF_SERVER_IDENTIFIER)
+
+ try {
+ // Mount the device
+ val mountPayload = contentFromResolvedArtifactNB("config-deploy")
+ log.debug("Mounting Device : $deviceID")
+ restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json"))
+
+ //Log the current configuration for the subtree
+ val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH)
+ log.info("Current configuration subtree : $currentConfig")
+ //Apply configlet
+ restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
+ storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
+ mutableMapOf("Content-Type" to "application/yang.patch+json"))
+
+ } catch (err: Exception) {
+ log.error("an error occurred while configuring device {}", err)
+ } finally {
+ //Un mount device
+ restconfUnMountDevice(webclientService, deviceID, "")
+ }
+ } catch (bpe: BluePrintProcessorException) {
+ log.error("Error looking up server identifier ", bpe)
+ }
+ }
+
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Recover function called!")
+ log.info("Execution request : $executionRequest")
+ log.error("Exception", runtimeException)
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/python/RestconfConfigDeploy.py b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/python/RestconfConfigDeploy.py
deleted file mode 100644
index af0b7e129..000000000
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Scripts/python/RestconfConfigDeploy.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# ============LICENSE_START=======================================================
-# 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.
-# ============LICENSE_END=========================================================
-
-from java.lang import Exception as JavaException
-
-from restconf_client import RestconfClient
-from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction
-
-
-class RestconfConfigDeploy(AbstractScriptComponentFunction):
- log = globals()["log"]
- configlet_template_name = "config-assign"
- configlet_resource_path = "/yang-ext:mount/mynetconf:netconflist"
- restconf_server_identifier = "sdnc"
-
- def process(self, execution_request):
-
- self.log.info("Started execution of process method")
- try:
- restconf_client = RestconfClient(self.log, self)
- pnf_id, resolution_key = self.retrieve_parameters(execution_request)
- web_client_service = restconf_client.web_client_service(self.restconf_server_identifier)
-
- 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, "application/json")
-
- # log the current configuration subtree
- current_configuration = restconf_client.retrieve_device_configuration_subtree(
- web_client_service, pnf_id, self.configlet_resource_path)
- self.log.info("Current configuration subtree: {}", current_configuration)
-
- # apply configuration
- configlet = restconf_client.retrieve_resolved_template_from_database(resolution_key, self.configlet_template_name)
- restconf_client.configure_device_json_patch(
- web_client_service, pnf_id, self.configlet_resource_path, configlet)
- except Exception, err:
- self.log.error("an error occurred while configuring device {}", err)
- raise err
- finally:
- restconf_client.unmount_device(web_client_service, pnf_id)
-
- except JavaException, err:
- self.log.error("Java Exception in the script", err)
- raise err
- except Exception, err:
- self.log.error("Python Exception in the script:" + str(err), err)
- raise err
- self.log.info("Ended execution of process method")
-
- def retrieve_parameters(self, execution_request):
- resolution_key = self.getDynamicProperties("resolution-key").asText()
- self.log.info("resolution_key: {}", resolution_key)
- pnf_id = execution_request.payload.get("config-deploy-request").get("config-deploy-properties").get("pnf-id")
- pnf_id = str(pnf_id).strip('\"')
- self.log.info("pnf-id: {}", pnf_id)
- return pnf_id, resolution_key
-
- def recover(self, runtime_exception, execution_request):
- self.log.info("Recover function called!")
- self.log.info("Execution request", execution_request)
- self.log.error("Exception", runtime_exception)
- print self.bluePrintRuntimeService.getBluePrintError().addError(runtime_exception.getMessage())
- return None
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta
index 21f431861..903600836 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta
@@ -1,7 +1,7 @@
TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Rahul Tyagi
-Entry-Definitions: Definitions/activation-blueprint.json
-Template-Name: activation-blueprint
+Entry-Definitions: Definitions/pnf_config_aai.json
+Template-Name: pnf_config_aai
Template-Version: 1.0.0
-Template-Tags: activation-blueprint
+Template-Tags: pnf_config_aai
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml
index 1a5995e06..0692eea7f 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml
@@ -8,7 +8,7 @@ processes:
requestId: "123456-1000"
subRequestId: sub-123456-1000
actionIdentifiers: &assign-ai
- blueprintName: configuration_over_restconf
+ blueprintName: pnf_config_aai
blueprintVersion: "1.0.0"
actionName: config-assign
mode: sync
@@ -35,7 +35,7 @@ processes:
commonHeader: *commonHeader
actionIdentifiers: &deploy-ai
actionName: config-deploy
- blueprintName: configuration_over_restconf
+ blueprintName: pnf_config_aai
blueprintVersion: "1.0.0"
mode: sync
payload:
diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
index 8c6cadb4c..a363e8ade 100644
--- a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
+++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
@@ -26,6 +26,13 @@ message BluePrintRemoveInput {
google.protobuf.Struct properties = 3;
}
+message BluePrintBootstrapInput {
+ org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ bool loadCBA = 2;
+ bool loadModelType = 3;
+ bool loadResourceDictionary = 4;
+}
+
message BluePrintManagementOutput {
org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader commonHeader = 1;
// Optional file chunk sent back to the client for Enrich and Download this is mandatory.
@@ -65,4 +72,5 @@ service BluePrintManagementService {
rpc downloadBlueprint (BluePrintDownloadInput) returns (BluePrintManagementOutput);
rpc uploadBlueprint (BluePrintUploadInput) returns (BluePrintManagementOutput);
rpc removeBlueprint (BluePrintRemoveInput) returns (BluePrintManagementOutput);
+ rpc bootstrapBlueprint (BluePrintBootstrapInput) returns (BluePrintManagementOutput);
}
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json
index 32468533a..adafc2997 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json
@@ -10,6 +10,29 @@
"input" : {
"type" : "source-input",
"properties" : { }
+ },
+ "aai-data": {
+ "type": "source-rest",
+ "properties": {
+ "verb": "GET",
+ "type": "JSON",
+ "url-path": "/aai/v14/network/pnfs/pnf/$pnf-id",
+ "path": "/pnf-name",
+ "headers" : {
+ "Accept": "application/json",
+ "X-TransactionId": "AAI-Temp-Tool",
+ "X-FromAppId": "AAI-Temp-Tool"
+ },
+ "input-key-mapping": {
+ "pnf-id": "pnf.pnf-id"
+ },
+ "output-key-mapping": {
+ "pnf-id": "pnf-name"
+ },
+ "key-dependencies": [
+ "pnf.pnf-id"
+ ]
+ }
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json
index 533b8042a..fdebe5503 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json
@@ -38,6 +38,22 @@
"script-class-reference": "SampleRAProcessor",
"instance-dependencies": []
}
+ },
+ "sdnc": {
+ "type": "source-rest",
+ "properties": {
+ "verb": "GET",
+ "type": "JSON",
+ "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id",
+ "path": "/service/0/service-instance-id",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance.service-instance-id"
+ },
+ "output-key-mapping": {
+ "service-instance-id": "service-instance-id"
+ },
+ "key-dependencies": ["service-instance.service-instance-id"]
+ }
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json
index 74f9310e3..91aba6369 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json
@@ -10,6 +10,28 @@
"input" : {
"type" : "source-input",
"properties" : { }
+ },
+ "sdnc": {
+ "type": "source-rest",
+ "properties": {
+ "verb": "GET",
+ "type": "JSON",
+ "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/vf-module/$vf-module-id",
+ "path": "/vf-module/0/vf-module-id",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance-id",
+ "vnf-id": "vnf-id",
+ "vf-module-id": "vf-module.vf-module-id"
+ },
+ "output-key-mapping": {
+ "vf-module-id": "vf-module-id"
+ },
+ "key-dependencies": [
+ "service-instance-id",
+ "vnf-id",
+ "vf-module.vf-module-id"
+ ]
+ }
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json
index 7b170a622..97d6b011e 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json
@@ -1,38 +1,39 @@
- {
- "tags": "vnf-id",
- "name": "vnf-id",
- "property": {
- "description": "vnf-id",
- "type": "string"
+{
+ "tags": "vnf-id",
+ "name": "vnf-id",
+ "property": {
+ "description": "vnf-id",
+ "type": "string"
+ },
+ "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",
+ "sources": {
+ "input": {
+ "type": "source-input"
},
- "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",
- "sources": {
- "input": {
- "type": "source-input"
- },
- "default": {
- "type": "source-default",
- "properties": {}
- },
- "sdnc": {
- "type": "source-rest",
- "properties": {
- "verb": "GET", "type": "JSON",
- "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-id",
- "path": "/param/0/value",
- "input-key-mapping": {
- "service-instance-id": "service-instance-id",
- "vnf-id": "vnf-id"
- },
- "output-key-mapping": {
- "vnf-id": "value"
- },
- "key-dependencies": [
- "service-instance-id",
- "vnf-id"
- ]
- }
+ "default": {
+ "type": "source-default",
+ "properties": {}
+ },
+ "sdnc": {
+ "type": "source-rest",
+ "properties": {
+ "verb": "GET",
+ "type": "JSON",
+ "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/",
+ "path": "/vnf/0/vnf-id",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance-id",
+ "vnf-id": "generic-vnf.vnf-id"
+ },
+ "output-key-mapping": {
+ "vnf-id": "vnf-id"
+ },
+ "key-dependencies": [
+ "service-instance-id",
+ "generic-vnf.vnf-id"
+ ]
}
}
}
+}
diff --git a/components/pom.xml b/components/pom.xml
new file mode 100644
index 000000000..fd19a4f5b
--- /dev/null
+++ b/components/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2018-2019 AT&T Intellectual Property.
+ ~
+ ~ 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</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>components</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Components Root</name>
+ <description>Components</description>
+
+ <modules>
+ <module>model-catalog/blueprint-model</module>
+ </modules>
+</project>
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index dc0e49fd7..138eecba5 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -24,7 +24,7 @@
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
<version>0.7.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
+ <relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
index 6678075bd..4e97460d3 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
@@ -304,6 +304,10 @@ class UatExecutor(
return realAnswer
}
+ override suspend fun <T> retry(times: Int, initialDelay: Long, delay: Long, block: suspend (Int) -> T): T {
+ return super.retry(times, initialDelay, delay, block)
+ }
+
fun asServiceDefinition() =
ServiceDefinition(selector, expectations)
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index 485b0bfee..fc2e7f244 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -34,14 +34,10 @@ resourceSourceMappings=processor-db=source-db,input=source-input,default=source-
blueprintsprocessor.blueprintDeployPath=blueprints/deploy
blueprintsprocessor.blueprintArchivePath=blueprints/archive
blueprintsprocessor.blueprintWorkingPath=blueprints/work
+
# Controller Blueprint Load Configurations
-# blueprints.load.initial-data may be overridden by ENV variables
-blueprintsprocessor.loadInitialData=false
-blueprintsprocessor.loadBluePrint=false
blueprintsprocessor.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/service-blueprint
-blueprintsprocessor.loadModelType=true
blueprintsprocessor.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type
-blueprintsprocessor.loadResourceDictionary=true
blueprintsprocessor.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
# CBA file extension
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index 6708dcf69..bd713080f 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -24,14 +24,9 @@ blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working
# Controller Blueprint Load Configurations
-# blueprints.load.initial-data may be overridden by ENV variables
-blueprintsprocessor.loadInitialData=false
-blueprintsprocessor.loadBluePrint=false
-blueprintsprocessor.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model/service-blueprint
-blueprintsprocessor.loadModelType=false
-blueprintsprocessor.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type/starter-type
-blueprintsprocessor.loadResourceDictionary=false
-blueprintsprocessor.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary/starter-dictionary
+blueprintsprocessor.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model
+blueprintsprocessor.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type
+blueprintsprocessor.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary
# CBA file extension
controllerblueprints.loadCbaExtension=zip
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index 4fed0ce67..fa550d1d0 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -19,6 +19,7 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.uat
+import kotlinx.coroutines.runBlocking
import org.junit.ClassRule
import org.junit.Rule
import org.junit.runner.RunWith
@@ -38,7 +39,7 @@ import kotlin.test.Test
// See more on https://docs.spring.io/autorepo/docs/spring-framework/current/spring-framework-reference/testing.html#testcontext-junit4-rules
@RunWith(Parameterized::class)
class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: String, // readable test description
- private val rootFs: FileSystem): BaseUatTest() {
+ private val rootFs: FileSystem) : BaseUatTest() {
companion object {
@@ -84,8 +85,10 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
@Test
fun runUat() {
- val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText()
- val cbaBytes = compressToBytes(rootFs.getPath("/"))
- uatExecutor.execute(uatSpec, cbaBytes)
+ runBlocking {
+ val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText()
+ val cbaBytes = compressToBytes(rootFs.getPath("/"))
+ uatExecutor.execute(uatSpec, cbaBytes)
+ }
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 6b1f186c9..91d51757a 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -110,35 +110,38 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
)
val prepareEnvOutput = remoteScriptExecutionService.prepareEnv(prepareEnvInput)
log.info("$ATTRIBUTE_PREPARE_ENV_LOG - ${prepareEnvOutput.response}")
- val logs = JacksonUtils.jsonNodeFromObject(prepareEnvOutput.response)
- setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, logs)
- setAttribute(ATTRIBUTE_EXEC_CMD_LOG, "N/A".asJsonPrimitive())
+ val logs = prepareEnvOutput.response
+ val logsEnv = logs.toString().asJsonPrimitive()
+ setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, logsEnv)
if (prepareEnvOutput.status != StatusType.SUCCESS) {
- setNodeOutputErrors(prepareEnvOutput.status.name, logs)
+ setAttribute(ATTRIBUTE_EXEC_CMD_LOG, "N/A".asJsonPrimitive())
+ setNodeOutputErrors(prepareEnvOutput.status.name, logsEnv)
} else {
- setNodeOutputProperties(prepareEnvOutput.status.name.asJsonPrimitive(), logs, "".asJsonPrimitive())
+ setNodeOutputProperties(prepareEnvOutput.status.name.asJsonPrimitive(), logsEnv, "".asJsonPrimitive())
}
}
- // Populate command execution properties and pass it to the remote server
- val properties = dynamicProperties?.returnNullIfMissing()?.rootFieldsToMap() ?: hashMapOf()
-
- val remoteExecutionInput = RemoteScriptExecutionInput(
- requestId = processId,
- remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
- command = scriptCommand,
- properties = properties)
- val remoteExecutionOutput = remoteScriptExecutionService.executeCommand(remoteExecutionInput)
-
- val logs = JacksonUtils.jsonNodeFromObject(remoteExecutionOutput.response)
- if (remoteExecutionOutput.status != StatusType.SUCCESS) {
- setNodeOutputErrors(remoteExecutionOutput.status.name,logs, remoteExecutionOutput.payload)
- } else {
- setNodeOutputProperties(remoteExecutionOutput.status.name.asJsonPrimitive(), logs,
- remoteExecutionOutput.payload)
+ // if Env preparation was successful, then proceed with command execution in this Env
+ if (bluePrintRuntimeService.getBluePrintError().errors.isEmpty()) {
+ // Populate command execution properties and pass it to the remote server
+ val properties = dynamicProperties?.returnNullIfMissing()?.rootFieldsToMap() ?: hashMapOf()
+
+ val remoteExecutionInput = RemoteScriptExecutionInput(
+ requestId = processId,
+ remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
+ command = scriptCommand,
+ properties = properties)
+ val remoteExecutionOutput = remoteScriptExecutionService.executeCommand(remoteExecutionInput)
+
+ val logs = JacksonUtils.jsonNodeFromObject(remoteExecutionOutput.response)
+ if (remoteExecutionOutput.status != StatusType.SUCCESS) {
+ setNodeOutputErrors(remoteExecutionOutput.status.name, logs, remoteExecutionOutput.payload)
+ } else {
+ setNodeOutputProperties(remoteExecutionOutput.status.name.asJsonPrimitive(), logs,
+ remoteExecutionOutput.payload)
+ }
}
-
} catch (e: Exception) {
log.error("Failed to process on remote executor", e)
} finally {
@@ -178,9 +181,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
*/
private fun setNodeOutputErrors(status: String, message: JsonNode, artifacts: JsonNode = "".asJsonPrimitive() ) {
setAttribute(ATTRIBUTE_EXEC_CMD_STATUS, status.asJsonPrimitive())
+ log.info("Executor status : $status")
setAttribute(ATTRIBUTE_EXEC_CMD_LOG, message)
+ log.info("Executor message : $message")
setAttribute(ATTRIBUTE_RESPONSE_DATA, artifacts)
+ log.info("Executor artifacts: $artifacts")
- addError(status, ATTRIBUTE_EXEC_CMD_LOG, message.asText())
+ addError(status, ATTRIBUTE_EXEC_CMD_LOG, message.toString())
}
}
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
index 49fd025d9..11a35eede 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
@@ -39,19 +39,20 @@ fun AbstractScriptComponentFunction.restconfClientService(selector: String): Blu
*/
suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService: BlueprintWebClientService,
- deviceId: String, payload: Any) {
- val headers: MutableMap<String, String> = hashMapOf()
- headers["Content-Type"] = "application/xml"
+ deviceId: String,
+ payload: Any,
+ headers: Map<String, String> = mutableMapOf("Content-Type" to "application/xml")) {
+
val mountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending mount request, url: $mountUrl")
- webClientService.exchangeNB("PUT", mountUrl, payload, headers)
+ webClientService.exchangeResource("PUT", mountUrl, payload as String, headers)
/** Check device has mounted */
val mountCheckUrl = "restconf/operational/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
val expectedResult = """"netconf-node-topology:connection-status":"connected""""
val mountCheckExecutionBlock: suspend (Int) -> String = { tryCount: Int ->
- val result = webClientService.exchangeNB("GET", mountCheckUrl, "")
+ val result = webClientService.exchangeResource("GET", mountCheckUrl, "")
if (result.body.contains(expectedResult)) {
log.info("NF was mounted successfully on ODL")
result.body
@@ -70,13 +71,13 @@ suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService
suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(webClientService: BlueprintWebClientService,
deviceId: String, configletResourcePath: String,
configletToApply: Any,
- additionalHeaders: Map<String, String>?) {
+ additionalHeaders: Map<String, String > = mutableMapOf("Content-Type" to "application/yang.patch+xml")) {
log.debug("headers: $additionalHeaders")
log.info("configuring device: $deviceId, Configlet: $configletToApply")
val applyConfigUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
- val result = webClientService.exchangeNB("PATCH", applyConfigUrl, configletToApply, additionalHeaders)
+ val result:Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
log.info("Configuration application result: $result")
}
@@ -88,7 +89,7 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientServic
val configPathUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
log.debug("sending GET request, url: $configPathUrl")
- return webClientService.exchangeNB("GET", configPathUrl, "")
+ return webClientService.exchangeResource("GET", configPathUrl, "")
}
/**
@@ -98,5 +99,5 @@ suspend fun AbstractScriptComponentFunction.restconfUnMountDevice(webClientServi
deviceId: String, payload: String) {
val unMountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending unMount request, url: $unMountUrl")
- webClientService.exchangeNB("DELETE", unMountUrl, "")
+ webClientService.exchangeResource("DELETE", unMountUrl, "")
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
index 0f804b8b2..5f2a6dfb6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -160,6 +160,29 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
}
}
+ override fun bootstrapBlueprint(request: BluePrintBootstrapInput,
+ responseObserver: StreamObserver<BluePrintManagementOutput>) {
+ runBlocking {
+ try {
+ log.info("request(${request.commonHeader.requestId}): Received bootstrap request")
+ val bootstrapRequest = BootstrapRequest().apply {
+ loadModelType = request.loadModelType
+ loadResourceDictionary = request.loadResourceDictionary
+ loadCBA = request.loadCBA
+ }
+ /** Perform bootstrap of Model Types, Resource Definitions and CBA */
+ bluePrintModelHandler.bootstrapBlueprint(bootstrapRequest)
+ responseObserver.onNext(successStatus(request.commonHeader))
+
+ } catch (e: Exception) {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to bootstrap", e))
+ } finally {
+ responseObserver.onCompleted()
+ }
+ }
+ }
+
private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput =
BluePrintManagementOutput.newBuilder()
.setCommonHeader(header)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index 94c095047..5ef50b09f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -35,9 +35,7 @@ import org.springframework.http.ResponseEntity
import org.springframework.http.codec.multipart.FilePart
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
-import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
-import java.time.Duration
/**
* BlueprintModelController Purpose: Handle controllerBlueprint API request
@@ -49,6 +47,15 @@ import java.time.Duration
@RequestMapping("/api/v1/blueprint-model")
open class BlueprintModelController(private val bluePrintModelHandler: BluePrintModelHandler) {
+ @PostMapping(path = arrayOf("/bootstrap"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE),
+ consumes = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
+ fun bootstrap(@RequestBody bootstrapRequest: BootstrapRequest): Mono<Unit> = monoMdc {
+ bluePrintModelHandler.bootstrapBlueprint(bootstrapRequest)
+ }
+
@PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
@@ -78,7 +85,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun allBlueprintModelMetaData(@NotNull @PathVariable(value = "keyword") keyWord: String): List<BlueprintModelSearch> {
- return this.bluePrintModelHandler.searchBluePrintModelsByKeyWord(keyWord)
+ return this.bluePrintModelHandler.searchBluePrintModelsByKeyWord(keyWord)
}
@@ -91,7 +98,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
): Page<BlueprintModelSearch> {
val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName)
- return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord,pageRequest)
+ return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord, pageRequest)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
index 5259ee1c9..346015bc4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2018-2019 AT&T Intellectual Property.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,13 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import java.io.Serializable
import java.util.*
+
+class BootstrapRequest {
+ var loadModelType: Boolean = false
+ var loadResourceDictionary: Boolean = false
+ var loadCBA: Boolean = false
+}
+
/**
* ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model
*
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index 216648369..5f7eacee8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -24,6 +24,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSe
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelContentRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelSearchRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BootstrapRequest
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.BluePrintDatabaseLoadService
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
@@ -36,6 +38,7 @@ import org.springframework.core.io.ByteArrayResource
import org.springframework.core.io.Resource
import org.springframework.data.domain.Page
import org.springframework.data.domain.PageRequest
+import org.springframework.data.domain.Pageable
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
@@ -44,7 +47,6 @@ import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.io.IOException
import java.util.*
-import org.springframework.data.domain.Pageable
/**
@@ -55,7 +57,8 @@ import org.springframework.data.domain.Pageable
*/
@Service
-open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: BluePrintCatalogService,
+open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BluePrintDatabaseLoadService,
+ private val blueprintsProcessorCatalogService: BluePrintCatalogService,
private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
private val blueprintModelSearchRepository: BlueprintModelSearchRepository,
private val blueprintModelRepository: BlueprintModelRepository,
@@ -64,6 +67,22 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService:
private val log = logger(BluePrintModelHandler::class)
+
+ open suspend fun bootstrapBlueprint(bootstrapRequest: BootstrapRequest) {
+ log.info("Bootstrap request with type load(${bootstrapRequest.loadModelType}), " +
+ "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
+ "cba load(${bootstrapRequest.loadCBA})")
+ if (bootstrapRequest.loadModelType) {
+ bluePrintDatabaseLoadService.initModelTypes()
+ }
+ if (bootstrapRequest.loadResourceDictionary) {
+ bluePrintDatabaseLoadService.initResourceDictionary()
+ }
+ if (bootstrapRequest.loadCBA) {
+ bluePrintDatabaseLoadService.initBluePrintCatalog()
+ }
+ }
+
/**
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
*
@@ -242,13 +261,11 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService:
* @return List<BlueprintModelSearch> list of the controller blueprint
</BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWord(keyWord: String): List<BlueprintModelSearch> {
- return blueprintModelSearchRepository.
- findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
- keyWord,keyWord,keyWord,keyWord,keyWord)
+ return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
+ keyWord, keyWord, keyWord, keyWord, keyWord)
}
-
/**
* This is a searchBluePrintModelsByKeyWordPagebale method to retrieve specific BlueprintModel in Database
* where keyword equals updatedBy or tags or artifcat name or artifcat version or artifact type and pageable
@@ -257,11 +274,10 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService:
*
* @return List<BlueprintModelSearch> list of the controller blueprint
</BlueprintModelSearch> */
- open fun searchBluePrintModelsByKeyWordPaged(keyWord: String, pageRequest: PageRequest): Page<BlueprintModelSearch>
- {
- return blueprintModelSearchRepository.
- findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(keyWord,keyWord,keyWord,keyWord,keyWord,pageRequest)
+ open fun searchBluePrintModelsByKeyWordPaged(keyWord: String, pageRequest: PageRequest): Page<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(keyWord, keyWord, keyWord, keyWord, keyWord, pageRequest)
}
+
/**
* This is a deleteBlueprintModel method
*
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
index f30d156ef..31bd2c953 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
@@ -20,8 +20,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load
import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.slf4j.LoggerFactory
-import org.springframework.boot.context.event.ApplicationReadyEvent
-import org.springframework.context.event.EventListener
import org.springframework.stereotype.Service
@Service
@@ -32,52 +30,36 @@ open class BluePrintDatabaseLoadService(private val bluePrintLoadConfiguration:
private val log = LoggerFactory.getLogger(BluePrintDatabaseLoadService::class.java)
-
- @EventListener(ApplicationReadyEvent::class)
open fun init() = runBlocking {
- if (bluePrintLoadConfiguration.loadInitialData) {
- initModelTypes()
- initResourceDictionary()
- initBluePrintCatalog()
- } else {
- log.info("Initial data load is disabled")
- }
-
+ initModelTypes()
+ initResourceDictionary()
+ initBluePrintCatalog()
}
open suspend fun initModelTypes() {
- log.info("model types load configuration(${bluePrintLoadConfiguration.loadModelType}) " +
- "under paths(${bluePrintLoadConfiguration.loadModeTypePaths})")
+ log.info("model types load from paths(${bluePrintLoadConfiguration.loadModeTypePaths})")
- if (bluePrintLoadConfiguration.loadModelType) {
- val paths = bluePrintLoadConfiguration.loadModeTypePaths?.split(",")
- paths?.let {
- modelTypeLoadService.loadPathsModelType(paths)
- }
+ val paths = bluePrintLoadConfiguration.loadModeTypePaths?.split(",")
+ paths?.let {
+ modelTypeLoadService.loadPathsModelType(paths)
}
}
open suspend fun initResourceDictionary() {
- log.info("resource dictionary load configuration(${bluePrintLoadConfiguration.loadResourceDictionary}) " +
- "under paths(${bluePrintLoadConfiguration.loadResourceDictionaryPaths})")
+ log.info("resource dictionary load from paths(${bluePrintLoadConfiguration.loadResourceDictionaryPaths})")
- if (bluePrintLoadConfiguration.loadResourceDictionary) {
- val paths = bluePrintLoadConfiguration.loadResourceDictionaryPaths?.split(",")
- paths?.let {
- resourceDictionaryLoadService.loadPathsResourceDictionary(paths)
- }
+ val paths = bluePrintLoadConfiguration.loadResourceDictionaryPaths?.split(",")
+ paths?.let {
+ resourceDictionaryLoadService.loadPathsResourceDictionary(paths)
}
}
open suspend fun initBluePrintCatalog() {
- log.info("blueprint load configuration(${bluePrintLoadConfiguration.loadBluePrint}) " +
- "under paths(${bluePrintLoadConfiguration.loadBluePrintPaths})")
+ log.info("cba load from paths(${bluePrintLoadConfiguration.loadBluePrintPaths})")
- if (bluePrintLoadConfiguration.loadBluePrint) {
- val paths = bluePrintLoadConfiguration.loadBluePrintPaths?.split(",")
- paths?.let {
- bluePrintCatalogLoadService.loadPathsBluePrintModelCatalog(paths)
- }
+ val paths = bluePrintLoadConfiguration.loadBluePrintPaths?.split(",")
+ paths?.let {
+ bluePrintCatalogLoadService.loadPathsBluePrintModelCatalog(paths)
}
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
index 54dd46ef7..61f515017 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
@@ -68,6 +68,18 @@ class BluePrintManagementGRPCHandlerTest {
}
@Test
+ fun testBootstrap() {
+ val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
+ val id = "123_Bootstrap"
+ val req = createBootstrapInputRequest(id)
+ val bootstrapOutput = blockingStub.bootstrapBlueprint(req)
+ assertEquals(200, bootstrapOutput.status.code)
+ assertTrue(bootstrapOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status")
+ assertEquals(id, bootstrapOutput.commonHeader.requestId)
+ }
+
+ @Test
fun `test upload and download blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
val id = "123_upload"
@@ -128,6 +140,21 @@ class BluePrintManagementGRPCHandlerTest {
}
}
+ private fun createBootstrapInputRequest(id: String): BluePrintBootstrapInput {
+ val commonHeader = CommonHeader
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
+
+ return BluePrintBootstrapInput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setLoadModelType(false)
+ .setLoadResourceDictionary(false)
+ .setLoadCBA(false)
+ .build()
+ }
private fun createUploadInputRequest(id: String, action: String): BluePrintUploadInput {
val file = normalizedFile("./src/test/resources/test-cba.zip")
diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml
index 658e5c417..cf9d88885 100755
--- a/ms/blueprintsprocessor/pom.xml
+++ b/ms/blueprintsprocessor/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
<version>0.7.0-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
+ <relativePath>..</relativePath>
</parent>
<artifactId>blueprintsprocessor</artifactId>
diff --git a/ms/command-executor/src/main/python/command_executor_server.py b/ms/command-executor/src/main/python/command_executor_server.py
index 577c8a0ca..39cd1e6da 100644
--- a/ms/command-executor/src/main/python/command_executor_server.py
+++ b/ms/command-executor/src/main/python/command_executor_server.py
@@ -53,12 +53,12 @@ class CommandExecutorServer(CommandExecutor_pb2_grpc.CommandExecutorServiceServi
payload_result = {}
handler = CommandExecutorHandler(request)
payload_result = handler.execute_command(request, log_results)
- if not payload_result["cds_return_code"]:
+ if payload_result["cds_return_code"] != 0:
self.logger.info("{} - Failed to executeCommand. {}".format(blueprint_id, log_results))
else:
self.logger.info("{} - Execution finished successfully.".format(blueprint_id))
- ret = utils.build_response(request, log_results, payload_result, payload_result["cds_return_code"])
+ ret = utils.build_response(request, log_results, payload_result, payload_result["cds_return_code"] == 0)
self.logger.info("Payload returned %s" % payload_result)
return ret \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
index 9b25a5ac9..10b902f2b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
@@ -22,14 +22,8 @@ open class BluePrintLoadConfiguration {
lateinit var blueprintDeployPath: String
lateinit var blueprintArchivePath: String
lateinit var blueprintWorkingPath: String
-
- var loadInitialData: Boolean = false
- var loadBluePrint: Boolean = false
+
var loadBluePrintPaths: String? = null
-
- var loadModelType: Boolean = false
var loadModeTypePaths: String? = null
-
- var loadResourceDictionary: Boolean = false
var loadResourceDictionaryPaths: String? = null
} \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 856b6927d..d7580f0b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2019 Bell Canada
+Modification Copyright © 2018-2019 AT&T Intellectual Property.
Unless otherwise specified, all software contained herein is licensed
under the Apache License, Version 2.0 (the License);
@@ -40,6 +41,7 @@ limitations under the License.
<modules>
<module>ms</module>
<module>cds-ui</module>
+ <module>components</module>
</modules>
<properties>