mcc

package module
v0.0.0-...-f5aa34b Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package routeret provides static route creation for the merget testbed. This is a reticulator, so it works with an existing xir.Net object

Index

Constants

View Source
const FLOAT32_MAX = 3.402823e38

Variables

View Source
var Version = "undefined"

Functions

func AllNeighbors

func AllNeighbors(*xir.Endpoint) bool

func DijkstraForest

func DijkstraForest(
	net *xir.Net,
	sel NeighborSelector,
) map[*xir.Node](*DijkstraState)

func DoBuildStaticRoutes

func DoBuildStaticRoutes(net *xir.Net, df map[*xir.Node](*DijkstraState)) error

DoBuildStaticRoutes takes a Network specification and a derived Dijkstra Forest and annotates every node in the specification with the shortest path to every other node.

func FindGateways

func FindGateways(net *xir.Net) []string

FindGateways examines a network representation and identifies multihomed hosts as potential gateways, returns a list of those hosts.

func FindLongestCommonPrefix

func FindLongestCommonPrefix(ip []net.IP) (result int, ok bool)

FindLongestCommonPrefix takes an arbitrary array of IP addresses and finds the longest netmask value which will contain all of the addresses, e.g., [128.2.0.0,128.2.0.1] = 31, [128.2.0.0, 128.2.133.11] = 16

func GenerateRoutesFromPath

func GenerateRoutesFromPath(lt map[LinkKey]bool, startNode, endNode *xir.Node, path []*xir.Link) (ok bool)

GenerateRoutesFromPath takes a start and ending node as well as the link table and produces the routes between those points.

func GetIPsFromEndpoints

func GetIPsFromEndpoints(ep xir.Endpoints) []string

GetIPsFromEndpoints takes an arbitrary set of xir Endpoint objects and pulls the IP addresses out of them, returning an array of string representations of IP addresses.

func GuessGatewayAddress

func GuessGatewayAddress(lt map[LinkKey]bool, srcNode, nextHop, endNode *xir.Node) (
	result string, ok bool)

GuessGatewayAddress takes three nodes (a source, a next hop, and a destination), finds the address in the next-hop that links the source to the destination.

func MakeLinkLookupTable

func MakeLinkLookupTable(net *xir.Net) map[LinkKey]bool

MakeLinkLookupTable generates a lookup table which describes whether a particular (src, dst) pair (specified via LinkKey) has a link.

func NeighborMap

func NeighborMap(net *xir.Net, sel NeighborSelector) map[*xir.Node][]XNbr

func RRIsHere

func RRIsHere() string

RRIsHere is a stub function that verifies that the routing reticulator is present for testing

func ShortestPath

func ShortestPath(a, b *xir.Node, ds *DijkstraState) (
	[]*xir.Link, bool)

func StripNetFromIP

func StripNetFromIP(address string) string

StripNetFromIP takes an IP + CIDR specification (e.g., "128.2.0.0/16") and strips the trailing netblock from it

Types

type DijkstraState

type DijkstraState struct {
	Q         []*xir.Node
	Visited   map[*xir.Node]bool
	Distance  map[*xir.Node]float32
	Prev      map[*xir.Node]XNbr
	Neighbors map[*xir.Node][]XNbr
}

func DijkstraTree

func DijkstraTree(
	source *xir.Node,
	net *xir.Net,
	sel NeighborSelector,
) *DijkstraState

func NewDijkstraState

func NewDijkstraState() *DijkstraState

type LinkKey

type LinkKey struct {
	Src, Dst string
}

A LinkKey is a (src, dst) pair describing a link between two network nodes. They're used to lookup the presence/absence of a link in a corresponding lookup table generated by MakeLinkLookupTable

type ModelChecker

type ModelChecker interface {
	// Human readable name for the instance.
	Name() string
	// Check takes a model and returns true if the model is OK to be used.
	// Otherwise it returns false with diagnostics. Error on internal
	// or unexpected error.
	Check(x *xir.Net) (bool, *[]ModelDiagnostic, error)
}

ModelChecker interface takes a model and checks for problems, errors, etc. If there are problems found, it gives useful diagnostic information.

func Checkers

func Checkers() []ModelChecker

Checkers returns the full list of available checkers.

type ModelDiagnostic

type ModelDiagnostic struct {
	Messsage   string
	Constraint string
	Node       string
	Link       string
}

ModelDiagnostic contains information about model errors/problems.

type ModelReticulator

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

ModelReticulator takes a model and mutates it in someway.

func Reticulators

func Reticulators() []ModelReticulator

Reticulators returns the full list of reticulators.

type NeighborSelector

type NeighborSelector func(endpoint *xir.Endpoint) bool

type NetworkIslands

type NetworkIslands struct {
}

NetworkIslands checks a network model for network islands

func (*NetworkIslands) Check

func (ni *NetworkIslands) Check(x *xir.Net) (bool, *[]ModelDiagnostic, error)

Check implements the model check interface.

func (*NetworkIslands) Name

func (ni *NetworkIslands) Name() string

Name ...

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(x *xir.Net) (bool, error)

Reticulate the given XIR

type XNbr

type XNbr struct {
	Node          *xir.Node
	Link          *xir.Link
	Local, Remote *xir.Endpoint
}

Jump to

Keyboard shortcuts

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