summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-07-22 13:09:18 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-07-23 15:31:17 -0400
commit9c0f6c2b556c9d39766636544827189d75b6af50 (patch)
tree1022153a904cb1ad680f770bf06affd619f6056b /components
parenta0140dea9c608d745767574ac621ca0060a2bddc (diff)
Clean restconf duplicate models and Implementation.
Change-Id: Id439ac5ded631aac0ee7fc69846ebe9bca650bb2 Issue-ID: CCSDK-1499 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'components')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json7
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json65
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json12
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py10
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json65
-rw-r--r--components/scripts/python/ccsdk_restconf/restconf_client.py13
7 files changed, 24 insertions, 153 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 135016a11..112014b88 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -287,9 +287,9 @@
}
},
"activate-restconf": {
- "type": "component-restconf-executor",
+ "type": "component-script-executor",
"interfaces": {
- "ComponentRestconfExecutor": {
+ "ComponentScriptExecutor": {
"operations": {
"process": {
"implementation": {
@@ -297,8 +297,7 @@
},
"inputs": {
"script-type": "kotlin",
- "script-class-reference": "DefaultRestconf_cba$MountNEditConfigure",
- "instance-dependencies": []
+ "script-class-reference": "DefaultRestconf_cba$MountNEditConfigure"
},
"outputs": {
"response-data": "",
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 6de1fe320..3595a9f67 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
@@ -259,71 +259,6 @@
},
"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",
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
index b3f5272b8..d185128d5 100644
--- 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
@@ -143,9 +143,9 @@
}
},
"config-deploy" : {
- "type" : "component-restconf-executor",
+ "type" : "component-script-executor",
"interfaces" : {
- "ComponentRestconfExecutor" : {
+ "ComponentScriptExecutor" : {
"operations" : {
"process" : {
"implementation" : {
@@ -154,7 +154,6 @@
"inputs" : {
"script-type" : "jython",
"script-class-reference" : "Scripts/python/RestconfConfigDeploy.py",
- "instance-dependencies" : [ ],
"dynamic-properties" : "*config-deploy-properties"
},
"outputs" : {
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 d6f702a9f..8c2c0abea 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
@@ -79,7 +79,7 @@
},
"derived_from" : "tosca.nodes.Component"
},
- "component-restconf-executor" : {
+ "component-script-executor" : {
"description" : "This is Restconf Transaction Configuration Component API",
"version" : "1.0.0",
"capabilities" : {
@@ -88,7 +88,7 @@
}
},
"interfaces" : {
- "ComponentRestconfExecutor" : {
+ "ComponentScriptExecutor" : {
"operations" : {
"process" : {
"inputs" : {
@@ -106,14 +106,6 @@
"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,
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 d65aefabb..17dd56104 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
@@ -19,10 +19,10 @@ from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import \
from java.lang import Exception as JavaException
from restconf_client import RestconfClient
+from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction
-class RestconfConfigDeploy(RestconfComponentFunction):
-
+class RestconfConfigDeploy(AbstractScriptComponentFunction):
log = globals()["log"]
configlet_template_name = "config-assign"
configlet_resource_path = "/yang-ext:mount/mynetconf:netconflist"
@@ -34,11 +34,11 @@ class RestconfConfigDeploy(RestconfComponentFunction):
try:
restconf_client = RestconfClient(self.log, self)
pnf_id, resolution_key = self.retrieve_parameters(execution_request)
- web_client_service = self.restClientService(self.restconf_server_identifier)
+ web_client_service = restconf_client.web_client_service(self.restconf_server_identifier)
try:
# mount the device
- mount_payload = self.resolveAndGenerateMessage("config-deploy-mapping", "config-deploy-template")
+ mount_payload = restconf_client.resolve_and_generate_message_from_template_prefix("config-deploy")
restconf_client.mount_device(web_client_service, pnf_id, mount_payload)
# log the current configuration subtree
@@ -47,7 +47,7 @@ class RestconfConfigDeploy(RestconfComponentFunction):
self.log.info("Current configuration subtree: {}", current_configuration)
# apply configuration
- configlet = self.resolveFromDatabase(resolution_key, self.configlet_template_name)
+ configlet = restconf_client.retrieve_resolved_template_from_database(resolution_key, self.configlet_template_name)
restconf_client.configure_device_json_patch(
web_client_service, pnf_id, self.configlet_resource_path, configlet)
except Exception, err:
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json
deleted file mode 100644
index cb28a4a10..000000000
--- a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "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",
- "default": "internal",
- "constraints": [
- {
- "valid_values": [
- "kotlin",
- "jython",
- "internal"
- ]
- }
- ]
- },
- "script-class-reference": {
- "description": "Kotlin Script class name or jython script name.",
- "required": true,
- "type": "string"
- },
- "instance-dependencies": {
- "required": true,
- "description": "Instance names to inject to Jython or Kotlin Script.",
- "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/scripts/python/ccsdk_restconf/restconf_client.py b/components/scripts/python/ccsdk_restconf/restconf_client.py
index 6d18b03c5..ec25853f0 100644
--- a/components/scripts/python/ccsdk_restconf/restconf_client.py
+++ b/components/scripts/python/ccsdk_restconf/restconf_client.py
@@ -18,10 +18,11 @@
# ============LICENSE_END=========================================================
#
from time import sleep
+from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import RestconfExecutorExtensionsKt
+from org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import ResourceResolutionExtensionsKt
class RestconfClient:
-
__base_odl_url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/"
__odl_status_check_limit = 10
__odl_status_check_pause = 1
@@ -32,6 +33,16 @@ class RestconfClient:
self.__log = log
self.__component_function = restconf_component_function
+ def web_client_service(self, identifier):
+ RestconfExecutorExtensionsKt.restconfClientService(self.__component_function, identifier)
+
+ def resolve_and_generate_message_from_template_prefix(self, artifact_prefix):
+ return ResourceResolutionExtensionsKt.contentFromResolvedArtifact(self.component_function, artifact_prefix)
+
+ def retrieve_resolved_template_from_database(self, key, artifact_template):
+ return ResourceResolutionExtensionsKt.storedContentFromResolvedArtifact(self.component_function, key,
+ artifact_template)
+
def mount_device(self, web_client_service, nf_id, mount_payload):
self.__log.debug("mounting device {}", nf_id)
headers = {"Content-Type": "application/xml"}