Ejemplo n.º 1
0
def initialize(notification_callback=None):
    """ Initialize the NTF library

    Args:
        notification_callback (SaNtfNotificationCallbackT): Callback to be
            invoked by NTF server to deliver a notification to the subscriber

    Raises:
        SafException: If any NTF API call did not return SA_AIS_OK
    """
    # Set the NTF API version to initialize
    version = SaVersionT('A', 1, 1)

    global _ntf_producer
    _ntf_producer = NtfProducer(version)

    global _ntf_subscriber
    _ntf_subscriber = NtfSubscriber(version)

    rc = _ntf_producer.init()
    if rc != eSaAisErrorT.SA_AIS_OK:
        raise SafException(rc)

    rc = _ntf_subscriber.init(notification_callback)
    if rc != eSaAisErrorT.SA_AIS_OK:
        raise SafException(rc)
Ejemplo n.º 2
0
def _initialize():
    ''' saImmOmInitialize with TRYAGAIN handling '''
    version = SaVersionT('A', 2, 15)

    err = saImmOmInitialize(HANDLE, None, version)

    err = saImmOmAccessorInitialize(HANDLE, ACCESSOR_HANDLE)
Ejemplo n.º 3
0
    def __init__(self, version=None):
        """ Constructor for ClmAgent class

        Args:
            version (SaVersionT): CLM API version
        """
        self.init_version = version if version is not None \
            else SaVersionT('B', 4, 1)
        super(ClmAgent, self).__init__(self.init_version)
Ejemplo n.º 4
0
    def __init__(self, version=None):
        """ Constructor for OmAgentManager class

        Args:
            version (SaVersionT): IMM OM API version
        """
        self.init_version = version if version else SaVersionT('A', 2, 15)
        self.version = None
        self.handle = None
        self.callbacks = None
        self.selection_object = None
Ejemplo n.º 5
0
    def __init__(self, version=None):
        """ Constructor for OiAgent class

        Args:
            version (SaVersionT): OI API version
        """
        self.handle = None
        self.init_version = version if version is not None \
            else SaVersionT('A', 2, 15)
        self.version = None
        self.selection_object = None
        self.callbacks = None
        self.imm_om = None
        self.accessor = None
Ejemplo n.º 6
0
    def __init__(self, version=None):
        """ Constructor for NtfAgent class

        Args:
            version (SaVersionT): NTF API version
        """
        self.init_version = version if version is not None \
            else SaVersionT('A', 1, 1)
        self.version = None
        self.handle = None
        self.callbacks = None
        self.sel_obj = SaSelectionObjectT()
        self.ntf_notif_function = None
        self.ntf_notif_discarded_function = None
Ejemplo n.º 7
0
    def __init__(self, service_user_name="", version=None):
        """ Constructor for SafLogger class

        Args:
            service_user_name (str): Logger's service user name
        """
        self.init_version = version if version else SaVersionT('A', 2, 3)
        self.version = None
        self.invocation = 0
        self.log_handle = None
        self.stream_handle = None
        self.sel_obj = SaSelectionObjectT()
        self.record = SaLogRecordT()
        self.log_write_error = eSaAisErrorT.SA_AIS_OK
        self.callbacks = SaLogCallbacksT()
        self.callbacks.saLogWriteLogCallback = \
            SaLogWriteLogCallbackT(self._log_write_callback)
        self.logger_info = LoggerInfo(service_user_name)
Ejemplo n.º 8
0
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
# under the GNU Lesser General Public License Version 2.1, February 1999.
# The complete license can be accessed from the following location:
# http://opensource.org/licenses/lgpl-license.php
# See the Copying file included with the OpenSAF distribution for full
# licensing terms.
#
# Author(s): Ericsson
#
############################################################################
""" LOG common utilities """
from pyosaf.saAis import SaVersionT
from pyosaf import saLog
from pyosaf.utils import decorate, initialize_decorate

LOG_VERSION = SaVersionT('A', 2, 1)

# Decorate pure saLog* API's with error-handling retry and exception raising
saLogInitialize = initialize_decorate(saLog.saLogInitialize)
saLogSelectionObjectGet = decorate(saLog.saLogSelectionObjectGet)
saLogDispatch = decorate(saLog.saLogDispatch)
saLogFinalize = decorate(saLog.saLogFinalize)
saLogStreamOpen_2 = decorate(saLog.saLogStreamOpen_2)
saLogStreamOpenAsync_2 = decorate(saLog.saLogStreamOpenAsync_2)
saLogWriteLog = decorate(saLog.saLogWriteLog)
saLogWriteLogAsync = decorate(saLog.saLogWriteLogAsync)
saLogStreamClose = decorate(saLog.saLogStreamClose)
saLogLimitGet = decorate(saLog.saLogLimitGet)
Ejemplo n.º 9
0
def initialize(callbacks=None):
    ''' Initializes IMM OI '''

    version = SaVersionT('A', 2, 15)

    saImmOiInitialize_2(HANDLE, callbacks, version)