Exemple #1
0
 def uncfgNtfOrg(self):
     for notifyName, paramsName in self.__knownNotifyNames.values():
         config.delNotificationTarget(self.snmpEngine, notifyName,
                                      paramsName)
     for k, subTree in self.__knownAuths.items():
         securityModel, securityName, securityLevel = k
         config.delTrapUser(self.snmpEngine, securityModel, securityName,
                            securityLevel, subTree)
     self.uncfgCmdGen()
Exemple #2
0
    def unconfigure(self,
                    snmpEngine,
                    authData=None,
                    contextName=null,
                    **options):
        cache = self._getCache(snmpEngine)

        if authData:
            authDataKey = authData.securityName, authData.securityModel, authData.securityLevel, contextName

            if authDataKey in cache['auth']:
                authDataKeys = (authDataKey, )

            else:
                raise error.PySnmpError('Unknown authData %s' % (authData, ))

        else:
            authDataKeys = tuple(cache['auth'])

        addrNames, paramsNames = self._cmdGenLcdCfg.unconfigure(
            snmpEngine, authData, contextName, **options)

        notifyAndParamsNames = [(cache['name'][x], x)
                                for x in cache['name'].keys()
                                if x[0] in paramsNames]

        for (notifyName, paramsName,
             useCount), notifyNameKey in notifyAndParamsNames:
            useCount -= 1

            if useCount:
                cache['name'][notifyNameKey] = notifyName, paramsName, useCount

            else:
                config.delNotificationTarget(snmpEngine, notifyName,
                                             paramsName)
                del cache['name'][notifyNameKey]

        for authDataKey in authDataKeys:
            authDataX, subTree, useCount = cache['auth'][authDataKey]

            useCount -= 1

            if useCount:
                cache['auth'][authDataKey] = authDataX, subTree, useCount

            else:
                config.delTrapUser(snmpEngine, authDataX.securityModel,
                                   authDataX.securityName,
                                   authDataX.securityLevel, subTree)

                del cache['auth'][authDataKey]
Exemple #3
0
 def uncfgNtfOrg(self):
     for notifyName, paramsName in self.__knownNotifyNames.values():
         config.delNotificationTarget(
             self.snmpEngine, notifyName, paramsName
             )
     for authData, subTree in self.__knownAuths.items():
         config.delTrapUser(
             self.snmpEngine,
             authData.securityModel,
             authData.securityName,
             authData.securityLevel,
             subTree
             )
     self.uncfgCmdGen()
Exemple #4
0
    def unconfigure(self, snmpEngine, authData=None, contextName=null, **options):
        cache = self._getCache(snmpEngine)

        if authData:
            authDataKey = authData.securityName, authData.securityModel, authData.securityLevel, contextName

            if authDataKey in cache['auth']:
                authDataKeys = (authDataKey,)

            else:
                raise error.PySnmpError('Unknown authData %s' % (authData,))

        else:
            authDataKeys = tuple(cache['auth'])

        addrNames, paramsNames = self._cmdGenLcdCfg.unconfigure(
            snmpEngine, authData, contextName, **options)

        notifyAndParamsNames = [
            (cache['name'][x], x) for x in cache['name'].keys()
            if x[0] in paramsNames
        ]

        for (notifyName, paramsName, useCount), notifyNameKey in notifyAndParamsNames:
            useCount -= 1

            if useCount:
                cache['name'][notifyNameKey] = notifyName, paramsName, useCount

            else:
                config.delNotificationTarget(snmpEngine, notifyName, paramsName)
                del cache['name'][notifyNameKey]

        for authDataKey in authDataKeys:
            authDataX, subTree, useCount = cache['auth'][authDataKey]

            useCount -= 1

            if useCount:
                cache['auth'][authDataKey] = authDataX, subTree, useCount

            else:
                config.delTrapUser(
                    snmpEngine, authDataX.securityModel, authDataX.securityName,
                    authDataX.securityLevel, subTree)

                del cache['auth'][authDataKey]
    def uncfgNtfOrg(self, authData=None):
        if authData:
            authDataKey = authData.securityName, authData.securityModel
            if authDataKey in self.__knownAuths:
                authDataKeys = ( authDataKey, )
            else:
                raise error.PySnmpError('Unknown authData %s' % (authData,))
        else:
            authDataKeys = self.__knownAuths.keys()

        addrNames, paramsNames = self.uncfgCmdGen(authData)

        notifyAndParamsNames = [ (self.__knownNotifyNames[x], x) for x in self.__knownNotifyNames.keys() if x[0] in paramsNames ]

        for (notifyName, paramsName, useCount), notifyNameKey in notifyAndParamsNames:
            useCount -= 1
            if useCount:
                self.__knownNotifyNames[notifyNameKey] = notifyName, paramsName, useCount
            else:
                config.delNotificationTarget(
                    self.snmpEngine, notifyName, paramsName
                )
                del self.__knownNotifyNames[notifyNameKey]

        for authDataKey in authDataKeys:
            authDataX, subTree, useCount = self.__knownAuths[authDataKey]
            useCount -= 1
            if useCount:
                self.__knownAuths[authDataKey] = authDataX, subTree, useCount
            else:
                config.delTrapUser(
                    self.snmpEngine,
                    authDataX.securityModel,
                    authDataX.securityName,
                    authDataX.securityLevel,
                    subTree
                )
                del self.__knownAuths[authDataKey]
    def uncfgNtfOrg(self, authData=None):
        if authData:
            authDataKey = authData.securityName, authData.securityModel
            if authDataKey in self.__knownAuths:
                authDataKeys = (authDataKey, )
            else:
                raise error.PySnmpError('Unknown authData %s' % (authData, ))
        else:
            authDataKeys = self.__knownAuths.keys()

        addrNames, paramsNames = self.uncfgCmdGen(authData)

        notifyAndParamsNames = [(self.__knownNotifyNames[x], x)
                                for x in self.__knownNotifyNames.keys()
                                if x[0] in paramsNames]

        for (notifyName, paramsName,
             useCount), notifyNameKey in notifyAndParamsNames:
            useCount -= 1
            if useCount:
                self.__knownNotifyNames[
                    notifyNameKey] = notifyName, paramsName, useCount
            else:
                config.delNotificationTarget(self.snmpEngine, notifyName,
                                             paramsName)
                del self.__knownNotifyNames[notifyNameKey]

        for authDataKey in authDataKeys:
            authDataX, subTree, useCount = self.__knownAuths[authDataKey]
            useCount -= 1
            if useCount:
                self.__knownAuths[authDataKey] = authDataX, subTree, useCount
            else:
                config.delTrapUser(self.snmpEngine, authDataX.securityModel,
                                   authDataX.securityName,
                                   authDataX.securityLevel, subTree)
                del self.__knownAuths[authDataKey]