Documentation ¶
Index ¶
- Constants
- func Delete(name string)
- func List()
- func Save(name string, v interface{})
- func Test()
- type AddressFamily
- type AutonomousSystem
- func (a *AutonomousSystem) GetMatchingLink(first, second *NetInterface) *NetInterface
- func (a *AutonomousSystem) IGPType() int
- func (a *AutonomousSystem) IsOSPFStub(area int) bool
- func (a *AutonomousSystem) ReserveSubnets()
- func (a *AutonomousSystem) SetupFullMesh(lm config.InternalLinks, noCost bool) []Link
- func (a *AutonomousSystem) SetupLinks(cfg config.InternalLinks)
- func (a *AutonomousSystem) SetupManual(lm config.InternalLinks, noCost bool) []Link
- func (a *AutonomousSystem) SetupRing(lm config.InternalLinks, noCost bool) []Link
- func (a *AutonomousSystem) TotalContainers() int
- type BGPNbr
- type ExternalLink
- type ExternalLinkItem
- type Host
- type HostFile
- type HostLink
- type HostLinkItem
- type IGPSettings
- type IXP
- type Link
- type LinkItem
- type Net
- func (n Net) AllIPs() []net.IP
- func (n Net) CheckPrefix(prefixLen int) (int, bool)
- func (n Net) Hosts() []net.IP
- func (n Net) Is4() bool
- func (n Net) MarshalJSON() ([]byte, error)
- func (n *Net) NextIP() net.IPNet
- func (n *Net) NextLinkIPs() (a net.IPNet, b net.IPNet)
- func (n *Net) NextSubnet(prefixLen int) net.IPNet
- func (n Net) Size() int
- func (n *Net) UnmarshalJSON(b []byte) error
- type NetInterface
- type OSPFNet
- type Project
- func (p *Project) ApplyExternalLinks()
- func (p *Project) ApplyHostLinks()
- func (p *Project) ApplyIXPLinks()
- func (p *Project) ApplyInternalLinks()
- func (p *Project) FindMatchingExtLink(iface *NetInterface) *NetInterface
- func (p *Project) GetMatchingExtLink(first, second *NetInterface) *NetInterface
- func (p *Project) Print()
- func (p *Project) RemoveExternalLinks()
- func (p *Project) RemoveHostLinks()
- func (p *Project) RemoveIXPLinks()
- func (p *Project) RemoveInternalLinks()
- func (p *Project) StartAll(linksFlag string)
- func (p *Project) StopAll()
- type RPKIServer
- type Router
- func (r *Router) CopyConfig(configPath string)
- func (r *Router) LoID() string
- func (r *Router) LoInfo() (string, int)
- func (r *Router) NeighborsAF() (af AddressFamily)
- func (r *Router) ReloadConfig()
- func (r *Router) SaveConfig(configPath string)
- func (r *Router) StartContainer(wg *sync.WaitGroup, configPath string)
- func (r *Router) StartFRR()
- func (r *Router) StopContainer(wg *sync.WaitGroup, configPath string)
- type VPN
- type VPNCustomer
Constants ¶
const ( IGPUndef = iota IGPOSPF = iota IGPISIS = iota )
const ( NoRel = iota Provider = iota Customer = iota Peer = iota )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AutonomousSystem ¶
type AutonomousSystem struct { ASN int IGP string MPLS bool Network Net LoStart net.IPNet Routers []*Router Hosts []*Host Links []Link HostLinks []HostLink VPN []VPN BGP struct { Disabled bool RedistributeIGP bool } OSPF struct { Stubs []int } RPKI struct { Servers []string } }
AutonomousSystem represents an AS in a Project
func (*AutonomousSystem) GetMatchingLink ¶
func (a *AutonomousSystem) GetMatchingLink(first, second *NetInterface) *NetInterface
func (*AutonomousSystem) IGPType ¶
func (a *AutonomousSystem) IGPType() int
func (*AutonomousSystem) IsOSPFStub ¶
func (a *AutonomousSystem) IsOSPFStub(area int) bool
func (*AutonomousSystem) ReserveSubnets ¶
func (a *AutonomousSystem) ReserveSubnets()
ReserveSubnets generates IPv4 addressing for internal links in an AS
func (*AutonomousSystem) SetupFullMesh ¶
func (a *AutonomousSystem) SetupFullMesh(lm config.InternalLinks, noCost bool) []Link
SetupFullMesh generates an internal links configuration using a full-mesh topology
func (*AutonomousSystem) SetupLinks ¶
func (a *AutonomousSystem) SetupLinks(cfg config.InternalLinks)
SetupLinks generates the L2 configuration based on provided config
func (*AutonomousSystem) SetupManual ¶
func (a *AutonomousSystem) SetupManual(lm config.InternalLinks, noCost bool) []Link
SetupManual generates an internal links configuration based on the provided informations
func (*AutonomousSystem) SetupRing ¶
func (a *AutonomousSystem) SetupRing(lm config.InternalLinks, noCost bool) []Link
SetupRing generates an internal links configuration using a ring topology
func (*AutonomousSystem) TotalContainers ¶
func (a *AutonomousSystem) TotalContainers() int
TotalContainres returns the total number of router containers needed for the AS (= P + PE + CE)
type BGPNbr ¶
type BGPNbr struct { RemoteAS int UpdateSource string ConnCheck bool NextHopSelf bool IfName string RouteMapsIn []string RouteMapsOut []string AF AddressFamily RRClient bool RSClient bool Mask int }
BGPNbr represents a neighbor configuration for a given router
type ExternalLink ¶
type ExternalLink struct { From *ExternalLinkItem To *ExternalLinkItem }
ExternalLink represents a link between 2 routers from different AS
type ExternalLinkItem ¶
type ExternalLinkItem struct { ASN int Router *Router Interface *NetInterface Relation int }
ExternalLinkItem represents a side of an ExternalLink
func NewExtLinkItem ¶
func NewExtLinkItem(asn int, router *Router) *ExternalLinkItem
NewExtLinkItem returns a poiter to an ExternalLinkItem based on the provided informations
type Host ¶
type Host struct { Hostname string ContainerName string DockerImage string Command []string Files []HostFile Links []*NetInterface NextInterface int }
func (*Host) StartContainer ¶
StartContainer starts the container
func (*Host) StopContainer ¶
type HostLink ¶
type HostLink struct { Router *LinkItem Host *HostLinkItem }
type HostLinkItem ¶
type HostLinkItem struct { Host *Host Interface *NetInterface }
func NewHostLinkItem ¶
func NewHostLinkItem(host *Host) *HostLinkItem
type IGPSettings ¶
type Net ¶
func NewNetwork ¶
func (Net) AllIPs ¶
AllIPs returns a slice containing all IPs in a network (identifier and broadcast included)
func (Net) CheckPrefix ¶
CheckPrefix returns the subnet length of the network. The second value return is true if the prefixLen provided is valable.
func (Net) MarshalJSON ¶
func (*Net) NextLinkIPs ¶
NextLinkIPs returns the 2 first host IPs of the NextAvailable IPNet, then sets the value to the next one
func (*Net) NextSubnet ¶
NextSubnet returns the current NextAvailable IPNet, then sets the value to the next subnet
func (*Net) UnmarshalJSON ¶
type NetInterface ¶
type NetInterface struct { IfName string Description string IP net.IPNet Speed int External bool Cost int VRF string IGP IGPSettings }
func (*NetInterface) IsDownstreamVRF ¶
func (l *NetInterface) IsDownstreamVRF() bool
func (*NetInterface) SetSpeedAndCost ¶
func (l *NetInterface) SetSpeedAndCost(v int)
type Project ¶
type Project struct { Name string AS map[int]*AutonomousSystem Ext []*ExternalLink IXPs []IXP RPKI map[string]RPKIServer AllLinks ovsdocker.OVSBulk }
Project is the main struct of topomate
func ReadConfig ¶
ReadConfig reads a yaml file, parses it and returns a Project
func (*Project) ApplyExternalLinks ¶
func (p *Project) ApplyExternalLinks()
ApplyExternalLinks creates all external links between the different AS
func (*Project) ApplyHostLinks ¶
func (p *Project) ApplyHostLinks()
func (*Project) ApplyIXPLinks ¶
func (p *Project) ApplyIXPLinks()
func (*Project) ApplyInternalLinks ¶
func (p *Project) ApplyInternalLinks()
ApplyInternalLinks creates all internal links for each AS of the project
func (*Project) FindMatchingExtLink ¶
func (p *Project) FindMatchingExtLink(iface *NetInterface) *NetInterface
func (*Project) GetMatchingExtLink ¶
func (p *Project) GetMatchingExtLink(first, second *NetInterface) *NetInterface
func (*Project) Print ¶
func (p *Project) Print()
Print displays some informations concerning the project
func (*Project) RemoveExternalLinks ¶
func (p *Project) RemoveExternalLinks()
RemoveExternalLinks removes all external links
func (*Project) RemoveHostLinks ¶
func (p *Project) RemoveHostLinks()
func (*Project) RemoveIXPLinks ¶
func (p *Project) RemoveIXPLinks()
func (*Project) RemoveInternalLinks ¶
func (p *Project) RemoveInternalLinks()
RemoveInternalLinks removes all internal links of the project
type RPKIServer ¶
type Router ¶
type Router struct { ID int Hostname string ContainerName string CustomImage string Loopback []net.IPNet Links []*NetInterface Neighbors map[string]*BGPNbr NextInterface int IGP struct { ISIS struct { Level int Area int } // OSPF []string OSPF []OSPFNet } }
Router contains informations needed to configure a router. It contains elements relative to the container and to the FRR configuration.
func (*Router) CopyConfig ¶
CopyConfig copies the configuration file configPath to the configuration directory in the container file system.
func (*Router) NeighborsAF ¶
func (r *Router) NeighborsAF() (af AddressFamily)
func (*Router) ReloadConfig ¶
func (r *Router) ReloadConfig()
func (*Router) SaveConfig ¶
func (*Router) StartContainer ¶
StartContainer starts the container for the router. If configPath is set, it also copies the configuration file from the configured directory to the container
type VPN ¶
type VPN struct { VRF string Customers []VPNCustomer Neighbors map[string]bool SpokeSubnets []net.IPNet }