summaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python
diff options
context:
space:
mode:
Diffstat (limited to 'components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py (renamed from components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py)14
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py36
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py32
3 files changed, 34 insertions, 48 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py
index 7663a875e..66d12edae 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py
@@ -14,16 +14,14 @@
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):
+class ConfigDeploy(NetconfComponentFunction):
def process(self, execution_request):
- try:
log = globals()[netconf_constant.SERVICE_LOG]
print(globals())
@@ -51,11 +49,7 @@ class NetconfRpcExample(NetconfComponentFunction):
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 self.addError(runtime_exception.getMessage())
- return None
+ log.error("Exception in the script {}", runtime_exception)
+ print self.addError(runtime_exception.cause.message)
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py
index 4cf635afe..8482a89d3 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py
@@ -19,28 +19,24 @@ from java.lang import Exception as JavaException
class DescriptionExample(AbstractRAProcessor):
def process(self, resource_assignment):
- try:
- # get dependencies result
- value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type")
-
- # logic based on dependency outcome
- result = ""
- if value == "vfw":
- result = "This is the Virtual Firewall entity"
- elif value == "vsn":
- result = "This is the Virtual Sink entity"
- elif value == "vpg":
- result = "This is the Virtual Packet Generator"
+ # get dependencies result
+ value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type")
+
+ # logic based on dependency outcome
+ result = ""
+ if value == "vfw":
+ result = "This is the Virtual Firewall entity"
+ elif value == "vsn":
+ result = "This is the Virtual Sink entity"
+ elif value == "vpg":
+ result = "This is the Virtual Packet Generator"
- # set value for resource getting currently resolved
- self.set_resource_data_value(resource_assignment, result)
+ # set value for resource getting currently resolved
+ self.set_resource_data_value(resource_assignment, result)
- except JavaException, err:
- log.error("Java Exception in the script {}", err)
- except Exception, err:
- log.error("Python Exception in the script {}", err)
return None
def recover(self, runtime_exception, resource_assignment):
- print self.addError(runtime_exception.getMessage())
- return None \ No newline at end of file
+ log.error("Exception in the script {}", runtime_exception)
+ print self.addError(runtime_exception.cause.message)
+ return None
diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py
index a2bef328e..40b3c3dcd 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py
@@ -14,7 +14,6 @@
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
@@ -23,25 +22,22 @@ from org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import \
class Rollback(NetconfComponentFunction):
def process(self, execution_request):
- try:
- log = globals()[netconf_constant.SERVICE_LOG]
- print(globals())
- nc = NetconfClient(log, self, "netconf-connection")
- rr = ResolutionHelper(self)
+ log = globals()[netconf_constant.SERVICE_LOG]
+ print(globals())
- # rollback config on device
- nc.connect()
- payloadHostnameRollback = rr.resolve_and_generate_message_from_template_prefix("junos-rollback-RPC")
- nc.invoke_rpc(payloadHostnameRollback)
- nc.commit()
- nc.disconnect()
+ nc = NetconfClient(log, self, "netconf-connection")
+ rr = ResolutionHelper(self)
- except JavaException, err:
- log.error("Java Exception in the script {}", err)
- except Exception, err:
- log.error("Python Exception in the script {}", err)
+ # rollback config on device
+ nc.connect()
+ payloadHostnameRollback = rr.resolve_and_generate_message_from_template_prefix("junos-rollback-RPC")
+ nc.invoke_rpc(payloadHostnameRollback)
+ nc.commit()
+ nc.disconnect()
+ return None
def recover(self, runtime_exception, execution_request):
- print self.addError(runtime_exception.getMessage())
- return None
+ log.error("Exception in the script {}", runtime_exception)
+ print self.addError(runtime_exception.cause.message)
+ return None