mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Refactor MAC utilities into a single class (#15379)
* Refactor MAC utils to a new utility class * Apply fixes from StyleCI * Inline functions Add tests Handle bridgeid format * Apply fixes from StyleCI * Dedicated code path for stp bridge parsing, and improve STP output a bit * Correctly parse dot1dBaseBridgeAddress and don't store int in bool field * trim any unexpected character from bridge addresses, add extra test data. * better comment * barsBridge can handle dot1dBaseBridgeAddress correctly now * parseBridge, check for properly formatted mac first. * update test data, empty data = empty mac * Fix new usage after rebase * import --------- Co-authored-by: StyleCI Bot <[email protected]>
This commit is contained in:
co-authored by
StyleCI Bot
parent
908aef6596
commit
d8c372bbf4
@@ -34,7 +34,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use LibreNMS\Util\IP;
|
||||
use LibreNMS\Util\Rewrite;
|
||||
use LibreNMS\Util\Mac;
|
||||
use LibreNMS\Util\Url;
|
||||
|
||||
class FdbTablesController extends TableController
|
||||
@@ -159,10 +159,11 @@ class FdbTablesController extends TableController
|
||||
*/
|
||||
public function formatItem($fdb_entry)
|
||||
{
|
||||
$mac = Mac::parse($fdb_entry->mac_address);
|
||||
$item = [
|
||||
'device' => $fdb_entry->device ? Url::deviceLink($fdb_entry->device) : '',
|
||||
'mac_address' => Rewrite::readableMac($fdb_entry->mac_address),
|
||||
'mac_oui' => Rewrite::readableOUI($fdb_entry->mac_address),
|
||||
'mac_address' => $mac->readable(),
|
||||
'mac_oui' => $mac->vendor(),
|
||||
'ipv4_address' => $fdb_entry->ipv4Addresses->implode(', '),
|
||||
'interface' => '',
|
||||
'vlan' => $fdb_entry->vlan ? $fdb_entry->vlan->vlan_vlan : '',
|
||||
|
||||
Reference in New Issue
Block a user