mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Re-implement NAC as a class based module (#9573)
* Less sql queries for nac module * Re-implement NAC as a class based module * Update comments * update module capture order * Fix style issues
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace LibreNMS;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Device\WirelessSensor;
|
||||
use LibreNMS\Device\YamlDiscovery;
|
||||
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
|
||||
@@ -42,6 +43,7 @@ class OS implements ProcessorDiscovery
|
||||
}
|
||||
|
||||
private $device; // annoying use of references to make sure this is in sync with global $device variable
|
||||
private $device_model;
|
||||
private $cache; // data cache
|
||||
private $pre_cache; // pre-fetch data cache
|
||||
|
||||
@@ -74,6 +76,20 @@ class OS implements ProcessorDiscovery
|
||||
return (int)$this->device['device_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Eloquent Device Model for the current device
|
||||
*
|
||||
* @return Device
|
||||
*/
|
||||
public function getDeviceModel()
|
||||
{
|
||||
if (is_null($this->device_model)) {
|
||||
$this->device_model = Device::find($this->getDeviceId());
|
||||
}
|
||||
|
||||
return $this->device_model;
|
||||
}
|
||||
|
||||
public function preCache()
|
||||
{
|
||||
if (is_null($this->pre_cache)) {
|
||||
|
Reference in New Issue
Block a user