topo

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Overview

Package topo contains various topology and related artifact generation utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearTopology

func ClearTopology(conn *grpc.ClientConn) error

ClearTopology removes all Devices, links and hosts from the simulator

func ConstructDevice added in v0.1.3

func ConstructDevice(dd Device) *simapi.Device

ConstructDevice creates a device from the specified device YAML descriptor

func ConstructHost added in v0.1.3

func ConstructHost(hd Host) *simapi.Host

ConstructHost creates a host from the specified host YAML descriptor

func ConstructLink(ld Link) *simapi.Link

ConstructLink creates a link from the specified link YAML descriptor

func GenerateNetcfg

func GenerateNetcfg(topologyPath string, netcfgPath string, driver string, pipeconf string, tenants []int) error

GenerateNetcfg loads the specified topology YAML file and uses it to generate ONOS netcfg.json file

func GenerateRobotTopology added in v0.1.5

func GenerateRobotTopology(topologyPath string, robotTopologyPath string) error

GenerateRobotTopology loads the specified topology YAML file and uses it to generate Robot topology YAML file

func GenerateTopology

func GenerateTopology(recipePath string, topologyPath string) error

GenerateTopology loads the specified topology recipe YAML file and uses the recipe to generate a fully elaborated topology YAML file that can be loaded via LoadTopology

func LoadTopology

func LoadTopology(conn *grpc.ClientConn, topologyPath string) error

LoadTopology loads the specified YAML file and creates the prescribed simulated topology entities using the fabric simulator API client.

func LoadTopologyFile added in v0.1.3

func LoadTopologyFile(path string, topology *Topology) error

LoadTopologyFile loads the specified topology YAML file

Types

type AccessFabric

type AccessFabric struct {
	Spines         int  `mapstructure:"spines" yaml:"spines"`
	SpinePortCount int  `mapstructure:"spine_port_count" yaml:"spine_port_count"`
	LeafPairs      int  `mapstructure:"leaf_pairs" yaml:"leaf_pairs"`
	LeafPortCount  int  `mapstructure:"leaf_port_count" yaml:"leaf_port_count"`
	SpineTrunk     int  `mapstructure:"spine_trunk" yaml:"spine_trunk"`
	PairTrunk      int  `mapstructure:"pair_trunk" yaml:"pair_trunk"`
	HostsPerPair   int  `mapstructure:"hosts_per_pair" yaml:"hosts_per_pair"`
	HostsHaveIPU   bool `mapstructure:"hosts_have_ipu" yaml:"hosts_have_ipu_leaf"`
	VMsPerIPU      int  `mapstructure:"vms_per_ipu" yaml:"vms_per_ipu"`
}

AccessFabric is a recipe for creating simulated access fabric with spines and paired leaves

type Builder

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

Builder hods state to assist generating various fabric topologies

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new topology builder context

func (*Builder) NextAgentPort

func (b *Builder) NextAgentPort() int32

NextAgentPort reserves the next available agent port and returns it

func (*Builder) NextDevicePortID

func (b *Builder) NextDevicePortID(deviceID string) string

NextDevicePortID reserves the next available port ID and returns it

type Device

type Device struct {
	ID        string        `mapstructure:"id" yaml:"id"`
	ChassisID uint64        `mapstructure:"chassis_id" yaml:"chassis_id"`
	Type      string        `mapstructure:"type" yaml:"type"`
	AgentPort int32         `mapstructure:"agent_port" yaml:"agent_port"`
	Stopped   bool          `mapstructure:"stopped" yaml:"stopped"`
	Ports     []Port        `mapstructure:"ports" yaml:"ports"`
	Pos       *GridPosition `mapstructure:"pos" yaml:"pos"`
}

Device is a description of a simulated device

type FixedFabric added in v1.0.3

type FixedFabric struct {
}

FixedFabric is a recipe for creating simulated 4 rack fabric with superspines

type GridPosition added in v0.1.1

type GridPosition struct {
	X int `mapstructure:"x" yaml:"x"`
	Y int `mapstructure:"y" yaml:"y"`
}

GridPosition carries X/Y coordinates of a node

type Host

type Host struct {
	ID   string        `mapstructure:"id" yaml:"id"`
	NICs []NIC         `mapstructure:"nics" yaml:"nics"`
	Pos  *GridPosition `mapstructure:"pos" yaml:"pos"`
}

Host is a description of a simulated host

type Link struct {
	SrcPortID      string `mapstructure:"src" yaml:"src"`
	TgtPortID      string `mapstructure:"tgt" yaml:"tgt"`
	Unidirectional bool   `mapstructure:"unidirectional" yaml:"unidirectional"`
}

Link is a description of a simulated link

type NIC

type NIC struct {
	Mac  string `mapstructure:"mac" yaml:"mac"`
	IPv4 string `mapstructure:"ip" yaml:"ip"`
	IPV6 string `mapstructure:"ipv6" yaml:"ipv6"`
	Port string `mapstructure:"port" yaml:"port"`
}

NIC is a description of a simulated NIC

type Netcfg

type Netcfg struct {
	Devices map[string]*NetcfgDevice `json:"devices"`
	Ports   map[string]*NetcfgPort   `json:"ports"`
	Hosts   map[string]*NetcfgHost   `json:"hosts"`
}

Netcfg structure represents ONOS network configuration

type NetcfgDevice

type NetcfgDevice struct {
	Basic          *NetcfgDeviceBasic          `json:"basic"`
	Underlay       *NetcfgDeviceUnderlay       `json:"underlay"`
	Reconciliation *NetcfgDeviceReconciliation `json:"reconciliation"`
}

NetcfgDevice structure represents ONOS device config

type NetcfgDeviceBasic

type NetcfgDeviceBasic struct {
	Name                         string                     `json:"name"`
	ManagementAddress            string                     `json:"managementAddress"`
	AncillaryManagementAddresses *NetcfgManagementAddresses `json:"ancillaryManagementAddresses,omitempty"`
	Driver                       string                     `json:"driver"`
	Pipeconf                     string                     `json:"pipeconf"`
	LocType                      string                     `json:"locType"`
	GridX                        int                        `json:"gridX"`
	GridY                        int                        `json:"gridY"`
}

NetcfgDeviceBasic structure represents ONOS basic device config

type NetcfgDeviceReconciliation added in v0.1.6

type NetcfgDeviceReconciliation struct {
	RequiredApps []string `json:"requiredApps"`
}

NetcfgDeviceReconciliation holds reconciliation config

type NetcfgDeviceUnderlay added in v0.1.6

type NetcfgDeviceUnderlay struct {
	NodeSid      int      `json:"nodeSid"`
	Loopbacks    []string `json:"loopbacks"`
	RouterMac    string   `json:"routerMac"`
	IsEdgeRouter bool     `json:"isEdgeRouter"`
}

NetcfgDeviceUnderlay holds underlay config

type NetcfgHost added in v0.1.1

type NetcfgHost struct {
	Basic *NetcfgHostBasic `json:"basic"`
}

NetcfgHost structure represents ONOS host config

type NetcfgHostBasic added in v0.1.1

type NetcfgHostBasic struct {
	Name    string `json:"name"`
	LocType string `json:"locType"`
	GridX   int    `json:"gridX"`
	GridY   int    `json:"gridY"`
}

NetcfgHostBasic structure represents ONOS basic host config

type NetcfgManagementAddresses added in v0.1.6

type NetcfgManagementAddresses struct {
	HostLocalAgent string `json:"host-local-agent"`
}

NetcfgManagementAddresses holds local agent addresses

type NetcfgPort added in v0.1.6

type NetcfgPort struct {
	Interfaces []*NetcfgPortInterfaces `json:"interfaces"`
}

NetcfgPort structure holds port configuration

type NetcfgPortInterfaces added in v0.1.6

type NetcfgPortInterfaces struct {
	Name         string   `json:"name"`
	Ips          []string `json:"ips"`
	VlanUntagged int      `json:"vlan-untagged,omitempty"`
	VlanTagged   []int    `json:"vlan-tagged,omitempty"`
	Mac          string   `json:"mac"`
}

NetcfgPortInterfaces represents a single port interface configuration

type PlainFabric added in v0.1.1

type PlainFabric struct {
	Spines              int  `mapstructure:"spines" yaml:"spines"`
	SpinePortCount      int  `mapstructure:"spine_port_count" yaml:"spine_port_count"`
	ReservedUplinkCount int  `mapstructure:"reserved_uplink_count" yaml:"reserved_uplink_count"`
	Leaves              int  `mapstructure:"leaves" yaml:"leaves"`
	LeafPortCount       int  `mapstructure:"leaf_port_count" yaml:"leaf_port_count"`
	SpineTrunk          int  `mapstructure:"spine_trunk" yaml:"spine_trunk"`
	HostsPerLeaf        int  `mapstructure:"hosts_per_leaf" yaml:"hosts_per_leaf"`
	HostsHaveIPU        bool `mapstructure:"hosts_have_ipu" yaml:"hosts_have_ipu_leaf"`
	VMsPerIPU           int  `mapstructure:"vms_per_ipu" yaml:"vms_per_ipu"`
}

PlainFabric is a recipe for creating simulated plain leaf-spine fabric with optional IPUs

type Port

type Port struct {
	Number    uint32 `mapstructure:"number" yaml:"number"`
	SDNNumber uint32 `mapstructure:"sdn_number" yaml:"sdn_number"`
	Speed     string `mapstructure:"speed" yaml:"speed"`
}

Port is a description of a simulated port

type Recipe

type Recipe struct {
	AccessFabric   *AccessFabric   `mapstructure:"access_fabric" yaml:"access_fabric"`
	PlainFabric    *PlainFabric    `mapstructure:"plain_fabric" yaml:"plain_fabric"`
	SuperSpineTier *SuperSpineTier `mapstructure:"superspine_tier" yaml:"superspine_tier"`
	FixedFabric    *FixedFabric    `mapstructure:"fixed_fabric" yaml:"fixed_fabric"`
}

Recipe is a container for holding one of the supported simulated topology recipes

type RobotDevice added in v0.1.5

type RobotDevice struct {
	ID        string       `mapstructure:"id" yaml:"id"`
	AgentPort int32        `mapstructure:"agent_port" yaml:"agent_port"`
	Links     []*RobotLink `mapstructure:"links" yaml:"links"`
}

RobotDevice is a description of an expected device

type RobotHost added in v0.1.5

type RobotHost struct {
	ID       string           `mapstructure:"id" yaml:"id"`
	MAC      string           `mapstructure:"mac" yaml:"mac"`
	IP       string           `mapstructure:"ip" yaml:"ip"`
	Gateway  string           `mapstructure:"gw" yaml:"gw"`
	VLAN     string           `mapstructure:"vlan" yaml:"vlan"`
	TenantID string           `mapstructure:"tenantid" yaml:"tenantid"`
	Links    []*RobotHostLink `mapstructure:"links" yaml:"links"`
}

RobotHost is a description of an expected host

type RobotHostLink struct {
	Device string `mapstructure:"device" yaml:"device"`
	Port   string `mapstructure:"port" yaml:"port"`
}

RobotHostLink is a description of an expected host link

type RobotLink struct {
	Target     string `mapstructure:"tgt" yaml:"tgt"`
	SourcePort string `mapstructure:"srcport" yaml:"srcport"`
	TargetPort string `mapstructure:"tgtport" yaml:"tgtport"`
}

RobotLink is a description of an expected link

type RobotNode added in v0.1.5

type RobotNode struct {
	IP string `mapstructure:"ip" yaml:"ip"`
}

RobotNode is a description of an expected ONOS controller node

type RobotTopology added in v0.1.5

type RobotTopology struct {
	Nodes   []*RobotNode
	Devices []*RobotDevice
	Hosts   []*RobotHost
}

RobotTopology is a description of an expected network topology

type SuperSpineTier added in v1.0.3

type SuperSpineTier struct {
	SuperSpines         int    `mapstructure:"superspines" yaml:"superspines"`
	SuperSpinesDomain   string `mapstructure:"superspines_domain" yaml:"superspines_domain"`
	SuperSpinePortCount int    `mapstructure:"superspine_port_count" yaml:"superspine_port_count"`
	Pods                int    `mapstructure:"pods" yaml:"pods"`
	PodsDomain          string `mapstructure:"pods_domain" yaml:"pods_domain"`
	PodSpines           int    `mapstructure:"pod_spines" yaml:"pod_spines"`
}

SuperSpineTier is a recipe for creating simulated superspine tier for linking access or plain fabric pods. This generates superspine YAML file and also an addendum per pod fabric YAML with external links to superspines. It is not intended to be used by itself.

type Topology

type Topology struct {
	Devices []Device `mapstructure:"Devices" yaml:"Devices"`
	Links   []Link   `mapstructure:"links" yaml:"links"`
	Hosts   []Host   `mapstructure:"hosts" yaml:"hosts"`
}

Topology is a description of a simulated network topology

func GenerateAccessFabric

func GenerateAccessFabric(fabric *AccessFabric) *Topology

GenerateAccessFabric generates topology YAML from the specified access fabric recipe

func GenerateFixedFabric added in v1.0.3

func GenerateFixedFabric(fabric *FixedFabric) *Topology

GenerateFixedFabric generates topology YAML from the specified super-spine fabric recipe

func GeneratePlainFabric added in v0.1.1

func GeneratePlainFabric(fabric *PlainFabric) *Topology

GeneratePlainFabric generates topology YAML from the specified spine-leaf fabric recipe

func GenerateSuperSpineTier added in v1.0.3

func GenerateSuperSpineTier(fabric *SuperSpineTier, path string) (*Topology, error)

GenerateSuperSpineTier generates topology YAML from the specified super-spine fabric recipe

Jump to

Keyboard shortcuts

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