aboutsummaryrefslogtreecommitdiffstats
path: root/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py
blob: 9f0fd4a712383d22f40a071f5af65660e2ac7060 (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 as err:
            raise BluePrintProcessorException(
                "Error on resource assignment. Message = " + err.message)