graph

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Code generated by graphupdater tool, DO NOT EDIT.

Package graph implements a multigraph model of a SCION network for use in tests. The default Mock SCIOND implementation uses the graph to simulate path lookups.

Note that the graph always returns the shortest paths, regardless whether they are valid SCION paths (e.g., the path might cross multiple peering links).

Index

Constants

This section is empty.

Variables

View Source
var (
	If_110_X_120_A  = common.IFIDType(1129)
	If_120_A_110_X  = common.IFIDType(2911)
	If_110_X_130_A  = common.IFIDType(1113)
	If_130_A_110_X  = common.IFIDType(1311)
	If_110_X_210_X  = common.IFIDType(1121)
	If_210_X_110_X  = common.IFIDType(2111)
	If_120_A_130_B  = common.IFIDType(2932)
	If_130_B_120_A  = common.IFIDType(3229)
	If_120_B_220_X  = common.IFIDType(3022)
	If_220_X_120_B  = common.IFIDType(2230)
	If_120_B1_220_X = common.IFIDType(3122)
	If_220_X_120_B1 = common.IFIDType(2231)
	If_120_B_121_X  = common.IFIDType(3015)
	If_121_X_120_B  = common.IFIDType(1530)
	If_120_X_111_B  = common.IFIDType(1227)
	If_111_B_120_X  = common.IFIDType(2712)
	If_130_A_131_X  = common.IFIDType(1316)
	If_131_X_130_A  = common.IFIDType(1613)
	If_130_B_111_A  = common.IFIDType(3214)
	If_111_A_130_B  = common.IFIDType(1432)
	If_130_A_112_X  = common.IFIDType(1317)
	If_112_X_130_A  = common.IFIDType(1713)
	If_111_C_121_X  = common.IFIDType(2815)
	If_121_X_111_C  = common.IFIDType(1528)
	If_111_B_211_A  = common.IFIDType(2723)
	If_211_A_111_B  = common.IFIDType(2327)
	If_111_C_211_A  = common.IFIDType(2823)
	If_211_A_111_C  = common.IFIDType(2328)
	If_111_A_112_X  = common.IFIDType(1417)
	If_112_X_111_A  = common.IFIDType(1714)
	If_121_X_131_X  = common.IFIDType(1516)
	If_131_X_121_X  = common.IFIDType(1615)
	If_121_X_122_X  = common.IFIDType(1518)
	If_122_X_121_X  = common.IFIDType(1815)
	If_122_X_133_X  = common.IFIDType(1810)
	If_133_X_122_X  = common.IFIDType(1018)
	If_131_X_132_X  = common.IFIDType(1619)
	If_132_X_131_X  = common.IFIDType(1916)
	If_132_X_133_X  = common.IFIDType(1910)
	If_133_X_132_X  = common.IFIDType(1019)
	If_210_X_220_X  = common.IFIDType(2122)
	If_220_X_210_X  = common.IFIDType(2221)
	If_210_X_211_A  = common.IFIDType(2123)
	If_211_A_210_X  = common.IFIDType(2321)
	If_210_X1_211_A = common.IFIDType(3323)
	If_211_A_210_X1 = common.IFIDType(2333)
	If_220_X_221_X  = common.IFIDType(2224)
	If_221_X_220_X  = common.IFIDType(2422)
	If_211_A_221_X  = common.IFIDType(2324)
	If_221_X_211_A  = common.IFIDType(2423)
	If_211_A_212_X  = common.IFIDType(2325)
	If_212_X_211_A  = common.IFIDType(2523)
	If_211_A1_212_X = common.IFIDType(3425)
	If_212_X_211_A1 = common.IFIDType(2534)
	If_211_A_222_X  = common.IFIDType(2326)
	If_222_X_211_A  = common.IFIDType(2623)
	If_221_X_222_X  = common.IFIDType(2426)
	If_222_X_221_X  = common.IFIDType(2624)
)
View Source
var DefaultGraphDescription = &Description{
	Nodes: []string{
		"1-ff00:0:110",
		"1-ff00:0:111",
		"1-ff00:0:112",
		"1-ff00:0:120",
		"1-ff00:0:121",
		"1-ff00:0:122",
		"1-ff00:0:130",
		"1-ff00:0:131",
		"1-ff00:0:132",
		"1-ff00:0:133",
		"2-ff00:0:210",
		"2-ff00:0:211",
		"2-ff00:0:212",
		"2-ff00:0:220",
		"2-ff00:0:221",
		"2-ff00:0:222",
	},
	Edges: []EdgeDesc{
		{"1-ff00:0:110", If_110_X_120_A, "1-ff00:0:120", If_120_A_110_X, false},
		{"1-ff00:0:110", If_110_X_130_A, "1-ff00:0:130", If_130_A_110_X, false},
		{"1-ff00:0:110", If_110_X_210_X, "2-ff00:0:210", If_210_X_110_X, false},
		{"1-ff00:0:120", If_120_A_130_B, "1-ff00:0:130", If_130_B_120_A, false},
		{"1-ff00:0:120", If_120_B_220_X, "2-ff00:0:220", If_220_X_120_B, false},
		{"1-ff00:0:120", If_120_B1_220_X, "2-ff00:0:220", If_220_X_120_B1, false},
		{"1-ff00:0:120", If_120_B_121_X, "1-ff00:0:121", If_121_X_120_B, false},
		{"1-ff00:0:120", If_120_X_111_B, "1-ff00:0:111", If_111_B_120_X, false},
		{"1-ff00:0:130", If_130_A_131_X, "1-ff00:0:131", If_131_X_130_A, false},
		{"1-ff00:0:130", If_130_B_111_A, "1-ff00:0:111", If_111_A_130_B, false},
		{"1-ff00:0:130", If_130_A_112_X, "1-ff00:0:112", If_112_X_130_A, false},
		{"1-ff00:0:111", If_111_C_121_X, "1-ff00:0:121", If_121_X_111_C, true},
		{"1-ff00:0:111", If_111_B_211_A, "2-ff00:0:211", If_211_A_111_B, true},
		{"1-ff00:0:111", If_111_C_211_A, "2-ff00:0:211", If_211_A_111_C, true},
		{"1-ff00:0:111", If_111_A_112_X, "1-ff00:0:112", If_112_X_111_A, false},
		{"1-ff00:0:121", If_121_X_131_X, "1-ff00:0:131", If_131_X_121_X, true},
		{"1-ff00:0:121", If_121_X_122_X, "1-ff00:0:122", If_122_X_121_X, false},
		{"1-ff00:0:122", If_122_X_133_X, "1-ff00:0:133", If_133_X_122_X, true},
		{"1-ff00:0:131", If_131_X_132_X, "1-ff00:0:132", If_132_X_131_X, false},
		{"1-ff00:0:132", If_132_X_133_X, "1-ff00:0:133", If_133_X_132_X, false},
		{"2-ff00:0:210", If_210_X_220_X, "2-ff00:0:220", If_220_X_210_X, false},
		{"2-ff00:0:210", If_210_X_211_A, "2-ff00:0:211", If_211_A_210_X, false},
		{"2-ff00:0:210", If_210_X1_211_A, "2-ff00:0:211", If_211_A_210_X1, false},
		{"2-ff00:0:220", If_220_X_221_X, "2-ff00:0:221", If_221_X_220_X, false},
		{"2-ff00:0:211", If_211_A_221_X, "2-ff00:0:221", If_221_X_211_A, true},
		{"2-ff00:0:211", If_211_A_212_X, "2-ff00:0:212", If_212_X_211_A, false},
		{"2-ff00:0:211", If_211_A1_212_X, "2-ff00:0:212", If_212_X_211_A1, false},
		{"2-ff00:0:211", If_211_A_222_X, "2-ff00:0:222", If_222_X_211_A, false},
		{"2-ff00:0:221", If_221_X_222_X, "2-ff00:0:222", If_222_X_221_X, false},
	},
}
View Source
var (
	StaticIfaceIdMapping = map[string]int{
		"110_X":  11,
		"111_A":  14,
		"111_B":  27,
		"111_C":  28,
		"112_X":  17,
		"120_X":  12,
		"120_A":  29,
		"120_B":  30,
		"120_B1": 31,
		"121_X":  15,
		"122_X":  18,
		"130_A":  13,
		"130_B":  32,
		"131_X":  16,
		"132_X":  19,
		"133_X":  10,
		"210_X":  21,
		"210_X1": 33,
		"211_A":  23,
		"211_A1": 34,
		"212_X":  25,
		"220_X":  22,
		"221_X":  24,
		"222_X":  26,
	}
)

