def startTrapReceiver(self): ''' start trap receiver to listen on traps from devices ''' global trapReceiver trapReceiver = TrapReceiver() trapReceiver.start() return trapReceiver
def testStart(self): self.__conf = {} self.__conf['snmpTrap'] = {} self.__conf['snmpTrap']['openclos_trap_group'] = {} self.__conf['snmpTrap']['openclos_trap_group']['target'] = "0.0.0.0" self.__conf['snmpTrap']['openclos_trap_group']['port'] = 20162 trapReceiver = TrapReceiver(self.__conf) trapReceiver.start() sleep(2) self.assertEqual(True, self.isPortOpen(20162)) trapReceiver.stop() sleep(2) self.assertEqual(False, self.isPortOpen(20162))
def testInit(self): self.__conf = {} self.__conf['snmpTrap'] = {} self.__conf['snmpTrap']['openclos_trap_group'] = {} self.__conf['snmpTrap']['openclos_trap_group']['target'] = "1.1.1.1" self.__conf['snmpTrap']['openclos_trap_group']['port'] = 20163 trapReceiver = TrapReceiver(self.__conf) self.assertEqual('1.1.1.1', trapReceiver.target) self.assertEqual(20163, trapReceiver.port)
def testInitDefaultValue(self): self.__conf = {} self.__conf['snmpTrap'] = {} trapReceiver = TrapReceiver(self.__conf) self.assertEqual('0.0.0.0', trapReceiver.target) self.assertEqual(20162, trapReceiver.port)