mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
interfaces - parse part of sfp module information in legacy_interfaces_details(), adds 'module temperature' and 'lane X' information as well.
`ifconfig` passes the information from `sfp.c` [1], which is has a fixed structure we can parse on our end.
[1] 6fbe7e4dd1/sbin/ifconfig/sfp.c (L75-L76)
This commit is contained in:
parent
cca972c05b
commit
ab0fc39a40
@ -409,6 +409,18 @@ function legacy_interfaces_details($intf = null)
|
||||
$result[$current_interface]['sfp']['part_number'] = $matches[2];
|
||||
$result[$current_interface]['sfp']['serial_number'] = $matches[3];
|
||||
$result[$current_interface]['sfp']['manufacturing_date'] = $matches[4];
|
||||
} elseif (
|
||||
isset($result[$current_interface]['sfp']) &&
|
||||
preg_match("/module temperature:\s+(.*)\s+voltage:\s+(.*)Volts/", $line, $matches)
|
||||
) {
|
||||
$result[$current_interface]['sfp']['temperature'] = $matches[1];
|
||||
$result[$current_interface]['sfp']['voltage'] = $matches[2];
|
||||
} elseif (
|
||||
isset($result[$current_interface]['sfp']) &&
|
||||
preg_match("/lane\s+(.*):\s+RX power:\s+(.*)\s+TX bias:\s+(.*)/", $line, $matches)
|
||||
) {
|
||||
$result[$current_interface]['sfp'][sprintf('lane_%s_rx_power', $matches[1])] = $matches[2];
|
||||
$result[$current_interface]['sfp'][sprintf('lane_%s_tx_bias', $matches[1])] = $matches[3];
|
||||
} elseif (preg_match("/status: (.*)$/", $line, $matches)) {
|
||||
$result[$current_interface]['status'] = $matches[1];
|
||||
} elseif (preg_match("/channel (\S*)/", $line, $matches)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user