Documentation ¶
Index ¶
- Constants
- Variables
- func ClearCurrentAlarm(db *gorm.DB, device *Device, alarmIdentifier string) error
- func FetchAllDeviceAlarmStatus(t time.Time) error
- func FetchAllDeviceStatus(t time.Time) error
- func FetchDeviceAlarmStatus(t time.Time, schema string, productType string) error
- func FetchDeviceStatus(t time.Time, schema string, productType string) error
- func FormateTime(t time.Time) string
- func GetKPIMeasureIds(schema string, productType string, measTypeIds []string) []uint
- func HandleDeviceAlive(device *Device, t time.Time, lastOnlineStatus bool)
- func HandleDeviceTimeout(device *Device, t time.Time)
- func HandleHttpPost(task *Task, data []any) error
- func HanldeGroupSearch(values []search.SearchValue) (string, []any)
- func InsertDeviceTransferLogComplete(db *gorm.DB, device *Device, ts int64, bucket string, key string, ...) error
- func InsertDevieEvent(db *gorm.DB, device *Device, eventType string, currentTime time.Time, ...) error
- func InsertDeviePerformanceValue(db *gorm.DB, device *Device, name string, source string, value float64, ...) error
- func ParseFileName(filename string) (string, time.Time, time.Time, string, string, string, error)
- func ParseTime(value string) time.Time
- func ReloadAllDataModels() error
- func ReloadAllKPIMeansure() error
- func ReloadAllProducts() error
- func SetProductPerformanceValueDefines(db *gorm.DB, product *Product, performanceValueDefines *jsontype.Tags) error
- func Setup()
- func SetupDefaultDataModel(db *gorm.DB, schema string) error
- func SetupDefaultDataModelTemplate(db *gorm.DB, dm *DataModel) error
- func SetupDefaultKPIMeasures(db *gorm.DB, schema string) error
- func SetupDefaultKPITemplates(db *gorm.DB, schema string) error
- func SetupProducts(db *gorm.DB, schema string)
- func SetupTasks(db *gorm.DB, schema string)
- func StartAllActiveDeviceKeepaliveTimers()
- func StartDeviceKeepaliveTimer(device *Device)
- func StopDeviceKeepaliveTimer(device *Device)
- func UpdateDeviceTransferLogComplete(db *gorm.DB, device *Device, ts int64, startTime time.Time, ...) error
- func UpdateDeviceTransferLogFault(db *gorm.DB, device *Device, ts int64, startTime time.Time, ...) error
- func UpdateTaskStatus(db *gorm.DB, schema string, task *Task, status TaskStatus) error
- func UpsertCurrentAlarm(db *gorm.DB, device *Device, data *igd.CurrentAlarm) error
- func UpsertDataModelParameter(db *gorm.DB, dm *DataModel, name string, typ *string, writable *bool, ...) error
- func UpsertExpeditedEvent(db *gorm.DB, device *Device, data *igd.ExpeditedEvent) error
- func UpsertSupportedAlarm(db *gorm.DB, product *Product, alarmIdentifier int, data *igd.SupportedAlarm) error
- type DataModel
- type DataModelParameter
- type DataModelTemplate
- type Device
- func (m *Device) AfterFind(tx *gorm.DB) (err error)
- func (m *Device) AfterSave(tx *gorm.DB) (err error)
- func (m *Device) BeforeSave(tx *gorm.DB) (err error)
- func (m *Device) FetchPmValues(db *gorm.DB, t time.Time) bool
- func (m *Device) GetMethodCall(commandKey string) acs.MethodCall
- func (m *Device) GetNextMethodCall() acs.MethodCall
- func (m Device) GetParameterInt64Value(name string) *int64
- func (m *Device) GetParameterNames(path string, nextLevel bool) []string
- func (m *Device) GetParameterPaths(path string, nextLevel bool) []string
- func (m Device) GetParameterValue(name string) *string
- func (m *Device) GetProduct() acs.Product
- func (m *Device) GetProperty(k string) any
- func (m Device) IsMethodSupported(name string) bool
- func (m *Device) LoadData()
- func (m *Device) PushGetDeviceParameterNames(parameterPath string, nextLevel bool) (acs.MethodCall, error)
- func (m *Device) PushMethodCall(t time.Time, methodName string, values map[string]any) (acs.MethodCall, error)
- func (m *Device) SaveData()
- func (m *Device) SendConnectRequest() error
- func (m *Device) UpdateByIgdValues(db *gorm.DB, values map[string]string)
- func (m *Device) UpdateMetaData(k string, v any)
- func (m *Device) UpdateMetaDatas(values map[string]any)
- func (m *Device) UpdateMethodCallRequestSend(commandKey string) error
- func (m *Device) UpdateMethodCallResponse(commandKey string, values map[string]any, faultCode int, faultString string) error
- func (m *Device) UpdateMethodCallState(commandKey string, state DeviceMethodCallState) error
- func (m *Device) UpdateMethodCallTimeout(commandKey string) error
- func (m *Device) UpdateMethodCallUnknow(commandKey string) error
- func (m *Device) UpdateParameterNotification(k string, v int)
- func (m *Device) UpdateParameterNotifications(values map[string]int)
- func (m *Device) UpdateParameterValue(k string, v string)
- func (m *Device) UpdateParameterValues(values map[string]string)
- func (m *Device) UpdateParameterWritable(k string, v bool)
- func (m *Device) UpdateParameterWritables(values map[string]bool)
- func (m *Device) UpdateProperties(values map[string]any)
- func (m *Device) UpdateProperty(k string, v any)
- type DeviceAlarm
- type DeviceAlarmEvent
- type DeviceAlarmStatus
- type DeviceEvent
- type DeviceMethodCall
- func (m *DeviceMethodCall) AfterFind(tx *gorm.DB) (err error)
- func (m *DeviceMethodCall) BeforeSave(tx *gorm.DB) (err error)
- func (m DeviceMethodCall) GetCommandKey() string
- func (m DeviceMethodCall) GetMethodName() string
- func (m DeviceMethodCall) GetRequestValue(n string) string
- func (m DeviceMethodCall) GetRequestValues() map[string]string
- func (m *DeviceMethodCall) LoadData()
- func (m *DeviceMethodCall) SaveData()
- type DeviceMethodCallState
- type DevicePerformanceValue
- type DeviceStatus
- type DeviceTransferLog
- type Firmware
- type Group
- type KPIMeas
- type KPITemplate
- type Methods
- type ParameterNotifications
- type ParameterTypes
- type ParameterValues
- type ParameterWritables
- type Product
- type ProductSupportedAlarm
- type Task
- type TaskDeviceLog
- type TaskExecMode
- type TaskHandleFunc
- type TaskJob
- type TaskServer
- func (s *TaskServer) ClearTask(task *Task)
- func (s *TaskServer) Close()
- func (s *TaskServer) GetTaskSessionsBySource(source string) []*TaskSession
- func (s *TaskServer) PushDeviceAlarm(alarm *DeviceAlarm)
- func (s *TaskServer) Run()
- func (s *TaskServer) StartTask(task *Task)
- func (s *TaskServer) StopTask(task *Task)
- type TaskSession
- type TaskStatus
Constants ¶
View Source
const ( TransferTypeUpload = "upload" TransferTypeDownload = "download" UploadFileTypeConfigurationFile = "1 Vendor Configuration File" UploadFileTypeLogFile = "2 Vendor Log File" DownloadFileTypeFirmwareUpgradeImage = "1 Firmware Upgrade Image" DownloadFileTypeWebContent = "2 Web Content" DownloadFileTypeVendorConfigurationFile = "3 Vendor Configuration File" )
View Source
const DeviceUploadBucket = "omc-upload"
View Source
const FirmwareBucket = "omc-firmware"
Variables ¶
View Source
var DeviceAlarmDeviceIndexNames = []string{"schema", "product_type", "device_id", "alarm_identifier"}
View Source
var DeviceAlarmPerceivedSeverityIndexNames = []string{"schema", "perceived_severity"}
View Source
var DeviceAlarmStatusIndexNames = []string{"schema", "product_type"}
View Source
var DeviceAlarmTypeIndexNames = []string{"schema", "product_type", "alarm_identifier", "event_type"}
View Source
var DeviceEventDeviceIndexNames = []string{"schema", "product_type", "device_id", "event_type"}
View Source
var DeviceEventIndexNames = []string{"schema", "product_type", "event_type"}
View Source
var DevicePerformanceValueDeviceIndexNames = []string{"schema", "product_type", "device_id", "name", "type"}
View Source
var DevicePerformanceValueIndexNames = []string{"schema", "product_type", "name", "type"}
View Source
var DeviceSearchHanleFuncs = search.SearchDataHandleFuncMap{ "group": HanldeGroupSearch, }
View Source
var DeviceStatusIndexNames = []string{"schema", "product_type"}
View Source
var SimpleDeviceInfoName = []string{
"id", "updated", "created", "deleted",
"schema", "oui", "product_class", "serial_number", "product_id",
"name", "group_id",
"enable", "online", "active_status", "last_inform_time",
"meta_data", "properties",
}
View Source
var TaskDeviceLogIndexNames = []string{"schema", "device_id", "task_id", "task_name", "task_type", "exec_mode"}
Functions ¶
func ClearCurrentAlarm ¶
func FetchAllDeviceStatus ¶
func FetchDeviceAlarmStatus ¶
func FetchDeviceStatus ¶
func FormateTime ¶
func GetKPIMeasureIds ¶
func HandleDeviceTimeout ¶
func HandleHttpPost ¶
func HanldeGroupSearch ¶
func HanldeGroupSearch(values []search.SearchValue) (string, []any)
func InsertDevieEvent ¶
func ParseFileName ¶
A20230627.2015+0800-2030+0800_000000.65740512A3200006L.xml A20230630.2345+0800-20230701.0000+0800_000000.65740512A3200006L.xml nrm_000000.65740512A3200006L.xml
func ReloadAllDataModels ¶
func ReloadAllDataModels() error
func ReloadAllKPIMeansure ¶
func ReloadAllKPIMeansure() error
func ReloadAllProducts ¶
func ReloadAllProducts() error
func SetupProducts ¶
func SetupTasks ¶
func StartAllActiveDeviceKeepaliveTimers ¶
func StartAllActiveDeviceKeepaliveTimers()
func StartDeviceKeepaliveTimer ¶
func StartDeviceKeepaliveTimer(device *Device)
func StopDeviceKeepaliveTimer ¶
func StopDeviceKeepaliveTimer(device *Device)
func UpdateTaskStatus ¶
func UpsertCurrentAlarm ¶
func UpsertExpeditedEvent ¶
func UpsertSupportedAlarm ¶
Types ¶
type DataModel ¶
type DataModel struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Default bool `json:"Default" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_datamodel_unique"` ProductType string `json:"ProductType" gorm:"uniqueIndex:idx_datamodel_unique"` Name string `json:"Name" gorm:"uniqueIndex:idx_datamodel_unique"` ParameterPath string `json:"ParameterPath" gorm:"index"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` Templates []*DataModelTemplate `json:"Templates"` Parameters []*DataModelParameter `json:"Parameters"` }
func GetDataModelByProduct ¶
func (DataModel) GetParameter ¶
func (m DataModel) GetParameter(name string) *DataModelParameter
func (DataModel) GetParameterType ¶
type DataModelParameter ¶
type DataModelParameter struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` DataModelID uint `json:"DataModelId" gorm:"uniqueIndex:idx_datamodel_param_unique"` DataModel *DataModel `json:"-"` Name string `json:"Name" gorm:"uniqueIndex:idx_datamodel_param_unique"` Default bool `json:"Default" gorm:"index"` Type string `json:"Type" gorm:"index"` Writable bool `json:"Writable" gorm:"index"` Description string `json:"Description"` DefaultValue string `json:"DefaultValue"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func GetDataModelParameterByID ¶
func GetDataModelParameterByID(db *gorm.DB, dm *DataModel, id uint) *DataModelParameter
func GetDataModelParameterByName ¶
func GetDataModelParameterByName(db *gorm.DB, dm *DataModel, name string) *DataModelParameter
func (*DataModelParameter) AfterFind ¶
func (m *DataModelParameter) AfterFind(tx *gorm.DB) (err error)
func (*DataModelParameter) BeforeSave ¶
func (m *DataModelParameter) BeforeSave(tx *gorm.DB) (err error)
func (*DataModelParameter) LoadData ¶
func (m *DataModelParameter) LoadData()
func (*DataModelParameter) SaveData ¶
func (m *DataModelParameter) SaveData()
type DataModelTemplate ¶
type DataModelTemplate struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Default bool `json:"Default" gorm:"index"` DataModelID uint `json:"DataModelId" gorm:"uniqueIndex:idx_datamodel_template_unique"` DataModel *DataModel `json:"-"` Name string `json:"Name" gorm:"uniqueIndex:idx_datamodel_template_unique"` ParameterNames *jsontype.Tags `json:"ParameterNames" gorm:"-"` ParameterNamesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:parameter_names"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func GetDataModelTemplate ¶
func GetDataModelTemplate(db *gorm.DB, dm *DataModel, id uint) *DataModelTemplate
func (*DataModelTemplate) AfterFind ¶
func (m *DataModelTemplate) AfterFind(tx *gorm.DB) (err error)
func (*DataModelTemplate) BeforeSave ¶
func (m *DataModelTemplate) BeforeSave(tx *gorm.DB) (err error)
func (*DataModelTemplate) LoadData ¶
func (m *DataModelTemplate) LoadData()
func (*DataModelTemplate) SaveData ¶
func (m *DataModelTemplate) SaveData()
type Device ¶
type Device struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_unique"` Oui string `json:"Oui" gorm:"uniqueIndex:idx_device_unique"` ProductClass string `json:"ProductClass" gorm:"uniqueIndex:idx_device_unique"` SerialNumber string `json:"SerialNumber" gorm:"uniqueIndex:idx_device_unique"` ProductType string `json:"ProductType" gorm:"index"` ActiveStatus string `json:"ActiveStatus" gorm:"index"` Enable bool `json:"Enable" gorm:"index"` Online bool `json:"Online" gorm:"index"` LastInformTime jsontype.JSONTime `json:"LastInformTime" gorm:"index"` ProductID uint `json:"ProductId" gorm:"index;not null"` Product *Product `json:"Product"` GroupID uint `json:"GroupId" gorm:"index"` Group *Group `json:"Group"` Name string `json:"Name"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` PropertiesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:properties"` Properties *jsontype.Tags `json:"Properties" gorm:"-"` MethodsRaw jsontype.JSONType[*Methods] `json:"-" gorm:"column:methods"` Methods *Methods `json:"Methods" gorm:"-"` ParameterValuesRaw jsontype.JSONType[*ParameterValues] `json:"-" gorm:"column:parameter_values"` ParameterValues *ParameterValues `json:"ParameterValues" gorm:"-"` ParameterWritablesRaw jsontype.JSONType[*ParameterWritables] `json:"-" gorm:"column:parameter_writables"` ParameterWritables *ParameterWritables `json:"ParameterWritables" gorm:"-"` ParameterNotificationsRaw jsontype.JSONType[*ParameterNotifications] `json:"-" gorm:"column:parameter_notifications"` ParameterNotifications *ParameterNotifications `json:"ParameterNotifications" gorm:"-"` }
func (*Device) GetMethodCall ¶
func (m *Device) GetMethodCall(commandKey string) acs.MethodCall
func (*Device) GetNextMethodCall ¶
func (m *Device) GetNextMethodCall() acs.MethodCall
func (Device) GetParameterInt64Value ¶
func (*Device) GetParameterNames ¶
func (*Device) GetParameterPaths ¶
func (Device) GetParameterValue ¶
func (*Device) GetProduct ¶
func (*Device) GetProperty ¶
func (Device) IsMethodSupported ¶
func (*Device) PushGetDeviceParameterNames ¶
func (*Device) PushMethodCall ¶
func (*Device) SendConnectRequest ¶
func (*Device) UpdateByIgdValues ¶
func (*Device) UpdateMetaData ¶
func (*Device) UpdateMetaDatas ¶
func (*Device) UpdateMethodCallRequestSend ¶
func (*Device) UpdateMethodCallResponse ¶
func (*Device) UpdateMethodCallState ¶
func (m *Device) UpdateMethodCallState(commandKey string, state DeviceMethodCallState) error
func (*Device) UpdateMethodCallTimeout ¶
func (*Device) UpdateMethodCallUnknow ¶
func (*Device) UpdateParameterNotification ¶
func (*Device) UpdateParameterNotifications ¶
func (*Device) UpdateParameterValue ¶
func (*Device) UpdateParameterValues ¶
func (*Device) UpdateParameterWritable ¶
func (*Device) UpdateParameterWritables ¶
func (*Device) UpdateProperties ¶
func (*Device) UpdateProperty ¶
type DeviceAlarm ¶
type DeviceAlarm struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_alarm_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_alarm_unique;not null"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_device_alarm_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` AlarmIdentifier string `json:"AlarmIdentifier" gorm:"uniqueIndex:idx_device_alarm_unique;not null"` AlarmRaisedTime jsontype.JSONTime `json:"AlarmRaisedTime"` AlarmChangedTime jsontype.JSONTime `json:"AlarmChangedTime"` AlarmClearedTime jsontype.JSONTime `json:"AlarmClearedTime"` ManagedObjectInstance string `json:"ManagedObjectInstance"` EventType string `json:"EventType"` ProbableCause string `json:"ProbableCause"` SpecificProblem string `json:"SpecificProblem"` PerceivedSeverity string `json:"PerceivedSeverity"` AdditionalText string `json:"AdditionalText"` AdditionalInformation string `json:"AdditionalInformation"` AlarmCleared bool `json:"AlarmCleared"` AlarmConfirmed bool `json:"AlarmConfirmed"` AlarmConfirmedTime jsontype.JSONTime `json:"AlarmConfirmedTime"` }
type DeviceAlarmEvent ¶
type DeviceAlarmEvent struct { OUI string ProductClass string SerialNumber string EventTime string AlarmIdentifier string NotificationType string ManagedObjectInstance string EventType string ProbableCause string SpecificProblem string PerceivedSeverity string AdditionalText string AdditionalInformation string }
type DeviceAlarmStatus ¶
type DeviceAlarmStatus struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_status_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_status_unique;not null"` ProductType string `json:"ProductType" gorm:"uniqueIndex:idx_device_status_unique;not null"` Total int64 `json:"Total"` Critical int64 `json:"Critical"` Major int64 `json:"Major"` Minor int64 `json:"Minor"` Warning int64 `json:"Warning"` }
type DeviceEvent ¶
type DeviceEvent struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_event_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_event_unique;not null"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_device_event_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` EventType string `json:"EventType" gorm:"uniqueIndex:idx_device_event_unique;not null"` CurrentTime jsontype.JSONTime `json:"CurrentTime"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func (*DeviceEvent) BeforeSave ¶
func (m *DeviceEvent) BeforeSave(tx *gorm.DB) (err error)
func (*DeviceEvent) LoadData ¶
func (m *DeviceEvent) LoadData()
func (*DeviceEvent) SaveData ¶
func (m *DeviceEvent) SaveData()
type DeviceMethodCall ¶
type DeviceMethodCall struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_method_call_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_method_call_unique;not null"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_device_method_call_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` State DeviceMethodCallState `json:"State" gorm:"index"` CommandKey string `json:"CommandKey"` MethodName string `json:"MethodName"` RequestValuesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:request_values"` RequestValues *jsontype.Tags `json:"RequestValues" gorm:"-"` ResponseValuesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:response_values"` ResponseValues *jsontype.Tags `json:"ResponseValues" gorm:"-"` FaultCode int `json:"FaultCode"` FaultString string `json:"FaultString"` }
func (*DeviceMethodCall) BeforeSave ¶
func (m *DeviceMethodCall) BeforeSave(tx *gorm.DB) (err error)
func (DeviceMethodCall) GetCommandKey ¶
func (m DeviceMethodCall) GetCommandKey() string
func (DeviceMethodCall) GetMethodName ¶
func (m DeviceMethodCall) GetMethodName() string
func (DeviceMethodCall) GetRequestValue ¶
func (m DeviceMethodCall) GetRequestValue(n string) string
func (DeviceMethodCall) GetRequestValues ¶
func (m DeviceMethodCall) GetRequestValues() map[string]string
func (*DeviceMethodCall) LoadData ¶
func (m *DeviceMethodCall) LoadData()
func (*DeviceMethodCall) SaveData ¶
func (m *DeviceMethodCall) SaveData()
type DeviceMethodCallState ¶
type DeviceMethodCallState int
const ( DeviceMethodCallStateInit DeviceMethodCallState = 0 DeviceMethodCallStateRequestSend DeviceMethodCallState = 1 DeviceMethodCallStateResponseRecv DeviceMethodCallState = 2 DeviceMethodCallStateResponseTimeout DeviceMethodCallState = 3 DeviceMethodCallStateUnknow DeviceMethodCallState = 100 )
type DevicePerformanceValue ¶
type DevicePerformanceValue struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_performance_value_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_performance_value_unique;not null"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_device_performance_value_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` Name string `json:"Name" gorm:"uniqueIndex:idx_device_performance_value_unique;not null"` Source string `json:"Source"` Type string `json:"Type"` Value float64 `json:"Value"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func (*DevicePerformanceValue) AfterFind ¶
func (m *DevicePerformanceValue) AfterFind(tx *gorm.DB) (err error)
func (*DevicePerformanceValue) BeforeSave ¶
func (m *DevicePerformanceValue) BeforeSave(tx *gorm.DB) (err error)
func (*DevicePerformanceValue) LoadData ¶
func (m *DevicePerformanceValue) LoadData()
func (*DevicePerformanceValue) SaveData ¶
func (m *DevicePerformanceValue) SaveData()
type DeviceStatus ¶
type DeviceStatus struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_status_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_status_unique;not null"` ProductType string `json:"ProductType" gorm:"uniqueIndex:idx_device_status_unique;not null"` Total int64 `json:"Total"` Online int64 `json:"Online"` Active int64 `json:"Active"` Offline int64 `json:"Offline"` }
type DeviceTransferLog ¶
type DeviceTransferLog struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_device_log_file_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_device_log_file_unique;not null"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_device_log_file_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` TransferType string `json:"TransferType" gorm:"uniqueIndex:idx_device_log_file_unique"` FileType string `json:"FileType" gorm:"uniqueIndex:idx_device_log_file_unique"` FileName string `json:"FileName" gorm:"uniqueIndex:idx_device_log_file_unique"` StartTime jsontype.JSONTime `json:"StartTime"` CompleteTime jsontype.JSONTime `json:"CompleteTime"` FaultCode int `json:"FaultCode"` FaultString string `json:"FaultString"` ObjectBucket string `json:"ObjectBucket"` ObjectKey string `json:"ObjectKey"` S3ObjectID *uint `json:"S3ObjectId" gorm:"index"` S3Object *s3.S3Object `json:"S3Object"` FirmwareID *uint `json:"FirmwareId" gorm:"index"` Firmware *Firmware `json:"Firmware"` }
func GetDeviceTransferLog ¶
func GetDeviceTransferLog(db *gorm.DB, device *Device, ts int64) *DeviceTransferLog
func (*DeviceTransferLog) AfterDelete ¶
func (m *DeviceTransferLog) AfterDelete(tx *gorm.DB) (err error)
type Firmware ¶
type Firmware struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_firmware_unique"` Name string `json:"Name" gorm:"uniqueIndex:idx_firmware_unique"` Version string `json:"Version" gorm:"uniqueIndex:idx_firmware_unique"` ProductType string `json:"ProductType" gorm:"index"` Products []*Product `gorm:"many2many:firmware_products;"` Uploader string `json:"Uploader"` UploadTime jsontype.JSONTime `json:"UploadTime"` S3ObjectID uint `json:"S3ObjectId" gorm:"index"` S3Object *s3.S3Object `json:"S3Object"` }
type Group ¶
type Group struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_group_unique"` Name string `json:"Name" gorm:"uniqueIndex:idx_group_unique"` ParentID *uint `json:"ParentId" gorm:"index"` Parent *Group `json:"Parent"` Children []*Group `json:"Children" gorm:"foreignKey:ParentID"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func (Group) FindChildByID ¶
type KPIMeas ¶
type KPIMeas struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_kpi_meas_unique"` ProductType string `json:"ProductType" gorm:"uniqueIndex:idx_kpi_meas_unique"` MeasTypeID string `json:"MeasTypeID" gorm:"uniqueIndex:idx_kpi_meas_unique"` MeasTypeSet string `json:"MeasTypeSet" gorm:"index"` Enable bool `json:"Enable" gorm:"index"` Default bool `json:"Default" gorm:"index"` Name string `json:"Name"` Unit string `json:"Unit"` StatsType string `json:"StatsType"` Formula string `json:"Formula"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` FormulaExpression *govaluate.EvaluableExpression `json:"-" gorm:"-"` }
func GetKPIMeasure ¶
func GetKPIMeasuresBySet ¶
type KPITemplate ¶
type KPITemplate struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_kpi_template_unique"` ProductType string `json:"ProductType" gorm:"uniqueIndex:idx_kpi_template_unique"` Name string `json:"Name" gorm:"uniqueIndex:idx_kpi_template_unique"` Default bool `json:"Default" gorm:"index"` PeriodicInterval int64 `json:"PeriodicInterval"` SelectType string `json:"SelectType"` SelectIds []uint `json:"SelectIds" gorm:"-"` SelectIdsRaw jsontype.JSONSlice[uint] `json:"-" gorm:"column:select_ids"` MeasTypeIds []string `json:"MeasTypeIds" gorm:"-"` MeasTypeIdsRaw jsontype.JSONSlice[string] `json:"-" gorm:"column:meas_type_ids"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` }
func (*KPITemplate) BeforeSave ¶
func (m *KPITemplate) BeforeSave(tx *gorm.DB) (err error)
func (*KPITemplate) LoadData ¶
func (m *KPITemplate) LoadData()
func (*KPITemplate) SaveData ¶
func (m *KPITemplate) SaveData()
func (KPITemplate) ViewTableName ¶
func (m KPITemplate) ViewTableName() string
type ParameterNotifications ¶
func (ParameterNotifications) GetValue ¶
func (m ParameterNotifications) GetValue(n string) int
func (ParameterNotifications) SetValue ¶
func (m ParameterNotifications) SetValue(n string, v int)
func (ParameterNotifications) SetValues ¶
func (m ParameterNotifications) SetValues(values map[string]int)
type ParameterTypes ¶
func (ParameterTypes) GetValue ¶
func (m ParameterTypes) GetValue(n string) string
func (ParameterTypes) GetValues ¶
func (m ParameterTypes) GetValues() map[string]string
func (ParameterTypes) SetValue ¶
func (m ParameterTypes) SetValue(n, v string)
func (ParameterTypes) SetValues ¶
func (m ParameterTypes) SetValues(values map[string]string)
type ParameterValues ¶
func (ParameterValues) GetValue ¶
func (m ParameterValues) GetValue(n string) string
func (ParameterValues) GetValues ¶
func (m ParameterValues) GetValues() map[string]string
func (ParameterValues) SetValue ¶
func (m ParameterValues) SetValue(n, v string)
func (ParameterValues) SetValues ¶
func (m ParameterValues) SetValues(values map[string]string)
type ParameterWritables ¶
func (ParameterWritables) GetValue ¶
func (m ParameterWritables) GetValue(n string) bool
func (ParameterWritables) RemoveValue ¶
func (m ParameterWritables) RemoveValue(n string)
func (ParameterWritables) SetValue ¶
func (m ParameterWritables) SetValue(n string, v bool)
func (ParameterWritables) SetValues ¶
func (m ParameterWritables) SetValues(values map[string]bool)
type Product ¶
type Product struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_product_class_unique;uniqueIndex:idx_product_model_unique"` ModelName string `json:"ModelName" gorm:"uniqueIndex:idx_product_model_unique"` Oui string `json:"Oui" gorm:"uniqueIndex:idx_product_class_unique"` ProductClass string `json:"ProductClass" gorm:"uniqueIndex:idx_product_class_unique"` ProductType string `json:"ProductType" gorm:"index"` Enable bool `json:"Enable" gorm:"index"` Default bool `json:"Default" gorm:"index"` ParameterPath string `json:"ParameterPath"` Manufacturer string `json:"Manufacturer"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` // ParameterTypesRaw jsontype.JSONType[*ParameterTypes] `json:"-" gorm:"column:parameter_types"` // ParameterTypes *ParameterTypes `json:"ParameterTypes" gorm:"-"` PerformanceValueDefinesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:performance_value_defines"` PerformanceValueDefines *jsontype.Tags `json:"PerformanceValueDefines" gorm:"-"` SupportedAlarms []*ProductSupportedAlarm `json:"SupportedAlarms"` Firmwares []*Firmware `json:"Firmwares" gorm:"many2many:firmware_products;"` }
func CreateProduct ¶
func GetProductByModelName ¶
func (*Product) GetDataModel ¶
type ProductSupportedAlarm ¶
type ProductSupportedAlarm struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_product_support_alarm_unique;not null"` ProductID uint `json:"ProductId" gorm:"uniqueIndex:idx_product_support_alarm_unique;not null"` Product *Product `json:"Product"` Oui string `json:"Oui"` ProductClass string `json:"ProductClass"` SerialNumber string `json:"SerialNumber"` ProductType string `json:"ProductType" gorm:"index"` AlarmIdentifier string `json:"AlarmIdentifier" gorm:"uniqueIndex:idx_product_support_alarm_unique;not null"` EventType string `json:"EventType"` ProbableCause string `json:"ProbableCause"` SpecificProblem string `json:"SpecificProblem"` PerceivedSeverity string `json:"PerceivedSeverity"` }
type Task ¶
type Task struct { ID uint `json:"Id" gorm:"primarykey"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` Created jsontype.JSONTime `json:"Created" gorm:"autoCreateTime"` Deleted gorm.DeletedAt `json:"Deleted" gorm:"index"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_task_unique"` TaskName string `json:"TaskName" gorm:"uniqueIndex:idx_task_unique"` TaskType string `json:"TaskType" gorm:"index"` Enable bool `json:"Enable" gorm:"index"` Default bool `json:"Default" gorm:"index"` ExecMode TaskExecMode `json:"ExecMode"` ExecStartTime jsontype.JSONTime `json:"ExecStartTime"` ExecEndTime jsontype.JSONTime `json:"ExecEndTime"` ExecInterval int `json:"ExecInterval"` ExecTimes int `json:"ExecTimes"` ExecRate int `json:"ExecRate"` RetryInterval int `json:"RetryInterval"` RetryTimes int `json:"RetryTimes"` RangesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:ranges"` Ranges *jsontype.Tags `json:"DeviceIds" gorm:"-"` Creater string `json:"Creater"` MetaDataRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:meta_data"` MetaData *jsontype.Tags `json:"MetaData" gorm:"-"` TaskStatus TaskStatus `json:"TaskStatus" gorm:"index"` ExecProcess int `json:"ExecProcess"` ExecLastTime jsontype.JSONTime `json:"ExecLastTime"` ExecNextTime jsontype.JSONTime `json:"ExecNextTime"` }
func CreateNBITask ¶
type TaskDeviceLog ¶
type TaskDeviceLog struct { Time jsontype.JSONTime `json:"Time" gorm:"autoCreateTime;uniqueIndex:idx_task_log_unique;not null"` Schema string `json:"Schema" gorm:"uniqueIndex:idx_task_log_unique;not null"` TaskID uint `json:"TaskId" gorm:"uniqueIndex:idx_task_log_unique;not null"` Task *Task `json:"Task" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` DeviceID uint `json:"DeviceId" gorm:"uniqueIndex:idx_task_log_unique;not null"` Device *Device `json:"Device" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Updated jsontype.JSONTime `json:"Updated" gorm:"autoUpdateTime"` TaskName string `json:"TaskName"` TaskType string `json:"TaskType"` ExecMode int `json:"ExecMode"` StartTime jsontype.JSONTime `json:"StartTime"` EndTime jsontype.JSONTime `json:"EndTime"` Code int `json:"Code"` Info string `json:"Info"` RangesRaw jsontype.JSONType[*jsontype.Tags] `json:"-" gorm:"column:ranges"` Ranges *jsontype.Tags `json:"DeviceIds" gorm:"-"` }
func (*TaskDeviceLog) BeforeSave ¶
func (m *TaskDeviceLog) BeforeSave(tx *gorm.DB) (err error)
type TaskExecMode ¶
type TaskExecMode int
const ( TaskExecModeImmediately TaskExecMode = 0 TaskExecModeSchedule TaskExecMode = 1 )
type TaskHandleFunc ¶
type TaskServer ¶
func GetTaskServer ¶
func GetTaskServer() *TaskServer
func NewTaskServer ¶
func NewTaskServer() *TaskServer
func (*TaskServer) ClearTask ¶
func (s *TaskServer) ClearTask(task *Task)
func (*TaskServer) Close ¶
func (s *TaskServer) Close()
func (*TaskServer) GetTaskSessionsBySource ¶
func (s *TaskServer) GetTaskSessionsBySource(source string) []*TaskSession
func (*TaskServer) PushDeviceAlarm ¶
func (s *TaskServer) PushDeviceAlarm(alarm *DeviceAlarm)
func (*TaskServer) Run ¶
func (s *TaskServer) Run()
func (*TaskServer) StartTask ¶
func (s *TaskServer) StartTask(task *Task)
func (*TaskServer) StopTask ¶
func (s *TaskServer) StopTask(task *Task)
type TaskSession ¶
type TaskSession struct { sync.Mutex Key string Task *Task Status TaskStatus Process int64 LastTime int64 NextTime int64 CurrentRate int64 Timeout int64 // contains filtered or unexported fields }
func CreateTaskSession ¶
func CreateTaskSession(db *gorm.DB, task *Task, f TaskHandleFunc) *TaskSession
func (*TaskSession) PushJob ¶
func (s *TaskSession) PushJob(data any)
func (*TaskSession) Start ¶
func (s *TaskSession) Start()
func (*TaskSession) Stop ¶
func (s *TaskSession) Stop()
type TaskStatus ¶
type TaskStatus int
const ( TaskStatusInit TaskStatus = 0 TaskStatusWaiting TaskStatus = 1 TaskStatusRunning TaskStatus = 2 TaskStatusFinish TaskStatus = 3 TaskStatusCancel TaskStatus = 4 )
Source Files ¶
- datamodel.go
- datamodel_map.go
- datamodel_param.go
- datamodel_template.go
- device.go
- device_alarm.go
- device_alarm_status.go
- device_alive.go
- device_call.go
- device_event.go
- device_perf.go
- device_status.go
- device_transefer.go
- device_update.go
- firmware.go
- group.go
- kpi.go
- kpi_temp.go
- param_define.go
- product.go
- product_map.go
- product_update.go
- setup.go
- setup_datamodel.go
- setup_kpi.go
- setup_products.go
- setup_task.go
- support_alarm.go
- task.go
- task_server.go
- task_session.go
- utils.go
Click to show internal directories.
Click to hide internal directories.