Move flags to their own modules
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"go.fd.io/govpp/api"
|
||||
|
||||
"govpp-snmp-example/logger"
|
||||
"govpp-snmp-example/vppstats"
|
||||
)
|
||||
|
||||
// IF-MIB OID bases:
|
||||
@ -65,14 +66,12 @@ type InterfaceMIB struct {
|
||||
ifEntrySession *agentx.Session
|
||||
ifXTableSession *agentx.Session
|
||||
stats map[uint32]*api.InterfaceCounters // indexed by interface index
|
||||
indexOffset int
|
||||
}
|
||||
|
||||
func NewInterfaceMIB(indexOffset int) *InterfaceMIB {
|
||||
func NewInterfaceMIB() *InterfaceMIB {
|
||||
return &InterfaceMIB{
|
||||
handler: &agentx.ListHandler{},
|
||||
stats: make(map[uint32]*api.InterfaceCounters),
|
||||
indexOffset: indexOffset,
|
||||
handler: &agentx.ListHandler{},
|
||||
stats: make(map[uint32]*api.InterfaceCounters),
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +109,7 @@ func (m *InterfaceMIB) UpdateStats(interfaceStats *api.InterfaceStats) {
|
||||
}
|
||||
|
||||
func (m *InterfaceMIB) addInterfaceToMIB(iface *api.InterfaceCounters) {
|
||||
idx := int(iface.InterfaceIndex) + m.indexOffset
|
||||
idx := int(iface.InterfaceIndex) + *vppstats.IfIndexOffset
|
||||
|
||||
// Add ifEntry (classic interface table) entries
|
||||
m.addIfEntry(iface, idx)
|
||||
|
Reference in New Issue
Block a user