# See the Copying file included with the OpenSAF distribution for full # licensing terms. # # Author(s): Ericsson # ############################################################################ ''' NTF common utilities ''' from pyosaf import saNtf, saAis import ctypes from pyosaf.utils import decorate saNtfInitialize = decorate(saNtf.saNtfInitialize) saNtfLocalizedMessageFree = decorate(saNtf.saNtfLocalizedMessageFree) saNtfStateChangeNotificationFilterAllocate = decorate( saNtf.saNtfStateChangeNotificationFilterAllocate) saNtfNotificationUnsubscribe = decorate(saNtf.saNtfNotificationUnsubscribe) saNtfNotificationReadInitialize = decorate( saNtf.saNtfNotificationReadInitialize) saNtfInitialize_2 = decorate(saNtf.saNtfInitialize_2) saNtfNotificationReadInitialize_2 = decorate( saNtf.saNtfNotificationReadInitialize_2) saNtfNotificationSubscribe = decorate(saNtf.saNtfNotificationSubscribe) saNtfInitialize_3 = decorate(saNtf.saNtfInitialize_3) saNtfSelectionObjectGet = decorate(saNtf.saNtfSelectionObjectGet) saNtfDispatch = decorate(saNtf.saNtfDispatch) saNtfFinalize = decorate(saNtf.saNtfFinalize) saNtfObjectCreateDeleteNotificationAllocate = decorate(
# See the Copying file included with the OpenSAF distribution for full # licensing terms. # # Author(s): Ericsson # ############################################################################ ''' CLM common utilitites ''' from pyosaf import saClm, saAis from pyosaf.utils import decorate # Decorate the raw saClm* functions with retry and raising exceptions saClmInitialize = decorate(saClm.saClmInitialize) saClmInitialize_3 = decorate(saClm.saClmInitialize_3) saClmInitialize_4 = decorate(saClm.saClmInitialize_4) saClmSelectionObjectGet = decorate(saClm.saClmSelectionObjectGet) saClmDispatch = decorate(saClm.saClmDispatch) saClmFinalize = decorate(saClm.saClmFinalize) saClmClusterTrack = decorate(saClm.saClmClusterTrack) saClmClusterNodeGet = decorate(saClm.saClmClusterNodeGet) saClmClusterNotificationFree = decorate(saClm.saClmClusterNotificationFree) saClmClusterTrack_4 = decorate(saClm.saClmClusterTrack_4) saClmClusterTrackStop = decorate(saClm.saClmClusterTrackStop) saClmClusterNotificationFree_4 = decorate(saClm.saClmClusterNotificationFree_4) saClmClusterNodeGet_4 = decorate(saClm.saClmClusterNodeGet_4) saClmClusterNodeGetAsync = decorate(saClm.saClmClusterNodeGetAsync) saClmResponse_4 = decorate(saClm.saClmResponse_4)
# 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)
SaImmSearchParametersT_2, eSaImmValueTypeT, SaImmAttrModificationT_2, \ eSaImmAttrModificationTypeT from pyosaf.saImmOi import SaImmOiHandleT from pyosaf.utils import log_err, bad_handle_retry, decorate, \ initialize_decorate from pyosaf.utils.immom.object import ImmObject from pyosaf.utils.immom.ccb import marshal_c_array from pyosaf.utils.immom.iterator import SearchIterator from pyosaf.utils.immom.agent import ImmOmAgent from pyosaf.utils.immom.accessor import ImmOmAccessor OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService" # Decorate pure saImmOi* API's with error-handling retry and exception raising saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2) saImmOiSelectionObjectGet = decorate(saImmOi.saImmOiSelectionObjectGet) saImmOiDispatch = decorate(saImmOi.saImmOiDispatch) saImmOiFinalize = decorate(saImmOi.saImmOiFinalize) saImmOiImplementerSet = decorate(saImmOi.saImmOiImplementerSet) saImmOiImplementerClear = decorate(saImmOi.saImmOiImplementerClear) saImmOiClassImplementerSet = decorate(saImmOi.saImmOiClassImplementerSet) saImmOiClassImplementerRelease = \ decorate(saImmOi.saImmOiClassImplementerRelease) saImmOiObjectImplementerSet = decorate(saImmOi.saImmOiObjectImplementerSet) saImmOiObjectImplementerRelease = \ decorate(saImmOi.saImmOiObjectImplementerRelease) saImmOiRtObjectCreate_2 = decorate(saImmOi.saImmOiRtObjectCreate_2) saImmOiRtObjectDelete = decorate(saImmOi.saImmOiRtObjectDelete) saImmOiRtObjectUpdate_2 = decorate(saImmOi.saImmOiRtObjectUpdate_2) saImmOiAdminOperationResult = decorate(saImmOi.saImmOiAdminOperationResult) saImmOiAdminOperationResult_o2 = \
# 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 utilitites ''' from pyosaf import saLog, saAis from pyosaf.utils import decorate LOG_VERSION = saAis.SaVersionT('A', 2, 1) # Decorate LOG functions to add retry loops and error handling saLogInitialize = 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)
from __future__ import print_function import select import itertools from pyosaf.saAis import eSaAisErrorT, unmarshalNullArray, \ unmarshalSaStringTArray from pyosaf import saImm, saImmOi from pyosaf.saImm import eSaImmValueTypeT, eSaImmAttrModificationTypeT, \ eSaImmClassCategoryT, SaImmClassNameT, unmarshalSaImmValue, SaStringT, PY3 from pyosaf.saImmOi import SaImmOiImplementerNameT from pyosaf.utils import SafException, decorate, bad_handle_retry, log_err from pyosaf.utils.immoi import OiAgent from pyosaf.utils.immom.object import ImmObject saImmOiClassImplementerSet = decorate(saImmOi.saImmOiClassImplementerSet) saImmOiImplementerSet = decorate(saImmOi.saImmOiImplementerSet) class AdminOperationParameter(object): """ This class represents an admin operation parameter """ def __init__(self, name, param_type, value): """ Create an instance of an admin operation parameter """ self.name = name self.type = param_type self.value = value def admin_operation_decorate(class_name, op_id): """ Admin operation decorator Decorate the specified function with the provided class name and admin
# ############################################################################ """ IMM OM common utilities """ import uuid from copy import deepcopy from ctypes import pointer from pyosaf import saImmOm, saImm from pyosaf.saAis import saAis, SaVersionT, SaNameT, SaAisErrorT, \ eSaAisErrorT, eSaBoolT, unmarshalNullArray, SaStringT from pyosaf.saImm import eSaImmScopeT, SaImmClassNameT, SaImmAttrNameT from pyosaf.utils import decorate, initialize_decorate, log_err # Decorate pure saImmOm* API's with error-handling retry and exception raising saImmOmInitialize = initialize_decorate(saImmOm.saImmOmInitialize) saImmOmSelectionObjectGet = decorate(saImmOm.saImmOmSelectionObjectGet) saImmOmDispatch = decorate(saImmOm.saImmOmDispatch) saImmOmFinalize = decorate(saImmOm.saImmOmFinalize) saImmOmClassCreate_2 = decorate(saImmOm.saImmOmClassCreate_2) saImmOmClassDescriptionGet_2 = decorate(saImmOm.saImmOmClassDescriptionGet_2) saImmOmClassDescriptionMemoryFree_2 = \ decorate(saImmOm.saImmOmClassDescriptionMemoryFree_2) saImmOmClassDelete = decorate(saImmOm.saImmOmClassDelete) saImmOmSearchInitialize_2 = decorate(saImmOm.saImmOmSearchInitialize_2) saImmOmSearchNext_2 = decorate(saImmOm.saImmOmSearchNext_2) saImmOmSearchFinalize = decorate(saImmOm.saImmOmSearchFinalize) saImmOmAccessorInitialize = decorate(saImmOm.saImmOmAccessorInitialize) saImmOmAccessorGet_2 = decorate(saImmOm.saImmOmAccessorGet_2) saImmOmAccessorFinalize = decorate(saImmOm.saImmOmAccessorFinalize) saImmOmAdminOwnerInitialize = decorate(saImmOm.saImmOmAdminOwnerInitialize) saImmOmAdminOwnerSet = decorate(saImmOm.saImmOmAdminOwnerSet)
# licensing terms. # # Author(s): Ericsson # ############################################################################ ''' NTF common utilities ''' from pyosaf import saNtf, saAis import ctypes from pyosaf.utils import decorate saNtfInitialize = decorate(saNtf.saNtfInitialize) saNtfLocalizedMessageFree = decorate(saNtf.saNtfLocalizedMessageFree) saNtfStateChangeNotificationFilterAllocate = decorate(saNtf.saNtfStateChangeNotificationFilterAllocate) saNtfNotificationUnsubscribe = decorate(saNtf.saNtfNotificationUnsubscribe) saNtfNotificationReadInitialize = decorate(saNtf.saNtfNotificationReadInitialize) saNtfInitialize_2 = decorate(saNtf.saNtfInitialize_2) saNtfNotificationReadInitialize_2 = decorate(saNtf.saNtfNotificationReadInitialize_2) saNtfNotificationSubscribe = decorate(saNtf.saNtfNotificationSubscribe) saNtfInitialize_3 = decorate(saNtf.saNtfInitialize_3) saNtfSelectionObjectGet = decorate(saNtf.saNtfSelectionObjectGet) saNtfDispatch = decorate(saNtf.saNtfDispatch) saNtfFinalize = decorate(saNtf.saNtfFinalize) saNtfObjectCreateDeleteNotificationAllocate = decorate(saNtf.saNtfObjectCreateDeleteNotificationAllocate) saNtfAttributeChangeNotificationAllocate = decorate(saNtf.saNtfAttributeChangeNotificationAllocate) saNtfStateChangeNotificationAllocate = decorate(saNtf.saNtfStateChangeNotificationAllocate) saNtfStateChangeNotificationAllocate_3 = decorate(saNtf.saNtfStateChangeNotificationAllocate_3)