topology

package
v0.0.0-...-5b448de Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OwnershipLink = "ownership"
	Layer2Link    = "layer2"
)

Describe the relation type between nodes

Variables

View Source
var (
	OwnershipMetadata = graph.Metadata{"RelationType": OwnershipLink}
	Layer2Metadata    = graph.Metadata{"RelationType": Layer2Link}
)

Describe the relation type between nodes in the graph

Functions

func AddLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) *graph.Edge

AddLayer2Link Link the parent and the child node

func AddOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) *graph.Edge

AddOwnershipLink Link the parent and the child node, the child can have only one parent, previous will be overwritten

func ExecuteGremlinQuery

func ExecuteGremlinQuery(g *graph.Graph, query string) (traversal.GraphTraversalStep, error)

ExecuteGremlinQuery run a gremlin query on the graph g

func GraphPath

func GraphPath(g *graph.Graph, n *graph.Node) string

GraphPath returns a string representation of the shortestpath between 2 host on the same owner

func HaveLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) bool

HaveLayer2Link returns true if parent and child have the same layer 2

func HaveOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) bool

HaveOwnershipLink returns true parent and child have the same ownership

func NamespaceFromNode

func NamespaceFromNode(g *graph.Graph, n *graph.Node) (string, string, error)

NamespaceFromNode returns the namespace name and the path of a node in the graph

func NewNetNSContextByNode

func NewNetNSContextByNode(g *graph.Graph, n *graph.Node) (*common.NetNSContext, error)

NewNetNSContextByNode creates a new network namespace context based on the node

Types

type HostNodeTIDMap

type HostNodeTIDMap map[string][]string

HostNodeTIDMap a map that store the value node TID and the key node host

func BuildHostNodeTIDMap

func BuildHostNodeTIDMap(nodes []*graph.Node) HostNodeTIDMap

BuildHostNodeTIDMap creates a new node and host (key) map

type NodePath

type NodePath []*graph.Node

NodePath describes a path in the graph between 2 nodes

func (NodePath) Marshal

func (p NodePath) Marshal() string

Marshal Serialize the node path

type TIDMapper

type TIDMapper struct {
	graph.DefaultGraphListener
	Graph *graph.Graph
	// contains filtered or unexported fields
}

TIDMapper describes the hostID nodes stored in a graph the mapper will broadcast node event to the registered listeners

func NewTIDMapper

func NewTIDMapper(g *graph.Graph) *TIDMapper

NewTIDMapper creates a new node mapper in the graph g

func (*TIDMapper) OnEdgeAdded

func (t *TIDMapper) OnEdgeAdded(e *graph.Edge)

OnEdgeAdded event

func (*TIDMapper) OnEdgeDeleted

func (t *TIDMapper) OnEdgeDeleted(e *graph.Edge)

OnEdgeDeleted event

func (*TIDMapper) OnEdgeUpdated

func (t *TIDMapper) OnEdgeUpdated(e *graph.Edge)

OnEdgeUpdated event

func (*TIDMapper) OnNodeAdded

func (t *TIDMapper) OnNodeAdded(n *graph.Node)

OnNodeAdded evetn

func (*TIDMapper) OnNodeUpdated

func (t *TIDMapper) OnNodeUpdated(n *graph.Node)

OnNodeUpdated event

func (*TIDMapper) Start

func (t *TIDMapper) Start()

Start the mapper

func (*TIDMapper) Stop

func (t *TIDMapper) Stop()

Stop the mapper

type TopologyTraversalExtension

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

TopologyTraversalExtension describes a new extension to enhance the topology

func NewTopologyTraversalExtension

func NewTopologyTraversalExtension() *TopologyTraversalExtension

NewTopologyTraversalExtension returns a new graph traversal mechanism externsion

func (*TopologyTraversalExtension) ParseStep

ParseStep parse the current step

func (*TopologyTraversalExtension) ScanIdent

ScanIdent returns an associated graph token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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