def getDeviceName(self,protocol): value = ["sysDescr"] obj = SNMP(protocol) try: conn = obj.connect() except Exception as e: #can not connect print("SNMP device module: can not connect to device") return None try: manufactor = obj.doCommand(value) except Exception as e: #can not do command print("SNMP device module: can not do command") return None manufactor = manufactor.split() #find version for pos,i in enumerate(manufactor,start=0): if str(i).lower() == "software": return ["_3com","_3com"+str(manufactor[pos-2])]
def getDeviceName(self, protocol): value = ["sysDescr"] obj = SNMP(protocol) try: conn = obj.connect() except Exception as e: #can not connect print("SNMP device module: can not connect to device") return None try: manufactor = obj.doCommand(value) except Exception as e: #can not do command print("SNMP device module: can not do command") return None manufactor = manufactor.split() #find version for pos, i in enumerate(manufactor, start=0): if re.match("C[0-9][0-9][0-9][0-9]", i): return ["cisco", "cisco" + str(i)]