Functions

func MustParseIA

func MustParseIA(ia string) addr.IA

Types

type AS

type AS struct {
	IFIDs map[common.IFIDType]struct{}
}

AS contains a list of all the IFIDs in an AS.

func (*AS) Delete

func (as *AS) Delete(ifid common.IFIDType)

Delete removes ifid from as.

type Description

type Description struct {
	Nodes []string
	Edges []EdgeDesc
}

Description contains the entire specification of a graph. It is useful for one shot initilizations.

type EdgeDesc

type EdgeDesc struct {
	Xia   string
	Xifid common.IFIDType
	Yia   string
	Yifid common.IFIDType
	Peer  bool
}

EdgeDesc is used in Descriptions to describe the links between ASes.

type Graph

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

Graph implements a graph of ASes and IFIDs for testing purposes. IFIDs must be globally unique.

Nodes are represented by ASes.

Edges are represented by pairs of IFIDs.

func New

func New(ctrl *gomock.Controller) *Graph

New allocates a new empty graph.

func NewDefaultGraph

func NewDefaultGraph(ctrl *gomock.Controller) *Graph

func NewFromDescription

func NewFromDescription(ctrl *gomock.Controller, desc *Description) *Graph

NewFromDescription initializes a new graph from description desc.

func (*Graph) Add

