summaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model/test-blueprint
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-07-18 16:59:19 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-07-23 15:09:32 -0400
commita0140dea9c608d745767574ac621ca0060a2bddc (patch)
treee09a1a3f34b4d5c2c7988385a375d8f3cac64a1d /components/model-catalog/blueprint-model/test-blueprint
parent4e7621ef49d87745df4eb05a4c7279eb2a1356ad (diff)
Refactor Netconf script component parent.
Change-Id: Ibbec8cd5785372a89e14a86d4e6ff7f9fed4aad2 Issue-ID: CCSDK-1499 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com> Signed-off-by: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com>
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