Aligned attributes of CDS components
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / python-executor / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / python / executor / ComponentRemotePythonExecutorDSL.kt
index 3df25c4..7f9f2b1 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
 
 import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.node.ArrayNode
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
@@ -53,6 +54,10 @@ fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType {
             ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
             false
         )
+        attribute(
+            ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+            true
+        )
 
         operation("ComponentRemotePythonExecutor", "ComponentRemotePythonExecutor Operation") {
             inputs {
@@ -84,6 +89,16 @@ fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType {
                     entrySchema("dt-system-packages")
                 }
             }
+            outputs {
+                property(
+                    ComponentRemotePythonExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
+                    false, "Output Response"
+                )
+                property(
+                    ComponentRemotePythonExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+                    true, "Status of the Component Execution ( success or failure )"
+                )
+            }
         }
     }
 }
@@ -184,5 +199,18 @@ class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description:
         }
     }
 
-    class OutputsBuilder : PropertiesAssignmentBuilder()
+    class OutputsBuilder : PropertiesAssignmentBuilder() {
+
+        fun status(status: String) = status(status.asJsonPrimitive())
+
+        fun status(status: JsonNode) {
+            property(ComponentScriptExecutor.OUTPUT_STATUS, status)
+        }
+
+        fun responseData(responseData: String) = responseData(responseData.asJsonType())
+
+        fun responseData(responseData: JsonNode) {
+            property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData)
+        }
+    }
 }