Common contexts for polling (#13158)

* Common contexts for polling
Don't store contexts on the device array, use the device model
Also should be easier to add different contexts later.

* rename variables for consistency
This commit is contained in:
Tony Murray
2021-08-23 01:22:28 -05:00
committed by GitHub
parent 54964e0c42
commit d8d0ccd03d
10 changed files with 30 additions and 55 deletions
+11
View File
@@ -116,6 +116,17 @@ class Device extends BaseModel
return null;
}
/**
* Get VRF contexts to poll.
* If no contexts are found, return the default context ''
*
* @return array
*/
public function getVrfContexts(): array
{
return $this->vrfLites->isEmpty() ? [''] : $this->vrfLites->pluck('context_name')->all();
}
/**
* Get the display name of this device (hostname) unless force_ip_to_sysname is set
* and hostname is an IP and sysName is set