Documentation
¶
Overview ¶
Package deviceswitch functions of getting switch faults code
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwitchFaults ¶
GetSwitchFaults will try to get all fault
func UpdateSwitchFaultLevel ¶
func UpdateSwitchFaultLevel()
UpdateSwitchFaultLevel update the map recording fault code and it's level, as long as deviceinfo changed
Types ¶
type SwitchDevManager ¶
type SwitchDevManager struct {
}
SwitchDevManager is the manager for switch
func NewSwitchDevManager ¶
func NewSwitchDevManager() *SwitchDevManager
NewSwitchDevManager create a new SwitchDevManager
func (*SwitchDevManager) GetSwitchFaultCodeByInterval ¶
func (sdm *SwitchDevManager) GetSwitchFaultCodeByInterval(ctx context.Context, interval time.Duration)
GetSwitchFaultCodeByInterval start a none stop loop to query and update switch fault code
func (*SwitchDevManager) InitSwitchDev ¶
func (sdm *SwitchDevManager) InitSwitchDev() error
InitSwitchDev try to call init func of driver, before call any other function
func (*SwitchDevManager) ShutDownSwitch ¶
func (sdm *SwitchDevManager) ShutDownSwitch()
ShutDownSwitch need to be called before dp exit
func (*SwitchDevManager) SubscribeSwitchFaults ¶
func (sdm *SwitchDevManager) SubscribeSwitchFaults() error
SubscribeSwitchFaults will start to subscribe fault from switch, and the callback function is faultEventHandler(event *C.struct_fault_event)
type SwitchFaultEvent ¶
type SwitchFaultEvent struct {
EventType uint
// SubType fault subtype used for id a fault
SubType uint
// PeerPortDevice used to tell what kind of device connected to
PeerPortDevice uint
PeerPortId uint
SwitchChipId uint
SwitchPortId uint
// Severity used to tell how serious is the fault
Severity uint
// Assertion tell what kind of fault, recover, happen or once
Assertion uint
EventSerialNum int
NotifySerialNum int
AlarmRaisedTime int64
AdditionalParam string
AdditionalInfo string
}
SwitchFaultEvent is the struct for switch reported fault