Add Jython Component model and validation logics.
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Tue, 20 Nov 2018 17:20:30 +0000 (12:20 -0500)
committerDan Timoney <dtimoney@att.com>
Fri, 30 Nov 2018 20:22:00 +0000 (20:22 +0000)
Change-Id: I2bdba0016a41e16198d60be68dff68d1ce7ad13a
Issue-ID: CCSDK-696
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
16 files changed:
components/core/load/model_type/node_type/component-resource-assignment.json
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json [new file with mode: 0644]
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json [new file with mode: 0644]
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json [moved from components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json with 56% similarity]
components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json [new file with mode: 0644]
components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json
components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json
components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json [new file with mode: 0644]
components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json
components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json [new file with mode: 0644]

index 1389bc3..2a90356 100644 (file)
@@ -7,7 +7,7 @@
     }\r
   },\r
   "interfaces": {\r
-    "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
+    "ResourceAssignmentComponent": {\r
       "operations": {\r
         "process": {\r
           "inputs": {\r
index 84d2bef..a412841 100644 (file)
@@ -93,6 +93,7 @@ object BluePrintConstants {
     const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle"\r
     const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"\r
     const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"\r
+    const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython"\r
     const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"\r
 \r
     const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation"\r
index a971898..64797ed 100644 (file)
@@ -37,6 +37,7 @@ object BluePrintTypes {
             BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,\r
             BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,\r
             BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,\r
+            BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,\r
             BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT\r
     )\r
 \r
index 19c6c2f..2f51980 100644 (file)
@@ -69,7 +69,7 @@ class BluePrintRuntimeServiceTest {
                 "data/default-context.json", executionContext)\r
 \r
         val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",\r
-                "DefaultComponentNode", "process")\r
+                "ResourceAssignmentComponent", "process")\r
 \r
         assertNotNull(inContext, "Failed to populate interface input property values")\r
         assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")\r
@@ -86,14 +86,14 @@ class BluePrintRuntimeServiceTest {
         bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance())\r
 \r
         bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",\r
-                "DefaultComponentNode", "process")\r
+                "ResourceAssignmentComponent", "process")\r
 \r
         val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",\r
-                "DefaultComponentNode", "process", "status")\r
+                "ResourceAssignmentComponent", "process", "status")\r
         assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status")\r
 \r
         val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",\r
-                "DefaultComponentNode", "process", "resource-assignment-params")\r
+                "ResourceAssignmentComponent", "process", "resource-assignment-params")\r
         assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params")\r
 \r
     }\r
