. * * @package LibreNMS * @link http://librenms.org * @copyright 2019 Heath Barnhart * @author Heath Barnhart */ namespace LibreNMS\Tests\Feature\SnmpTraps; use App\Models\Device; use LibreNMS\Snmptrap\Dispatcher; use LibreNMS\Snmptrap\Trap; class AdvaDyingGaspTrapTest extends SnmpTrapTestCase { public function testDyingGasp() { $device = factory(Device::class)->create(); $trapText = "$device->hostname UDP: [$device->ip]:57602->[192.168.5.5]:162 DISMAN-EVENT-MIB::sysUpTimeInstance 26:19:43:37.24 SNMPv2-MIB::snmpTrapOID.0 CM-SYSTEM-MIB::cmSnmpDyingGaspTrap"; $trap = new Trap($trapText); $message = "Dying Gasp received"; \Log::shouldReceive('event')->once()->with($message, $device->device_id, 'trap', 5); $this->assertTrue(Dispatcher::handle($trap), 'Could not handle cmSnmpDyingGaspTrap'); } }