Documentation
¶
Overview ¶
(C) Copyright [2023] Hewlett Packard Enterprise Development LP
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Package common ...
Index ¶
- Constants
- Variables
- func CheckDBConnection() error
- func CreateContext(transactionID, actionID, actionName, threadID, threadName, processName string) context.Context
- func CreateJobQueue(qsize int) (chan<- interface{}, <-chan interface{})
- func CreateMetadata(ctx context.Context) context.Context
- func CreateNewRequestContext(ctx context.Context) context.Context
- func DecryptWithPrivateKey(ciphertext []byte) ([]byte, error)
- func EncryptWithPublicKey(password []byte) ([]byte, error)
- func GeneralError(statusCode int32, statusMsg, errMsg string, msgArgs []interface{}, ...) response.RPC
- func GetContextData(ctx context.Context) context.Context
- func GetDBConnection(dbFlag DbType) (*persistencemgr.ConnPool, *errors.Error)
- func GetIPFromHostName(fqdn string) (string, error)
- func GetServiceEndpointAddresses(srvName string) ([]string, error)
- func IsK8sDeployment() bool
- func ModifyContext(ctx context.Context, threadName, podName string) context.Context
- func RequestParamsCaseValidator(rawRequestBody []byte, reqStruct interface{}) (string, error)
- func RunReadWorkers(ctx context.Context, jobChannel <-chan interface{}, ...)
- func RunWriteWorkers(jobChannel chan<- interface{}, dataBatch []interface{}, workerCount int, ...)
- func SendFailedRPCCallResponse(ctx iris.Context, errorMessage string)
- func SendInvalidSessionResponse(ctx iris.Context, errorMessage string)
- func SendMalformedJSONRequestErrResponse(ctx iris.Context, errorMessage string)
- func SetCommonHeaders(w http.ResponseWriter)
- func SetResponseHeader(ctx iris.Context, params map[string]string)
- func SetUpMockConfig() error
- func TrackConfigFileChanges(configFilePath string, eventChan chan<- interface{}, errChan chan<- error)
- func TruncateDB(dbFlag DbType) *errors.Error
- func URIValidator(uri string) bool
- type ActionKey
- type ActionType
- type ControlMessage
- type ControlMessageData
- type DbType
- type DeviceSubscription
- type EmbQueue
- type Event
- type EventConst
- type EventMessageBus
- type Events
- type Link
- type MessageData
- type Plugin
- type PluginResponseStatus
- type PluginStats
- type PluginStatus
- type PluginStatusEvent
- type PluginTask
- type StatusRequest
- type StatusResponse
- type SubscribeEMBData
- type Target
- type TaskData
- type TaskEvent
- type TaskUpdateInfo
Constants ¶
const ( // RoleAdmin defines admin role for all service to authorize RoleAdmin = "Administrator" // RoleMonitor defines monitor role for all service to authorize RoleMonitor = "Operator" // RoleClient defines client role for all service to authorize RoleClient = "ReadOnly" // PrivilegeLogin defines the privilege for login PrivilegeLogin = "Login" // PrivilegeConfigureManager defines the privilege for configuraton manager PrivilegeConfigureManager = "ConfigureManager" // PrivilegeConfigureUsers defines the privilege for user configuratons PrivilegeConfigureUsers = "ConfigureUsers" // PrivilegeConfigureSelf defines the privilege for self configuratons PrivilegeConfigureSelf = "ConfigureSelf" // PrivilegeConfigureComponents defines the privilege for component configuratons PrivilegeConfigureComponents = "ConfigureComponents" //Cancelled - This value shall represent that the operation was cancelled either through //a Delete on a Task Monitor or Task Resource or by an internal process. Cancelled = "Cancelled" //Cancelling - This value shall represent that the operation is in the process of being cancelled. Cancelling = "Cancelling" //Completed - This value shall represent that the operation is complete and //completed sucessfully or with warnings. Completed = "Completed" //Exception - This value shall represent that the operation is complete and completed with errors. Exception = "Exception" //Interrupted - This value shall represent that the operation has been interrupted but //is expected to restart and is therefore not complete. Interrupted = "Interrupted" //Killed - This value shall represent that the operation is complete because the task //was killed by an operator. Deprecated v1.2+. This value has been //deprecated and is being replaced by the value Cancelled which has more //determinate semantics. Killed = "Killed" //New - This value shall represent that this task is newly created but the operation //has not yet started. New = "New" //Pending - This value shall represent that the operation is pending some condition and //has not yet begun to execute. Pending = "Pending" //Running - This value shall represent that the operation is executing. Running = "Running" //Service - This value shall represent that the operation is now running as a service and //expected to continue operation until stopped or killed. Service = "Service" //Starting - This value shall represent that the operation is starting. Starting = "Starting" //Stopping - This value shall represent that the operation is stopping but is not yet complete. Stopping = "Stopping" //Suspended - This value shall represent that the operation has been suspended but is //expected to restart and is therefore not complete. Suspended = "Suspended" //Critical - A critical condition exists that requires immediate attention. Critical = "Critical" //OK - Normal. OK = "OK" //Warning - A condition exists that requires attention. Warning = "Warning" // ManagerTypeAuxiliaryController - A controller that provides management functions // for a particular subsystem or group of devices. ManagerTypeAuxiliaryController = "AuxiliaryController" // ManagerTypeBMC - A controller that provides management functions for a single computer system. ManagerTypeBMC = "BMC" // ManagerTypeEnclosureManager - A controller that provides management functions // for a chassis or group of devices or systems. ManagerTypeEnclosureManager = "EnclosureManager" // ManagerTypeManagementController - A controller that primarily monitors or manages the operation of a device or system. ManagerTypeManagementController = "ManagementController" // ManagerTypeRackManager - A controller that provides management functions for a whole or part of a rack. ManagerTypeRackManager = "RackManager" // ManagerTypeService - A software-based service that provides management functions. ManagerTypeService = "Service" // SubscriptionIndex is a index name which required for indexing of event subscriptions SubscriptionIndex = "Subscription" // DeviceSubscriptionIndex is a index name which required for indexing // subscription of device DeviceSubscriptionIndex = "DeviceSubscription" // ManagerAccountType has schema version to be returned with manager account ManagerAccountType = "#ManagerAccount.v1_9_0.ManagerAccount" // AccountServiceType has schema version to be returned with accountservice AccountServiceType = "#AccountService.v1_11_0.AccountService" // RoleType has schema version to be returned with Role RoleType = "#Role.v1_3_1.Role" // SessionServiceType has schema version to be returned with sessionservice SessionServiceType = "#SessionService.v1_1_8.SessionService" // SessionType has schema version to be returned with session SessionType = "#Session.v1_4_0.Session" // EventType has schema version to be returned with event EventType = "#Event.v1_7_0.Event" // AggregationServiceType has schema version to be returned with Aggregationservice AggregationServiceType = "#AggregationService.v1_0_1.AggregationService" // TaskType has schema version to be returned with Task TaskType = "#Task.v1_6_0.Task" // EventDestinationType has schema version to be returned with EventDestination EventDestinationType = "#EventDestination.v1_12_0.EventDestination" // EventServiceType has schema version to be returned with Event Service Type EventServiceType = "#EventService.v1_8_0.EventService" // ManagerType has schema version to be returned with Manager ManagerType = "#Manager.v1_15_0.Manager" // TaskEventType has schema version to be returned with TaskEvent TaskEventType = "TaskEvent.1.0.3" // UpdateServiceType has schema version to be returned with UpdateService UpdateServiceType = "#UpdateService.v1_11_0.UpdateService" // SettingsType has schema version to be returned with Settings in update service SettingsType = "#Settings.v1_3_3.OperationApplyTimeSupport" // TelemetryServiceType has version to be returned with Telemetry Service TelemetryServiceType = "#TelemetryService.v1_3_1.TelemetryService" //AggregationSourceType has version to be returned with AggregationSource Service AggregationSourceType = "#AggregationSource.v1_2_0.AggregationSource" //ChassisType has version to be returned with Chassis Service ChassisType = "#Chassis.v1_20_0.Chassis" //ManagerAccountServiceType has version to be returned with RemoteAccountService response ManagerAccountServiceType = "#AccountService.v1_13_0.AccountService" // AggregateSubscriptionIndex is a index name which required for indexing // subscription of aggregate AggregateSubscriptionIndex = "AggregateToHost" // PluginEventHandlingActionName is an action name to be logged while processing events PluginEventHandlingActionName = "EventHandling" // PluginEventHandlingActionID is an action id to be logged while processing events PluginEventHandlingActionID = "220" // PluginEventPublishingActionName is an action name to be logged while publishing events PluginEventPublishingActionName = "EventPublish" // PluginEventPublishingActionID is an action id to be logged while publishing events PluginEventPublishingActionID = "221" // PluginTrackFileConfigActionName is an action name to be logged while tracking config changes PluginTrackFileConfigActionName = "TrackConfigFIleChanges" // PluginTrackFileConfigActionID is an action id to be logged while tracking config changes PluginTrackFileConfigActionID = "000" //LogServicesID is the URI for endpoints which operates on a specific log LogServicesID = "LogServices/{id}" //EntriesID is the URI for endpoints which operates on a specific entry EntriesID = "Entries/{id}" //RolesID is the URI for endpoints which performs operations on a specific user role RolesID = "Roles/{id}" //AccountsID is the URI for endpoints which performs operations on a specific user account AccountsID = "Accounts/{id}" //AggregationSourcesID is the URI for endpoints which performs operations on a specific aggregation source AggregationSourcesID = "AggregationSources/{id}" //ChassisID is the URI for endpoints which performs operations on a specific computer system chassis, rack group, or a rack. ChassisID = "Chassis/{id}" //AddressPoolsID is the URI for endpoints which performs operations on a specific address pool AddressPoolsID = "AddressPools/{id}" //PortsID is the URI for endpoints which performs operations on a specific switch port PortsID = "Ports/{id}" //ZonesID is the URI for endpoints which performs operations on a specific fabric zone ZonesID = "Zones/{id}" //EndpointsID is the URI for endpoints which performs operations on a specific fabric endpoint EndpointsID = "Endpoints/{id}" )
const ( TransactionID = "transactionid" ThreadID = "threadid" ThreadName = "threadname" ActionName = "actionname" ActionID = "actionid" ProcessName = "processname" RequestBody = "requestbody" )
Below fields are Process Name for logging
const ( ManagerService = "svc-managers" AccountService = "svc-account" SystemService = "svc-systems" SessionService = "svc-account-session" APIService = "svc-api" UpdateService = "svc-update" TaskService = "svc-task" AggregationService = "svc-aggregation" EventService = "svc-event" TelemetryService = "svc-telemetry" LicenseService = "svc-licenses" FabricService = "svc-fabrics" )
Below fields are service names for logging
const ( // DefaultThreadID to be used for apis DefaultThreadID = "0" // Invalid Action InvalidActionID = "000" )
Below fields are thread IDs for logging
const ( InvalidActionName = "MethodNotAllowed" CheckAuth = "Check-Authentication" CheckSessionCreation = "CheckSessionCreationCredentials" CheckSessionTimeout = "CheckSessionTimeOut" SendRequest = "SendRequest" StartRequest = "StartRequest" SimpleUpdate = "SimpleUpdate" StartUpdate = "StartUpdate" OverWriteCompletedTaskUtil = "OverWriteCompletedTaskUtil" AsyncTaskDelete = "AsyncTaskDelete" ResetAggregates = "Reset-Aggregates" ResetAggregate = "Reset-Aggregate" SetBootOrder = "SettingBootOrder" CollectAndSetDefaultBootOrder = "CollectAndSetDefaultBoorOrder" AddAggregationSource = "AddingAggregationSource" DeleteAggregationSource = "DeleteAggregationSource" SubTaskStatusUpdate = "SubTaskStatusUpdate" ResetSystem = "ResetSystem" SetDefaultBootOrderElementsOfAggregate = "SetDefaultBootOrderElementsOfAggregate" RediscoverSystemInventory = "RediscoverSystemInventory" CheckPluginStatus = "CheckPluginStatus" GetTelemetryResource = "GetTelemetryResource" PollPlugin = "PollPlugin" CreateRemoteAccountService = "CreateRemoteAccountService" UpdateRemoteAccountService = "UpdateRemoteAccountService" DeleteRemoteAccountService = "DeleteRemoteAccountService" InstallLicenseService = "InstallLicenseService" ProcessTaskEvents = "ProcessTaskEvents" CreateVolume = "CreateVolume" DeleteVolume = "DeleteVolume" SessionToken = "sessiontoken" SessionUserID = "sessionuserid" SessionRoleID = "sessionroleid" StatusCode = "statuscode" ComputerSystemReset = "ComputerSystemReset" ChangeBootOrderSettings = "ChangeBootOrderSettings" GetFabricManagerChassis = "GetFabricManagerChassis" CollectChassisResource = "CollectChassisResource" UpdateChassisResource = "UpdateChassisResource" UpdateSecureBoot = "UpdateSecureBoot" ResetSecureBoot = "ResetSecureBoot" )
Below fields are thread names for logging
const ( // Taskmon URI key Taskmon = "taskmon" // EnvPodName is a key name to get the pod name from environment EnvPodName = "POD_NAME" )
const ResetTaskIDPrefix = "reset-"
ResetTaskIDPrefix is the prefix for the task id for a reset request
Variables ¶
var Actions = map[ActionKey]ActionType{}/* 212 elements not displayed */
Actions contain map of URI object and action related to request made by user
var ChassisResource = map[string]string{
"Power": "Power",
"Thermal": "Thermal",
"NetworkAdapters": "NetworkAdaptersCollection",
"NetworkPorts": "NetworkPortsCollection",
"NetworkDeviceFunctions": "NetworkDeviceFunctionsCollection",
"Assembly": "Assembly",
"PCIeSlots": "PCIeSlots",
"PCIeDevices": "PCIeDevicesCollection",
"Sensors": "SensorsCollection",
"LogServices": "LogServicesCollection",
}
ChassisResource contains the Resource name and table name this map is basically to fetch the table name against the chassis resource name, so it will be usefull to store the resource data into the particular database table and also it will be usefull to retrives the chassis resource data
var ( // K8sODIMNamespace has the namepace where service is deployed K8sODIMNamespace string )
var ManagersResource = map[string]string{
"NetworkProtocol": "NetworkProtocol",
"EthernetInterfaces": "EthernetInterfacesCollection",
"HostInterfaces": "HostInterfacesCollection",
"VirtualMedia": "VirtualMediaCollection",
"LogServices": "LogServicesCollection",
"SerialInterfaces": "SerialInterfaceCollection",
"Entries": "EntriesCollection",
}
ManagersResource contains the Resource name and table name this map is basically to fetch the table name against the manager resource name, so it will be usefull to store the resource data into the particular database table and also it will be usefull to retrives the manager resource data
var ( // MuxLock is used for avoiding race conditions MuxLock = &sync.Mutex{} )
var PluginTaskIndex = "PluginTaskIndex"
PluginTaskIndex is name for SET in redis to store plugin task IDs
var RediscoverResources = []string{
"Bios",
"BootOptions",
"Storage",
}
RediscoverResources contains to get only these resource from the device when reset flag is set when device is restarted.
var ResourceTypes = map[string]string{
"AccelerationFunction": "AccelerationFunction",
"AddressPool": "AddressPool",
"Assembly": "Assembly",
"Bios": "Bios",
"BootOption": "BootOptions",
"Chassis": "Chassis",
"ComputerSystem": "Systems",
"Drive": "Drive",
"Endpoint": "Endpoint",
"EthernetInterface": "EthernetInterfaces",
"Event": "Event",
"EventDestination": "EventDestination",
"EventService": "EventService",
"Fabric": "Fabric",
"HostInterface": "HostInterfaces",
"IPAddresses": "IPAddresses",
"Job": "Job",
"JobService": "JobService",
"LogEntry": "LogEntry",
"LogService": "LogServices",
"Manager": "Manager",
"ManagerAccount": "ManagerAccount",
"ManagerNetworkProtocol": "ManagerNetworkProtocol",
"Memory": "Memory",
"MemoryChunks": "MemoryChunks",
"MemoryDomain": "MemoryDomains",
"MemoryMetrics": "MemoryMetrics",
"Message": "Message",
"MessageRegistry": "MessageRegistry",
"MessageRegistryFile": "MessageRegistryFile",
"NetworkAdapter": "NetworkAdapters",
"NetworkDeviceFunction": "NetworkDeviceFunction",
"NetworkInterface": "NetworkInterfaces",
"NetworkPort": "NetworkPort",
"PCIeDevice": "PCIeDevices",
"PCIeFunction": "PCIeFunction",
"PCIeSlots": "PCIeSlots",
"PhysicalContext": "PhysicalContext",
"Port": "Port",
"Power": "Power",
"PrivilegeRegistry": "PrivilegeRegistry",
"Privileges": "Privileges",
"Processor": "Processors",
"ProcessorCollection": "ProcessorCollection",
"ProcessorMetrics": "ProcessorMetrics",
"Protocol": "Protocol",
"Redundancy": "Redundancy",
"Resource": "Resource",
"Role": "Role",
"SecureBoot": "SecureBoot",
"Sensor": "Sensor",
"SerialInterfaces": "SerialInterfaces",
"Session": "Session",
"Storage": "Storage",
"Switch": "Switch",
"Task": "Task",
"Thermal": "Thermal",
"VLanNetworkInterface": "VLanNetworkInterface",
"Volume": "Volume",
"Zone": "Zone",
}
ResourceTypes specifies the map of valid resource types that can be used for an event subscription
var SessionURI = "/redfish/v1/SessionService/Sessions"
SessionURI is redfish URI for sessions
var SystemResource = map[string]string{
"Bios": "Bios",
"SecureBoot": "SecureBoot",
"Storage": "StorageCollection",
"BootOptions": "BootOptionsCollection",
"MemoryDomains": "MemoryDomainsCollection",
"NetworkInterfaces": "NetworkInterfacesCollection",
"Processors": "ProcessorsCollection",
"EthernetInterfaces": "EthernetInterfacesCollection",
"Memory": "MemoryCollection",
"VLANS": "VLANS",
"LogServices": "LogServicesCollection",
"Settings": "Bios",
"Volumes": "VolumesCollection",
"Drives": "DrivesCollection",
}
SystemResource contains the Resource name and table name this map is basically to fetch the table name against the system resource name, so it will be usefull to store the resource data into the particular database table and also it will be usefull to retrives the system resource data
var Types = map[string]string{
"EthernetInterfaces": "#EthernetInterface.v1_8_0.EthernetInterface",
}
Types contains schema versions to be returned
var URIWithNoAuth = []string{
"/redfish/v1",
"/redfish/v1/$metadata",
"/redfish/v1/odata",
"/redfish/v1/SessionService",
"/redfish/v1/SessionService/Sessions",
}
URIWithNoAuth contains the list of URI's which does not require authentication
var XForwardedFor = "X-Forwarded-For"
XForwardedFor holds the IP of plugin instance in response header
Functions ¶
func CheckDBConnection ¶
func CheckDBConnection() error
CheckDBConnection will check both inMemory and onDisk DB connections This function is expected to be called at each service startup
func CreateContext ¶
func CreateContext(transactionID, actionID, actionName, threadID, threadName, processName string) context.Context
CreateContext will create and returns a new context with the values passed
func CreateJobQueue ¶
func CreateJobQueue(qsize int) (chan<- interface{}, <-chan interface{})
CreateJobQueue defines the queue which will act as an infinite buffer. We can make use of this when we are not sure about the capacity required for the creating a buffered channel.
The function will return two channels; the first one will act as an entry or input channel and the later will be an exit or output channel.
The in channel must be closed by the user, but the closing of the out channel is taken care by the function itself.
func CreateMetadata ¶
CreateMetadata is used to add metadata values in context to be used in grpc calls
func CreateNewRequestContext ¶
CreateNewRequestContext creates a new context with the values from a context passed
func DecryptWithPrivateKey ¶
DecryptWithPrivateKey is used to decrypt ciphered text to device password with the private key whose path is available in the config file
func EncryptWithPublicKey ¶
EncryptWithPublicKey is used to encrypt device password using odimra public key
func GeneralError ¶
func GeneralError(statusCode int32, statusMsg, errMsg string, msgArgs []interface{}, t *TaskUpdateInfo) response.RPC
GeneralError will create the error response and update task if required This function can be used only if the expected response have only one extended info object. Error code for the response will be GeneralError If there is no requirement of task updation pass a nil value for *TaskUpdateInfo
func GetContextData ¶
GetContextData is used to fetch data from metadata and add it to context
func GetDBConnection ¶
func GetDBConnection(dbFlag DbType) (*persistencemgr.ConnPool, *errors.Error)
GetDBConnection is for maintaining and supplying DB connection pool for InMemory and OnDisk DB's Takes dbFlag of type DbType/int32 dbFlag:
InMemory: returns In-Memory DB connection pool OnDsik: returns On-Disk DB connection pool
func GetIPFromHostName ¶
GetIPFromHostName - look up the ip from the fqdn
func GetServiceEndpointAddresses ¶
GetServiceEndpointAddresses is for getting the list of IP addresses of all the pods belonging to the passed kubernetes service. Expects service name as defined in kubernetes deployment and returns the string slice with IP addresses of the pods and error if operation failed IsK8sDeployment should be used before calling GetServiceEndpointAddresses to check if it is kubernetes deployment
func IsK8sDeployment ¶
func IsK8sDeployment() bool
IsK8sDeployment is for finding out if it is kubernetes deployment
func ModifyContext ¶
ModifyContext modify the values in the context
func RequestParamsCaseValidator ¶
RequestParamsCaseValidator function validates input json w.r.t the structure defined, returns all the invalid properties sent in an input
func RunReadWorkers ¶
func RunReadWorkers(ctx context.Context, jobChannel <-chan interface{}, jobProcess func(context.Context, interface{}) bool, workerCount int)
RunReadWorkers will create a worker pool for doing a specific task which is passed to it as process after reading the data from the channel.
The function will three parameters: 1) jobChannel - an out channel of type interface on which the data is passed 2) process - a function which will do some logical tasks by taking data from jobChan 3) workerCount - number of workers required for doing the process
func RunWriteWorkers ¶
func RunWriteWorkers(jobChannel chan<- interface{}, dataBatch []interface{}, workerCount int, done chan bool)
RunWriteWorkers will create a worker pool for inserting data into a channel
The function will three parameters: 1) jobChannel - an in channel of type interface to which the data is passed 2) dataBatch - a slice of data which needed to be passed into the jobChannel 3) workerCount - number of workers required for doing the task 4) done - is a notification channel that indicates that job is done Please make sure all the data from the dataBatch has been wrote to the jobChannel before closing it, else it may cause data loss.
func SendFailedRPCCallResponse ¶
SendFailedRPCCallResponse writes the response to client when a RPC call fails
func SendInvalidSessionResponse ¶
SendInvalidSessionResponse writes the response to client when no valid session is found
func SendMalformedJSONRequestErrResponse ¶
SendMalformedJSONRequestErrResponse writes the response to client when the request contains malformed JSON structure
func SetCommonHeaders ¶
func SetCommonHeaders(w http.ResponseWriter)
SetCommonHeaders will add the common headers to the response writer
func SetResponseHeader ¶
SetResponseHeader will add the params to the response header
func SetUpMockConfig ¶
func SetUpMockConfig() error
SetUpMockConfig set ups a mock configuration for unit testing
func TrackConfigFileChanges ¶
func TrackConfigFileChanges(configFilePath string, eventChan chan<- interface{}, errChan chan<- error)
TrackConfigFileChanges monitors the config changes using fsnotfiy
func TruncateDB ¶
TruncateDB will clear DB. It will be useful for test cases Takes DbFlag of type DbType/int32 to choose Inmemory or OnDisk db to truncate dbFlag:
InMemory: Truncates InMemory DB OnDisk: Truncates OnDisk DB
Types ¶
type ActionType ¶
ActionType defines type of action
type ControlMessage ¶
type ControlMessage int
ControlMessage is the data type for ControlMessage types
const ( // SubscribeEMB is the ControlMessage type to // indicate to subscribe plugin EMB SubscribeEMB ControlMessage = iota )
type ControlMessageData ¶
type ControlMessageData struct { MessageType ControlMessage Data interface{} }
ControlMessageData holds the control message data
type DeviceSubscription ¶
type DeviceSubscription struct { EventHostIP string `json:"EventHostIP,omitempty"` OriginResources []string `json:"OriginResources"` Location string `json:"location,omitempty"` OriginResource string `json:"OriginResource"` }
DeviceSubscription is a model to store the subscription details of a device
type EmbQueue ¶
type EmbQueue struct { QueueName string `json:"EmbQueueName"` QueueDesc string `json:"EmbQueueDesc"` }
EmbQueue holds the information of Queue Name and Queue Description
type Event ¶
type Event struct { MemberID string `json:"MemberId,omitempty"` EventType string `json:"EventType"` EventGroupID int `json:"EventGroupId,omitempty"` EventID string `json:"EventId"` Severity string `json:"Severity"` EventTimestamp string `json:"EventTimestamp"` Message string `json:"Message"` MessageArgs []string `json:"MessageArgs,omitempty"` MessageID string `json:"MessageId"` Oem interface{} `json:"Oem,omitempty"` OriginOfCondition *Link `json:"OriginOfCondition,omitempty"` }
Event contains the details of the event subscribed from PMB
type EventConst ¶
type EventConst int
EventConst constant
const ( // RedfishEvent constant RedfishEvent EventConst = iota // MetricReport constant MetricReport )
type EventMessageBus ¶
type EventMessageBus struct { EmbType string `json:"EmbType"` EmbQueue []EmbQueue `json:"EmbQueue"` }
EventMessageBus holds the information of EMB Broker type and EMBQueue information
type Events ¶
type Events struct { IP string `json:"ip"` Request []byte `json:"request"` EventType string `json:"eventType"` }
Events contains the data with IP sent fro mplugin to PMB
type Link ¶
type Link struct {
Oid string `json:"@odata.id"`
}
Link property shall contain a link to the resource or object that originated the condition that caused the event to be generated
type MessageData ¶
type MessageData struct { OdataType string `json:"@odata.type"` Name string `json:"Name"` Context string `json:"@odata.context"` Events []Event `json:"Events"` }
MessageData contains information of Events and message details including arguments it will be used to pass to gob encoding/decoding which will register the type. it will be send as byte stream on the wire to/from kafka
type Plugin ¶
type Plugin struct { IP string Port string Username string Password []byte ID string PluginType string PreferredAuthType string }
Plugin is the model for plugin information
type PluginResponseStatus ¶
type PluginResponseStatus struct { Available string `json:"Available"` Uptime string `json:"Uptime"` TimeStamp string `json:"TimeStamp"` }
PluginResponseStatus hold status data of Plugin
type PluginStats ¶
type PluginStats struct { Resources string `json:"Resources"` Subscriptions string `json:"Subscriptions"` }
PluginStats holds the actual status details
type PluginStatus ¶
type PluginStatus struct { // Method - Method for communicating with Plugin Method string // Token - plugin session token Token string // RequestBody - holds the data for request body RequestBody StatusRequest // ResponseWaitTime - the resposne wait time in seconds ResponseWaitTime int // Count - the number of times the status check should happen Count int // RetryInterval the wait time in minutes before initiating the next request RetryInterval int // PluginIP PluginIP string //PluginPort PluginPort string //PluginUsername PluginUsername string //PluginUserPassword PluginUserPassword string //PluginPreferredAuthType PluginPreferredAuthType string //CACertificate to use while making HTTP queries CACertificate *[]byte }
PluginStatus holds the data required for continuously checking the plugin health
func (*PluginStatus) CheckStatus ¶
func (p *PluginStatus) CheckStatus() (bool, int, []string, error)
CheckStatus will check the for the status health of the plugin in a frequent interval The function will return the following bool: if true, plugin is alive int: number of tries on the plugin before concluding error: will contains the error details, if any happend during the tries queueList:will contains the list of queues to which events are published
type PluginStatusEvent ¶
type PluginStatusEvent struct { Name string `json:"Name"` Type string `json:"Type"` Timestamp string `json:"Timestamp"` OriginatorID string `json:"OriginatorID"` }
PluginStatusEvent contains details of the plugin status
type PluginTask ¶
type PluginTask struct { IP string `json:"IP"` PluginServerName string `json:"PluginServerName"` OdimTaskID string `json:"OdimTaskID"` PluginTaskMonURL string `json:"PluginTaskMonURL"` }
PluginTask contains the IP of the plugin instance that returns plugin taskmon, task id created in odim, and taskmon url sent by plugin it is used to map the odim task to plugin task and to know the IP of plugin instance that handle the task
type StatusRequest ¶
type StatusRequest struct { Comment string `json:"_comment"` Name string `json:"Name"` Version string `json:"Version"` }
StatusRequest is the plugin request for status check
type StatusResponse ¶
type StatusResponse struct { Comment string `json:"_comment"` Name string `json:"Name"` Version string `json:"Version"` Status *PluginResponseStatus `json:"Status"` EventMessageBus *EventMessageBus `json:"EventMessageBus"` }
StatusResponse is the general reponse for status check
type SubscribeEMBData ¶
SubscribeEMBData holds data required for subscribing to plugin EMB
type Target ¶
type Target struct { ManagerAddress string `json:"ManagerAddress"` Password []byte `json:"Password"` UserName string `json:"UserName"` PostBody []byte `json:"PostBody"` DeviceUUID string `json:"DeviceUUID"` PluginID string `json:"PluginID"` Location string `json:"Location"` }
Target is for sending the request to south bound/plugin
type TaskData ¶
type TaskData struct { TaskID string TargetURI string Response response.RPC TaskRequest string TaskState string TaskStatus string PercentComplete int32 HTTPMethod string FinalResponse response.RPC }
TaskData holds the response data which is been put into the task for task updation
type TaskEvent ¶
type TaskEvent struct { TaskID string `json:"TaskID"` TaskState string `json:"TaskState"` TaskStatus string `json:"TaskStatus"` PercentComplete int32 `json:"PercentComplete"` StatusCode int32 `json:"StatusCode"` ResponseBody []byte `json:"ResponseBody"` EndTime time.Time `json:"EndTime"` }
TaskEvent contains the task progress data sent form plugin to PMB