Documentation
¶
Index ¶
- Constants
- Variables
- func CheckRedfishSerial(remote *structs.L2DeviceRemoteInfo) (result string)
- func CheckRedfishSerial2(remote *structs.L2DeviceRemoteInfo) (result string, err error)
- func CheckRedfishVersion(remote *structs.L2DeviceRemoteInfo) (result string)
- func CheckRedfishVersion2(remote *structs.L2DeviceRemoteInfo) (result string, err error)
- func ConfigPathCheck(filePath, mode string) (file string)
- func DeleteYaml(fileName string, logger *log.Logger)
- func Exec(cmdStr string) (string, error)
- func NewInstance(mode string, isRedfish bool, localDataPath string) structs.L2NodemapInstanceInterface
- func Playbook_Task(file string, info *structs.RepoResult, logger *log.Logger) (error, *structs.AnsibleTaskResult)
- func ServiceConfigViper(path string)
- func WriteContent(filePath string, content []byte, logger *log.Logger) (err error)
- func WriteYaml(fileName string, info *structs.RepoResult, logger *log.Logger)
- type ANSIBLE
- func (ts *ANSIBLE) ActiveMonitorPushSetting(ctx context.Context, args *structs.Args, reply *structs.RepoResultTaskReplay) error
- func (ts *ANSIBLE) AnsibleCMD(ctx context.Context, info *structs.RepoResult, ...) error
- func (ts *ANSIBLE) CategrafSnmpConfig(ctx context.Context, args *structs.Args, reply *structs.RepoResultTaskReplay) error
- func (ts *ANSIBLE) TelegrafPushSetting(ctx context.Context, args *structs.Args, reply *structs.RepoResultTaskReplay) error
- func (ts *ANSIBLE) TelegrafPushSetting2(ctx context.Context, args *structs.Args, reply *structs.RepoResultTaskReplay) error
- type BaseTaskConfig
- func (s BaseTaskConfig) GetMainConfig() structs.L2NodemapServiceCenterInterface
- func (s BaseTaskConfig) GetMethod() string
- func (s BaseTaskConfig) IsPretty() bool
- func (s BaseTaskConfig) IsSelected(version, deviceType string) bool
- func (s BaseTaskConfig) SupportVersion() []string
- func (s *BaseTaskConfig) WithMainConfig(cf structs.L2NodemapServiceCenterInterface)
- type CheckTaskConfig
- type CmdPair
- type Controller
- type GPON
- type GofishTaskConfig
- type INFINIBAND
- type IPMITaskConfig
- type KwArgs
- type LinuxTaskConfig
- type Option
- type RedfishTaskConfig
- type RedfisnInfoTaskConfig
- type RestfulTaskConfig
- type RshellTaskConfig
- type SDN
- type SERVEROOB
- func (ts *SERVEROOB) IsAlive(ctx context.Context, arg *structs.Args, reply *structs.Reply) (err error)
- func (ts *SERVEROOB) OOBGPU(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) OOBSerialNumber(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) OOBSerialNumberSNMPANDREDFISH(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) OOBVersion(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) OOBVersionSNMPANDREDFISH(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishBaseInfo(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishBmc(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishCpu(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishDisk(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishMem(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishMeta(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishNetwork(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishNetworkinterface(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishPower(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishPowerControl(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- func (ts *SERVEROOB) RedfishVersion(ctx context.Context, args *structs.Args, reply *structs.Reply) error
- type SSHServerType
- type SSHTaskConfig
- type STREAM
- type SdnTaskConfig
- type Service
- type ServiceConfig
- type ServiceModeConfig
- type SnmpServiceType
- type SnmpTaskConfig
- type TOPO
- type VMWARE
- type VmwareTaskConfig
- type WorkContext
Constants ¶
const ( DcimInterface = "DcimInterface" DcimRearport = "DcimRearport" DcimFrontport = "DcimFrontport" DcimDevice = "DcimDevice" VirtualizationCluster = "VirtualizationCluster" SdnController = "SdnController" VirtualizationVirtualmachine = "VirtualizationVirtualmachine" DcimInputDevice = "DcimInputDevice" DeviceAndVirtualmachine = "deviceAndVirtualmachine" )
Variables ¶
var ( DEFAULT_SERVICE_FILE = "../config/service.yaml" Config = &ServiceConfig{} DEFAULT_SSH_CMD_TIMEOUT = 5 // DEFAULT_NEWL2SERVICE_FILE = "../internal/app/service/l2service/service.yaml.back" DEFAULT_NEWL2SERVICE_FILE = "../config/service.yaml" )
Functions ¶
func CheckRedfishSerial ¶
func CheckRedfishSerial(remote *structs.L2DeviceRemoteInfo) (result string)
func CheckRedfishSerial2 ¶
func CheckRedfishSerial2(remote *structs.L2DeviceRemoteInfo) (result string, err error)
func CheckRedfishVersion ¶
func CheckRedfishVersion(remote *structs.L2DeviceRemoteInfo) (result string)
func CheckRedfishVersion2 ¶
func CheckRedfishVersion2(remote *structs.L2DeviceRemoteInfo) (result string, err error)
func ConfigPathCheck ¶
func DeleteYaml ¶
func NewInstance ¶
func NewInstance(mode string, isRedfish bool, localDataPath string) structs.L2NodemapInstanceInterface
L2NodemapInstanceInterface包含Process方法,该方法是不同类型设备的处理入口
func Playbook_Task ¶
func Playbook_Task(file string, info *structs.RepoResult, logger *log.Logger) (error, *structs.AnsibleTaskResult)
func ServiceConfigViper ¶
func ServiceConfigViper(path string)
func WriteContent ¶
Types ¶
type ANSIBLE ¶
type ANSIBLE struct{}
func (*ANSIBLE) ActiveMonitorPushSetting ¶
func (*ANSIBLE) AnsibleCMD ¶
func (ts *ANSIBLE) AnsibleCMD(ctx context.Context, info *structs.RepoResult, reply *structs.RepoResultTaskReplay) error
func (*ANSIBLE) CategrafSnmpConfig ¶
func (*ANSIBLE) TelegrafPushSetting ¶
func (*ANSIBLE) TelegrafPushSetting2 ¶
type BaseTaskConfig ¶
type BaseTaskConfig struct {
Version []string `yaml:"version" mapstructure:"version"`
Method string `yaml:"method" mapstructure:"method"`
Type []string `yaml:"type" mapstructure:"type"`
Pretty bool `yaml:"pretty" mapstructure:"pretty"`
// contains filtered or unexported fields
}
func (BaseTaskConfig) GetMainConfig ¶
func (s BaseTaskConfig) GetMainConfig() structs.L2NodemapServiceCenterInterface
func (BaseTaskConfig) GetMethod ¶
func (s BaseTaskConfig) GetMethod() string
func (BaseTaskConfig) IsPretty ¶
func (s BaseTaskConfig) IsPretty() bool
func (BaseTaskConfig) IsSelected ¶
func (s BaseTaskConfig) IsSelected(version, deviceType string) bool
func (BaseTaskConfig) SupportVersion ¶
func (s BaseTaskConfig) SupportVersion() []string
func (*BaseTaskConfig) WithMainConfig ¶
func (s *BaseTaskConfig) WithMainConfig(cf structs.L2NodemapServiceCenterInterface)
type CheckTaskConfig ¶
type CheckTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (CheckTaskConfig) GetSubOid ¶
func (s CheckTaskConfig) GetSubOid(key string) string
func (CheckTaskConfig) NewExecutor ¶
func (s CheckTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(list []*structs.L2DeviceRemoteInfo, conn net.Conn, namedPipe string) *Controller
func (*Controller) Loop ¶
func (c *Controller) Loop()
type GofishTaskConfig ¶
type GofishTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (GofishTaskConfig) GetSubOid ¶
func (s GofishTaskConfig) GetSubOid(key string) string
func (GofishTaskConfig) NewExecutor ¶
func (s GofishTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type IPMITaskConfig ¶
type IPMITaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (IPMITaskConfig) GetSubOid ¶
func (s IPMITaskConfig) GetSubOid(key string) string
func (IPMITaskConfig) NewExecutor ¶
func (s IPMITaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type LinuxTaskConfig ¶
type LinuxTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (LinuxTaskConfig) GetSubOid ¶
func (s LinuxTaskConfig) GetSubOid(key string) string
func (LinuxTaskConfig) NewExecutor ¶
func (s LinuxTaskConfig) NewExecutor(remote *model.L2DeviceRemoteInfo) (clitask.Executor, error)
type Option ¶
type Option func(*ServiceModeConfig)
type RedfishTaskConfig ¶
type RedfishTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (RedfishTaskConfig) GetSubOid ¶
func (s RedfishTaskConfig) GetSubOid(key string) string
func (RedfishTaskConfig) NewExecutor ¶
func (s RedfishTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type RedfisnInfoTaskConfig ¶
type RedfisnInfoTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (RedfisnInfoTaskConfig) GetSubOid ¶
func (s RedfisnInfoTaskConfig) GetSubOid(key string) string
func (RedfisnInfoTaskConfig) NewExecutor ¶
func (s RedfisnInfoTaskConfig) NewExecutor(remote *model.L2DeviceRemoteInfo) (clitask.Executor, error)
type RestfulTaskConfig ¶
type RestfulTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (RestfulTaskConfig) GetSubOid ¶
func (s RestfulTaskConfig) GetSubOid(key string) string
func (RestfulTaskConfig) NewExecutor ¶
func (s RestfulTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type RshellTaskConfig ¶
type RshellTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (RshellTaskConfig) GetSubOid ¶
func (s RshellTaskConfig) GetSubOid(key string) string
func (RshellTaskConfig) NewExecutor ¶
func (s RshellTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type SERVEROOB ¶
type SERVEROOB struct{}
func (*SERVEROOB) OOBSerialNumber ¶
func (*SERVEROOB) OOBSerialNumberSNMPANDREDFISH ¶
func (*SERVEROOB) OOBVersion ¶
func (*SERVEROOB) OOBVersionSNMPANDREDFISH ¶
func (*SERVEROOB) RedfishBaseInfo ¶
func (*SERVEROOB) RedfishBmc ¶
func (*SERVEROOB) RedfishCpu ¶
func (*SERVEROOB) RedfishDisk ¶
func (*SERVEROOB) RedfishMem ¶
func (*SERVEROOB) RedfishMeta ¶
func (*SERVEROOB) RedfishNetwork ¶
func (*SERVEROOB) RedfishNetworkinterface ¶
func (*SERVEROOB) RedfishPower ¶
func (*SERVEROOB) RedfishPowerControl ¶
type SSHServerType ¶
type SSHServerType int
type SSHTaskConfig ¶
type SSHTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
Commands []*CmdPair `yaml:"commands" mapstructure:"commands"`
ConfigMode bool `yaml:"config_mode" mapstructure:"config_mode"`
}
func (SSHTaskConfig) GetSubOid ¶
func (s SSHTaskConfig) GetSubOid(key string) string
func (SSHTaskConfig) NewExecutor ¶
func (s SSHTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
func (s SSHTaskConfig) NewSSHTask(remote *structs.L2DeviceRemoteInfo) (*terminal.Execute, error) {
type SdnTaskConfig ¶
type SdnTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (SdnTaskConfig) GetSubOid ¶
func (s SdnTaskConfig) GetSubOid(key string) string
func (SdnTaskConfig) NewExecutor ¶
func (s SdnTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type Service ¶
type Service struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Snmp []*SnmpTaskConfig `yaml:"snmp" json:"snmp" mapstructure:"snmp"`
Restful []*RestfulTaskConfig `yaml:"restful" json:"restful" mapstructure:"restful"`
SSH []*SSHTaskConfig `yaml:"ssh" json:"ssh" mapstructure:"ssh"`
Redfish []*RedfishTaskConfig `yaml:"redfish" json:"redfish" mapstructure:"redfish"`
Gofish []*GofishTaskConfig `yaml:"gofish" mapstructure:"gofish" json:"gofish"`
Sdn []*SdnTaskConfig `yaml:"sdn" mapstructure:"sdn" json:"sdn"`
Rshell []*RshellTaskConfig `yaml:"rshell" mapstructure:"rshell" json:"rshell"`
Vmware []*VmwareTaskConfig `yaml:"vmware" json:"vmware" mapstructure:"vmware"`
Excel []*CheckTaskConfig `yaml:"excel" json:"excel" mapstructure:"excel"`
IPMI []*IPMITaskConfig `yaml:"ipmi" json:"ipmi" mapstructure:"ipmi"`
// contains filtered or unexported fields
}
选择器中具体的服务列表
func (Service) ServiceName ¶
func (*Service) WithInstance ¶
func (s *Service) WithInstance(instance structs.L2NodemapInstanceInterface)
type ServiceConfig ¶
type ServiceConfig struct {
Service []*ServiceModeConfig
}
func (ServiceConfig) Select ¶
func (sc ServiceConfig) Select(ctx context.Context, remote *structs.L2DeviceRemoteInfo, srv string) (structs.L2NodemapServiceInterface, structs.OK)
type ServiceModeConfig ¶
type ServiceModeConfig struct {
Platform string
Manufacturer string
Catalog string
Service []*Service
// contains filtered or unexported fields
}
选择器
type SnmpServiceType ¶
type SnmpServiceType int
type SnmpTaskConfig ¶
type SnmpTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
Oid string `yaml:"oid" mapstructure:"oid"`
OidMap map[string]string `yaml:"oidmap" mapstructure:"oidmap"`
IndexAll []int `yaml:"indexall" mapstructure:"indexall"`
Prefix []int `yaml:"prefix" mapstructure:"prefix"`
PrefixMap map[string]string `yaml:"prefixmap" mapstructure:"prefixmap"`
}
func (SnmpTaskConfig) GetSubOid ¶
func (s SnmpTaskConfig) GetSubOid(key string) string
func (SnmpTaskConfig) NewExecutor ¶
func (s SnmpTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type TOPO ¶
type TOPO struct {
Data string
}
func (*TOPO) InbandSerialNumber ¶
func (*TOPO) TopoMainService ¶
func (ts *TOPO) TopoMainService(ctx context.Context, args *structs.Args, reply *structs.Reply) error
func (a *structs.Args) Device() (DeviceWithPlatform, error) { var err error switch a.StructType { case DcimDevice: var d model.DcimDevice tx := global.GVA_DB1.Where("id = ?", a.Id).Preload("DcimPlatform").Preload("DcimDevicetype.DcimManufacturer").Preload("DcimCatalog").Find(&d) err = tx.Error return &d, err case VirtualizationCluster: var d model.VirtualizationCluster tx := global.GVA_DB1.Where("id = ?", a.Id).Preload("DcimPlatform").Preload("DcimCatalog").Find(&d) err = tx.Error return &d, err case SdnController: var d model.SdnController tx := global.GVA_DB1.Where("id = ?", a.Id).Preload("DcimPlatform").Preload("DcimCatalog").Find(&d) err = tx.Error return &d, err case VirtualizationVirtualmachine: var d model.VirtualizationVirtualmachine tx := global.GVA_DB1.Where("id = ?", a.Id).Preload("DcimPlatform").Preload("DcimCatalog").Find(&d) err = tx.Error return &d, err }
return nil, fmt.Errorf("unsupport struct type: %s", a.StructType) }
type VmwareTaskConfig ¶
type VmwareTaskConfig struct {
BaseTaskConfig `mapstructure:",squash"`
}
func (VmwareTaskConfig) GetSubOid ¶
func (s VmwareTaskConfig) GetSubOid(key string) string
func (VmwareTaskConfig) NewExecutor ¶
func (s VmwareTaskConfig) NewExecutor(remote *structs.L2DeviceRemoteInfo) (clitask.Executor, error)
type WorkContext ¶
type WorkContext struct {
Uuid string
Service interface{}
}
func NewWorkContext ¶
func NewWorkContext(ts interface{}, arg interface{}) *WorkContext