aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-12 16:49:54 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-13 09:31:17 -0400
commit64a168d7d9a86e5cbdf4e01718066e93ca0592da (patch)
treede0e0fb077ec73e235c83b40b8e1d4151db0c242
parent75607716182fe6b0dbf333bdfe1271a6398e827a (diff)
Add intial test CBA
Change-Id: If7c18e8ad472cebc3e36858fcb0cdf4c7ef6d52d Issue-ID: CCSDK-1149 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json333
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json22
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json106
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json413
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json9
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json148
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml15
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml22
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml15
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/README134
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py46
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py61
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py47
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py0
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta6
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json13
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl7
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json1
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json64
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl4
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json88
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl18
-rw-r--r--components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json15
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json29
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json30
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/hostname.json14
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/interface-description.json21
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/interface-name.json15
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json16
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/unit-number.json14
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json16
-rw-r--r--components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json27
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt17
35 files changed, 1792 insertions, 0 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json
new file mode 100644
index 00000000..b6464f3c
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json
@@ -0,0 +1,333 @@
+{
+ "tosca_definitions_version" : "controller_blueprint_1_0_0",
+ "metadata" : {
+ "template_author" : "Alexis de Talhouët",
+ "author-email" : "adetalhouet89@gmail.com",
+ "user-groups" : "ADMIN, OPERATION",
+ "template_name" : "test",
+ "template_version" : "1.0.0",
+ "template_tags" : "test"
+ },
+ "imports" : [ {
+ "file" : "Definitions/data_types.json"
+ }, {
+ "file" : "Definitions/relationship_types.json"
+ }, {
+ "file" : "Definitions/artifact_types.json"
+ }, {
+ "file" : "Definitions/node_types.json"
+ }, {
+ "file" : "Definitions/policy_types.json"
+ } ],
+ "dsl_definitions" : {
+ "ipam-1" : {
+ "type" : "token-auth",
+ "url" : "http://localhost:32778",
+ "token" : "Token 0123456789abcdef0123456789abcdef01234567"
+ },
+ "config-deploy-properties" : {
+ "resolution-key" : {
+ "get_input" : "resolution-key"
+ }
+ }
+ },
+ "topology_template" : {
+ "workflows" : {
+ "resource-assignment" : {
+ "steps" : {
+ "resource-assignment-process" : {
+ "description" : "Resource Assign Workflow",
+ "target" : "resource-assignment-process",
+ "activities" : [ {
+ "call_operation" : ""
+ } ]
+ }
+ },
+ "inputs" : {
+ "artifact-name" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "store-result" : {
+ "required" : true,
+ "type" : "boolean"
+ },
+ "resolution-key" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-assignment-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(resource-assignment).",
+ "required" : true,
+ "type" : "dt-resource-assignment-properties"
+ }
+ }
+ },
+ "config-deploy" : {
+ "steps" : {
+ "config-deploy" : {
+ "description" : "Resource Assign and Python Netconf Activation Workflow",
+ "target" : "config-deploy-process",
+ "activities" : [ {
+ "call_operation" : ""
+ } ]
+ }
+ },
+ "inputs" : {
+ "resolution-key" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "password" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "username" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "ip" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "config-deploy-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(config-deploy).",
+ "required" : true,
+ "type" : "dt-config-deploy-properties"
+ }
+ }
+ },
+ "rollback" : {
+ "steps" : {
+ "rollback" : {
+ "description" : "Roolback Workflow",
+ "target" : "rollback-process",
+ "activities" : [ {
+ "call_operation" : ""
+ } ]
+ }
+ },
+ "inputs" : {
+ "resolution-key" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "password" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "username" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "ip" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "config-deploy-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(config-deploy).",
+ "required" : true,
+ "type" : "dt-config-deploy-properties"
+ },
+ "rollback-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(rollback).",
+ "required" : true,
+ "type" : "dt-rollback-properties"
+ }
+ }
+ }
+ },
+ "node_templates" : {
+ "resource-assignment-process" : {
+ "type" : "dg-generic",
+ "properties" : {
+ "content" : {
+ "get_artifact" : [ "SELF", "dg-resource-assignment-process" ]
+ },
+ "dependency-node-templates" : [ "resource-assignment" ]
+ },
+ "artifacts" : {
+ "dg-resource-assignment-process" : {
+ "type" : "artifact-directed-graph",
+ "file" : "Plans/ResourceAssignment.xml"
+ }
+ }
+ },
+ "resource-assignment" : {
+ "type" : "component-resource-resolution",
+ "interfaces" : {
+ "ResourceResolutionComponent" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "resolution-key" : {
+ "get_input" : "resolution-key"
+ },
+ "store-result" : {
+ "get_input" : "store-result"
+ },
+ "artifact-prefix-names" : {
+ "get_input" : "artifact-name"
+ }
+ },
+ "outputs" : {
+ "resource-assignment-params" : {
+ "get_attribute" : [ "SELF", "assignment-params" ]
+ },
+ "status" : "success"
+ }
+ }
+ }
+ }
+ },
+ "artifacts" : {
+ "hostname-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/hostname-template.vtl"
+ },
+ "hostname-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Templates/hostname-mapping.json"
+ },
+ "vf-module-1-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/vf-module-1-template.vtl"
+ },
+ "vf-module-1-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Templates/vf-module-1-mapping.json"
+ }
+ }
+ },
+ "config-deploy-process" : {
+ "type" : "dg-generic",
+ "properties" : {
+ "content" : {
+ "get_artifact" : [ "SELF", "dg-config-deploy-process" ]
+ },
+ "dependency-node-templates" : [ "config-deploy" ]
+ },
+ "artifacts" : {
+ "dg-config-deploy-process" : {
+ "type" : "artifact-directed-graph",
+ "file" : "Plans/ConfigDeploy.xml"
+ }
+ }
+ },
+ "config-deploy" : {
+ "type" : "component-netconf-executor",
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "ComponentNetconfExecutor" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "script-type" : "jython",
+ "script-class-reference" : "Scripts/python/NetconfRpcExample.py",
+ "instance-dependencies" : [ ],
+ "dynamic-properties" : "*config-deploy-properties"
+ },
+ "outputs" : {
+ "response-data" : "",
+ "status" : "SUCCESS"
+ }
+ }
+ }
+ }
+ },
+ "artifacts" : {
+ "vfw-interface-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/vfw-interface-template.vtl"
+ },
+ "vfw-interface-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Templates/vfw-interface-mapping.json"
+ }
+ }
+ },
+ "rollback-process" : {
+ "type" : "dg-generic",
+ "properties" : {
+ "content" : {
+ "get_artifact" : [ "SELF", "dg-rollback-process" ]
+ },
+ "dependency-node-templates" : [ "config-deploy" ]
+ },
+ "artifacts" : {
+ "dg-rollback-process" : {
+ "type" : "artifact-directed-graph",
+ "file" : "Plans/Rollback.xml"
+ }
+ }
+ },
+ "rollback" : {
+ "type" : "component-netconf-executor",
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "ComponentNetconfExecutor" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "script-type" : "jython",
+ "script-class-reference" : "Scripts/python/Rollback.py",
+ "instance-dependencies" : [ ],
+ "dynamic-properties" : "*config-deploy-properties"
+ },
+ "outputs" : {
+ "response-data" : "",
+ "status" : "SUCCESS"
+ }
+ }
+ }
+ }
+ },
+ "artifacts" : {
+ "junos-rollback-RPC-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/junos-rollback-RPC-template.vtl"
+ },
+ "junos-rollback-RPC-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Templates/junos-rollback-RPC-mapping.json"
+ }
+ }
+ },
+ "netconf-device" : {
+ "type" : "vnf-netconf-device",
+ "capabilities" : {
+ "netconf" : {
+ "properties" : {
+ "login-key" : {
+ "get_input" : "password"
+ },
+ "login-account" : {
+ "get_input" : "username"
+ },
+ "target-ip-address" : {
+ "get_input" : "ip"
+ },
+ "port-number" : 830,
+ "connection-time-out" : 5
+ }
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json
new file mode 100644
index 00000000..6ec3b410
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json
@@ -0,0 +1,22 @@
+{
+ "artifact_types" : {
+ "artifact-directed-graph" : {
+ "description" : "Directed Graph File",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.artifacts.Implementation",
+ "file_ext" : [ "json", "xml" ]
+ },
+ "artifact-mapping-resource" : {
+ "description" : "Resource Mapping File used along with Configuration template",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.artifacts.Implementation",
+ "file_ext" : [ "json" ]
+ },
+ "artifact-template-velocity" : {
+ "description" : " Velocity Template used for Configuration",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.artifacts.Implementation",
+ "file_ext" : [ "vtl" ]
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json
new file mode 100644
index 00000000..d60e6f00
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json
@@ -0,0 +1,106 @@
+{
+ "data_types" : {
+ "dt-config-deploy-properties" : {
+ "description" : "Dynamic DataType definition for workflow(config-deploy).",
+ "version" : "1.0.0",
+ "properties" : {
+ "vfw_interface_ip" : {
+ "type" : "dt-netbox-ip"
+ },
+ "interface-name" : {
+ "type" : "string"
+ },
+ "interface-description" : {
+ "type" : "string"
+ },
+ "unit-number" : {
+ "type" : "string"
+ },
+ "prefix-id" : {
+ "type" : "string",
+ "default" : "11"
+ },
+ "vf-module-type" : {
+ "type" : "string"
+ },
+ "vf-module-number" : {
+ "type" : "string",
+ "default" : "3"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ },
+ "dt-netbox-ip" : {
+ "description" : "This is Netbox IP Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "id" : {
+ "required" : true,
+ "type" : "integer"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "dt-resource-assignment-properties" : {
+ "description" : "Dynamic DataType definition for workflow(resource-assignment).",
+ "version" : "1.0.0",
+ "properties" : {
+ "hostname" : {
+ "type" : "string"
+ },
+ "vfw_interface_ip" : {
+ "type" : "dt-netbox-ip"
+ },
+ "interface-description" : {
+ "type" : "string"
+ },
+ "vf-module-type" : {
+ "type" : "string"
+ },
+ "vf-module-number" : {
+ "type" : "string",
+ "default" : "3"
+ },
+ "prefix-id" : {
+ "type" : "integer",
+ "default" : 11
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ },
+ "dt-rollback-properties" : {
+ "description" : "Dynamic DataType definition for workflow(rollback).",
+ "version" : "1.0.0",
+ "properties" : {
+ "vfw_interface_ip" : {
+ "type" : "dt-netbox-ip"
+ },
+ "interface-name" : {
+ "type" : "string"
+ },
+ "interface-description" : {
+ "type" : "string"
+ },
+ "unit-number" : {
+ "type" : "string"
+ },
+ "prefix-id" : {
+ "type" : "string",
+ "default" : "11"
+ },
+ "vf-module-type" : {
+ "type" : "string"
+ },
+ "vf-module-number" : {
+ "type" : "string",
+ "default" : "3"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json
new file mode 100644
index 00000000..b0586921
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json
@@ -0,0 +1,413 @@
+{
+ "node_types" : {
+ "component-netconf-executor" : {
+ "description" : "This is Netconf Transaction Configuration Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vnf-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "ComponentNetconfExecutor" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "script-type" : {
+ "description" : "Script type, kotlin type is supported",
+ "required" : true,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "kotlin", "jython", "internal" ]
+ } ],
+ "default" : "internal"
+ },
+ "dynamic-properties" : {
+ "description" : "Dynamic Json Content or DSL Json reference.",
+ "required" : false,
+ "type" : "json"
+ },
+ "script-class-reference" : {
+ "description" : "Kotlin Script class name or jython script name.",
+ "required" : true,
+ "type" : "string"
+ },
+ "instance-dependencies" : {
+ "description" : "Instance names to inject to Jython or Kotlin Script.",
+ "required" : true,
+ "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"
+ },
+ "component-resource-resolution" : {
+ "description" : "This is Resource Assignment Component API",
+ "version" : "1.0.0",
+ "attributes" : {
+ "assignment-params" : {
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "interfaces" : {
+ "ResourceResolutionComponent" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "resolution-key" : {
+ "description" : "Key for service instance related correlation.",
+ "required" : false,
+ "type" : "string"
+ },
+ "store-result" : {
+ "description" : "Whether or not to store the output.",
+ "required" : false,
+ "type" : "boolean"
+ },
+ "resource-type" : {
+ "description" : "Request type.",
+ "required" : false,
+ "type" : "string"
+ },
+ "artifact-prefix-names" : {
+ "description" : "Template , Resource Assignment Artifact Prefix names",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "request-id" : {
+ "description" : "Request Id, Unique Id for the request.",
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-id" : {
+ "description" : "Resource Id.",
+ "required" : false,
+ "type" : "string"
+ },
+ "action-name" : {
+ "description" : "Action Name of the process",
+ "required" : false,
+ "type" : "string"
+ },
+ "dynamic-properties" : {
+ "description" : "Dynamic Json Content or DSL Json reference.",
+ "required" : false,
+ "type" : "json"
+ }
+ },
+ "outputs" : {
+ "resource-assignment-params" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "status" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Component"
+ },
+ "dg-generic" : {
+ "description" : "This is Generic Directed Graph Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "content" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dependency-node-templates" : {
+ "description" : "Dependent Step Components NodeTemplate name.",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.DG"
+ },
+ "source-capability" : {
+ "description" : "This is Component Resource Source Node Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "script-type" : {
+ "required" : true,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "kotlin", "internal", "jython" ]
+ } ],
+ "default" : "kotlin"
+ },
+ "script-class-reference" : {
+ "description" : "Capability reference name for internal and kotlin, for jython script file path",
+ "required" : true,
+ "type" : "string"
+ },
+ "instance-dependencies" : {
+ "description" : "Instance dependency Names to Inject to Kotlin / Jython Script.",
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "key-dependencies" : {
+ "description" : "Resource Resolution dependency dictionary names.",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.ResourceSource"
+ },
+ "source-default" : {
+ "description" : "This is Default Resource Source Node Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "key" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "key-dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.ResourceSource"
+ },
+ "source-input" : {
+ "description" : "This is Input Resource Source Node Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "key" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "key-dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.ResourceSource"
+ },
+ "source-primary-db" : {
+ "description" : "This is Database Resource Source Node Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "type" : {
+ "required" : true,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "SQL", "PLSQL" ]
+ } ]
+ },
+ "endpoint-selector" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "query" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "input-key-mapping" : {
+ "required" : false,
+ "type" : "map",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "output-key-mapping" : {
+ "required" : false,
+ "type" : "map",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "key-dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.ResourceSource"
+ },
+ "source-rest" : {
+ "description" : "This is Rest Resource Source Node Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "type" : {
+ "required" : false,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "JSON" ]
+ } ],
+ "default" : "JSON"
+ },
+ "verb" : {
+ "required" : false,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "GET", "POST", "DELETE", "PUT" ]
+ } ],
+ "default" : "GET"
+ },
+ "payload" : {
+ "required" : false,
+ "type" : "string",
+ "default" : ""
+ },
+ "endpoint-selector" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "url-path" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "path" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "expression-type" : {
+ "required" : false,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "JSON_PATH", "JSON_POINTER" ]
+ } ],
+ "default" : "JSON_PATH"
+ },
+ "input-key-mapping" : {
+ "required" : false,
+ "type" : "map",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "output-key-mapping" : {
+ "required" : false,
+ "type" : "map",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "key-dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.ResourceSource"
+ },
+ "tosca.nodes.Component" : {
+ "description" : "This is default Component Node",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.DG" : {
+ "description" : "This is Directed Graph Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.ResourceSource" : {
+ "description" : "TOSCA base type for Resource Sources",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.Vnf" : {
+ "description" : "This is VNF Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "vnf-netconf-device" : {
+ "description" : "This is VNF Device with Netconf Capability",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "netconf" : {
+ "type" : "tosca.capabilities.Netconf",
+ "properties" : {
+ "login-key" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc"
+ },
+ "login-account" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc-tacacs"
+ },
+ "source" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "npm"
+ },
+ "target-ip-address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "port-number" : {
+ "required" : true,
+ "type" : "integer",
+ "default" : 830
+ },
+ "connection-time-out" : {
+ "required" : false,
+ "type" : "integer",
+ "default" : 30
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Vnf"
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json
new file mode 100644
index 00000000..1e44cc70
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json
@@ -0,0 +1,3 @@
+{
+ "policy_types" : { }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json
new file mode 100644
index 00000000..027bfc0f
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json
@@ -0,0 +1,9 @@
+{
+ "relationship_types" : {
+ "tosca.relationships.ConnectsTo" : {
+ "description" : "Relationship tosca.relationships.ConnectsTo",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.relationships.Root"
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json
new file mode 100644
index 00000000..446a8a68
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json
@@ -0,0 +1,148 @@
+{
+ "create_netbox_ip" : {
+ "tags" : "oam-local-ipv4-address",
+ "name" : "create_netbox_ip",
+ "property" : {
+ "description" : "netbox ip",
+ "type" : "dt-netbox-ip"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "primary-config-data" : {
+ "type" : "source-rest",
+ "properties" : {
+ "type" : "JSON",
+ "verb" : "POST",
+ "endpoint-selector" : "ipam-1",
+ "url-path" : "/api/ipam/prefixes/$prefix-id/available-ips/",
+ "path" : "",
+ "input-key-mapping" : {
+ "prefix-id" : "prefix-id"
+ },
+ "output-key-mapping" : {
+ "address" : "address",
+ "id" : "id"
+ },
+ "key-dependencies" : [ "prefix-id" ]
+ }
+ }
+ }
+ },
+ "hostname" : {
+ "tags" : "hostname",
+ "name" : "hostname",
+ "property" : {
+ "description" : "hostname",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "input" : {
+ "type" : "source-input"
+ }
+ }
+ },
+ "interface-description" : {
+ "tags" : "interface-description",
+ "name" : "interface-description",
+ "property" : {
+ "description" : "interface-description",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "capability" : {
+ "type" : "source-capability",
+ "properties" : {
+ "script-type" : "jython",
+ "script-class-reference" : "DescriptionExample",
+ "instance-dependencies" : [ ]
+ }
+ }
+ }
+ },
+ "interface-name" : {
+ "tags" : "interface-name",
+ "name" : "interface-name",
+ "property" : {
+ "description" : "interface-name",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "input" : {
+ "type" : "source-input",
+ "properties" : { }
+ }
+ }
+ },
+ "prefix-id" : {
+ "tags" : "prefix-id",
+ "name" : "prefix-id",
+ "property" : {
+ "description" : "prefix-id",
+ "type" : "integer"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "default" : {
+ "type" : "source-default",
+ "properties" : { }
+ }
+ }
+ },
+ "unit-number" : {
+ "tags" : "unit-number",
+ "name" : "unit-number",
+ "property" : {
+ "description" : "unit-number",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "input" : {
+ "type" : "source-input"
+ }
+ }
+ },
+ "vf-module-number" : {
+ "tags" : "vf-module-number",
+ "name" : "vf-module-number",
+ "property" : {
+ "description" : "vf-module-number",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "default" : {
+ "type" : "source-default",
+ "properties" : { }
+ }
+ }
+ },
+ "vf-module-type" : {
+ "tags" : "vf-module-type",
+ "name" : "vf-module-type",
+ "property" : {
+ "description" : "vf-module-type",
+ "type" : "string"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "primary-db" : {
+ "type" : "source-primary-db",
+ "properties" : {
+ "type" : "SQL",
+ "query" : "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid",
+ "input-key-mapping" : {
+ "vfmoduleid" : "vf-module-number"
+ },
+ "output-key-mapping" : {
+ "vf-module-type" : "value"
+ },
+ "key-dependencies" : [ "vf-module-number" ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml
new file mode 100644
index 00000000..ec154a15
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service-logic xmlns="http://www.onap.org/sdnc/svclogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="CONFIG" version="1.0.0">
+ <method rpc="ConfigDeploy" mode="sync">
+ <block atomic="true">
+ <execute plugin="config-deploy" method="process">
+ <outcome value="failure">
+ <return status="failure" />
+ </outcome>
+ <outcome value="success">
+ <return status="success" />
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml
new file mode 100644
index 00000000..15872e52
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'
+ module='CONFIG'
+ version='1.0.0'>
+ <method rpc='ResourceAssignment' mode='sync'>
+ <block atomic="true">
+ <execute plugin="resource-assignment" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <return status="success">
+ </return>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml
new file mode 100644
index 00000000..c1231d7a
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service-logic xmlns="http://www.onap.org/sdnc/svclogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="CONFIG" version="1.0.0">
+ <method rpc="Rollback" mode="sync">
+ <block atomic="true">
+ <execute plugin="rollback" method="process">
+ <outcome value="failure">
+ <return status="failure" />
+ </outcome>
+ <outcome value="success">
+ <return status="success" />
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/README b/components/model-catalog/blueprint-model/test-blueprint/golden/README
new file mode 100644
index 00000000..06f91123
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/README
@@ -0,0 +1,134 @@
+
+Example
+
+ Pre-requisite
+
+ Netbox running: https://github.com/netbox-community/netbox-docker
+ NETCONF capable device (JUNOS use in this example, but templates could be changed for another OS)
+ Blueprint processor
+
+ resources
+
+ Bellow a table of the resource used within this example, and how this resource
+ are resolved.
+ The resources are used in the context of device configuration. These shouldn't be
+ confused with SDC model resources.
+
+ name | resolve through
+ ------------------------------------------------------
+ prefix-id | default
+ vfw_interface_ip | rest (through Netbox)
+ hostname | input
+ vf-module-number | default
+ vf-module-type | database
+ unit-number | input
+ interface-name | input
+ interface-description | capability (python script)
+
+ 3 workflow
+
+ resource-assignment (dry-run)
+
+ Ability to resolve multiple templates and mappings at the same time,
+ based on the request 'artifact-name', and provide the result as output.
+ Example provide two templates: hostname and vf-module-1
+
+ In order to perform dry-run, we need to store the template and have
+ the ability to retrieve the stored result later point in time. For this
+ we have to specify that we want to store the result, and we need to provide
+ a resolution-key.
+
+ Here is the request payload:
+
+ artifact name: template(s) to resolve
+ store-result: whether to save the generated configlet in DB
+ resolution-key: To identify the configlet saved in the DB
+ hostname: Value defined to be result trough input in the hostname mapping file
+
+ {
+ "resource-assignment-request": {
+ "artifact-name": [ "hostname", "vf-module-1" ],
+ "resolution-key": "hostname-demo-123",
+ "store-result": true,
+ "resource-assignment-properties": {
+ "hostname": "demo123"
+ }
+ }
+ }
+
+ Output:
+
+ {
+ "resource-assignment-params": {
+ "hostname": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration xmlns:junos=\"http://xml.juniper.net/junos/17.4R1/junos\">\n <system xmlns=\"http://yang.juniper.net/junos-qfx/conf/system\">\n <host-name operation=\"delete\" />\n <host-name operation=\"create\">demo123</host-name>\n </system>\n</configuration>\n",
+ "vf-module-1": "<interface>\n <description>This is the Virtual Firewall entity</description>\n <vfw>10.10.10.39/24</vfw>\n</interface>"
+ },
+ "status": "success"
+ }
+
+ config-deploy
+
+ This action will run a python script that will retrieved the resolved template
+ from previous step using the resolution-key and the artifact-name.
+ The script will also resolve another template during its execution: the Interface Template.
+ Finally, this action will push these resolved templates into a device (JUNOS) using NETCONF.
+ The python script will make use of utilities classes provided by the platform:
+ resolution helper and netconf client.
+
+ Information about the device is modelled as a requirement of this action, specifying that
+ username, password and ip of the device should be provided as input. Note: you could resolve
+ those information using the resource resolution framework, if need be.
+
+ Here is the request payload:
+
+ resolution-key: To identify the configlet saved in the DB in previous step
+ username: NETCONF device user
+ password: NETCONF device password
+ ip: NETCONF device ip
+ interface-name: Name of the interface to configure
+ unit-number: Unit to configure for the interface
+
+ {
+ "resolution-key": "hostname-demo-123",
+ "username": "user",
+ "password": "pass",
+ "ip": "10.198.1.35",
+ "config-deploy-properties": {
+ "interface-name": "ge-0/0/7",
+ unit-number": "0"
+ }
+ }
+
+ Output:
+
+ No specific output beside success or failure.
+
+ rollback
+
+ This action will rollback the last committed config on the device, using NETCONF and device
+ specific RPC. To do so, a python script will be used, similar as in previous action, to dynamically
+ resolve the rollback template payload, and send the RPC to the device.
+
+ Information about the NETCONF device is provided in a similar fashion as previous step. Actually, the
+ same model is used.
+
+ Here is the request payload:
+
+ username: NETCONF device user
+ password: NETCONF device password
+ ip: NETCONF device ip
+
+ {
+ "username": "pass",
+ "password": "user",
+ "ip": "10.10.10.10"
+ }
+
+ Output:
+
+ No specific output beside success or failure.
+
+
+Postman collection used for this example. 4 requests are provided one per workflow to execute, and 1 to load the CBA in the runtime environment.
+
+ https://www.getpostman.com/collections/4d199ff02a735bd3e680 \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py
new file mode 100644
index 00000000..fce7c324
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2019 Bell Canada.
+#
+# 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.
+
+from abstract_ra_processor import AbstractRAProcessor
+from blueprint_constants import *
+from java.lang import Exception as JavaException
+
+class DescriptionExample(AbstractRAProcessor):
+
+ def process(self, resource_assignment):
+ try:
+ # get dependencies result
+ value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type")
+
+ # logic based on dependency outcome
+ result = ""
+ if value == "vfw":
+ result = "This is the Virtual Firewall entity"
+ elif value == "vsn":
+ result = "This is the Virtual Sink entity"
+ elif value == "vpg":
+ result = "This is the Virtual Packet Generator"
+
+ # set value for resource getting currently resolved
+ self.set_resource_data_value(resource_assignment, result)
+
+ except JavaException, err:
+ log.error("Java Exception in the script {}", err)
+ except Exception, err:
+ log.error("Python Exception in the script {}", err)
+ return None
+
+ def recover(self, runtime_exception, resource_assignment):
+ print "NoOp"
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py
new file mode 100644
index 00000000..ed22989f
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py
@@ -0,0 +1,61 @@
+# Copyright (c) 2019 Bell Canada.
+#
+# 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.
+
+import netconf_constant
+from common import ResolutionHelper
+from java.lang import Exception as JavaException
+from netconfclient import NetconfClient
+from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \
+ NetconfComponentFunction
+
+
+class NetconfRpcExample(NetconfComponentFunction):
+
+ def process(self, execution_request):
+ try:
+ log = globals()[netconf_constant.SERVICE_LOG]
+ print(globals())
+
+ nc = NetconfClient(log, self, "netconf-connection")
+ rr = ResolutionHelper(self)
+
+ # Get meshed template from DB
+ resolution_key = self.getDynamicProperties("resolution-key").asText()
+ artifact_name = "hostname"
+ payloadHostname = rr.retrieve_resolved_template_from_database(resolution_key, artifact_name)
+
+ # resolve param and mesh template
+ payloadInterface = rr.resolve_and_generate_message_from_template_prefix("vfw-interface")
+
+ nc.connect()
+ nc.lock()
+ #if not response.isSuccess():
+ # og.error(response.errorMessage)
+ nc.discard_change()
+ nc.edit_config(message_content=payloadInterface, edit_default_peration="none")
+ nc.edit_config(message_content=payloadHostname, edit_default_peration="none")
+ nc.validate()
+ nc.commit()
+ #nc.commit(confirmed = True, confirm_timeout=15)
+ nc.unlock()
+ nc.disconnect()
+
+ except JavaException, err:
+ log.error("Java Exception in the script {}", err)
+ except Exception, err:
+ log.error("Python Exception in the script {}", err)
+
+ def recover(self, runtime_exception, execution_request):
+ print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py
new file mode 100644
index 00000000..73419d71
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2019 Bell Canada.
+#
+# 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.
+
+import netconf_constant
+from common import ResolutionHelper
+from java.lang import Exception as JavaException
+from netconfclient import NetconfClient
+from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \
+ NetconfComponentFunction
+
+
+class Rollback(NetconfComponentFunction):
+
+ def process(self, execution_request):
+ try:
+ log = globals()[netconf_constant.SERVICE_LOG]
+ print(globals())
+
+ nc = NetconfClient(log, self, "netconf-connection")
+ rr = ResolutionHelper(self)
+
+ # rollback config on device
+ nc.connect()
+ payloadHostnameRollback = rr.resolve_and_generate_message_from_template_prefix("junos-rollback-RPC")
+ nc.invoke_rpc(payloadHostnameRollback)
+ nc.commit()
+ nc.disconnect()
+
+ except JavaException, err:
+ log.error("Java Exception in the script {}", err)
+ except Exception, err:
+ log.error("Python Exception in the script {}", err)
+
+ def recover(self, runtime_exception, execution_request):
+ print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py
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
new file mode 100644
index 00000000..065eda19
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,6 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Alexis de Talhouët
+Entry-Definitions: Definitions/activation-blueprint.json
+Template-Tags: test
+Content-Type: application/vnd.oasis.bpmn
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json
new file mode 100644
index 00000000..1e02d690
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json
@@ -0,0 +1,13 @@
+[
+ {
+ "name": "hostname",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "dependencies": [
+ ]
+ }
+]
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl
new file mode 100644
index 00000000..1e80b6d1
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
+ <system xmlns="http://yang.juniper.net/junos-qfx/conf/system">
+ <host-name operation="delete" />
+ <host-name operation="create">$hostname</host-name>
+ </system>
+</configuration>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json
new file mode 100644
index 00000000..0637a088
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json
@@ -0,0 +1 @@
+[] \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl
new file mode 100644
index 00000000..655a2b1c
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl
@@ -0,0 +1,3 @@
+<rpc>
+ <load-configuration rollback="1"/>
+</rpc> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json
new file mode 100644
index 00000000..eba259e3
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json
@@ -0,0 +1,64 @@
+[
+ {
+ "name": "interface-description",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "interface-description",
+ "dictionary-source": "capability",
+ "dependencies": [
+ "vf-module-type"
+ ]
+ },
+ {
+ "name": "vf-module-type",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "vf-module-type",
+ "dictionary-source": "primary-db",
+ "dependencies": [
+ "vf-module-number"
+ ]
+ },
+ {
+ "name": "vf-module-number",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "default": "3"
+ },
+ "dictionary-name": "vf-module-number",
+ "dictionary-source": "default",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "prefix-id",
+ "input-param": true,
+ "property": {
+ "type": "integer",
+ "default": 11
+ },
+ "dictionary-name": "prefix-id",
+ "dictionary-source": "default",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "vfw_interface_ip",
+ "input-param": true,
+ "property": {
+ "type": "dt-netbox-ip"
+ },
+ "dictionary-name": "create_netbox_ip",
+ "dictionary-source": "primary-config-data",
+ "dependencies": [
+ "prefix-id"
+ ]
+ }
+] \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl
new file mode 100644
index 00000000..9ba34a05
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl
@@ -0,0 +1,4 @@
+<interface>
+ <description>$interface-description</description>
+ <vfw>$vfw_interface_ip.address</vfw>
+</interface> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json
new file mode 100644
index 00000000..149d3eb2
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json
@@ -0,0 +1,88 @@
+[
+ {
+ "name": "interface-description",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "interface-description",
+ "dictionary-source": "capability",
+ "dependencies": [
+ "vf-module-type"
+ ]
+ },
+ {
+ "name": "interface-name",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "interface-name",
+ "dictionary-source": "input",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "unit-number",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "unit-number",
+ "dictionary-source": "input",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "prefix-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "default": "11"
+ },
+ "dictionary-name": "prefix-id",
+ "dictionary-source": "default",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "vf-module-type",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "vf-module-type",
+ "dictionary-source": "primary-db",
+ "dependencies": [
+ "vf-module-number"
+ ]
+ },
+ {
+ "name": "vf-module-number",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "default": "3"
+ },
+ "dictionary-name": "vf-module-number",
+ "dictionary-source": "default",
+ "dependencies": [
+
+ ]
+ },
+ {
+ "name": "vfw_interface_ip",
+ "input-param": true,
+ "property": {
+ "type": "dt-netbox-ip"
+ },
+ "dictionary-name": "create_netbox_ip",
+ "dictionary-source": "primary-config-data",
+ "dependencies": [
+ "prefix-id"
+ ]
+ }
+] \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl
new file mode 100644
index 00000000..3223535e
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl
@@ -0,0 +1,18 @@
+<configuration>
+ <interfaces>
+ <interface>
+ <name>$interface-name</name>
+ <unit operation="create">
+ <name>$unit-number</name>
+ <description>$interface-description</description>
+ <family>
+ <inet>
+ <address>
+ <name>$vfw_interface_ip.address</name>
+ </address>
+ </inet>
+ </family>
+ </unit>
+ </interface>
+ </interfaces>
+</configuration> \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json b/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json
new file mode 100644
index 00000000..81c908d6
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json
@@ -0,0 +1,15 @@
+{
+ "version": "1.0.0",
+ "description": "This is Netbox IP Data Type",
+ "properties": {
+ "address": {
+ "required": true,
+ "type": "string"
+ },
+ "id": {
+ "required": true,
+ "type": "integer"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json b/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json
new file mode 100644
index 00000000..297a8ef8
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json
@@ -0,0 +1,29 @@
+{
+ "tags" : "oam-local-ipv4-address",
+ "name" : "create_netbox_ip",
+ "property" : {
+ "description" : "netbox ip",
+ "type" : "dt-netbox-ip"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "primary-config-data" : {
+ "type" : "source-rest",
+ "properties" : {
+ "type" : "JSON",
+ "verb" : "POST",
+ "endpoint-selector" : "ipam-1",
+ "url-path" : "/api/ipam/prefixes/$prefix-id/available-ips/",
+ "path" : "",
+ "input-key-mapping" : {
+ "prefix-id" : "prefix-id"
+ },
+ "output-key-mapping" : {
+ "address" : "address",
+ "id" : "id"
+ },
+ "key-dependencies" : [ "prefix-id" ]
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json b/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json
new file mode 100644
index 00000000..35a8a351
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json
@@ -0,0 +1,30 @@
+{
+ "tags": "oam-local-ipv4-address",
+ "name": "delete_netbox_ip",
+ "property": {
+ "description": "delete netbox ip",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "primary-config-data": {
+ "type": "source-rest",
+ "properties": {
+ "type": "JSON",
+ "verb": "DELETE",
+ "endpoint-selector": "ipam-1",
+ "url-path": "/api/ipam/ip-addresses/$ip-address-id",
+ "path": "/address",
+ "input-key-mapping": {
+ "ip-address-id": "ip-address-id"
+ },
+ "output-key-mapping": {
+
+ },
+ "key-dependencies": [
+ "ip-address-id"
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/hostname.json b/components/model-catalog/resource-dictionary/test-dictionary/hostname.json
new file mode 100644
index 00000000..025cce33
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/hostname.json
@@ -0,0 +1,14 @@
+{
+ "tags": "hostname",
+ "name": "hostname",
+ "property": {
+ "description": "hostname",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "input": {
+ "type": "source-input"
+ }
+ }
+ } \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json b/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json
new file mode 100644
index 00000000..d13bfc44
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json
@@ -0,0 +1,21 @@
+{
+ "tags": "interface-description",
+ "name": "interface-description",
+ "property": {
+ "description": "interface-description",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "capability": {
+ "type": "source-capability",
+ "properties": {
+ "script-type": "jython",
+ "script-class-reference": "DescriptionExample",
+ "instance-dependencies": [
+
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json b/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json
new file mode 100644
index 00000000..53a11ed7
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json
@@ -0,0 +1,15 @@
+{
+ "name" : "interface-name",
+ "tags" : "interface-name",
+ "updated-by" : "adetalhouet",
+ "property" : {
+ "description" : "interface-name",
+ "type" : "string"
+ },
+ "sources" : {
+ "input" : {
+ "type" : "source-input",
+ "properties" : { }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json b/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json
new file mode 100644
index 00000000..e515eca5
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json
@@ -0,0 +1,16 @@
+{
+ "tags": "prefix-id",
+ "name": "prefix-id",
+ "property" :{
+ "description": "prefix-id",
+ "type": "integer"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "default": {
+ "type": "source-default",
+ "properties": {
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json b/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json
new file mode 100644
index 00000000..333fd78e
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json
@@ -0,0 +1,14 @@
+{
+ "tags": "unit-number",
+ "name": "unit-number",
+ "property": {
+ "description": "unit-number",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "input": {
+ "type": "source-input"
+ }
+ }
+ } \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json
new file mode 100644
index 00000000..cdd40f66
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json
@@ -0,0 +1,16 @@
+{
+ "tags": "vf-module-number",
+ "name": "vf-module-number",
+ "property" :{
+ "description": "vf-module-number",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "default": {
+ "type": "source-default",
+ "properties": {
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json
new file mode 100644
index 00000000..b06057c4
--- /dev/null
+++ b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json
@@ -0,0 +1,27 @@
+{
+ "name": "vf-module-type",
+ "tags": "vf-module-type",
+ "property": {
+ "description": "vf-module-type",
+ "type": "string"
+ },
+ "updated-by": "adetalhouet",
+ "sources": {
+ "primary-db": {
+ "type": "source-primary-db",
+ "properties": {
+ "type": "SQL",
+ "query": "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid",
+ "input-key-mapping": {
+ "vfmoduleid": "vf-module-number"
+ },
+ "output-key-mapping": {
+ "vf-module-type": "value"
+ },
+ "key-dependencies": [
+ "vf-module-number"
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
index 3bfb3d2b..919d202f 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -55,6 +55,7 @@ class BluePrintEnhancerServiceImplTest {
runBlocking {
modelTypeLoadService.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type")
resourceDictionaryLoadService.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/starter-dictionary")
+ resourceDictionaryLoadService.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/test-dictionary")
}
}
@@ -73,4 +74,20 @@ class BluePrintEnhancerServiceImplTest {
val valid = bluePrintValidatorService.validateBluePrints(targetPath)
Assert.assertTrue("blueprint validation failed ", valid)
}
+
+ @Test
+ @Throws(Exception::class)
+ fun testEnhancementAndValidation2() {
+
+ val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/golden"
+
+ val targetPath = Paths.get("target", "bp-enhance").toUri().path
+
+ val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath)
+ Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext)
+
+ // Validate the Generated BluePrints
+ val valid = bluePrintValidatorService.validateBluePrints(targetPath)
+ Assert.assertTrue("blueprint validation failed ", valid)
+ }
} \ No newline at end of file