示例#1
0
 def startTrapReceiver(self):
     '''
     start trap receiver to listen on traps from devices
     '''
     global trapReceiver
     trapReceiver = TrapReceiver()
     trapReceiver.start()
     return trapReceiver
示例#2
0
 def startTrapReceiver(self):
     '''
     start trap receiver to listen on traps from devices
     '''
     global trapReceiver
     trapReceiver = TrapReceiver()
     trapReceiver.start()
     return trapReceiver
示例#3
0
 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))
示例#4
0
 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)
示例#5
0
 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))
示例#6
0
 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)