func (g *Graph) Add(ia string)

Add adds a new node to the graph. If ia is not a valid string representation of an ISD-AS, Add panics.

func (g *Graph) AddLink(xIA string, xIFID common.IFIDType,
	yIA string, yIFID common.IFIDType, peer bool)

AddLink adds a new edge between the ASes described by xIA and yIA, with xIFID in xIA and yIFID in yIA. If xIA or yIA are not valid string representations of an ISD-AS, AddLink panics.

func (*Graph) Beacon

func (g *Graph) Beacon(ifids []common.IFIDType) *seg.PathSegment

Beacon constructs path segments across a series of egress ifids. The parent AS of the first IFID is the origin of the beacon, and the beacon propagates down to the parent AS of the remote counterpart of the last IFID. The constructed segment includes peering links. The hop fields in the returned segment do not contain valid MACs.

func (*Graph) DeleteInterface

func (g *Graph) DeleteInterface(ifid common.IFIDType)

DeleteInterface removes ifid from the graph without deleting its remote counterpart. This is useful for testing IFID misconfigurations.

func (*Graph) GetParent

func (g *Graph) GetParent(ifid common.IFIDType) addr.IA

GetParent returns the parent AS of ifid.

func (*Graph) GetPaths

func (g *Graph) GetPaths(xIA string, yIA string) [][]common.IFIDType

GetPaths returns all the minimum-length paths. If xIA = yIA, a 1-length slice containing an empty path is returned. If no path exists between xIA and yIA, a 0-length slice is returned.

Note that this always returns shortest length paths, even if they might not be valid SCION paths.

func (g *Graph) RemoveLink(ifid common.IFIDType)

RemoveLink deletes the edge containing ifid from the graph.

Jump to

Keyboard shortcuts

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