switcher

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Frr is the path to the frr configuration file
	Frr = "/etc/frr/frr.conf"
	// FrrTmp is the path to the tempoary location of the frr configuration file
	FrrTmp = "/etc/frr/frr.tmp"
	// FrrReloadService is the systemd service to reload
	FrrReloadService = "frr.service"
	// FrrValidationService is the systemd unit that is used for validation
	FrrValidationService = "frr-validation"
)
View Source
const (
	// Interfaces is the path to the network interfaces file
	Interfaces = "/etc/network/interfaces"
	// InterfacesTmp is the path to a temporary location of the interfaces file
	InterfacesTmp = "/etc/network/interfaces.tmp"
	// InterfacesReloadService is the systemd service to reload
	InterfacesReloadService = "ifreload.service"
	// InterfacesValidationService is the systemd unit that is used for validation
	InterfacesValidationService = "interfaces-validation"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Applier

type Applier interface {
	Apply() error
	Render(w io.Writer) error
}

Applier is an interface for rendering and reloading a switch configuration change

func NewFrrApplier

func NewFrrApplier(c *Conf) Applier

NewFrrApplier creates a new FrrApplier

func NewInterfacesApplier

func NewInterfacesApplier(c *Conf) Applier

NewInterfacesApplier creates a new InterfacesApplier

type Conf

type Conf struct {
	Name                 string
	LogLevel             string
	Loopback             string
	ASN                  uint32
	Ports                Ports
	DevMode              bool
	MetalCoreCIDR        string
	AdditionalBridgeVIDs []string
}

Conf holds the switch configuration

func (*Conf) Apply

func (c *Conf) Apply() error

Apply applies the configuration to the switch

func (*Conf) FillRouteMapsAndIPPrefixLists

func (c *Conf) FillRouteMapsAndIPPrefixLists()

func (*Conf) FillVLANIDs

func (c *Conf) FillVLANIDs(m vlan.Mapping) error

FillVLANIDs fills the given configuration object with switch-local VLAN-IDs if they are present in the given VLAN-Mapping otherwise: new available VLAN-IDs will be used

type Filter

type Filter struct {
	IPPrefixLists []IPPrefixList
	RouteMaps     []RouteMap
}

func (*Filter) Assemble

func (s *Filter) Assemble(rmPrefix string, vnis, cidrs []string)

type Firewall

type Firewall struct {
	Filter
	Port  string
	Cidrs []string
	Vnis  []string
}

type FrrApplier

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

FrrApplier is responsible for writing and applying the FRR configuration

func (FrrApplier) Apply

func (a FrrApplier) Apply() error

Apply applies the configuration to the system

func (FrrApplier) Render

func (a FrrApplier) Render(w io.Writer) error

Render renders the frr configuration to the given writer

type IPPrefixList

type IPPrefixList struct {
	Name string
	Spec string
}

IPPrefixList represents 'ip prefix-list' filtering mechanism to be used in combination with route-maps.

type InterfacesApplier

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

InterfacesApplier is responsible for writing and applying the network interfaces configuration

func (InterfacesApplier) Apply

func (a InterfacesApplier) Apply() error

Apply applies the configuration to the system

func (InterfacesApplier) Render

func (a InterfacesApplier) Render(w io.Writer) error

Render renders the network interfaces to the given writer

type Nic

type Nic struct {
	AddressCIDR string
	Gateway     string
}

Nic holds the configuration for a network interface

type Ports

type Ports struct {
	Eth0          Nic
	Underlay      []string
	Unprovisioned []string
	BladePorts    []string
	Vrfs          map[string]*Vrf
	Firewalls     map[string]*Firewall
}

type RouteMap

type RouteMap struct {
	Name    string
	Entries []string
	Policy  string
	Order   int
}

RouteMap represents a route-map to permit or deny routes.

type Vrf

type Vrf struct {
	Filter
	VNI       uint32
	VLANID    uint16
	Neighbors []string
	Cidrs     []string
}

Tenant holds the switch configuration for a specific tenant

Jump to

Keyboard shortcuts

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