reticulators

package
v0.1.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoBuildStaticRoutes

func DoBuildStaticRoutes(net *xir.Network) error

Types

type BreadthFirst

type BreadthFirst struct {
	// Visit is called on all nodes on their first visit.
	// If you want a copy of the path, please copy it yourself,
	// as it may share a pointer with other paths
	Visit func([]graph.Node)

	HoldVisit func(graph.Node) bool

	// Traverse is called on all edges that may be traversed
	// during the walk. This includes edges that would hop to
	// an already visited node.
	//
	// The value returned by Traverse determines whether
	// an edge can be traversed during the walk.
	Traverse func(graph.Edge) bool
	// contains filtered or unexported fields
}

func (*BreadthFirst) Walk

func (b *BreadthFirst) Walk(g graph.Graph, froms ...graph.Node) (*swiss.Map[int64, struct{}], []graph.Node, []graph.Node)

Walk performs a breadth-first traversal of the graph g starting from the given node, depending on the Traverse field. The traversal follows edges for which Traverse(edge) is true. This returns all the visited nodes, all terminal nodes, and the nodes that detected a cycle

type IPv4Addressing

type IPv4Addressing struct {

	// AddrSpace keeps track of the "next" unused subnet.
	AddrSpace *net.IPNet

	// ActiveNets keeps track of all subnets currently in use.
	ActiveNets map[string]bool
}

IPv4Addressing holds data and implements the Reticulator interface

func NewIPv4Addressing

func NewIPv4Addressing() *IPv4Addressing

NewIPv4Addressing returns an initialized addressing reticulator.

func (*IPv4Addressing) Name

func (a *IPv4Addressing) Name() string

Name is a Reticulator interface function.

func (*IPv4Addressing) Reticulate

func (a *IPv4Addressing) Reticulate(xn *xir.Network) (bool, error)

Reticulate is a Reticulator interface function.

The basic strategy is to add addresses to each link. If a link has existing addresses, add addresses from the link's subnet that are not in use. If a link has no addresses, assign it an unused subnet (starting at 10.0.X.0) and fill it with addresses from the unused subnet.

Assumptions:

  • /24 subnet for each link.
  • existing addresses on a link are in the same subnet.

type ModelReticulator

type ModelReticulator interface {
	Name() string
	Reticulate(x *xir.Network) (bool, error)
}

ModelReticulator takes a model and mutates it in someway.

type Path

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

type StaticRouting

type StaticRouting struct {
}

StaticRouting ...

func (*StaticRouting) Name

func (sr *StaticRouting) Name() string

Name implements the Reticulator interface.

func (*StaticRouting) Reticulate

func (sr *StaticRouting) Reticulate(xn *xir.Network) (bool, error)

Reticulate the given XIR

Jump to

Keyboard shortcuts

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