model

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CONFIG_SEPARATOR = "%"
View Source
const EmptyOutput string = "#EMPTY#"
View Source
const EmptySeparator string = "#NONE#"
View Source
const ManagementInterfaceName string = "mgmt"
View Source
const ManagementLayerReplacer string = "mgmt"
View Source
const NChars int = 32
View Source
const NumberAS string = "as"
View Source
const NumberNumber string = "number"

Variables

View Source
var SEPARATOR *regexp.Regexp

Functions

func BuildConfigFiles

func BuildConfigFiles(cfg *types.Config, nm *types.NetworkModel, verbose bool) error

func BuildNetworkModel

func BuildNetworkModel(cfg *types.Config, d *Diagram, verbose bool) (nm *types.NetworkModel, err error)

func BuildNetworkModelForFileList added in v0.6.0

func BuildNetworkModelForFileList(cfg *types.Config, d *Diagram) (nm *types.NetworkModel, err error)

BuildNetworkModelForFileList builds a lightweight NetworkModel sufficient for file listing. This function only processes the minimum required for FilesToGenerate() to work: - Module loading (for FileDefinitions) - Topology skeleton (nodes, interfaces, class labels) - Class validation It skips expensive operations like IP address assignment and parameter generation.

func ListGeneratedFiles added in v0.5.0

func ListGeneratedFiles(cfg *types.Config, nm *types.NetworkModel, verbose bool) ([]string, error)

ListGeneratedFiles returns a list of files that would be generated by generateConfigFiles

func LoadModules

func LoadModules(cfg *types.Config) error

func ParseLabels

func ParseLabels(value string) (classes []string)

Types

type ChildConfig added in v0.5.0

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

type ConfigAggregator added in v0.5.0

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

type ConfigBlock

type ConfigBlock struct {
	Block    string
	Priority int
}

type ConfigElement

type ConfigElement struct {
	Line string
}

func (*ConfigElement) String

func (e *ConfigElement) String() string

func (*ConfigElement) StringLines

func (e *ConfigElement) StringLines() []string

type ConfigElementer

type ConfigElementer interface {
	String() string
	StringLines() []string
}

type ConfigGroup

type ConfigGroup struct {
	Title string
	Depth int
	// contains filtered or unexported fields
}

func (*ConfigGroup) Add

func (g *ConfigGroup) Add(line string)

func (*ConfigGroup) AddElement

func (g *ConfigGroup) AddElement(e ConfigElementer)

func (*ConfigGroup) Get

func (g *ConfigGroup) Get(title string) (ConfigGrouper, bool)

func (*ConfigGroup) String

func (g *ConfigGroup) String() string

func (*ConfigGroup) StringLines

func (g *ConfigGroup) StringLines() []string

type ConfigGrouper

type ConfigGrouper interface {
	Add(string)
	AddElement(ConfigElementer)
	Get(string) (ConfigGrouper, bool)
	String() string
	StringLines() []string
}

type ConfigTemplateDependencyNode added in v0.5.0

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

ConfigTemplateDependencyNode adapts ConfigTemplate to DependencyNode interface

func (*ConfigTemplateDependencyNode) GetDependencies added in v0.5.0

func (ctdn *ConfigTemplateDependencyNode) GetDependencies() ([]string, error)

func (*ConfigTemplateDependencyNode) GetID added in v0.5.0

func (ctdn *ConfigTemplateDependencyNode) GetID() string

func (*ConfigTemplateDependencyNode) GetItem added in v0.5.0

type DependencyGraph added in v0.5.0

type DependencyGraph[T any] struct {
	// contains filtered or unexported fields
}

DependencyGraph handles topological sorting of dependency nodes

func NewDependencyGraph added in v0.5.0

func NewDependencyGraph[T any]() *DependencyGraph[T]

func (*DependencyGraph[T]) AddNode added in v0.5.0

func (dg *DependencyGraph[T]) AddNode(node DependencyNode[T])

func (*DependencyGraph[T]) TopologicalSort added in v0.5.0

func (dg *DependencyGraph[T]) TopologicalSort() ([]T, error)

type DependencyNode added in v0.5.0

type DependencyNode[T any] interface {
	GetID() string
	GetDependencies() ([]string, error)
	GetItem() T
}

DependencyNode represents a node in dependency graph

type Diagram

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

func DiagramFromDotFile

func DiagramFromDotFile(filepath string) (*Diagram, error)

func (*Diagram) Groups

func (d *Diagram) Groups() map[string]*gographviz.SubGraph
func (d *Diagram) Links() []*gographviz.Edge

func (*Diagram) MergeDiagram

func (d *Diagram) MergeDiagram(d2 *Diagram)

Merge Diagram merge components in two Diagram objects. Labels in same components are merged. Lines are considered same only when the end nodes and "their ports" are completely same (Note that links without specified ports are always considered different).

func (*Diagram) NodeGroups

func (d *Diagram) NodeGroups(name string) (groups []*gographviz.SubGraph)

func (*Diagram) Nodes

func (d *Diagram) Nodes() []*gographviz.Node
func (d *Diagram) SortedLinks() []*gographviz.Edge

func (*Diagram) SortedNodes

func (d *Diagram) SortedNodes() []*gographviz.Node

type NameSpacerDependencyNode added in v0.5.0

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

NameSpacerDependencyNode adapts NameSpacer to DependencyNode interface

func (*NameSpacerDependencyNode) GetDependencies added in v0.5.0

func (nsdn *NameSpacerDependencyNode) GetDependencies() ([]string, error)

func (*NameSpacerDependencyNode) GetID added in v0.5.0

func (nsdn *NameSpacerDependencyNode) GetID() string

func (*NameSpacerDependencyNode) GetItem added in v0.5.0

func (nsdn *NameSpacerDependencyNode) GetItem() types.NameSpacer

Jump to

Keyboard shortcuts

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