diff options
author | Dan Timoney <dtimoney@att.com> | 2023-06-14 17:07:55 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2023-06-14 17:07:55 -0400 |
commit | 2593494642c8f425f5e6897241312006563797b1 (patch) | |
tree | 7b0311126f48415263ab3f011851a6dbf9b14598 | |
parent | 5e9a1da4ef37b6b47ba428325478b79466d7d181 (diff) |
Convert scripts to python3
Convert python2 scripts to python3
Issue-ID: CCSDK-3906
Signed-off-by: Dan Timoney <dtimoney@att.com>
Change-Id: I68b82108c5cd51a99735f65f964b8ebc16181c1b
15 files changed, 34 insertions, 34 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 2fd6c6659..a11b0d4b7 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 @@ -42,11 +42,11 @@ class NetconfRpcExample(AbstractScriptComponentFunction): nc.unlock() nc.disconnect() - except JavaException, err: + except JavaException as err: log.error("Java Exception in the script {}", err) - except Exception, err: + except Exception as err: log.error("Python Exception in the script {}", err) def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py index 86c9ff141..1ee41825d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py @@ -5,9 +5,9 @@ from blueprint_constants import * class SamplePythonComponentNode(JythonComponentFunction): def process(self, execution_request): - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def recover(self, runtime_exception, execution_request): - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py index 30b9ff951..beb544b2c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py @@ -10,7 +10,7 @@ class SampleRAProcessor(AbstractRAProcessor): def process(self, execution_request): AbstractRAProcessor.process(self, execution_request) - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) if self.ra_valid is True: value = self.resolve_values_script(execution_request, self.value_to_resolve) self.set_resource_data_value(execution_request, value) @@ -20,10 +20,10 @@ class SampleRAProcessor(AbstractRAProcessor): def recover(self, runtime_exception, execution_request): AbstractRAProcessor.recover(self, runtime_exception, execution_request) - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def resolve_values_script(self, execution_request, value_to_resolve): # TODO : DO business logic here - print "Resolve value for " + value_to_resolve + " here..." + print("Resolve value for " + value_to_resolve + " here...") return "test_python" diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py index 5038caa77..15eb38c16 100755 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py @@ -37,12 +37,12 @@ class DefaultGetNetConfig(AbstractPythonComponentFunction): if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage - except Exception, err: + except Exception as err: log.info("Exception in the script {}",err.getMessage()) status = netconf_constant.STATUS_FAILURE errorMessage = "Get Running Config Failure ::"+err.getMessage() def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py index 86c9ff141..1ee41825d 100755 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py @@ -5,9 +5,9 @@ from blueprint_constants import * class SamplePythonComponentNode(JythonComponentFunction): def process(self, execution_request): - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def recover(self, runtime_exception, execution_request): - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py index acf12b333..c76c589c2 100755 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py @@ -8,10 +8,10 @@ class SampleRAProcessor(AbstractRAProcessor): AbstractRAProcessor.__init__(self) def process(self, resource_assignment): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH) self.set_resource_data_value(resource_assignment, "") return None def recover(self, runtime_exception, resource_assignment): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py index 2146be7ce..7e80fd813 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/ConfigDeploy.py @@ -48,5 +48,5 @@ class ConfigDeploy(NetconfComponentFunction): def recover(self, runtime_exception, execution_request): log.error("Exception in the script {}", runtime_exception) - print self.addError(runtime_exception.cause.message) + 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 8482a89d3..66c6e32c6 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 @@ -38,5 +38,5 @@ class DescriptionExample(AbstractRAProcessor): def recover(self, runtime_exception, resource_assignment): log.error("Exception in the script {}", runtime_exception) - print self.addError(runtime_exception.cause.message) + 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 40b3c3dcd..dbfdade2b 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 @@ -39,5 +39,5 @@ class Rollback(NetconfComponentFunction): def recover(self, runtime_exception, execution_request): log.error("Exception in the script {}", runtime_exception) - print self.addError(runtime_exception.cause.message) + print(self.addError(runtime_exception.cause.message)) return None diff --git a/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py index a9d4d454e..916ef9b43 100644 --- a/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py +++ b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py @@ -7,9 +7,9 @@ class AbstractPythonComponentFunction(AbstractComponentFunction): AbstractComponentFunction.__init__(self) def process(self, execution_request): - print "Processing calling from parent..." + print("Processing calling from parent...") return None def recover(self, runtime_exception, execution_request): - print "Recovering calling from parent..." + print("Recovering calling from parent...") return None diff --git a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py index 05fe2e082..9f0fd4a71 100644 --- a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py +++ b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py @@ -9,11 +9,11 @@ from org.onap.ccsdk.cds.controllerblueprints.core import \ class AbstractRAProcessor(ResourceAssignmentProcessor): def process(self, resource_assignment): - print "Processing.." + print("Processing..") return None def recover(self, runtime_exception, resource_assignment): - print "Recovering.." + print("Recovering..") return None def set_resource_data_value(self, resource_assignment, value): @@ -24,6 +24,6 @@ class AbstractRAProcessor(ResourceAssignmentProcessor): else: ResourceAssignmentUtils.Companion.setFailedResourceDataValue( resource_assignment, "Fail to resolve value") - except BluePrintProcessorException, err: + except BluePrintProcessorException as err: raise BluePrintProcessorException( "Error on resource assignment. Message = " + err.message) diff --git a/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py index a1e6c5d3b..ca0be5761 100644 --- a/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py +++ b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py @@ -1,5 +1,5 @@ -from abstract_blueprint_function import AbstractPythonComponentFunction -from blueprint_constants import * +from .abstract_blueprint_function import AbstractPythonComponentFunction +from .blueprint_constants import * class SampleBlueprintComponent(AbstractPythonComponentFunction): @@ -9,10 +9,10 @@ class SampleBlueprintComponent(AbstractPythonComponentFunction): def process(self, execution_request): super(SamplePythonComponentNode, self).process(execution_request) - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def recover(self, runtime_exception, execution_request): super(SamplePythonComponentNode, self).recover(runtime_exception, execution_request) - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py index fa821082e..5e789815b 100644 --- a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py +++ b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py @@ -1,14 +1,14 @@ -from abstract_ra_processor import AbstractRAProcessor -from blueprint_constants import * +from .abstract_ra_processor import AbstractRAProcessor +from .blueprint_constants import * class SampleRAProcessorFunction(AbstractRAProcessor): def process(self, resource_assignment): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH) self.set_resource_data_value(resource_assignment, "") return None def recover(self, runtime_exception, resource_assignment): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/PythonTestScript.py b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/PythonTestScript.py index 42b611b88..d2d023b9d 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/PythonTestScript.py +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/PythonTestScript.py @@ -1,9 +1,9 @@ class PythonTestScript(): def process(self, execution_request): - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def recover(self, runtime_exception, execution_request): - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/scripts/SamplePythonComponentNode.py b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/scripts/SamplePythonComponentNode.py index f1b614a59..7150e4378 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/scripts/SamplePythonComponentNode.py +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/scripts/SamplePythonComponentNode.py @@ -5,10 +5,10 @@ from blueprint_constants import * class SamplePythonComponentNode(AbstractPythonComponentFunction): def process(self, execution_request): - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None def recover(self, runtime_exception, execution_request): - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + print("Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH) return None |