znet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisClient added in v0.1.0

func NewRedisClient(host string) (*redis.Client, error)

Types

type AEInterface added in v0.1.0

type AEInterface struct {
	Description string `yaml:"description"`
	Name        string `yaml:"name"`
	MTU         int    `yaml:"mtu"`
	Options     struct {
		MinimumLinks int      `yaml:"minimum_links"`
		LACP         []string `yaml:"lacp"`
	} `yaml:"options"`
	EthernetSwitching EthernetSwitching `yaml:"ethernet_switching"`
}

type BGP added in v0.1.0

type BGP struct {
	Groups []BGPGroup `yaml:"groups"`
}

type BGPGroup added in v0.1.0

type BGPGroup struct {
	Name      string   `yaml:"name"`
	Type      string   `yaml:"type"`
	ASN       int      `yaml:"asn"`
	Neighbors []string `yaml:"neighbors"`
	Import    []string `yaml:"import"`
	Export    []string `yaml:"export"`
}

type Config

type Config struct {
	Rooms    []Room      `yaml:"rooms"`
	Endpoint string      `yaml:"endpoint"`
	Nats     NatsConfig  `yaml:"nats,omitempty"`
	Junos    NatsConfig  `yaml:"junos,omitempty"`
	Redis    RedisConfig `yaml:"redis,omitempty"`
	Http     HttpConfig  `yaml:"http,omitempty"`
	Ldap     LdapConfig  `yaml:"ldap,omitempty"`
}

func (*Config) Room

func (c *Config) Room(name string) (Room, error)

type Data added in v0.1.0

type Data struct {
	TemplateDir   string   `yaml:"template_dir"`
	TemplatePaths []string `yaml:"template_paths"`
	DataDir       string   `yaml:"data_dir"`
	Hierarchy     []string `yaml:"hierarchy"`
}

type EthernetInterface added in v0.1.0

type EthernetInterface struct {
	Description       string            `yaml:"description"`
	EthernetSwitching EthernetSwitching `yaml:"ethernet_switching"`
	EthernetOptions   []string          `yaml:"ethernet_options"`
	MTU               int               `yaml:"mtu"`
	Name              string            `yaml:"name"`
	NativeVlanId      int               `yaml:"native_vlan_id"`
}

type EthernetSwitching added in v0.1.0

type EthernetSwitching struct {
	Mode  string   `yaml:"mode"`
	VLANs []string `yaml:"vlans"`
}

type HostData added in v0.1.0

type HostData struct {
	NTPServers            []string              `yaml:"ntp_servers"`
	DHCPServer            string                `yaml:"dhcp_server"`
	DHCPForwardInterfaces []string              `yaml:"dhcp_forward_interfaces"`
	LLDPInterfaces        []string              `yaml:"lldp_interfaces"`
	IRBInterfaces         []IRBInterface        `yaml:"irb_interfaces"`
	AEInterfaces          []AEInterface         `yaml:"ae_interfaces"`
	EthernetInterfaces    []EthernetInterface   `yaml:"eth_interfaces"`
	RouterAdvertisements  []RouterAdvertisement `yaml:"router_advertisements"`
	BGP                   BGP                   `yaml:"bgp"`
	Security              Security              `yaml:"security"`
}

type HttpConfig added in v0.1.0

type HttpConfig struct {
	ListenAddress string
}

type IRBInterface added in v0.1.0

type IRBInterface struct {
	Unit  string   `yaml:"unit"`
	Inet  []string `yaml:"inet"`
	Inet6 []string `yaml:"inet6"`
	MTU   int      `yaml:"mtu"`
}

type JunosConfig added in v0.1.0

type JunosConfig struct {
	Hosts      []string
	Username   string
	PrivateKey string
}

type LdapConfig added in v0.1.0

type LdapConfig struct {
	BaseDN string
	BindDN string
	BindPW string
	Host   string
}

type Listener added in v0.1.0

type Listener struct {
	Config *Config
	// contains filtered or unexported fields
}

func NewListener added in v0.1.0

func NewListener(config *Config) (*Listener, error)

func (*Listener) Listen added in v0.1.0

func (l *Listener) Listen(listenAddr string, ch chan bool)

func (*Listener) Shutdown added in v0.1.0

func (l *Listener) Shutdown()

type NatsConfig added in v0.1.0

type NatsConfig struct {
	URL   string
	Topic string
}

