gosmi

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 5 Imported by: 6

README

gosmi

Starting with v0.2.0, this library is native Go and no longer a wrapper around libsmi. The implementation is currently very close, but may change in the future.

For the native implementation, two additional components have been added:

  • SMIv1/2 parser in parser
  • libsmi-compatible Go implementation in smi

Usage

On Ubuntu for v0.1.0 and below: $ sudo apt-get install libsmi2-dev

Examples

Examples can now be found in:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFS added in v0.4.0

func AppendFS(fs ...smi.NamedFS)

func AppendPath

func AppendPath(path string)

func Exit

func Exit()

func GetPath

func GetPath() string

func Init

func Init()

func IsLoaded

func IsLoaded(moduleName string) bool

func LoadModule

func LoadModule(modulePath string) (string, error)

func NamedFS added in v0.4.0

func NamedFS(name string, fs smi.FS) smi.NamedFS

func PrependFS added in v0.4.0

func PrependFS(fs ...smi.NamedFS)

func PrependPath

func PrependPath(path string)

func ReadConfig

func ReadConfig(filename string, tag ...string) error

func SetFS added in v0.4.0

func SetFS(fs ...smi.NamedFS)

func SetPath

func SetPath(path string)

Types

type Notification

type Notification struct {
	SmiNode
	Objects []SmiNode
}

type SmiModule

type SmiModule struct {
	models.Module
	// contains filtered or unexported fields
}

func CreateModule

func CreateModule(smiModule *types.SmiModule) (module SmiModule)

func GetLoadedModules

func GetLoadedModules() (modules []SmiModule)

func GetModule

func GetModule(name string) (module SmiModule, err error)

func (SmiModule) GetIdentityNode

func (m SmiModule) GetIdentityNode() (node SmiNode, ok bool)

func (SmiModule) GetImports

func (m SmiModule) GetImports() (imports []models.Import)

func (SmiModule) GetNode

func (m SmiModule) GetNode(name string) (node SmiNode, err error)

func (SmiModule) GetNodes

func (m SmiModule) GetNodes(kind ...types.NodeKind) (nodes []SmiNode)

func (SmiModule) GetRaw

func (m SmiModule) GetRaw() (module *types.SmiModule)

func (SmiModule) GetRevisions

func (m SmiModule) GetRevisions() (revisions []models.Revision)

func (SmiModule) GetType

func (m SmiModule) GetType(name string) (outType SmiType, err error)

func (SmiModule) GetTypes

func (m SmiModule) GetTypes() (types []SmiType)

func (*SmiModule) SetRaw

func (m *SmiModule) SetRaw(smiModule *types.SmiModule)

type SmiNode

type SmiNode struct {
	models.Node

	SmiType *SmiType
	// contains filtered or unexported fields
}

func CreateNode

func CreateNode(smiNode *types.SmiNode) SmiNode

func GetNode

func GetNode(name string, module ...SmiModule) (node SmiNode, err error)

func GetNodeByOID added in v0.2.1

func GetNodeByOID(oid types.Oid) (node SmiNode, err error)

func (SmiNode) AsNotification

func (n SmiNode) AsNotification() Notification

func (SmiNode) AsTable

func (t SmiNode) AsTable() Table

func (SmiNode) GetAugment

func (t SmiNode) GetAugment() (row SmiNode)

func (SmiNode) GetColumns

func (t SmiNode) GetColumns() (columns map[string]SmiNode, columnOrder []string)

func (SmiNode) GetImplied

func (t SmiNode) GetImplied() bool

func (SmiNode) GetIndex

func (t SmiNode) GetIndex() (index []SmiNode)

func (SmiNode) GetModule

func (n SmiNode) GetModule() (module SmiModule)

func (SmiNode) GetNotificationObjects

func (n SmiNode) GetNotificationObjects() (objects []SmiNode)

func (SmiNode) GetRaw

func (n SmiNode) GetRaw() (node *types.SmiNode)

func (SmiNode) GetRow

func (t SmiNode) GetRow() (row SmiNode)

func (SmiNode) GetSubtree

func (n SmiNode) GetSubtree() (nodes []SmiNode)

func (SmiNode) Render

func (n SmiNode) Render(flags types.Render) string

func (SmiNode) RenderNumeric

func (n SmiNode) RenderNumeric() string

func (SmiNode) RenderQualified

func (n SmiNode) RenderQualified() string

func (*SmiNode) SetRaw

func (n *SmiNode) SetRaw(smiNode *types.SmiNode)

type SmiType

type SmiType struct {
	models.Type
	// contains filtered or unexported fields
}

func CreateType

func CreateType(smiType *types.SmiType) (outType SmiType)

func CreateTypeFromNode

func CreateTypeFromNode(smiNode *types.SmiNode) (outType *SmiType)

func GetType

func GetType(name string, module ...SmiModule) (outType SmiType, err error)

func (SmiType) GetModule

func (t SmiType) GetModule() (module SmiModule)

func (SmiType) GetRaw

func (t SmiType) GetRaw() (outType *types.SmiType)

func (*SmiType) SetRaw

func (t *SmiType) SetRaw(smiType *types.SmiType)

func (SmiType) String

func (t SmiType) String() string

type Table

type Table struct {
	SmiNode
	Columns     map[string]SmiNode
	ColumnOrder []string
	Implied     bool
	Index       []SmiNode
}

Directories

Path Synopsis
cmd
smi
smi

Jump to

Keyboard shortcuts

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