aboutsummaryrefslogtreecommitdiffstats
path: root/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py
blob: 05fe2e08234e4165a06dc6fc4cdf98617acc476d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor import \
    ResourceAssignmentProcessor
from org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils import \
    ResourceAssignmentUtils
from org.onap.ccsdk.cds.controllerblueprints.core import \
    BluePrintProcessorException


class AbstractRAProcessor(ResourceAssignmentProcessor):

    def process(self, resource_assignment):
        print "Processing.."
        return None

    def recover(self, runtime_exception, resource_assignment):
        print "Recovering.."
        return None

    def set_resource_data_value(self, resource_assignment, value):
        try:
            if value is not None:
                ResourceAssignmentUtils.Companion.setResourceDataValue(
                    resource_assignment, self.raRuntimeService, value)
            else:
                ResourceAssignmentUtils.Companion.setFailedResourceDataValue(
                    resource_assignment, "Fail to resolve value")
        except BluePrintProcessorException, err:
            raise BluePrintProcessorException(
                "Error on resource assignment. Message = " + err.message)