mgrcommon

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetPluginTokenFunc = GetPluginToken
	GetPluginDataFunc  = mgrmodel.GetPluginData
	StringEqualFold    = strings.EqualFold
	ContactPluginFunc  = ContactPlugin
	JSON_UnmarshalFunc = json.Unmarshal
)

Functions

func DeviceCommunication

func DeviceCommunication(ctx context.Context, req ResourceInfoRequest) response.RPC

DeviceCommunication to connect with device with all the params

func GetPluginToken

func GetPluginToken(ctx context.Context, req PluginContactRequest) string

GetPluginToken will verify the if any token present to the plugin else it will create token for the new plugin

func GetResourceInfoFromDevice

func GetResourceInfoFromDevice(ctx context.Context, req ResourceInfoRequest) (string, error)

GetResourceInfoFromDevice will contact to the and gets the Particual resource info from device

func TrackConfigFileChanges

func TrackConfigFileChanges(configFilePath string, dbInterface DBInterface, errChan chan error)

TrackConfigFileChanges monitors the odim config changes using fsnotfiy

func TranslateToSouthBoundURL

func TranslateToSouthBoundURL(url string) string

TranslateToSouthBoundURL translates the url to southbound URL

Types

type BmcUpdatedCreds

type BmcUpdatedCreds struct {
	UserName        string
	UpdatedPassword string
}

type DBInterface

type DBInterface struct {
	AddManagertoDBInterface func(mgrmodel.RAManager) error
	GenericSave             func([]byte, string, string) error
}

DBInterface hold interface for db functions

type PluginContactRequest

type PluginContactRequest struct {
	Token          string
	OID            string
	DeviceInfo     interface{}
	BasicAuth      map[string]string
	ContactClient  func(context.Context, string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	Plugin         mgrmodel.Plugin
	HTTPMethodType string
}

PluginContactRequest hold the request of contact plugin

type PluginToken

type PluginToken struct {
	Tokens map[string]string
	// contains filtered or unexported fields
}

PluginToken interface to hold the token

var Token PluginToken

Token variable hold the all the XAuthToken against the plguin ID

func (*PluginToken) GetToken

func (p *PluginToken) GetToken(pluginID string) string

GetToken to get the token from map

func (*PluginToken) StoreToken

func (p *PluginToken) StoreToken(plguinID, token string)

StoreToken to store the token ioto the map

type ResourceInfoRequest

type ResourceInfoRequest struct {
	URL                   string
	UUID                  string
	SystemID              string
	ContactClient         func(context.Context, string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	DecryptDevicePassword func([]byte) ([]byte, error)
	HTTPMethod            string
	RequestBody           []byte
	BmcUpdatedCreds       *BmcUpdatedCreds
}

ResourceInfoRequest hold the request of getting Resource

type ResponseStatus

type ResponseStatus struct {
	StatusCode    int32
	StatusMessage string
}

ResponseStatus holds the response of Contact Plugin

func ContactPlugin

func ContactPlugin(ctx context.Context, req PluginContactRequest, errorMessage string) ([]byte, string, ResponseStatus, error)

ContactPlugin is commons which handles the request and response of Contact Plugin usage

func RetryManagersOperation

func RetryManagersOperation(ctx context.Context, req PluginContactRequest, errorMessage string) ([]byte, string, ResponseStatus, error)

RetryManagersOperation will be called whenever the unauthorized status code during the plugin call This function will create a new session token reexcutes the plugin call

Jump to

Keyboard shortcuts

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