Merge "Fix relativePath in ms/blueprintsprocessor/application"
authorKAPIL SINGAL <ks220y@att.com>
Thu, 21 Nov 2019 14:08:53 +0000 (14:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 21 Nov 2019 14:08:53 +0000 (14:08 +0000)
19 files changed:
components/model-catalog/blueprint-model/pom.xml [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/test-blueprint/capability_cli/pom.xml
components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/test-blueprint/pom.xml [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/remote_ansible/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/test-blueprint/resource-audit/pom.xml
components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/pnf_config.json [moved from components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Definitions/activation-blueprint.json with 98% similarity]
components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/pnf_config_aai.json [moved from components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Definitions/activation-blueprint.json with 98% similarity]
components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/TOSCA-Metadata/TOSCA.meta
components/model-catalog/blueprint-model/uat-blueprints/pnf_config_aai/Tests/uat.yaml
components/pom.xml [new file with mode: 0644]
ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
ms/command-executor/src/main/python/command_executor_server.py
pom.xml

diff --git a/components/model-catalog/blueprint-model/pom.xml b/components/model-catalog/blueprint-model/pom.xml
new file mode 100644 (file)
index 0000000..5b852d2
--- /dev/null
@@ -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.blueprintsprocessor</groupId>
+        <artifactId>cba-parent</artifactId>
+        <version>0.7.0-SNAPSHOT</version>
+    </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>
index 8f1df9f..854c20b 100644 (file)
@@ -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
 
index c714496..ea76d50 100644 (file)
@@ -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.
     <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>
index 9066e48..8aad13c 100755 (executable)
@@ -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
index b8f3a20..f85c611 100644 (file)
@@ -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 (file)
index 0000000..f9dab02
--- /dev/null
@@ -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>
index 17448a8..efaeabf 100644 (file)
@@ -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
index 2c3a91f..2e3ed2c 100644 (file)
@@ -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
index 527e2b6..5f6c49e 100644 (file)
@@ -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.
   -->
 <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>
@@ -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"
   },
index ca06373..096bd7d 100644 (file)
@@ -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
index 518bbe0..85b10c6 100644 (file)
@@ -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:
@@ -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"
   },
index 21f4318..9036008 100644 (file)
@@ -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
index 1a5995e..0692eea 100644 (file)
@@ -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/pom.xml b/components/pom.xml
new file mode 100644 (file)
index 0000000..fd19a4f
--- /dev/null
@@ -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>
index 6b1f186..91d5175 100644 (file)
@@ -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())
     }
 }
index 577c8a0..39cd1e6 100644 (file)
@@ -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/pom.xml b/pom.xml
index 856b692..d7580f0 100644 (file)
--- 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>