cimc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIMCSession

type CIMCSession interface {
	// PowerOn powers on the connected host
	PowerOn(context.Context) error
	// PowerOff powers off the connected host
	PowerOff(context.Context) error
	// PowerCycle powers off and then on the connected host
	PowerCycle(context.Context) error
	// GetPowerState gets the power state of the connected host
	GetPowerState(context.Context) (PowerState, error)
	// OpenConsole opens a console to the connected host
	OpenConsole(context.Context) (*goexpect.GExpect, error)
	// CloseConsole opens a console to the connected host
	CloseConsole(context.Context) error
	// SendCmd sends a command to the connected host
	SendCmd(context.Context, string) (string, error)
	// Close closes the session
	Close(context.Context) error
}

func NewSession

func NewSession(addr, user, pass string) (CIMCSession, error)

NewSession - return a Session, logging in with password and user@addr

For example NewSession("10.0.0.1", "admin", "password")

type PowerState

type PowerState int
const (
	Unknown PowerState = iota
	Off
	On
)

func (PowerState) String

func (p PowerState) String() string

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session - object holding info for the cimc session.

func (*Session) Close

func (cs *Session) Close(ctx context.Context) error

Close - close the ssh session.

func (*Session) CloseConsole

func (cs *Session) CloseConsole(ctx context.Context) error

CloseConsole - exit from the host console, back to the cimc shell.

func (*Session) GetPowerState

func (cs *Session) GetPowerState(ctx context.Context) (PowerState, error)

GetPowerState - return power state of system.

func (*Session) OpenConsole

func (cs *Session) OpenConsole(ctx context.Context) (*goexpect.GExpect, error)

OpenConsole - return a expect.GExpect that is hooked up to the host's console. as you would get if you typed 'connect host'

func (*Session) PowerCycle

func (cs *Session) PowerCycle(ctx context.Context) error

PowerCycle - Turn power off, if off and then back on.

func (*Session) PowerOff

func (cs *Session) PowerOff(ctx context.Context) error

PowerOff - Turn power off, if on

func (*Session) PowerOn

func (cs *Session) PowerOn(ctx context.Context) error

PowerOn - Turn power off, if off

func (*Session) SendCmd

func (cs *Session) SendCmd(ctx context.Context, msg string) (string, error)

SendCmd - send a command to the cimc command line interface. Return its response.

func (Session) String

func (cs Session) String() string

Jump to

Keyboard shortcuts

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