Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
validation_service_rpc.py 1.27 KiB

from lofar.messaging.RPC import RPC, RPCException, RPCWrapper
from config import VALIDATION_BUSNAME, VALIDATION_SERVICENAME
import logging
logger = logging.getLogger(__file__)
from ast import literal_eval

class ValidationRPC(RPCWrapper):

    def __init__(self, busname=VALIDATION_BUSNAME,
                 servicename=VALIDATION_SERVICENAME,
                 broker=None,
                 timeout=120):
        super(ValidationRPC, self).__init__(busname, servicename, broker, timeout=timeout)

    def validate_trigger_specification(self, xml):
        logger.info("Requesting validation of trigger XML")
        result = self.rpc('validate_trigger_specification', xml=xml)
        logger.info("Received validation result -> " +str(result))
        return result

    def validate_specification(self, xml):
        logger.info("Requesting validation of specification XML")
        result = self.rpc('validate_specification', xml=xml)
        logger.info("Received validation result -> " +str(result))
        return result


    def validate_mom_specification(self, xml):
        logger.info("Requesting validation of MoM specification XML")
        result = self.rpc('validate_mom_specification', xml=xml)
        logger.info("Received validation result -> " +str(result))
        return result