summaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model/test-blueprint
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-07-24 14:13:22 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-24 14:13:22 +0000
commit6a949fae1d76bd133a198c54c5a616c9835527b5 (patch)
treee9bd44047a55cdd54a73ef42763c4cd86298b314 /components/model-catalog/blueprint-model/test-blueprint
parent5e6fbc2ee27fc9514d026d17093ba7530184b55f (diff)
parenta0140dea9c608d745767574ac621ca0060a2bddc (diff)
Merge "Refactor Netconf script component parent."
Diffstat (limited to 'components/model-catalog/blueprint-model/test-blueprint')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py70
1 files changed, 34 insertions, 36 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
index f146e8123..2fd6c6659 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
@@ -16,39 +16,37 @@ import netconf_constant
from common import ResolutionHelper
from java.lang import Exception as JavaException
from netconfclient import NetconfClient
-from org.onap.ccsdk.cds.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)
-
- payload = rr.resolve_and_generate_message_from_template_prefix("hostname")
-
- nc.connect()
- response = nc.lock()
- if not response.isSuccess():
- log.error(response.errorMessage)
-
- nc.edit_config(message_content=payload, edit_default_peration="none")
- nc.validate()
- nc.discard_change()
- nc.validate()
- nc.commit()
- 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
+from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction
+
+class NetconfRpcExample(AbstractScriptComponentFunction):
+
+ def process(self, execution_request):
+ try:
+ log = globals()[netconf_constant.SERVICE_LOG]
+ print(globals())
+ nc = NetconfClient(log, self, "netconf-connection")
+ rr = ResolutionHelper(self)
+
+ payload = rr.resolve_and_generate_message_from_template_prefix("hostname")
+
+ nc.connect()
+ response = nc.lock()
+ if not response.isSuccess():
+ log.error(response.errorMessage)
+
+ nc.edit_config(message_content=payload, edit_default_peration="none")
+ nc.validate()
+ nc.discard_change()
+ nc.validate()
+ nc.commit()
+ 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