type NetworkHost added in v0.1.0

type NetworkHost struct {
	Name       string
	HostName   string
	Domain     string
	Platform   string
	Group      string
	Role       string
	DeviceType string
	Data       HostData
}

type NetworkZone added in v0.1.0

type NetworkZone struct {
	Name       string
	NTPServers []string
}

type RedisConfig added in v0.1.0

type RedisConfig struct {
	Host string
}

type Room

type Room struct {
	Name string `yaml:"name"`
	IDs  []int  `yaml:"ids"`
}

type RouterAdvertisement added in v0.1.0

type RouterAdvertisement struct {
	Interface string `yaml:"interface"`
	DNSServer string `yaml:"dns_server"`
	Prefix    string `yaml:"prefix"`
}

type Security added in v0.1.0

type Security struct {
	Zones          []SecurityZone         `yaml:"zones"`
	Policies       []SecurityPolicies     `yaml:"policies"`
	SimplePolicies []SimpleSecurityPolicy `yaml:"simple_policies"`
}

type SecurityPolicies added in v0.1.0

type SecurityPolicies struct {
	From     string           `yaml:"from"`
	To       string           `yaml:"to"`
	Policies []SecurityPolicy `yaml:"policies"`
}

type SecurityPolicy added in v0.1.0

type SecurityPolicy struct {
	Name  string   `yaml:"name"`
	Match []string `yaml:"match"`
	Then  []string `yaml:"then"`
}

type SecurityZone added in v0.1.0

type SecurityZone struct {
	Name           string                  `yaml:"name"`
	Screen         string                  `yaml:"screen"`
	SystemServices []string                `yaml:"system_services"`
	Protocols      []string                `yaml:"protocols"`
	Interfaces     []SecurityZoneInterface `yaml:"interfaces"`
}

type SecurityZoneInterface added in v0.1.0

type SecurityZoneInterface struct {
	Name           string   `yaml:"name"`
	SystemServices []string `yaml:"system_services"`
}

type SimpleSecurityPolicy added in v0.1.0

type SimpleSecurityPolicy struct {
	From string   `yaml:"from"`
	To   []string `yaml:"to"`
	Then string   `yaml:"then"`
}

type Znet added in v0.1.0

type Znet struct {
	ConfigDir string
	Config    Config
	Data      Data
	// contains filtered or unexported fields
}

func NewZnet added in v0.1.0

func NewZnet(file string) *Znet

func (*Znet) ConfigureNetworkHost added in v0.1.0

func (z *Znet) ConfigureNetworkHost(host *NetworkHost, commit bool)

func (*Znet) DataForDevice added in v0.1.0

func (z *Znet) DataForDevice(host NetworkHost) HostData

DataForDevice

func (*Znet) GetNetworkHosts added in v0.1.0

func (z *Znet) GetNetworkHosts(l *ldap.Conn, baseDN string) []NetworkHost

func (*Znet) GetNetworkZones added in v0.1.0

func (z *Znet) GetNetworkZones(l *ldap.Conn, baseDN string) []NetworkZone

func (*Znet) HierarchyForDevice added in v0.1.0

func (z *Znet) HierarchyForDevice(host NetworkHost) []string

HierarchyForDevice retuns a list of file paths to consult for the data hierarchy.

func (*Znet) Listen added in v0.1.0

func (z *Znet) Listen(listenAddr string, ch chan bool)

func (*Znet) LoadConfig added in v0.1.0

func (z *Znet) LoadConfig(file string)

func (*Znet) LoadData added in v0.1.0

func (z *Znet) LoadData(configDir string)

func (*Znet) NewLDAPClient added in v0.1.0

func (z *Znet) NewLDAPClient(config LdapConfig) (*ldap.Conn, error)

func (*Znet) RenderHostTemplateFile added in v0.1.0

func (z *Znet) RenderHostTemplateFile(host NetworkHost, path string) string

RenderHostTemplateFile renders a template file using a Host object.

func (*Znet) TemplateStringsForDevice added in v0.1.0

func (z *Znet) TemplateStringsForDevice(host NetworkHost, templates []string) []string

TemplateStringsForDevice renders a list of template strings given a host.

func (*Znet) TemplatesForDevice added in v0.1.0

func (z *Znet) TemplatesForDevice(host NetworkHost) []string

TemplatesForDevice returns a list of template paths for a given host.

Jump to

Keyboard shortcuts

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