agcommon

package
v0.0.0-...-8d2fcc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//GetResourceDetailsFunc function pointer for the agmodel.GetResourceDetails
	GetResourceDetailsFunc = agmodel.GetResourceDetails
	// GetAllKeysFromTableFunc function pointer for the agmodel.GetAllKeysFromTable
	GetAllKeysFromTableFunc = agmodel.GetAllKeysFromTable
	//GetAllSystemsFunc function pointer for the agmodel.GetAllSystems
	GetAllSystemsFunc = agmodel.GetAllSystems
	//GetDeviceSubscriptionsFunc  function pointer for the  agmodel.GetDeviceSubscriptions
	GetDeviceSubscriptionsFunc = agmodel.GetDeviceSubscriptions
	// UpdateDeviceSubscriptionFunc function pointer for the agmodel.UpdateDeviceSubscription
	UpdateDeviceSubscriptionFunc = agmodel.UpdateDeviceSubscription
	// GetEventSubscriptionsFunc function pointer for the agmodel.GetEventSubscriptions
	GetEventSubscriptionsFunc = agmodel.GetEventSubscriptions
	// JSONUnMarshalFunc function pointer for the json.Unmarshal
	JSONUnMarshalFunc = json.Unmarshal
	//LookupIPfunc  function pointer for the  net.LookupIP
	LookupIPfunc = net.LookupIP
	//SplitHostPortfunc  function pointer for the net.SplitHostPort
	SplitHostPortfunc = net.SplitHostPort
)
View Source
var (
	// ConfigFilePath holds the value of odim config file path
	ConfigFilePath string
	// PSRecord holds the record of each plugin health check status
	PSRecord PluginStatusRecord
)
View Source
var SupportedConnectionMethodTypes = map[string]bool{
	"Redfish": true,
	"SNMP":    false,
	"OEM":     false,
	"NETCONF": false,
	"IPMI15":  false,
	"IPMI20":  false,
}

SupportedConnectionMethodTypes is for validating the connection method type

Functions

func ContactPlugin

func ContactPlugin(ctx context.Context, req agmodel.PluginContactRequest, serverName string) (*http.Response, error)

ContactPlugin is for sending requests to a plugin.

func CreateContext

func CreateContext(transactionId, actionId, actionName, threadId, threadName, ProcessName string) context.Context

func GetAllPlugins

func GetAllPlugins(ctx context.Context) ([]agmodel.Plugin, error)

GetAllPlugins is for fetching all the plugins added andn stored in db.

func GetDeviceSubscriptionDetails

func GetDeviceSubscriptionDetails(serverAddress string) (string, []string, error)

GetDeviceSubscriptionDetails is for getting device event susbcription details

func GetPluginStatus

func GetPluginStatus(ctx context.Context, plugin agmodel.Plugin) bool

GetPluginStatus checks the status of given plugin

func GetPluginStatusRecord

func GetPluginStatusRecord(plugin string) (int, bool)

GetPluginStatusRecord is for getting the status record of a plugin

func GetSearchKey

func GetSearchKey(key, index string) string

GetSearchKey will return search key with regular expression for filtering

func GetStorageResources

func GetStorageResources(ctx context.Context, oid string) map[string]interface{}

GetStorageResources will get the resource details from the database for the given odata id

func GetSubscribedEvtTypes

func GetSubscribedEvtTypes(searchKey string) ([]string, error)

GetSubscribedEvtTypes is to get event subscription details

func LookupHost

func LookupHost(addr string) (ip, host, port string, err error)

LookupHost - look up the ip from the host address

func LookupPlugin

func LookupPlugin(ctx context.Context, addr string) (agmodel.Plugin, error)

LookupPlugin is for fetching the plugin data using the plugin address for lookup

func SetPluginStatusRecord

func SetPluginStatusRecord(plugin string, count int)

SetPluginStatusRecord is for setting the status record of a plugin

func TrackConfigFileChanges

func TrackConfigFileChanges(dbInterface DBInterface, errChan chan error)

TrackConfigFileChanges monitors the odim config changes using fsnotfiy Whenever any config file changes and events will be and reload the configuration and verify the existing connection methods

func UpdateDeviceSubscriptionDetails

func UpdateDeviceSubscriptionDetails(ctx context.Context, subsData map[string]string)

UpdateDeviceSubscriptionDetails is for updating the event subscription details fo a device

Types

type DBInterface

type DBInterface struct {
	GetAllKeysFromTableInterface func(string) ([]string, error)
	GetConnectionMethodInterface func(string) (agmodel.ConnectionMethod, *errors.Error)
	AddConnectionMethodInterface func(agmodel.ConnectionMethod, string) *errors.Error
	DeleteInterface              func(string, string, common.DbType) *errors.Error
}

DBInterface hold interface for db functions

func (*DBInterface) AddConnectionMethods

func (e *DBInterface) AddConnectionMethods(connectionMethodConf []config.ConnectionMethodConf) error

AddConnectionMethods will add the connection method type and variant into DB

type PluginHealthCheckInterface

type PluginHealthCheckInterface struct {
	DecryptPassword func([]byte) ([]byte, error)
	PluginConfig    config.PluginStatusPolling
	RootCA          []byte
}

PluginHealthCheckInterface holds the methods required for plugin healthcheck

func (*PluginHealthCheckInterface) DupPluginConf

func (phc *PluginHealthCheckInterface) DupPluginConf()

DupPluginConf is for duplicating the plugin status polling config using a lock at one place instead of acquiring a lock and reading the config params multiple times

func (*PluginHealthCheckInterface) GetPluginManagedServers

func (phc *PluginHealthCheckInterface) GetPluginManagedServers(plugin agmodel.Plugin) []agmodel.Target

GetPluginManagedServers is for fetching the list of servers managed by a plugin

func (*PluginHealthCheckInterface) GetPluginStatus

func (phc *PluginHealthCheckInterface) GetPluginStatus(ctx context.Context, plugin agmodel.Plugin) (bool, []string)

GetPluginStatus is for checking the status of a plugin

type PluginStatusRecord

type PluginStatusRecord struct {
	InactiveCount map[string]int
	Lock          sync.Mutex
}

PluginStatusRecord holds the record of plugins and the number of times is has been inactive during periodic health check

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL