agmodel

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

Documentation

Overview

Package agmodel ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAggregateHostIndex

func AddAggregateHostIndex(uuid string, hostIP []string) error

AddAggregateHostIndex add aggregate hosts

func AddAggregationSource

func AddAggregationSource(req AggregationSource, aggregationSourceURI string) *errors.Error

AddAggregationSource connects to the persistencemgr and Add the AggregationSource to db

Inputs:

1.req: AggregationSource info 2.aggregationSourceURI : uri of AggregationSource

func AddConnectionMethod

func AddConnectionMethod(connectionMethod ConnectionMethod, connectionMethodURI string) *errors.Error

AddConnectionMethod will add connection methods on disk

func AddElementsToAggregate

func AddElementsToAggregate(aggregate Aggregate, aggregateURL string) *errors.Error

AddElementsToAggregate add elements to the aggregate

func AddNewHostToAggregateHostIndex

func AddNewHostToAggregateHostIndex(aggregateID string, hostIP string) error

AddNewHostToAggregateHostIndex add aggregate hosts

func AddSystemResetInfo

func AddSystemResetInfo(systemID, resetType string) *errors.Error

AddSystemResetInfo connects to the persistencemgr and Add the system reset info to db

Inputs:

1.systemURI: computer system uri for which system operation is maintained 2.resetType : reset type which is performed

func CheckActiveRequest

func CheckActiveRequest(key string) (bool, *errors.Error)

CheckActiveRequest will check the DB to see whether there are any active requests for the given key It will return true if there is an active request or false if not It will also through an error if any DB connection issues arise

func CheckMetricRequest

func CheckMetricRequest(key string) (bool, *errors.Error)

CheckMetricRequest will check the DB to see whether there are any active requests for the given key It will return true if there is an active request or false if not It will also through an error if any DB connection issues arise

func CreateAggregate

func CreateAggregate(aggregate Aggregate, aggregateURI string) *errors.Error

CreateAggregate will create aggregate on disk

func Delete

func Delete(table, key string, dbtype common.DbType) *errors.Error

Delete will delete the data from the provided db with the provided table and key data

func DeleteActiveRequest

func DeleteActiveRequest(key string) *errors.Error

DeleteActiveRequest deletes the active request key from the DB, return error if any

func DeleteAggregate

func DeleteAggregate(key string) *errors.Error

DeleteAggregate will delete the aggregate

func DeleteAggregateHostIndex

func DeleteAggregateHostIndex(uuid string) error

DeleteAggregateHostIndex delete aggregate from aggregatehostsIndex table

func DeleteAggregationSource

func DeleteAggregationSource(aggregtionSourceURI string) *errors.Error

DeleteAggregationSource will delete the AggregationSource entry from the database based on the aggregtionSourceURI

func DeleteComputeSystem

func DeleteComputeSystem(index int, key string) *errors.Error

DeleteComputeSystem will delete the compute system

func DeleteManagersData

func DeleteManagersData(key, table string) *errors.Error

DeleteManagersData will delete the table entry from the database based on the uuid

func DeleteMetricRequest

func DeleteMetricRequest(key string) *errors.Error

DeleteMetricRequest deletes the active request key from the DB, return error if any

func DeletePluginData

func DeletePluginData(key, table string) *errors.Error

DeletePluginData will delete the plugin entry from the database based on the uuid

func DeleteSystem

func DeleteSystem(key string) *errors.Error

DeleteSystem will delete the system from OnDisk

func DeleteSystemOperationInfo

func DeleteSystemOperationInfo(systemURI string) *errors.Error

DeleteSystemOperationInfo will delete the system operation entry from the database based on the systemURI

func DeleteSystemResetInfo

func DeleteSystemResetInfo(systemURI string) *errors.Error

DeleteSystemResetInfo will delete the system reset entry from the database based on the systemURI

func GenericSave

func GenericSave(body []byte, table string, key string) error

GenericSave will save any resource data into the database

func GetAllKeysFromTable

func GetAllKeysFromTable(table string) ([]string, error)

GetAllKeysFromTable retrun all matching data give table name

func GetAllMatchingDetails

func GetAllMatchingDetails(table, pattern string, dbtype common.DbType) ([]string, *errors.Error)

GetAllMatchingDetails accepts the table name ,pattern and DB type and return all the keys which mathces the pattern

func GetComputeSystem

func GetComputeSystem(ctx context.Context, deviceUUID string) (dmtfmodel.ComputerSystem, error)

GetComputeSystem will fetch the compute resource details

func GetComputerSystem

func GetComputerSystem(systemid string) (string, *errors.Error)

GetComputerSystem fetches computer system details by UUID from database

func GetDeviceSubscriptions

func GetDeviceSubscriptions(hostIP string) (*common.DeviceSubscription, error)

GetDeviceSubscriptions is to get subscription details of device

func GetEventSubscriptions

