aboutsummaryrefslogtreecommitdiffstats
path: root/components/model-catalog
diff options
context:
space:
mode:
Diffstat (limited to 'components/model-catalog')
-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