index d5416c0..1137c1d 100644 (file)
@@ -40,7 +40,7 @@
       "resource-assignment-ra-component": {
         "type": "component-resource-assignment",
         "interfaces": {
-          "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
+          "ResourceAssignmentComponent": {
             "operations": {
               "process": {
                 "inputs": {
         }
       },
       "interfaces": {
-        "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
+        "ResourceAssignmentComponent": {
           "operations": {
             "process": {
               "inputs": {
index e067a7d..269fd0c 100644 (file)
@@ -9,7 +9,13 @@
   },
   "imports": [
     {
-      "file": "Definitions/types.json"
+      "file": "Definitions/data-types.json"
+    },
+    {
+      "file": "Definitions/node-types.json"
+    },
+    {
+      "file": "Definitions/artifact-types.json"
     }
   ],
   "topology_template": {
@@ -64,7 +70,7 @@
           "request-id": "1234"
         },
         "interfaces": {
-          "DefaultComponentNode": {
+          "ResourceAssignmentComponent": {
             "operations": {
               "process": {
                 "inputs": {
           "request-id": "1234"
         },
         "interfaces": {
-          "DefaultComponentNode": {
+          "ResourceAssignmentComponent": {
             "operations": {
               "process": {
                 "implementation": {
         },
         "artifacts": {
           "component-script": {
-            "type": "artifact-script-python",
+            "type": "artifact-script-jython",
+            "file": "Scripts/SamplePythonComponentNode.py"
+          }
+        }
+      },
+      "activate-jython": {
+        "type": "component-jython-executor",
+        "interfaces": {
+          "JythonExecutorComponent": {
+            "operations": {
+              "process": {
+                "implementation": {
+                  "primary": "component-script"
+                },
+                "outputs": {
+                  "response-data": "",
+                  "status": ""
+                }
+              }
+            }
+          }
+        },
+        "artifacts": {
+          "component-script": {
+            "type": "artifact-script-jython",
             "file": "Scripts/SamplePythonComponentNode.py"
           }
         }
             "target": "resource-assignment",
             "activities": [
               {
-                "call_operation": "ResourceAssignmentNode.process"
+                "call_operation": "ResourceAssignmentComponent.process"
               }
             ]
           }
             "target": "resource-assignment",
             "activities": [
               {
-                "call_operation": "ResourceAssignmentNode.process"
+                "call_operation": "ResourceAssignmentComponent.process"
               }
             ]
           }
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json
new file mode 100644 (file)
index 0000000..d741d15
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "artifact_types": {
+    "artifact-template-velocity": {
+      "description": "Velocity Template used for Configuration",
+      "version": "1.0.0",
+      "file_ext": [
+        "vtl"
+      ],
+      "derived_from": "tosca.artifacts.Implementation"
+    },
+    "artifact-mapping-resource": {
+      "description": "Velocity Template Resource Mapping File used along with Configuration template",
+      "version": "1.0.0",
+      "file_ext": [
+        "json"
+      ],
+      "derived_from": "tosca.artifacts.Implementation"
+    },
+    "artifact-script-jython": {
+      "description": "Jython Script File",
+      "version": "1.0.0",
+      "file_ext": [
+        "py"
+      ],
+      "derived_from": "tosca.artifacts.Implementation"
+    },
+    "artifact-directed-graph": {
+      "description": "Directed Graph File",
+      "version": "1.0.0",
+      "file_ext": [
+        "json",
+        "xml"
+      ],
+      "derived_from": "tosca.artifacts.Implementation"
+    },
+    "artifact-component-jar": {
+      "description": "Component Jar",
+      "version": "1.0.0",
+      "file_ext": [
+        "jar"
+      ],
+      "derived_from": "tosca.artifacts.Implementation"
+    }
+  }
+}
\ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json
new file mode 100644 (file)
index 0000000..6ca1ffd
--- /dev/null
@@ -0,0 +1,24 @@
+{
+  "data_types": {
+    "sample-property": {
+      "description": "This is sample data type",
+      "version": "1.0.0",
+      "properties": {
+        "content": {
+          "required": false,
+          "type": "string"
+        },
+        "process-name": {
+          "required": false,
+          "type": "string"
+        },
+        "version": {
+          "required": false,
+          "type": "string",
+          "default": "LATEST"
+        }
+      },
+      "derived_from": "tosca.datatypes.Root"
+    }
+  }
+}
\ No newline at end of file
@@ -1,55 +1,4 @@
 {
-  "artifact_types": {
-    "artifact-template-velocity": {
-      "description": " Velocity Template used for Configuration",
-      "version": "1.0.0",
-      "file_ext": [
-        "vtl"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    },
-    "artifact-mapping-resource": {
-      "description": " Velocity Template Resource Mapping File used along with Configuration template",
-      "version": "1.0.0",
-      "file_ext": [
-        "json"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    },
-    "artifact-script-kotlin": {
-      "description": " Kotlin Script Template used for Configuration",
-      "version": "1.0.0",
-      "file_ext": [
-        "kt"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    },
-    "artifact-script-python": {
-      "description": " Kotlin Script Template used for Configuration",
-      "version": "1.0.0",
-      "file_ext": [
-        "py"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    },
-    "artifact-directed-graph": {
-      "description": "Directed Graph File",
-      "version": "1.0.0",
-      "file_ext": [
-        "json",
-        "xml"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    },
-    "artifact-component-jar": {
-      "description": "Component Jar",
-      "version": "1.0.0",
-      "file_ext": [
-        "jar"
-      ],
-      "derived_from": "tosca.artifacts.Implementation"
-    }
-  },
   "node_types": {
     "dg-activate": {
       "description": "This is BPMN Activate node type",
@@ -81,8 +30,8 @@
       "version": "1.0.0",
       "derived_from": "tosca.nodes.Root"
     },
-    "tosca.nodes.component.Python": {
-      "description": "This is Resource Assignment Python Component API",
+    "tosca.nodes.component.Jython": {
+      "description": "This is Resource Assignment Jython Component API",
       "version": "1.0.0",
       "derived_from": "tosca.nodes.Root"
     },
@@ -97,7 +46,7 @@
         }
       },
       "interfaces": {
-        "DefaultComponentNode": {
+        "ResourceAssignmentComponent": {
           "operations": {
             "process": {
               "inputs": {
       },
       "derived_from": "tosca.nodes.Component"
     },
-    "component-resource-assignment-python": {
-      "description": "This is Resource Assignment Component API",
+    "component-jython-executor": {
+      "description": "This is Jython Execution Component.",
       "version": "1.0.0",
-      "properties": {
-        "request-id": {
-          "description": "Request Id used to store the generated configuration, in the database along with the template-name",
-          "required": true,
-          "type": "string"
+      "capabilities": {
+        "component-node": {
+          "type": "tosca.capabilities.Node"
         }
       },
       "interfaces": {
-        "DefaultComponentNode": {
+        "JythonExecutorComponent": {
           "operations": {
             "process": {
-              "inputs": {
-                "action-name": {
-                  "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
-                  "required": false,
-                  "type": "string"
-                }
-              },
               "outputs": {
-                "resource-assignment-params": {
-                  "required": true,
+                "response-data": {
+                  "description": "Execution Response Data in JSON format.",
+                  "required": false,
                   "type": "string"
                 },
                 "status": {
+                  "description": "Status of the Component Execution ( success or failure )",
                   "required": true,
                   "type": "string"
                 }
           }
         }
       },
-      "derived_from": "tosca.nodes.component.Python"
-    }
-  },
-  "data_types": {
-    "sample-property": {
-      "description": "This is sample data type",
-      "version": "1.0.0",
-      "properties": {
-        "content": {
-          "required": false,
-          "type": "string"
-        },
-        "process-name": {
-          "required": false,
-          "type": "string"
-        },
-        "version": {
-          "required": false,
-          "type": "string",
-          "default": "LATEST"
-        }
-      },
-      "derived_from": "tosca.datatypes.Root"
+      "derived_from": "tosca.nodes.component.Jython"
     }
   }
 }
\ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json
new file mode 100644 (file)
index 0000000..969662a
--- /dev/null
@@ -0,0 +1,8 @@
+{\r
+  "description": "Jython Script File",\r
+  "version": "1.0.0",\r
+  "file_ext": [\r
+    "py"\r
+  ],\r
+  "derived_from": "tosca.artifacts.Implementation"\r
+}
\ No newline at end of file
index 764f9e8..ba14260 100644 (file)
@@ -7,7 +7,7 @@
                }\r
        },\r
        "interfaces": {\r
-               "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {\r
+               "ConfigGeneratorComponent": {\r
                        "operations": {\r
                                "process": {\r
                                        "inputs": {\r
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json
new file mode 100644 (file)
index 0000000..4959a9d
--- /dev/null
@@ -0,0 +1,40 @@
+{
+  "description": "This is Jython Execution Component.",
+  "version": "1.0.0",
+  "capabilities": {
+    "component-node": {
+      "type": "tosca.capabilities.Node"
+    }
+  },
+  "interfaces": {
+    "JythonExecutorComponent": {
+      "operations": {
+        "process": {
+          "inputs": {
+            "instance-dependencies": {
+              "required": true,
+              "description": "Instance Names to Inject to Jython Script.",
+              "type": "list",
+              "entry_schema": {
+                "type": "string"
+              }
+            }
+          },
+          "outputs": {
+            "response-data": {
+              "description": "Execution Response Data in JSON format.",
+              "required": false,
+              "type": "string"
+            },
+            "status": {
+              "description": "Status of the Component Execution ( success or failure )",
+              "required": true,
+              "type": "string"
+            }
+          }
+        }
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.component.Jython"
+}
\ No newline at end of file
index 240caf3..7e1d813 100644 (file)
@@ -14,7 +14,7 @@
     }\r
   },\r
   "interfaces": {\r
-    "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {\r
+    "NetconfExecutorComponent": {\r
       "operations": {\r
         "process": {\r
           "inputs": {\r
@@ -75,5 +75,5 @@
       }\r
     }\r
   },\r
-  "derived_from": "tosca.nodes.Component"\r
+  "derived_from": "tosca.nodes.component.Jython"\r
 }
\ No newline at end of file
index d424a8e..a29a875 100644 (file)
@@ -7,7 +7,7 @@
     }\r
   },\r
   "interfaces": {\r
-    "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
+    "ResourceAssignmentComponent": {\r
       "operations": {\r
         "process": {\r
           "inputs": {\r
diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json
new file mode 100644 (file)
index 0000000..8e194f6
--- /dev/null
@@ -0,0 +1,5 @@
+{\r
+  "description": "This is Jython Component",\r
+  "version": "1.0.0",\r
+  "derived_from": "tosca.nodes.Root"\r
+}
\ No newline at end of file