func GetEventSubscriptions(key string) ([]string, error)

GetEventSubscriptions is for getting the event subscription details

func GetRegistryFile

func GetRegistryFile(Table, key string) (string, *errors.Error)

GetRegistryFile from InMemory DB

func GetResource

func GetResource(Table, key string) (string, *errors.Error)

GetResource fetches a resource from database using table and key

func GetResourceDetails

func GetResourceDetails(key string) (string, *errors.Error)

GetResourceDetails fetches a resource from database using key

func GetString

func GetString(index, match string) ([]string, error)

GetString is used to retrive index values of type string

Inputs:

1. index is the index name to search with 2. match is the value to match with

func GetSystemResetInfo

func GetSystemResetInfo(systemURI string) (map[string]string, *errors.Error)

GetSystemResetInfo fetches the system reset info for the given systemURI

Inputs:

1.systemURI: computer system uri for which system operation is maintained

func RemoveElementsFromAggregate

func RemoveElementsFromAggregate(aggregate Aggregate, aggregateURL string) *errors.Error

RemoveElementsFromAggregate remove elements from an aggregate

func RemoveNewIPToAggregateHostIndex

func RemoveNewIPToAggregateHostIndex(aggregateID string, hostIP string) error

RemoveNewIPToAggregateHostIndex remove existing host ip from aggregate

func SaveBMCInventory

func SaveBMCInventory(data map[string]interface{}) error

SaveBMCInventory function save all bmc inventory data togeter using the transaction model

func SaveChassis

func SaveChassis(ctx context.Context, chassis dmtfmodel.Chassis, deviceUUID string) error

SaveChassis will save the chassis details into the database

func SaveComputeSystem

func SaveComputeSystem(ctx context.Context, computeServer dmtfmodel.ComputerSystem, deviceUUID string) error

SaveComputeSystem will save the compute server complete details into the database

func SaveIndex

func SaveIndex(searchForm map[string]interface{}, table, uuid, bmcAddress string) error

SaveIndex is used to create a

func SavePluginData

func SavePluginData(plugin Plugin) *errors.Error

SavePluginData will saves plugin on disk

func SavePluginManagerInfo

func SavePluginManagerInfo(body []byte, table string, key string) error

SavePluginManagerInfo will save plugin manager data into the database

func SaveRegistryFile

func SaveRegistryFile(ctx context.Context, body []byte, table string, key string) error

SaveRegistryFile will save any Registry file in database OnDisk DB

func UpdateAggregtionSource

func UpdateAggregtionSource(aggregationSource AggregationSource, key string) *errors.Error

UpdateAggregtionSource updates the aggregation details

func UpdateComputeSystem

func UpdateComputeSystem(key string, computeData interface{}) error

UpdateComputeSystem is used for updating ComputerSystem table

func UpdateConnectionMethod

func UpdateConnectionMethod(connectionMethod ConnectionMethod, key string) *errors.Error

UpdateConnectionMethod updates the Connection Method details

func UpdateDeviceSubscription

func UpdateDeviceSubscription(devSubscription common.DeviceSubscription) error

UpdateDeviceSubscription is to update subscription details of device

func UpdateIndex

func UpdateIndex(searchForm map[string]interface{}, table, uuid, bmcAddress string) error

UpdateIndex is used for updating an existing index

func UpdatePluginData

func UpdatePluginData(plugin Plugin, key string) *errors.Error

UpdatePluginData updates the plugin details

func UpdateSystemData

func UpdateSystemData(system SaveSystem, key string) *errors.Error

UpdateSystemData updates the bmc details

Types

type Aggregate

type Aggregate struct {
	Elements []OdataID `json:"Elements"`
}

Aggregate payload is used for perform the operations on Aggregate

func GetAggregate

func GetAggregate(aggregateURI string) (Aggregate, *errors.Error)

GetAggregate fetches the aggregate info for the given aggregateURI

type AggregationSource

type AggregationSource struct {
	HostName        string                `json:"HostName"`
	UserName        string                `json:"UserName,omitempty"`
	Password        []byte                `json:"Password,omitempty"`
	Links           interface{}           `json:"Links,omitempty"`
	ODataContext    string                `json:"@odata.context,omitempty"`
	ODataEtag       string                `json:"@odata.etag,omitempty"`
	ODataID         string                `json:"@odata.id"`
	ODataType       string                `json:"@odata.type"`
	Name            string                `json:"Name"`
	Actions         *dmtfmodel.OemActions `json:"Actions,omitempty"`
	Description     string                `json:"Description,omitempty"`
	ID              string                `json:"Id"`
	Oem             *dmtfmodel.Oem        `json:"Oem,omitempty"`
	SNMP            *SNMP                 `json:"SNMP,omitempty"`
	AggregationType string                `json:"AggregationType,omitempty"`
}

AggregationSource payload of adding a AggregationSource

func GetAggregationSourceInfo

