From 19dfd637dd3888b2f986d9e3543c34ff7dc6b4aa Mon Sep 17 00:00:00 2001 From: Steve Siani Date: Thu, 15 Aug 2019 21:42:50 -0400 Subject: Wrapper functions for placing output responseData and Status Issue-ID: CCSDK-1625 Change-Id: I80e6c0d8f04df3a05d9bfc230addda5f0501b1b1 Signed-off-by: Steve Siani --- .../starter-type/node_type/component-config-snapshots-executor.json | 4 ++++ .../starter-type/node_type/component-jython-executor.json | 6 ++++++ .../starter-type/node_type/component-netconf-executor.json | 6 ++++++ .../starter-type/node_type/component-remote-ansible-executor.json | 4 ++++ .../starter-type/node_type/component-script-executor.json | 6 ++++++ components/scripts/python/ccsdk_netconf/common.py | 1 + components/scripts/python/ccsdk_netconf/netconf_constant.py | 2 ++ components/scripts/python/ccsdk_netconf/netconfclient.py | 6 ++++-- components/scripts/python/ccsdk_restconf/restconf_client.py | 4 ++++ components/scripts/python/ccsdk_restconf/restconf_constant.py | 1 + 10 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 components/scripts/python/ccsdk_restconf/restconf_constant.py diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json index 1cc366637..caae68eef 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json @@ -13,6 +13,10 @@ "config-snapshot-value": { "required": false, "type": "string" + }, + "response-data": { + "required": false, + "type": "json" } }, "capabilities": { 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 b78a7c63a..ae674f3ec 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 @@ -1,6 +1,12 @@ { "description": "This is Jython Execution Component.", "version": "1.0.0", + "attributes": { + "response-data": { + "required": false, + "type": "json" + } + }, "capabilities": { "component-node": { "type": "tosca.capabilities.Node" diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 3233d2121..e72cf951b 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -1,6 +1,12 @@ { "description": "This is Netconf Transaction Configuration Component API", "version": "1.0.0", + "attributes": { + "response-data": { + "required": false, + "type": "json" + } + }, "capabilities": { "component-node": { "type": "tosca.capabilities.Node" diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json index 498db8246..508380c91 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json @@ -9,6 +9,10 @@ "ansible-command-logs": { "required": true, "type": "string" + }, + "response-data": { + "required": false, + "type": "json" } }, "capabilities": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json index b241aa36f..22596020f 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json @@ -1,6 +1,12 @@ { "description": "This is CLI Transaction Configuration Component API", "version": "1.0.0", + "attributes": { + "response-data": { + "required": false, + "type": "json" + } + }, "capabilities": { "component-node": { "type": "tosca.capabilities.Node" diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py index f7ac1ac35..66c7a98b5 100644 --- a/components/scripts/python/ccsdk_netconf/common.py +++ b/components/scripts/python/ccsdk_netconf/common.py @@ -26,3 +26,4 @@ class ResolutionHelper: def retrieve_resolved_template_from_database(self, key, artifact_template): return ResourceResolutionExtensionsKt.storedContentFromResolvedArtifact(self.component_function, key, artifact_template) + diff --git a/components/scripts/python/ccsdk_netconf/netconf_constant.py b/components/scripts/python/ccsdk_netconf/netconf_constant.py index 534ca9e13..52ac0ae5a 100644 --- a/components/scripts/python/ccsdk_netconf/netconf_constant.py +++ b/components/scripts/python/ccsdk_netconf/netconf_constant.py @@ -8,6 +8,8 @@ PARAM_ACTION = "action" STATUS_SUCCESS = "success" STATUS_FAILURE = "failure" +ATTRIBUTE_RESPONSE_DATA = "response-data" + CONFIG_TARGET_RUNNING = "running" CONFIG_TARGET_CANDIDATE = "candidate" CONFIG_DEFAULT_OPERATION_MERGE = "merge" diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index a942845b9..b3aef11f4 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,5 +1,4 @@ -from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ - CONFIG_DEFAULT_OPERATION_REPLACE +from netconf_constant import * from org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import NetconfExecutorExtensionsKt @@ -60,3 +59,6 @@ class NetconfClient: def discard_change(self): device_response = self.netconf_rpc_client.discardConfig() return device_response + + def set_execution_attribute_response_data(self, response_data): + self.setAttribute(ATTRIBUTE_RESPONSE_DATA, response_data) diff --git a/components/scripts/python/ccsdk_restconf/restconf_client.py b/components/scripts/python/ccsdk_restconf/restconf_client.py index 927c1fedd..6e53dcf93 100644 --- a/components/scripts/python/ccsdk_restconf/restconf_client.py +++ b/components/scripts/python/ccsdk_restconf/restconf_client.py @@ -18,6 +18,7 @@ # ============LICENSE_END========================================================= # from time import sleep +from restconf_constant import * from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import RestconfExecutorExtensionsKt from org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import ResourceResolutionExtensionsKt @@ -92,3 +93,6 @@ class RestconfClient: url = self.__base_odl_url + nf_id self.__log.debug("sending unmount request, url: {}", url) web_client_service.exchangeResource("DELETE", url, "") + + def set_execution_attribute_response_data(self, response_data): + self.setAttribute(ATTRIBUTE_RESPONSE_DATA, response_data) diff --git a/components/scripts/python/ccsdk_restconf/restconf_constant.py b/components/scripts/python/ccsdk_restconf/restconf_constant.py new file mode 100644 index 000000000..2e1c58312 --- /dev/null +++ b/components/scripts/python/ccsdk_restconf/restconf_constant.py @@ -0,0 +1 @@ +ATTRIBUTE_RESPONSE_DATA = "response-data" \ No newline at end of file -- cgit 1.2.3-korg