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))