func GetAggregationSourceInfo(aggregationSourceURI string) (AggregationSource, *errors.Error)

GetAggregationSourceInfo fetches the AggregationSource info for the given aggregationSourceURI

type ConnectionMethod

type ConnectionMethod struct {
	ConnectionMethodType    string `json:"ConnectionMethodType"`
	ConnectionMethodVariant string `json:"ConnectionMethodVariant"`
	Links                   Links  `json:"Links"`
}

ConnectionMethod payload is used for perform the operations on connection method

func GetConnectionMethod

func GetConnectionMethod(connectionMethodURI string) (ConnectionMethod, *errors.Error)

GetConnectionMethod fetches the connection method info for the given connection method uri

type DeviceData

type DeviceData struct {
	UserName              string
	Password              []byte
	Address               string
	Operation             string
	EventSubscriptionInfo *EventSubscriptionInfo
	TriggerInfo           *TriggerInfo
}

DeviceData holds device credentials, event subcription and trigger details

type EventSubscriptionInfo

type EventSubscriptionInfo struct {
	EventTypes []string
	Location   string
}

EventSubscriptionInfo holds the event subscription details of a device

type Links struct {
	AggregationSources []OdataID `json:"AggregationSources"`
}

Links is payload of aggregation resources

type OdataID

type OdataID struct {
	OdataID string `json:"@odata.id"`
}

OdataID struct definition for @odata.id

type Plugin

type Plugin struct {
	IP                string
	Port              string
	Username          string
	Password          []byte
	ID                string
	PluginType        string
	PreferredAuthType string
	ManagerUUID       string
}

Plugin is the model for plugin information

func GetPluginData

func GetPluginData(pluginID string) (Plugin, *errors.Error)

GetPluginData will fetch plugin details

type PluginContactRequest

type PluginContactRequest struct {
	URL             string
	HTTPMethodType  string
	ContactClient   func(string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	PostBody        interface{}
	LoginCredential map[string]string
	Token           string
	Plugin          Plugin
}

PluginContactRequest holds the details required to contact the plugin

type PluginStartUpData

type PluginStartUpData struct {
	RequestType           string
	ResyncEvtSubscription bool
	Devices               map[string]DeviceData
}

PluginStartUpData holds the required data for plugin startup

type SNMP

type SNMP struct {
	AuthenticationKey      string `json:"AuthenticationKey,omitempty"`
	AuthenticationKeySet   string `json:"AuthenticationKeySet,omitempty"`
	AuthenticationProtocol string `json:"AuthenticationProtocol,omitempty"`
	EncryptionKey          string `json:"EncryptionKey,omitempty"`
	EncryptionKeySet       bool   `json:"EncryptionKeySet,omitempty"`
	EncryptionProtocol     string `json:"EncryptionProtocol,omitempty"`
	TrapCommunity          string `json:"TrapCommunity,omitempty"`
}

SNMP payload of adding a SNMP

type SaveSystem

type SaveSystem struct {
	ManagerAddress string
	Password       []byte
	UserName       string
	DeviceUUID     string
	PluginID       string
}

SaveSystem model is used to save encrypted data into db

func (*SaveSystem) Create

func (system *SaveSystem) Create(ctx context.Context, systemID string) *errors.Error

Create connects to the persistencemgr and creates a system in db

type Schema

type Schema struct {
	SearchKeys    []map[string]map[string]string `json:"searchKeys"`
	ConditionKeys []string                       `json:"conditionKeys"`
	QueryKeys     []string                       `json:"queryKeys"`
}

Schema model is used to iterate throgh the schema json for search/filter

type ServerInfo

type ServerInfo SaveSystem

ServerInfo holds the details of the server

type SystemOperation

type SystemOperation struct {
	Operation string
}

SystemOperation hold the value system operation(InventoryRediscovery or Delete)

func GetSystemOperationInfo

func GetSystemOperationInfo(systemURI string) (SystemOperation, *errors.Error)

GetSystemOperationInfo fetches the system opeation info for the given systemURI

Inputs:

1.systemURI: computer system uri for which system operation is maintained

func (*SystemOperation) AddSystemOperationInfo

func (system *SystemOperation) AddSystemOperationInfo(systemID string) *errors.Error

AddSystemOperationInfo connects to the persistencemgr and Add the system operation info to db

Inputs:

1.systemURI: computer system uri for which system operation is maintained

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"`
}

Target is for sending the requst to south bound/plugin

func GetAllSystems

func GetAllSystems() ([]Target, *errors.Error)

GetAllSystems extracts all the computer systems saved in ondisk

func GetTarget

func GetTarget(deviceUUID string) (*Target, error)

GetTarget fetches the System(Target Device Credentials) table details

type TriggerInfo

type TriggerInfo struct {
}

TriggerInfo holds the metric trigger info of a device

Jump to

Keyboard shortcuts

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