summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json4
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json4
-rwxr-xr-xcomponents/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json4
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json4
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py99
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json100
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json54
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json1
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json4
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json37
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json72
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json2
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json45
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-generic.json2
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/source-default.json14
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/source-input.json14
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json4
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/source-rest.json4
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Workflow.json (renamed from components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json)8
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json5
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json5
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json5
-rw-r--r--components/scripts/python/ccsdk_restconf/__init__.py0
-rw-r--r--components/scripts/python/ccsdk_restconf/restconf_client.py74
29 files changed, 118 insertions, 464 deletions
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
index 4484d550e..e1d9be006 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
+++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
@@ -3318,7 +3318,7 @@
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
},
- "tosca.nodes.DG": {
+ "tosca.nodes.Workflow": {
"description": "This is Directed Graph Node Type",
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
@@ -3459,7 +3459,7 @@
}
}
},
- "derived_from": "tosca.nodes.DG"
+ "derived_from": "tosca.nodes.Workflow"
},
"artifact-config-template": {
"description": "This is Configuration Velocity Template",
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
index c550306d3..07e4df140 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
@@ -278,7 +278,7 @@
}
}
},
- "derived_from": "tosca.nodes.DG"
+ "derived_from": "tosca.nodes.Workflow"
},
"source-capability": {
"description": "This is Component Resource Source Node Type",
@@ -478,7 +478,7 @@
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
},
- "tosca.nodes.DG": {
+ "tosca.nodes.Workflow": {
"description": "This is Directed Graph Node Type",
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json
index b40c8cb34..7e78a42c8 100755
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json
@@ -139,7 +139,7 @@
}
}
},
- "derived_from" : "tosca.nodes.DG"
+ "derived_from" : "tosca.nodes.Workflow"
},
"source-input" : {
"description" : "This is Input Resource Source Node Type",
@@ -164,7 +164,7 @@
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
},
- "tosca.nodes.DG" : {
+ "tosca.nodes.Workflow" : {
"description" : "This is Directed Graph Node Type",
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
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
index ed7c580bc..4a0041773 100644
--- 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
@@ -155,7 +155,7 @@
}
}
},
- "derived_from" : "tosca.nodes.DG"
+ "derived_from" : "tosca.nodes.Workflow"
},
"source-input" : {
"description" : "This is Input Resource Source Node Type",
@@ -180,7 +180,7 @@
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
},
- "tosca.nodes.DG" : {
+ "tosca.nodes.Workflow" : {
"description" : "This is Directed Graph Node Type",
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
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
index 01e2ec477..78a38a225 100644
--- 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
@@ -14,30 +14,40 @@
# limitations under the License.
# ============LICENSE_END=========================================================
-from time import sleep
-
from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import \
RestconfComponentFunction
from java.lang import Exception as JavaException
+from restconf_client import RestconfClient
+
class RestconfConfigDeploy(RestconfComponentFunction):
log = globals()["log"]
- odl_status_check_limit = 10
- odl_status_check_pause = 1
- odl_status_check_url = "restconf/operational/network-topology:network-topology/topology/topology-netconf/node/"
- base_odl_url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/"
- server_identifier = "sdncodl"
configlet_template_name = "config-assign"
- configlet_odl_resource = "/yang-ext:mount/mynetconf:netconflist"
+ configlet_resource_path = "/yang-ext:mount/mynetconf:netconflist"
+ restconf_server_identifier = "sdncodl"
def process(self, execution_request):
self.log.info("Started execution of process method")
try:
+ restconf_client = RestconfClient(self.log, self)
pnf_id, resolution_key = self.retrieve_parameters(execution_request)
- self.interact_with_odl(pnf_id, resolution_key)
+ web_client_service = self.restClientService(self.restconf_server_identifier)
+
+ try:
+ mount_payload = self.resolveAndGenerateMessage("config-deploy-mapping", "config-deploy-template")
+ restconf_client.mount_device(web_client_service, pnf_id, mount_payload)
+
+ configlet = self.resolveFromDatabase(resolution_key, self.configlet_template_name)
+ restconf_client.configure_device(web_client_service, pnf_id, self.configlet_resource_path, configlet)
+ except Exception, err:
+ self.log.error("an error occurred while configuring device {}", err)
+ raise err
+ finally:
+ restconf_client.unmount_device(web_client_service, pnf_id)
+
except JavaException, err:
self.log.error("Java Exception in the script", err)
raise err
@@ -54,74 +64,9 @@ class RestconfConfigDeploy(RestconfComponentFunction):
self.log.info("pnf-id: {}", pnf_id)
return pnf_id, resolution_key
- def interact_with_odl(self, pnf_id, resolution_key):
- try:
- self.mount(pnf_id)
- self.log_current_configlet(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)
-
- def mount(self, pnf_id):
- self.log.info("mounting device {}", pnf_id)
- mount_payload = self.resolveAndGenerateMessage("config-deploy-mapping", "config-deploy-template")
- self.log.info("mount payload: \n {}", mount_payload)
- headers = {"Content-Type": "application/xml"} # defining custom header
- url = self.base_odl_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)
- self.wait_for_odl_to_mount(pnf_id)
-
- def wait_for_odl_to_mount(self, pnf_id):
- counter = 0
- url = self.odl_status_check_url + pnf_id
- self.log.info("url for ODL status check: {}", url)
- web_client_service = self.restClientService(self.server_identifier)
- expected_result = '"netconf-node-topology:connection-status":"connected"'
- while counter < self.odl_status_check_limit:
- result = web_client_service.exchangeResource("GET", url, "")
- self.log.info("ODL status check result: {}", result)
- if expected_result in result:
- self.log.info("PNF was mounted successfully on ODL")
- return None
- sleep(1)
- counter += 1
- raise JavaException("PNF was not mounted on ODL, aborting configuration procedure")
-
- def log_current_configlet(self, pnf_id):
- self.log.info("retrieving configuration for device {}", pnf_id)
- url = self.base_odl_url + pnf_id + self.configlet_odl_resource
- self.log.info("sending GET request, url: {}", url)
- web_client_service = self.restClientService(self.server_identifier)
- result = web_client_service.exchangeResource("GET", url, "")
- self.log.info("Current configuration: {}", result)
-
- def apply_configuration(self, pnf_id, resolution_key, template_name):
- self.log.info("configuring device {}", pnf_id)
- 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)
- headers = { "Content-Type": "application/yang.patch+json" } # defining custom header
- url = self.base_odl_url + pnf_id + self.configlet_odl_resource
- 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 unmount(self, pnf_id):
- url = self.base_odl_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 recover(self, runtime_exception, execution_request):
self.log.info("Recover function called!")
- self.log.error(runtime_exception.getMessage())
+ self.log.info("Execution request", execution_request)
+ self.log.error("Exception", runtime_exception)
print self.bluePrintRuntimeService.getBluePrintError().addError(runtime_exception.getMessage())
- return None \ No newline at end of file
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json
deleted file mode 100644
index eadc848be..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "artifact_types" : { }
-} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json
deleted file mode 100644
index 9e040b85d..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "tosca_definitions_version": "controller_blueprint_1_0_0",
- "metadata": {
- "template_author": "Brinda Santh <brindasanth@in.ibm.com>",
- "template_name": "component_invoke",
- "template_version": "1.0.0",
- "template_tags": "brinda, component_invoke"
- },
- "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"
- }
- ],
- "topology_template": {
- "workflows": {
- "component-invoke": {
- "steps": {
- "activate-process": {
- "description": "Sample Component Invocation flow",
- "target": "sample-component",
- "activities": [
- {
- "call_operation": "sample-component"
- }
- ]
- }
- },
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "response-property1": {
- "type": "string",
- "value": "executed"
- },
- "response-property2": {
- "type": "string",
- "value": {
- "get_input": "action-name"
- }
- }
- }
- }
- },
- "node_templates": {
- "sample-component": {
- "type": "component-sample-executor",
- "interfaces": {
- "ComponentSampleExecutor": {
- "operations": {
- "process": {
- "inputs": {
- "sample-property": "sample-value",
- "sample-list-property": [
- "json-parser-service"
- ],
- "dynamic-properties": {
- "prop1": "prop1-value",
- "prop2": "prop2-value"
- }
- },
- "outputs": {
- "response-data": "",
- "status": ""
- }
- }
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json
deleted file mode 100644
index 8c304c40b..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "data_types" : { }
-} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json
deleted file mode 100644
index 1e02cef4a..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "node_types": {
- "component-sample-executor": {
- "description": "This is Sample Component API",
- "version": "1.0.0",
- "interfaces": {
- "ComponentSampleExecutor": {
- "operations": {
- "process": {
- "inputs": {
- "sample-property": {
- "description": "Sample Property.",
- "required": true,
- "type": "string"
- },
- "sample-list-property": {
- "description": "Dependent Step Components NodeTemplate name.",
- "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"
- },
- "tosca.nodes.Component": {
- "description": "This is default Component Node",
- "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/component_invoke/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json
deleted file mode 100644
index 1e44cc70a..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy_types" : { }
-} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json
deleted file mode 100644
index 4ddd7a57c..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "relationship_types" : { }
-} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json
deleted file mode 100644
index 6f31cf5a2..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json
+++ /dev/null
@@ -1 +0,0 @@
-{ } \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta
deleted file mode 100644
index a7c130a23..000000000
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta
+++ /dev/null
@@ -1,5 +0,0 @@
-TOSCA-Meta-File-Version: 1.0.0
-CSAR-Version: 1.0
-Created-By: Brinda Santh <brindasanth@in.ibm.com>
-Entry-Definitions: Definitions/component_invoke.json
-Template-Tags: Brinda Santh, component_invoke \ 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
index f143e560b..c1cded219 100644
--- 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
@@ -162,7 +162,7 @@
}
}
},
- "derived_from" : "tosca.nodes.DG"
+ "derived_from" : "tosca.nodes.Workflow"
},
"source-capability" : {
"description" : "This is Component Resource Source Node Type",
@@ -353,7 +353,7 @@
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
},
- "tosca.nodes.DG" : {
+ "tosca.nodes.Workflow" : {
"description" : "This is Directed Graph Node Type",
"version" : "1.0.0",
"derived_from" : "tosca.nodes.Root"
diff --git a/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json b/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json
deleted file mode 100644
index af99d75b8..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json
deleted file mode 100644
index 263882ad7..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "description": "This is Generate Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "ConfigGeneratorComponent": {
- "operations": {
- "process": {
- "inputs": {
- "template-data": {
- "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "template-content": {
- "description": "Conditional : Dynamic Template used to generate Configuration.",
- "required": false,
- "type": "string"
- },
- "resource-type": {
- "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "action-name": {
- "description": "Conditional : Action 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"
- },
- "template-name": {
- "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "generated-config": {
- "description": "Generated Configuration for the Template adn Resource Data",
- "required": true,
- "type": "string"
- },
- "mask-info": {
- "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.cds.controllerblueprints.core.data.custom.MaskInfo ",
- "required": false,
- "type": "string"
- },
- "status": {
- "description": "Status of the Component Execution ( success or failure )",
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
-} \ No newline at end of file
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
index 5a024a7d6..b78a7c63a 100644
--- 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
@@ -41,5 +41,5 @@
}
}
},
- "derived_from": "tosca.nodes.component.Jython"
+ "derived_from": "tosca.nodes.Component"
} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json
deleted file mode 100644
index 68b3ebde2..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "description": "This is Sample Component API",
- "version": "1.0.0",
- "interfaces": {
- "ComponentSampleExecutor": {
- "operations": {
- "process": {
- "inputs": {
- "sample-property": {
- "description": "Sample Property.",
- "required": true,
- "type": "string"
- },
- "sample-list-property": {
- "required": true,
- "description": "Dependent Step Components NodeTemplate name.",
- "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"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
index ec9904bf5..23aa63ea2 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
@@ -15,5 +15,5 @@
}
}
},
- "derived_from": "tosca.nodes.DG"
+ "derived_from": "tosca.nodes.Workflow"
} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-default.json b/components/model-catalog/definition-type/starter-type/node_type/source-default.json
index 13e234e1b..3e7d14ce8 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/source-default.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/source-default.json
@@ -1,18 +1,6 @@
{
"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"
- }
- }
- },
+ "properties": { },
"derived_from": "tosca.nodes.ResourceSource"
} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-input.json b/components/model-catalog/definition-type/starter-type/node_type/source-input.json
index 126ea30bd..bf84481bd 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/source-input.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/source-input.json
@@ -1,18 +1,6 @@
{
"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"
- }
- }
- },
+ "properties": { },
"derived_from": "tosca.nodes.ResourceSource"
} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json
index 702748f8a..6f03dbfc4 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json
@@ -4,12 +4,12 @@
"properties": {
"type": {
"required": true,
+ "default": "SQL",
"type": "string",
"constraints": [
{
"valid_values": [
- "SQL",
- "PLSQL"
+ "SQL"
]
}
]
diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json
index b28e9341d..f9995a883 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json
@@ -3,7 +3,7 @@
"version": "1.0.0",
"properties": {
"type": {
- "required": false,
+ "required": true,
"type": "string",
"default": "JSON",
"constraints": [
@@ -15,7 +15,7 @@
]
},
"verb": {
- "required": false,
+ "required": true,
"type": "string",
"default": "GET",
"constraints": [
diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Workflow.json
index 86728cf2f..eb8cac0ae 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Workflow.json
@@ -1,5 +1,5 @@
-{
- "description": "This is Directed Graph Node Type",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
+{
+ "description": "This is Directed Graph Node Type",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
} \ No newline at end of file
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
deleted file mode 100644
index 8e194f6dd..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Jython Component",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json
deleted file mode 100644
index 381ed59e2..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Kotlin Component",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json
deleted file mode 100644
index 7b67c8cb2..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Python Component",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/components/scripts/python/ccsdk_restconf/__init__.py b/components/scripts/python/ccsdk_restconf/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/components/scripts/python/ccsdk_restconf/__init__.py
diff --git a/components/scripts/python/ccsdk_restconf/restconf_client.py b/components/scripts/python/ccsdk_restconf/restconf_client.py
new file mode 100644
index 000000000..43e885a5b
--- /dev/null
+++ b/components/scripts/python/ccsdk_restconf/restconf_client.py
@@ -0,0 +1,74 @@
+#
+# ============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
+
+
+class RestconfClient:
+
+ __odl_status_check_limit = 10
+ __odl_status_check_pause = 1
+ __odl_status_check_url = "restconf/operational/network-topology:network-topology/topology/topology-netconf/node/"
+ __base_odl_url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/"
+
+ def __init__(self, log, restconf_component_function):
+ self.__log = log
+ self.__component_function = restconf_component_function
+
+ def mount_device(self, web_client_service, pnf_id, mount_payload):
+ self.__log.debug("mounting device {}", pnf_id)
+ headers = {"Content-Type": "application/xml"}
+ url = self.__base_odl_url + pnf_id
+ self.__log.debug("sending mount request, url: {}", url)
+ web_client_service.exchangeResource("PUT", url, mount_payload, headers)
+ self.__wait_for_odl_to_mount(web_client_service, pnf_id)
+
+ def __wait_for_odl_to_mount(self, web_client_service, pnf_id):
+ counter = 0
+ url = self.__odl_status_check_url + pnf_id
+ self.__log.info("url for ODL status check: {}", url)
+ expected_result = '"netconf-node-topology:connection-status":"connected"'
+ while counter < self.__odl_status_check_limit:
+ result = web_client_service.exchangeResource("GET", url, "")
+ if expected_result in result:
+ self.__log.info("PNF was mounted successfully on ODL")
+ return None
+ sleep(self.__odl_status_check_pause)
+ counter += 1
+ raise Exception("PNF was not mounted on ODL, aborting configuration procedure")
+
+ def configure_device(self, web_client_service, pnf_id, configlet_resource_path, configlet_to_apply):
+ self.log_current_configlet(web_client_service, pnf_id, configlet_resource_path)
+ self.__log.info("configuring device: {}, Configlet: {}", pnf_id, configlet_to_apply)
+ headers = {"Content-Type": "application/yang.patch+json"}
+ url = self.__base_odl_url + pnf_id + configlet_resource_path
+ self.__log.debug("sending patch request, url: {}", url)
+ result = web_client_service.exchangeResource("PATCH", url, configlet_to_apply, headers)
+ self.__log.info("Configuration application result: {}", result)
+
+ def log_current_configlet(self, web_client_service, pnf_id, configlet_resource_path):
+ url = self.__base_odl_url + pnf_id + configlet_resource_path
+ self.__log.debug("sending GET request, url: {}", url)
+ result = web_client_service.exchangeResource("GET", url, "")
+ self.__log.info("Current configuration: {}", result)
+
+ def unmount_device(self, web_client_service, pnf_id):
+ url = self.__base_odl_url + str(pnf_id)
+ self.__log.debug("sending unmount request, url: {}", url)
+ web_client_service.exchangeResource("DELETE", url, "")