vtyang

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QUESTION_MARK rune = 63 // '?'
)

Variables

View Source
var (
	GlobalOptRunFilePath string
)

Functions

func DBNodeDiff

func DBNodeDiff(na, nb *DBNode) string

func ErrorOnDie

func ErrorOnDie(err error)

func InitAgent

func InitAgent(runtimePath, yangPath string) error

func NewCommand

func NewCommand() *cobra.Command

func ParseXPath

func ParseXPath(dbm *DatabaseManager, xpath *XPath, s string) error

Types

type CliMode

type CliMode int
const (
	CliModeView CliMode = iota
	CliModeConfigure
)

type Command

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

type CommandNode

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

type CommitHistory

type CommitHistory struct {
	Timestamp time.Time
	Before    string
	After     string
	Client    string
	Comment   string
}

func (CommitHistory) ToDBNode

func (h CommitHistory) ToDBNode() (*DBNode, error)

func (CommitHistory) WriteToFile

func (h CommitHistory) WriteToFile(basepath string) error

type CompletionNode

type CompletionNode struct {
	Name        string
	Description string
	Childs      []*CompletionNode
}

func DigNode

func DigNode(node *CompletionNode, query []string) *CompletionNode

func DigNodeOrDie

func DigNodeOrDie(mode CliMode, query []string) *CompletionNode

func (*CompletionNode) String

func (n *CompletionNode) String() string

type CompletionTree

type CompletionTree struct {
	Root *CompletionNode
}

func (*CompletionTree) Completion

func (t *CompletionTree) Completion(line string, pos int) []*CompletionNode

type Configuration

type Configuration struct {
	Revision int
	Data     string
}

type DBNode

type DBNode struct {
	Name       string
	Type       DBNodeType
	Childs     []DBNode
	ListChilds [][]DBNode
	Value      DBValue
}

func EnsureListNode

func EnsureListNode(listNode *DBNode, kv map[string]string) *DBNode

func Interface2DBNode

func Interface2DBNode(i interface{}) (*DBNode, error)

func ReadFromJsonFile

func ReadFromJsonFile(filename string) (*DBNode, error)

func ReadFromJsonString

func ReadFromJsonString(jsonstr string) (*DBNode, error)

func (*DBNode) DeepCopy

func (n *DBNode) DeepCopy() *DBNode

func (*DBNode) String

func (n *DBNode) String() string

func (*DBNode) ToMap

func (n *DBNode) ToMap() interface{}

func (*DBNode) WriteToJsonFile

func (n *DBNode) WriteToJsonFile(filename string) error

type DBNodeType

type DBNodeType string
const (
	Container DBNodeType = "container"
	List      DBNodeType = "list"
	Leaf      DBNodeType = "leaf"
	LeafList  DBNodeType = "leaf-list"
)

type DBValue

type DBValue struct {
	Type DBValueType

	// Union
	Integer int
	String  string
	Boolean bool
}

func (*DBValue) SetFromString

func (v *DBValue) SetFromString(s string) error

func (DBValue) ToValue

func (v DBValue) ToValue() interface{}

type DBValueType

type DBValueType string
const (
	YString  DBValueType = "string"
	YInteger DBValueType = "integer"
	YBoolean DBValueType = "boolean"
)

func YangTypeKind2YType

func YangTypeKind2YType(t yang.TypeKind) DBValueType

type DatabaseManager

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

func NewDatabaseManager

func NewDatabaseManager() *DatabaseManager

func (*DatabaseManager) DeleteNode

func (dbm *DatabaseManager) DeleteNode(xpath XPath) error

func (*DatabaseManager) Dump

func (m *DatabaseManager) Dump()

func (*DatabaseManager) DumpEntries

func (m *DatabaseManager) DumpEntries() []*yang.Entry

func (*DatabaseManager) GetNode

func (dbm *DatabaseManager) GetNode(xpath XPath) (*DBNode, error)

func (*DatabaseManager) LoadDatabaseFromData

func (m *DatabaseManager) LoadDatabaseFromData(n *DBNode) error

func (*DatabaseManager) LoadDatabaseFromFile

func (m *DatabaseManager) LoadDatabaseFromFile(f string) error

func (*DatabaseManager) LoadYangModule

func (m *DatabaseManager) LoadYangModule(path string) error

func (*DatabaseManager) LoadYangModuleOrDie

func (m *DatabaseManager) LoadYangModuleOrDie(path string)

func (*DatabaseManager) SetNode

func (dbm *DatabaseManager) SetNode(xpath XPath, val string) (
	*DBNode, error)

type XPath

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

func NewXPath

func NewXPath(dbm *DatabaseManager, s string) (XPath, error)

func NewXPathOrDie

func NewXPathOrDie(dbm *DatabaseManager, s string) XPath

func ParseXPathArgs

func ParseXPathArgs(dbm *DatabaseManager, args []string, setmode bool) (XPath, string, error)

func (XPath) CreateDBNodeTree

func (xpath XPath) CreateDBNodeTree() (*DBNode, error)

func (XPath) String

func (x XPath) String() string

type XWord

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

Jump to

Keyboard shortcuts

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