summaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model/test-blueprint/capability_restconf
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2019-03-22 10:35:38 -0700
committerJessica Wagantall <jwagantall@linuxfoundation.org>2019-03-22 10:36:17 -0700
commit995a36660fc855447d69a41a9a25b6b27fa57bf0 (patch)
treed5f5cb3dfaac6e31f9f2d885a04c9e180a2a02c3 /components/model-catalog/blueprint-model/test-blueprint/capability_restconf
parent9cee11e750a6ea570bf3580f5f20399bf898e694 (diff)
parent86233d8ea68bebb4e49cc8d1378917f2e1d3cee4 (diff)
Migrate "components" from ccsdk/apps
Migrate code from ccsdk/apps components subfolder into ccsdk/cds Issue-ID: CIMAN-245 Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'components/model-catalog/blueprint-model/test-blueprint/capability_restconf')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json198
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json28
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json13
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json13
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json24
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json194
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json17
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml15
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml15
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py112
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl37
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl14
15 files changed, 691 insertions, 0 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json
new file mode 100644
index 000000000..628a7d04d
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json
@@ -0,0 +1,198 @@
+{
+ "tosca_definitions_version" : "controller_blueprint_1_0_0",
+ "metadata" : {
+ "template_author" : "Rodrigo Ottero",
+ "author-email" : "rodrigo.ottero@est.tech",
+ "user-groups" : "ADMIN, OPERATION",
+ "template_name" : "configuration_over_restconf",
+ "template_version" : "1.0.0",
+ "template_tags" : "pnf, restconf, config, configuration"
+ },
+ "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" : {
+ "config-assign-properties" : {
+ "resolution-key" : {
+ "get_input" : "resolution-key"
+ }
+ },
+ "config-deploy-properties" : {
+ "resolution-key" : {
+ "get_input" : "resolution-key"
+ }
+ }
+
+ },
+ "topology_template" : {
+ "workflows" : {
+ "config-assign" : {
+ "steps" : {
+ "activate-process" : {
+ "description" : "Create a configlet",
+ "target" : "config-assign-process",
+ "activities" : [ {
+ "call_operation" : ""
+ } ]
+ }
+ },
+ "inputs" : {
+ "resolution-key" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "artifact-name" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "store-result" : {
+ "required" : true,
+ "type" : "boolean"
+ },
+ "config-assign-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(config-assign).",
+ "required" : true,
+ "type" : "dt-config-assign-properties"
+ }
+ }
+ },
+ "config-deploy" : {
+ "steps" : {
+ "activate-process" : {
+ "description" : "Send a configlet to the pnf",
+ "target" : "config-deploy-process",
+ "activities" : [ {
+ "call_operation" : ""
+ } ]
+ }
+ },
+ "inputs" : {
+ "resolution-key" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "config-deploy-properties" : {
+ "description" : "Dynamic PropertyDefinition for workflow(config-deploy).",
+ "required" : true,
+ "type" : "dt-config-deploy-properties"
+ }
+ }
+ }
+ },
+ "node_templates" : {
+ "config-assign-process" : {
+ "type" : "dg-generic",
+ "properties" : {
+ "content" : {
+ "get_artifact" : [ "SELF", "dg-config-assign-process" ]
+ },
+ "dependency-node-templates" : [ "config-assign" ]
+ },
+ "artifacts" : {
+ "dg-config-assign-process" : {
+ "type" : "artifact-directed-graph",
+ "file" : "Plans/CONFIG_configAssign.xml"
+ }
+ }
+ },
+ "config-assign" : {
+ "type" : "component-resource-resolution",
+ "interfaces" : {
+ "ResourceResolutionComponent" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "resolution-key" : {
+ "get_input" : "resolution-key"
+ },
+ "store-result" : true,
+ "artifact-prefix-names" : ["config-assign"]
+ },
+ "outputs" : {
+ "resource-assignment-params" : {
+ "get_attribute" : [ "SELF", "assignment-params" ]
+ },
+ "status" : "success"
+ }
+ }
+ }
+ }
+ },
+ "artifacts" : {
+ "config-assign-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/config-assign-restconf-configlet-template.vtl"
+ },
+ "config-assign-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Definitions/config-assign-pnf-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-assign-process" : {
+ "type" : "artifact-directed-graph",
+ "file" : "Plans/CONFIG_configDeploy.xml"
+ }
+ }
+ },
+ "config-deploy" : {
+ "type" : "component-restconf-executor",
+ "interfaces" : {
+ "ComponentRestconfExecutor" : {
+ "operations" : {
+ "process" : {
+ "implementation" : {
+ "primary" : "component-script"
+ },
+ "inputs" : {
+ "script-type" : "jython",
+ "script-class-reference" : "Scripts/python/RestconfConfigDeploy.py",
+ "instance-dependencies" : [ ],
+ "dynamic-properties" : "*config-deploy-properties"
+ },
+ "outputs" : {
+ "response-data" : "",
+ "status" : "success"
+ }
+ }
+ }
+ }
+ },
+ "artifacts" : {
+ "config-deploy-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/config-deploy-restconf-mount-template.vtl"
+ },
+ "config-deploy-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Definitions/config-deploy-pnf-mapping.json"
+ },
+ "component-script" : {
+ "type" : "artifact-script-jython",
+ "file" : "Scripts/python/RestconfConfigDeploy.py"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json
new file mode 100644
index 000000000..aa5295e44
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json
@@ -0,0 +1,28 @@
+{
+ "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-script-jython" : {
+ "description" : "Jython Script File",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.artifacts.Implementation",
+ "file_ext" : [ "py" ]
+ },
+ "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/capability_restconf/Definitions/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json
new file mode 100644
index 000000000..fc8e1bf64
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json
@@ -0,0 +1,13 @@
+[
+ {
+ "name": "entity",
+ "input-param": true,
+ "property": {
+ "type": "json"
+ },
+ "dictionary-name": "entity",
+ "dictionary-source": "input",
+ "dependencies": [
+ ]
+ }
+]
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json
new file mode 100644
index 000000000..fc8e1bf64
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json
@@ -0,0 +1,13 @@
+[
+ {
+ "name": "entity",
+ "input-param": true,
+ "property": {
+ "type": "json"
+ },
+ "dictionary-name": "entity",
+ "dictionary-source": "input",
+ "dependencies": [
+ ]
+ }
+]
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json
new file mode 100644
index 000000000..e5aa763ba
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json
@@ -0,0 +1,24 @@
+{
+ "data_types" : {
+ "dt-config-assign-properties" : {
+ "description" : "Dynamic DataType definition for workflow(config-assign).",
+ "version" : "1.0.0",
+ "properties" : {
+ "entity" : {
+ "type" : "json"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ },
+ "dt-config-deploy-properties" : {
+ "description" : "Dynamic DataType definition for workflow(config-deploy).",
+ "version" : "1.0.0",
+ "properties" : {
+ "entity" : {
+ "type" : "json"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json
new file mode 100644
index 000000000..ed7c580bc
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json
@@ -0,0 +1,194 @@
+{
+ "node_types" : {
+ "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"
+ },
+ "component-restconf-executor" : {
+ "description" : "This is Restconf Transaction Configuration Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "interfaces" : {
+ "ComponentRestconfExecutor" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "script-type" : {
+ "description" : "Script type, kotlin type is supported",
+ "required" : true,
+ "type" : "string",
+ "constraints" : [ {
+ "valid_values" : [ "kotlin", "jython", "internal" ]
+ } ],
+ "default" : "internal"
+ },
+ "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"
+ }
+ },
+ "dynamic-properties" : {
+ "description" : "Dynamic Json Content or DSL Json reference.",
+ "required" : false,
+ "type" : "json"
+ }
+ },
+ "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"
+ },
+ "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-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"
+ },
+ "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"
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json
new file mode 100644
index 000000000..1e44cc70a
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/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/capability_restconf/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json
new file mode 100644
index 000000000..4ddd7a57c
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json
@@ -0,0 +1,3 @@
+{
+ "relationship_types" : { }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json
new file mode 100644
index 000000000..98a73b101
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json
@@ -0,0 +1,17 @@
+{
+ "entity" : {
+ "tags" : "entity",
+ "name" : "entity",
+ "property" : {
+ "description" : "entity",
+ "type" : "json"
+ },
+ "updated-by" : "Rodrigo Ottero <rodrigo.ottero@est.tech>",
+ "sources" : {
+ "input" : {
+ "type" : "source-input",
+ "properties" : { }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml
new file mode 100644
index 000000000..220cba9f7
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.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="ResourceAssignAndActivate" mode="sync">
+ <block atomic="true">
+ <execute plugin="config-assign" method="process">
+ <outcome value="failure">
+ <return status="failure" />
+ </outcome>
+ <outcome value="success">
+ <return status="success" />
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml
new file mode 100644
index 000000000..fbed3d575
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_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="ResourceAssignAndActivate" 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>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py
new file mode 100644
index 000000000..33f9400eb
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py
@@ -0,0 +1,112 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+from time import sleep
+
+from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \
+ RestconfComponentFunction
+from java.lang import Exception as JavaException
+
+
+class RestconfConfigDeploy(RestconfComponentFunction):
+
+ log = globals()["log"]
+ seconds_to_sleep = 5
+ base_mount_url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/"
+ server_identifier = "sdncodl"
+ configlet_template_name = "config-assign"
+
+ def process(self, execution_request):
+
+ self.log.info("Started execution of process method")
+ try:
+ self.log.info("getting resolution-key")
+ resolution_key = self.getDynamicProperties("resolution-key").asText()
+ self.log.info("resolution_key: {}", resolution_key)
+
+ self.log.info("getting pnf-id")
+ pnf_id = execution_request.payload.get("config-deploy-request").get("config-deploy-properties").get("entity").get("pnf-id")
+ pnf_id = str(pnf_id).strip('\"')
+ self.log.info("pnf-id: {}", pnf_id)
+
+ self.log.info("mounting device {}", pnf_id)
+ self.mount(pnf_id)
+
+ self.log.info("sleeping for {} seconds", self.seconds_to_sleep)
+ sleep(self.seconds_to_sleep)
+
+ try:
+ self.log.info("configuring device {}", pnf_id)
+ self.apply_configuration(pnf_id, resolution_key, self.configlet_template_name)
+ except Exception, err:
+ self.log.error("an error occurred while configuring device {}", err)
+ raise err
+ finally:
+ self.log.info("unmounting device {}", pnf_id)
+ self.unmount(pnf_id)
+
+ self.log.info("Ended execution of process method")
+
+ except JavaException, err:
+ self.log.error("Java Exception in the script", err)
+ raise err
+ except Exception, err:
+ self.log.error("Python Exception in the script", err)
+ raise err
+
+ def mount(self, pnf_id):
+ self.log.info("meshing mount payload")
+ mount_payload = self.resolveAndGenerateMessage("config-deploy-mapping", "config-deploy-template")
+ self.log.info("mount payload: \n {}", mount_payload)
+
+ # defining custom header
+ headers = {
+ "Content-Type": "application/xml"
+ }
+
+ url = self.base_mount_url + str(pnf_id)
+ self.log.info("sending mount request, url: {}", url)
+ web_client_service = self.restClientService(self.server_identifier)
+ web_client_service.exchangeResource("PUT", url, mount_payload, headers)
+
+ def unmount(self, pnf_id):
+ url = self.base_mount_url + str(pnf_id)
+ self.log.info("sending unmount request, url: {}", url)
+ web_client_service = self.restClientService(self.server_identifier)
+ web_client_service.exchangeResource("DELETE", url, "")
+
+ def apply_configuration(self, pnf_id, resolution_key, template_name):
+ self.log.info("Retrieving configlet from database (resolution-key: {}, template_name: {}",
+ resolution_key, template_name)
+ configlet = self.resolveFromDatabase(resolution_key, template_name)
+ self.log.info("Configlet: {}", configlet)
+
+ # defining custom header
+ headers = {
+ "Content-Type": "application/yang.patch+json"
+ }
+
+ url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + pnf_id \
+ + "/yang-ext:mount/mynetconf:netconflist"
+ self.log.info("sending patch request, url: {}", url)
+ web_client_service = self.restClientService(self.server_identifier)
+ result = web_client_service.exchangeResource("PATCH", url, configlet, headers)
+ self.log.info("Configuration application result: {}", result)
+
+ def recover(self, runtime_exception, execution_request):
+ self.log.info("Recover method, no code to execute")
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 000000000..6ac9caf57
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,5 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Rodrigo Ottero
+Entry-Definitions: Definitions/activation-blueprint.json
+Template-Tags: activation-blueprint
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl
new file mode 100644
index 000000000..3812380ea
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl
@@ -0,0 +1,37 @@
+{
+ "ietf-restconf:yang-patch":{
+ "patch-id":"patch-1",
+ "edit":[
+ {
+ "edit-id":"edit1",
+ "operation":"merge",
+ "target":"/",
+ "value":{
+ "netconflist":{
+ "netconf":[
+ {
+ "netconf-id":"40",
+ "netconf-param":"4040"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "edit-id":"edit2",
+ "operation":"merge",
+ "target":"/",
+ "value":{
+ "netconflist":{
+ "netconf":[
+ {
+ "netconf-id":"50",
+ "netconf-param":"98765"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl
new file mode 100644
index 000000000..935177658
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl
@@ -0,0 +1,14 @@
+<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+ <node-id>$entity.pnf-id</node-id>
+ <key-based xmlns="urn:opendaylight:netconf-node-topology">
+ <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL-private-key</key-id>
+ <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username>
+ </key-based>
+ <host xmlns="urn:opendaylight:netconf-node-topology">$entity.pnf-name</host>
+ <port xmlns="urn:opendaylight:netconf-node-topology">6513</port>
+ <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
+ <protocol xmlns="urn:opendaylight:netconf-node-topology">
+ <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name>
+ </protocol>
+ <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">5</max-connection-attempts>
+</node>