def createSecToGroupTableEntry (self, trxContext, securityModel, securityName): self._log("create-sec-to-group-table-entry").debug2("called. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) """ create an entry with the securityName in SNMP-VIEW-BASED-ACM-MIB vacmSecurityToGroupTable vacmSecurityToGroupEntry set vacmSecurityModel to securityModel set vacmSecurityName to securityName set vacmGroupName to notif-only """ self._log("create-sec-to-group-table-entry").debug2("called. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) targetKeyPath = KeyPath() valVacm = Value() (tag, ns, prefix) = ("SNMP-VIEW-BASED-ACM-MIB", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacm.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valVacm) tagValueList = TagValues() valVacmSecToGroupTable = Value() (tag, ns, prefix) = ("vacmSecurityToGroupTable", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacmSecToGroupTable.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valVacmSecToGroupTable) valBegin = Value() (tag, ns, prefix) = ("vacmSecurityToGroupEntry", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKeyModel = Value() valKeyModel.setInt32(securityModel) tagValueList.push(("vacmSecurityModel", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valKeyModel) valKeySecName = Value() valKeySecName.setString(securityName) tagValueList.push(("vacmSecurityName", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valKeySecName) # vacmGroupName to notif-only valGroupName = Value() valGroupName.setString(self.AC_NOTIF_ONLY) tagValueList.push(("vacmGroupName", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valGroupName) valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) valTargetParamTable = Value() (tag, ns, prefix) = ("vacmSecurityToGroupTable","http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valTargetParamTable.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetParamTable) res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext) if res != ReturnCodes.kOk: self._log('create-sec-to-group-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("create-sec-to-group-table-entry-done").debug2("done. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) return ReturnCodes.kOk
def _getSelfKeyPath (self, opV , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("op-y", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(opV); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("op-v", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("dns", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("name-resolution", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("system", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("housekeeper", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log", "qt-log")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log", "qt-log")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("log", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log", "qt-log")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("rules", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("content", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def removeTargetParamTableEntry (self, trxContext, entryName): self._log("remove-target-param-table-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName) pathToDelete = KeyPath() valTarget = Value() (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTarget.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valTarget) valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetParamsTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valTargetAddrTable) valEntry = Value() (tag, ns, prefix) = ("snmpTargetParamsEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valEntry.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valEntry) valKey = Value() valKey.setString(entryName) pathToDelete.addKeyPathPostfix(valKey) res = self._maapiDomain.writeMaapi(None, None, trxContext, itemsToDelete=[pathToDelete]) if res != ReturnCodes.kOk: self._log('remove-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("remove-target-addr-table-entry-done").debug2("done. trxContext=%s, entryName=%s", trxContext, entryName) return ReturnCodes.kOk
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("alarm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans", "qt-pltf-fans")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("fans", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans", "qt-pltf-fans")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("platform", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform", "qt-pltf")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self, lll , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("bbb", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lll); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lll", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("base", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self, controller , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(controller); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("controller", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-controller", "qt-strg-ctrl")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("storage", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage", "qt-strg")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self, process , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("execution", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(process); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("process", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("neighbors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("ipv6", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("network", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network", "qt-net")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self, kid , toys , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(toys); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("toys", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(kid); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("kid", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def s_create (cls, logger, domain): __pychecker__="no-argsused" logger('s-create-blinkystaticresolution').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyStaticResolution._validationPointId, BlinkyStaticResolution._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("static", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("name-resolution", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("system", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyStaticResolution(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def setVersionInTargetParamTableEntry (self, trxContext, entryName, snmpVersion): """ sets the entry with the entryName in SNMP-TARGET-MIB snmpTargetParamsTable snmpTargetParamsEntry set snmpTargetParamsMPModel to 0 (v1) or 1 (v2c) set snmpTargetParamsSecurityModel to 1 (v1) or 2 (v2c) """ self._log("set-version-in-target-param-table-entry").debug2("called. trxContext=%s, entryName=%s, snmpVersion=%s", trxContext, entryName, snmpVersion) targetKeyPath = KeyPath() valTarget = Value() (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTarget.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valTarget) valTargetParamTable = Value() (tag, ns, prefix) = ("snmpTargetParamsTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetParamTable.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valTargetParamTable) valEntry = Value() (tag, ns, prefix) = ("snmpTargetParamsEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valEntry.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valEntry) valKey = Value() valKey.setString(entryName) targetKeyPath.addKeyPathPostfix(valKey) tagValueList = TagValues() valMPModel = Value() # snmpTargetParamsMPModel to 0 (v1) or 1 (v2c) if snmpVersion == SnmpNotificationVersionType.kV1: valMPModel.setInt32(self.MP_MODEL_V1) elif snmpVersion == SnmpNotificationVersionType.kV2c: valMPModel.setInt32(self.MP_MODEL_V2C) tagValueList.push(("snmpTargetParamsMPModel", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valMPModel) # snmpTargetParamsSecurityModel to 1 (v1) valSecurityModel = Value() if snmpVersion == SnmpNotificationVersionType.kV1: valSecurityModel.setInt32(self.SECURITY_MODEL_V1) elif snmpVersion == SnmpNotificationVersionType.kV2c: valSecurityModel.setInt32(self.SECURITY_MODEL_V2C) tagValueList.push(("snmpTargetParamsSecurityModel", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valSecurityModel) res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext) if res != ReturnCodes.kOk: self._log('create-target-param-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("set-version-in-target-param-table-entry-done").debug2("done. trxContext=%s, entryName=%s, snmpVersion=%s", trxContext, entryName, snmpVersion) return ReturnCodes.kOk
def s_create (cls, logger, alien, domain): __pychecker__="no-argsused" logger('s-create-blinkystatuswrapper').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyStatusWrapper._validationPointId, BlinkyStatusWrapper._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("status-wrapper", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(alien); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("root", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyStatusWrapper(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def s_create (cls, logger, lll, domain): __pychecker__="no-argsused" logger('s-create-blinkyccc').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyCcc._validationPointId, BlinkyCcc._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("ccc", "http://qwilt.com/model/benchmark", "bnch")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lll); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lll", "http://qwilt.com/model/benchmark", "bnch")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("base", "http://qwilt.com/model/benchmark", "bnch")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyCcc(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("list-ordered-by-user", "http://qwilt.com/model/lake-example", "lake-example")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("chair", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example", "se")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("generation-dummy", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def __init__(self, logger, dpDomain, maapiDomain, configNode): self._log = logger.createLoggerSameModule( G_GROUP_NAME_SNMP_MANAGER_BLINKY_COMMUNITY_TRANSFORMATOR) self._dpDomain = dpDomain self._maapiDomain = maapiDomain self._configNode = configNode self._relativeKeyPath = KeyPath() self._keyPath = copy.deepcopy(configNode.getKeyPath()) xmlVal = Value() xmlVal.setXmlTag( ("community", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlVal) self._callpointName = "tech-snmp-community-callpoint" self._readSecurityName = "all-read-only" self._keyPathForCursor = KeyPath() valCommunity = Value() (tag, ns, prefix) = ( "SNMP-COMMUNITY-MIB", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunity.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valCommunity) valCommunityTable = Value() (tag, ns, prefix) = ( "snmpCommunityTable", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunityTable.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valCommunityTable) valEntry = Value() (tag, ns, prefix) = ( "snmpCommunityEntry", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valEntry.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valEntry) self._communityUtils = CommunityUtils(self._log, self._maapiDomain, self._keyPathForCursor)
def _getSelfKeyPath(self, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag( ("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("interfaces", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag( ("list-ordered-by-user", "http://qwilt.com/model/lake-example", "lake-example")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "pre-topper", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-pre-topper", "qtc-pt")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("content", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, alien, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(alien) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(( "alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(( "root", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "chair", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example", "se")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def setDestinationInTargetTableEntry (self, trxContext, entryName, ipAddress): self._log("set-destination-in-target-table-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName) targetKeyPath = KeyPath() valTarget = Value() (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTarget.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valTarget) tagValueList = TagValues() valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetAddrTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetAddrTable) valBegin = Value() (tag, ns, prefix) = ("snmpTargetAddrEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKey = Value() valKey.setString(entryName) tagValueList.push(("snmpTargetAddrName", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valKey) # snmpTargetAddrTAddress to 0.0.0.0.0.162 valTAddr = Value() addrStr = ipAddress valTAddr.setBinary(addrStr) tagValueList.push(("snmpTargetAddrTAddress", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valTAddr) valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetAddrTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetAddrTable) res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext) if res != ReturnCodes.kOk: self._log('get-destination-in-target-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("set-destination-in-target-table-entry-done").debug2("done. trxContext=%s, entryName=%s", trxContext, entryName) return ReturnCodes.kOk
def registerOperNodeToDomain(self, operNode): for logFunc in self._log("register-oper-node-to-domain").debug1Func(): logFunc("Called, operNode=%s", operNode) operRelativePath = KeyPath() operNode.getOperRelativePath(operRelativePath) callpointName = operNode.getCallpointName() res = operNode.getDomain().registerOperCallpoint( callpointName, self, operRelativePath, operNode) if res != ReturnCodes.kOk: for logFunc in self._log( "register-oper-node-to-domain-register-oper-callpoint-failed" ).errorFunc(): logFunc( "domain->registerOperCallpoint() failed. callpointName=%s, myKeyPath=%s, operRelativePath=%s, operNode=%s, res=%s", callpointName, self.myKeyPath, operRelativePath, operNode, res) return ReturnCodes.kGeneralError self.myRegisteredOperNodes.append(operNode) for logFunc in self._log( "register-oper-node-to-domain-done").debug1Func(): logFunc("Done, operNode=%s", operNode) return ReturnCodes.kOk
def unregisterOperNodeFromDomain(self, operNode): for logFunc in self._log( "unregister-oper-node-from-domain").debug1Func(): logFunc("Called, operNode=%s", operNode) self.myRegisteredOperNodes.remove(operNode) callpointName = operNode.getCallpointName() operRelativePath = KeyPath() operNode.getOperRelativePath(operRelativePath) res = operNode.getDomain().unregisterCallpoint(callpointName, self.getKeyPath(), operRelativePath) if res != ReturnCodes.kOk: for logFunc in self._log( "unregister-oper-node-from-domain-unregister-callpoint-failed" ).errorFunc(): logFunc( "domain->unregisterCallpoint() failed. callpointName=%s, myKeyPath=%s, operRelativePath=%s, operNode=%s, res=%s", callpointName, self.myKeyPath, operRelativePath, operNode, res) return ReturnCodes.kGeneralError for logFunc in self._log( "unregister-oper-node-from-domain-done").debug1Func(): logFunc("Done, operNode=%s", operNode) return ReturnCodes.kOk
def __init__ (self, logger, dpDomain, maapiDomain, configNode): self._log = logger.createLoggerSameModule(G_GROUP_NAME_SNMP_MANAGER_BLINKY_SNMP_TRANSFORMATOR) self._dpDomain = dpDomain self._maapiDomain = maapiDomain self._relativeKeyPath = KeyPath() self._keyPath = copy.deepcopy(configNode.getKeyPath()) xmlVal = Value() xmlVal.setXmlTag(("snmp", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlVal) self._callpointName = "tech-snmp-callpoint" self._readSecurityName = "all-read-only" self._keyPathSnmpV2 = KeyPath() valMib = Value() (tag, ns, prefix) = ("SNMPv2-MIB", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valMib.setXmlTag((tag, ns, prefix)) self._keyPathSnmpV2.addKeyPathPostfix(valMib) valSystem = Value() (tag, ns, prefix) = ("system", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valSystem.setXmlTag((tag, ns, prefix)) self._keyPathSnmpV2.addKeyPathPostfix(valSystem)
def __init__(self, logger, maapiDomain, keyPathForCursor): self._log = logger.createLoggerSameModule( G_GROUP_NAME_SNMP_MANAGER_BLINKY_COMMUNITY_UTILS) self._maapiDomain = maapiDomain self._relativeKeyPath = KeyPath() self._keyPathForCursor = copy.deepcopy(keyPathForCursor)
def _getSelfKeyPath(self, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def s_create(cls, logger, domain): __pychecker__ = "no-argsused" logger('s-create-blinkyreporting').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyReporting._validationPointId, BlinkyReporting._actionPointId) confd_key = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "reporting", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting", "qtc-report")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("content", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyReporting(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def setConfigObj(self, configObj): for logFunc in self._log("set-config-obj").debug1Func(): logFunc("called. configObj=%s", configObj) res = self.distributeConfigObjectToDescendants(configObj) if (res != ReturnCodes.kOk): for logFunc in self._log( "set-config-obj-distribute-failed").errorFunc(): logFunc( "distributeConfigObjectToDescendants() failed. configObj=%s. res=%", configObj, res) return ReturnCodes.kGeneralError jointKeyPath = KeyPath() jointKeyPath.copyPartial(configObj.getKeyPath(), configObj.getKeyPath().getLen()) operRelativePath = KeyPath() self.getOperRelativePath(operRelativePath) jointKeyPath.joinKeyPath(operRelativePath) for logFunc in self._log("set-config-obj-joint-keypath").debug3Func(): logFunc("jointKeyPath is: %s", jointKeyPath) self.internalSetKeyPath(jointKeyPath) self.myConfigNode = configObj return ReturnCodes.kOk
def s_create(cls, logger, alien, domain): __pychecker__ = "no-argsused" logger('s-create-blinkyalien').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyAlien._validationPointId, BlinkyAlien._actionPointId) confd_key = KeyPath() ancestorVal = Value() ancestorVal.setString(alien) confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(( "alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(( "root", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyAlien(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def removeEntry(self, trxContext, entryName): self._log("remove-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName) pathToDelete = KeyPath() valCommunity = Value() (tag, ns, prefix) = ( "SNMP-COMMUNITY-MIB", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunity.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valCommunity) valCommunityTable = Value() (tag, ns, prefix) = ( "snmpCommunityTable", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunityTable.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valCommunityTable) valEntry = Value() (tag, ns, prefix) = ( "snmpCommunityEntry", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valEntry.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valEntry) valKey = Value() valKey.setBuf((entryName, len(entryName))) pathToDelete.addKeyPathPostfix(valKey) res = self._maapiDomain.writeMaapi(None, None, trxContext, itemsToDelete=[pathToDelete]) if res != ReturnCodes.kOk: self._log('remove-entry-domain-failed').error( 'self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError return ReturnCodes.kOk
def s_create(cls, logger, domain): __pychecker__ = "no-argsused" logger('s-create-blinkylistorderedbyuser').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyListOrderedByUser._validationPointId, BlinkyListOrderedByUser._actionPointId) confd_key = KeyPath() xmlVal = Value() xmlVal.setXmlTag( ("list-ordered-by-user", "http://qwilt.com/model/lake-example", "lake-example")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyListOrderedByUser(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def s_create (cls, logger, domain): __pychecker__="no-argsused" logger('s-create-blinkylistorderedbyuser').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyListOrderedByUser._validationPointId, BlinkyListOrderedByUser._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("list-ordered-by-user", "http://qwilt.com/model/lake-example", "lake-example")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyListOrderedByUser(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def __init__ (self, logger, dpDomain, maapiDomain, configNode, communityUtils): self._log = logger.createLoggerSameModule(G_GROUP_NAME_SNMP_MANAGER_BLINKY_DESTINATION_TRANSFORMATOR) self._dpDomain = dpDomain self._maapiDomain = maapiDomain self._configNode = configNode self._communityUtils = communityUtils self._snmpManager = None self._relativeKeyPath = KeyPath() self._keyPath = copy.deepcopy(configNode.getKeyPath()) xmlValNotifications = Value() xmlValNotifications.setXmlTag(("notifications", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlValNotifications) xmlValDestination = Value() xmlValDestination.setXmlTag(("destination", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlValDestination) self._callpointName = "tech-snmp-destination-callpoint" self._keyPathForCursor = KeyPath() valTarget = Value() (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTarget.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valTarget) valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetAddrTable", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valTargetAddrTable) valEntry = Value() (tag, ns, prefix) = ("snmpTargetAddrEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valEntry.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valEntry)
def removeCallpointInfo(self, callpointCtx): operRelativePath = KeyPath() self.getOperRelativePath(operRelativePath) for logFunc in self._log("remove-callpoint-info").debug3Func(): logFunc( "called. callpoint name=%s, callpoint config keypath=%s, operRelativePath=%s", callpointCtx.getCallpointName(), callpointCtx.getConfigKeyPath(), operRelativePath) callpointCtx.removeMapping(operRelativePath) return ReturnCodes.kOk
def s_create(cls, logger, configP, domain): __pychecker__ = "no-argsused" logger('s-create-blinkyconfigp').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyConfigP._validationPointId, BlinkyConfigP._actionPointId) confd_key = KeyPath() ancestorVal = Value() ancestorVal.setInt64(configP) confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("config-p", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyConfigP(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def __init__(self, logger, maapiDomain): self._log = logger.createLoggerSameModule( G_GROUP_NAME_SNMP_MANAGER_BLINKY_COUNTERS_TRANSFORMATOR) self._maapiDomain = maapiDomain self.targetKeyPath = KeyPath() valCommunity = Value() (tag, ns, prefix) = ("SNMPv2-MIB", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valCommunity.setXmlTag((tag, ns, prefix)) self.targetKeyPath.addKeyPathPostfix(valCommunity) valCommunityTable = Value() (tag, ns, prefix) = ("snmp", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valCommunityTable.setXmlTag((tag, ns, prefix)) self.targetKeyPath.addKeyPathPostfix(valCommunityTable)
def _getSelfKeyPath (self, show , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(show); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("show", "http://qwilt.com/model/tv", "tv")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def removeSecToGroupTableEntry (self, trxContext, secModel, secName): self._log("remove-sec-to-group-table-entry").debug2("called. trxContext=%s, secModel=%s, secName=%s", trxContext, secModel, secName) pathToDelete = KeyPath() valVacm = Value() (tag, ns, prefix) = ("SNMP-VIEW-BASED-ACM-MIB", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacm.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valVacm) valVacmSecToGroupTable = Value() (tag, ns, prefix) = ("vacmSecurityToGroupTable", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacmSecToGroupTable.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valVacmSecToGroupTable) valEntry = Value() (tag, ns, prefix) = ("vacmSecurityToGroupEntry", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valEntry.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valEntry) """valKeyModel = Value() valKeyModel.setInt32(secModel) pathToDelete.addKeyPathPostfix(valKeyModel) valKeySecName = Value() valKeySecName.setString(secName) pathToDelete.addKeyPathPostfix(valKeySecName) res = self._maapiDomain.writeMaapi(None, None, trxContext, itemsToDelete=[pathToDelete]) if res != ReturnCodes.kOk: self._log('remove-sec-to-group-table-entry-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError""" # due to a limitation of pyconfdlib.key_path.KeyPath (which onlys support single-key lists), we have to manually build the key path string here pathToDeleteStr = "%s{%s %s}" % (pathToDelete.getCannonicalStr(), secModel, secName) res = self._maapiDomain.deleteMaapiByStringKeyPath([pathToDeleteStr], trxContext) if res != ReturnCodes.kOk: self._log('remove-sec-to-group-table-entry-domain-failed').error('self._maapiDomain.deleteMaapiByStringKeyPath() failed. PARAMS') return ReturnCodes.kGeneralError self._log("remove-sec-to-group-table-entry-done").debug2("done. trxContext=%s, secModel=%s, secName=%s", trxContext, secModel, secName) return ReturnCodes.kOk
def __init__(self, logger, dpDomain, maapiDomain, configNode): self._log = logger.createLoggerSameModule( G_GROUP_NAME_SNMP_MANAGER_BLINKY_SNMP_TRANSFORMATOR) self._dpDomain = dpDomain self._maapiDomain = maapiDomain self._relativeKeyPath = KeyPath() self._keyPath = copy.deepcopy(configNode.getKeyPath()) xmlVal = Value() xmlVal.setXmlTag( ("snmp", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlVal) self._callpointName = "tech-snmp-callpoint" self._readSecurityName = "all-read-only" self._keyPathSnmpV2 = KeyPath() valMib = Value() (tag, ns, prefix) = ("SNMPv2-MIB", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valMib.setXmlTag((tag, ns, prefix)) self._keyPathSnmpV2.addKeyPathPostfix(valMib) valSystem = Value() (tag, ns, prefix) = ("system", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valSystem.setXmlTag((tag, ns, prefix)) self._keyPathSnmpV2.addKeyPathPostfix(valSystem)
def __init__ (self, logger, maapiDomain): self._log = logger.createLoggerSameModule(G_GROUP_NAME_SNMP_MANAGER_BLINKY_COUNTERS_TRANSFORMATOR) self._maapiDomain = maapiDomain self.targetKeyPath = KeyPath() valCommunity = Value() (tag, ns, prefix) = ("SNMPv2-MIB", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valCommunity.setXmlTag((tag, ns, prefix)) self.targetKeyPath.addKeyPathPostfix(valCommunity) valCommunityTable = Value() (tag, ns, prefix) = ("snmp", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z", "SNMPv2_MIB") valCommunityTable.setXmlTag((tag, ns, prefix)) self.targetKeyPath.addKeyPathPostfix(valCommunityTable)
def _getSelfKeyPath(self, lll, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("aaa", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lll) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lll", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("base", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, show, actor, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(actor) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("actor", "http://qwilt.com/model/tv", "tv")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(show) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("show", "http://qwilt.com/model/tv", "tv")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, kid, toys, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(toys) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("toys", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(kid) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("kid", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, table, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("size", "http://qwilt.com/model/room", "room")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(table) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("table", "http://qwilt.com/model/room", "room")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, person, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(person) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("people", "http://qwilt.com/model/school-example", "sche")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("school", "http://qwilt.com/model/school-example", "sche")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath(self, linux_, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(linux_) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("linux", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux", "qt-lnx")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def _getSelfKeyPath (self, person , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("status", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test", "le")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(person); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("people", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test", "le")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def __init__ (self, logger, dpDomain, maapiDomain, configNode): self._log = logger.createLoggerSameModule(G_GROUP_NAME_SNMP_MANAGER_BLINKY_COMMUNITY_TRANSFORMATOR) self._dpDomain = dpDomain self._maapiDomain = maapiDomain self._configNode = configNode self._relativeKeyPath = KeyPath() self._keyPath = copy.deepcopy(configNode.getKeyPath()) xmlVal = Value() xmlVal.setXmlTag(("community", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) self._keyPath.addKeyPathPostfix(xmlVal) self._callpointName = "tech-snmp-community-callpoint" self._readSecurityName = "all-read-only" self._keyPathForCursor = KeyPath() valCommunity = Value() (tag, ns, prefix) = ("SNMP-COMMUNITY-MIB", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunity.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valCommunity) valCommunityTable = Value() (tag, ns, prefix) = ("snmpCommunityTable", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valCommunityTable.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valCommunityTable) valEntry = Value() (tag, ns, prefix) = ("snmpCommunityEntry", "http://tail-f.com/ns/mibs/SNMP-COMMUNITY-MIB/200308060000Z", "SNMP_COMMUNITY_MIB") valEntry.setXmlTag((tag, ns, prefix)) self._keyPathForCursor.addKeyPathPostfix(valEntry) self._communityUtils = CommunityUtils(self._log, self._maapiDomain, self._keyPathForCursor)
def s_create (cls, logger, interface, domain): __pychecker__="no-argsused" logger('s-create-blinkyconnectivitycheck').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyConnectivityCheck._validationPointId, BlinkyConnectivityCheck._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("connectivity-check", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(interface); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("interface", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("interfaces", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyConnectivityCheck(logger) logger("s-create-keypath").info("confd_key=%s", confd_key) newNode.setParent(None) newNode.setKeyPath(confd_key) newNode.setDomain(domain) res = newNode.internalInit() if (res != ReturnCodes.kOk): logger("s-create-internal-init-failed")\ .error("internalInit() failed. confd_key=%s", confd_key) if newNode._validationPointId: res = domain.registerValidationPoint(newNode._validationPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-validation-node--failed")\ .error("registerValidationNode(%s) failed", newNode._validationPointId) return None newNode.validateRegistrationDone = True if newNode._actionPointId: res = domain.registerActionPoint(newNode._actionPointId, newNode) if (res != ReturnCodes.kOk): logger("s-create-register-action-node--failed")\ .error("registerActionNode(%s) failed", newNode._actionPointId) return None newNode.actionRegistrationDone = True return newNode
def _getSelfKeyPath (self, source , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(source); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("source", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("manager", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("platform", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform", "qt-pltf")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath