Add IF-MIB::ifHighSpeed for >2.5Gbps interfaces
Cut a Debian release.
This commit is contained in:
9
debian/changelog
vendored
9
debian/changelog
vendored
@ -1,3 +1,12 @@
|
||||
govpp-snmp-agentx (1.1.1-1) bookworm; urgency=medium
|
||||
|
||||
* Add IF-MIB::ifHighSpeed field (OID 1.3.6.1.2.1.31.1.1.1.15)
|
||||
* Populate ifHighSpeed with interface speed in Megabits per second
|
||||
* Implement conditional ifSpeed population (skip for speeds > 2.5Gbps)
|
||||
* Improve SNMP compliance for high-speed interface reporting
|
||||
|
||||
-- Pim van Pelt <pim@ipng.ch> Sun, 23 Jun 2025 00:10:00 +0000
|
||||
|
||||
govpp-snmp-agentx (1.1.0-1) bookworm; urgency=medium
|
||||
|
||||
* Add interface event monitoring with VPP API integration
|
||||
|
@ -60,6 +60,7 @@ import (
|
||||
// ifHCOutUcastPkts .11 - Counter64
|
||||
// ifHCOutMulticastPkts .12 - Counter64
|
||||
// ifHCOutBroadcastPkts .13 - Counter64
|
||||
// ifHighSpeed .15 - Gauge32 (interface speed in Mbps)
|
||||
// ifAlias .18 - DisplayString
|
||||
|
||||
const ifEntryOID = "1.3.6.1.2.1.2.2.1"
|
||||
@ -231,14 +232,19 @@ func (m *InterfaceMIB) addIfEntry(iface *api.InterfaceCounters, idx int) {
|
||||
item.Type = pdu.VariableTypeInteger
|
||||
item.Value = mtu
|
||||
|
||||
// ifSpeed (.5) - Use real speed if available, otherwise default to 1Gbps
|
||||
speed := uint32(1000000000)
|
||||
if details != nil && details.Speed > 0 {
|
||||
speed = uint32(details.Speed)
|
||||
// ifSpeed (.5) - Only populate for speeds <= 2.5Gbps (legacy field limitation)
|
||||
if details != nil && details.Speed > 0 && details.Speed <= 2500000000 {
|
||||
// Use real speed for interfaces <= 2.5Gbps
|
||||
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
||||
item.Type = pdu.VariableTypeGauge32
|
||||
item.Value = uint32(details.Speed)
|
||||
} else if details == nil || details.Speed == 0 {
|
||||
// Default to 1Gbps when speed is unknown
|
||||
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
||||
item.Type = pdu.VariableTypeGauge32
|
||||
item.Value = uint32(1000000000)
|
||||
}
|
||||
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
||||
item.Type = pdu.VariableTypeGauge32
|
||||
item.Value = speed
|
||||
// For speeds > 2.5Gbps, don't populate ifSpeed field at all
|
||||
|
||||
// ifPhysAddress (.6) - Use real MAC address if available
|
||||
macAddr := ""
|
||||
@ -411,6 +417,16 @@ func (m *InterfaceMIB) addIfXTable(iface *api.InterfaceCounters, idx int) {
|
||||
item.Type = pdu.VariableTypeCounter64
|
||||
item.Value = iface.TxBroadcast.Packets
|
||||
|
||||
// ifHighSpeed (.15) - Interface speed in Megabits per second
|
||||
details := m.interfaceDetails[iface.InterfaceIndex]
|
||||
speedMbps := uint32(1000) // default 1 Gbps = 1000 Mbps
|
||||
if details != nil && details.Speed > 0 {
|
||||
speedMbps = uint32(details.Speed / 1000000) // Convert bps to Mbps
|
||||
}
|
||||
item = m.handler.Add(fmt.Sprintf("%s.15.%d", ifXTableOID, idx))
|
||||
item.Type = pdu.VariableTypeGauge32
|
||||
item.Value = speedMbps
|
||||
|
||||
// ifAlias (.18) - Interface description/alias
|
||||
item = m.handler.Add(fmt.Sprintf("%s.18.%d", ifXTableOID, idx))
|
||||
item.Type = pdu.VariableTypeOctetString
|
||||
|
Reference in New Issue
Block a user