summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt120
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json23
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml7
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml3
-rwxr-xr-xms/command-executor/pom.xml3
-rw-r--r--ms/controllerblueprints/modules/pom.xml3
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml3
-rw-r--r--ms/pom.xml3
-rwxr-xr-xms/sdclistener/parent/pom.xml3
9 files changed, 150 insertions, 18 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 0c5a947f1..896d9a648 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -17,14 +17,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.junit.Test
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.PrepareRemoteEnvInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionOutput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StatusType
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement
+import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import kotlin.test.assertEquals
@@ -58,7 +66,117 @@ class ComponentRemotePythonExecutorTest {
executionServiceInput.stepData = stepInputData
componentRemotePythonExecutor.applyNB(executionServiceInput)
}
+ }
+
+ /**
+ * Test cases for python executor to work with the process NB of remote
+ * executor.
+ */
+ @Test
+ fun testComponentRemotePythonExecutorProcessNB() {
+ runBlocking {
+ val remoteScriptExecutionService =
+ MockRemoteScriptExecutionService()
+ val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
+ remoteScriptExecutionService)
+ val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>(
+ "123456-1000")
+ val input = getMockedOutput(bluePrintRuntime)
+ componentRemotePythonExecutor.bluePrintRuntimeService =
+ bluePrintRuntime
+ componentRemotePythonExecutor.applyNB(input)
+ }
+ }
+
+ /**
+ * Mocked input information for remote python executor.
+ */
+ fun getMockedOutput(svc: DefaultBluePrintRuntimeService):
+ ExecutionServiceInput {
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
+
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ operationalInputs.putJsonElement("endpoint-selector", "aai")
+ operationalInputs.putJsonElement("dynamic-properties", rootNode)
+ operationalInputs.putJsonElement("command", "./run.sh")
+ operationalInputs.putJsonElement("packages", "py")
+
+ every {
+ svc.resolveNodeTemplateInterfaceOperationInputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
+ } returns operationalInputs
+
+ val stepInputData = StepData().apply {
+ name = "execute-remote-python"
+ properties = stepMetaData
+ }
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java)!!
+ executionServiceInput.stepData = stepInputData
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ svc.resolveNodeTemplateInterfaceOperationOutputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
+ } returns operationOutputs
+ val bluePrintRuntimeService = BluePrintMetadataUtils
+ .getBluePrintRuntime("123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts")
+ every {
+ svc.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script")
+ } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script")
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive())
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive())
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive())
+ } returns Unit
+
+ every {
+ svc.bluePrintContext()
+ } returns bluePrintRuntimeService.bluePrintContext()
+ return executionServiceInput
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json
new file mode 100644
index 000000000..68a366432
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json
@@ -0,0 +1,23 @@
+{
+ "actionIdentifiers": {
+ "actionName": "activate",
+ "blueprintName": "remote_scripts",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ "execute-remote-python": {
+ "input": "1234"
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
index e50b1915f..623571dd3 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
@@ -14,10 +14,7 @@
~ 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">
+<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">
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
@@ -45,4 +42,4 @@
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index 42abbc51d..e3eda7d7b 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -16,8 +16,7 @@
~ 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">
+<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>
diff --git a/ms/command-executor/pom.xml b/ms/command-executor/pom.xml
index 7376d7746..d88664f07 100755
--- a/ms/command-executor/pom.xml
+++ b/ms/command-executor/pom.xml
@@ -14,8 +14,7 @@
~ 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">
+<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>
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index c4d1b1d37..88890d6e7 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -15,8 +15,7 @@
~ 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">
+<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.controllerblueprints</groupId>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 40a5c259d..dca163ef8 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -18,8 +18,7 @@
~ 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">
+<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.controllerblueprints</groupId>
diff --git a/ms/pom.xml b/ms/pom.xml
index b97ebc03f..e4692d083 100644
--- a/ms/pom.xml
+++ b/ms/pom.xml
@@ -14,8 +14,7 @@
* 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">
+<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>
diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml
index fabdc2530..c480be0c3 100755
--- a/ms/sdclistener/parent/pom.xml
+++ b/ms/sdclistener/parent/pom.xml
@@ -16,8 +16,7 @@
~ 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">
+<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>