Documentation ¶
Index ¶
- func LoadEnvironment(config VaultConfig, e EnvironmentConfig) (map[string]string, error)
- func NewLDAPClient(config LDAPConfig) (*ldap.Conn, error)
- func NewSecretClient(config VaultConfig) (*api.Client, error)
- func PublicKeyFile(file string) ssh.AuthMethod
- func SSHAgent() ssh.AuthMethod
- type AEInterface
- type BGP
- type BGPGroup
- type Config
- type Data
- type EnvironmentConfig
- type EthernetInterface
- type EthernetSwitching
- type HTTPConfig
- type HostData
- type HueConfig
- type IRBInterface
- type InetUnit
- type Inventory
- type JunosConfig
- type LDAPConfig
- type Lights
- type LightsConfig
- type Listener
- type NatsConfig
- type NetworkHost
- type NetworkZone
- type PolicyOptions
- type PolicyStatement
- type PolicyTerm
- type RFToyConfig
- type RPCConfig
- type RedisConfig
- type Room
- type RouterAdvertisement
- type Routing
- type Security
- type SecurityNATRule
- type SecurityNATRuleMatch
- type SecurityNATRuleSet
- type SecurityPolicies
- type SecurityPolicy
- type SecurityZone
- type SecurityZoneInterface
- type SimpleSecurityPolicy
- type StaticRoute
- type StaticRoutes
- type UnknownHost
- type VLAN
- type VaultConfig
- type Znet
- func (z *Znet) AdoptUnknownHost(u UnknownHost, baseDN string)
- func (z *Znet) Close() error
- func (z *Znet) ConfigureNetworkHost(host *NetworkHost, commit bool, auth *junos.AuthMethod, show bool) error
- func (z *Znet) DataForDevice(host NetworkHost) HostData
- func (z *Znet) GetNetworkZones(l *ldap.Conn, baseDN string) []NetworkZone
- func (z *Znet) HierarchyForDevice(host NetworkHost) []string
- func (z *Znet) Listen(listenAddr string, ch chan bool)
- func (z *Znet) LoadData(configDir string)
- func (z *Znet) RecordUnknownHost(baseDN string, address string, mac string) error
- func (z *Znet) RenderHostTemplateFile(host NetworkHost, path string) string
- func (z *Znet) TemplateStringsForDevice(host NetworkHost, templates []string) []string
- func (z *Znet) TemplatesForDevice(host NetworkHost) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadEnvironment ¶ added in v0.4.0
func LoadEnvironment(config VaultConfig, e EnvironmentConfig) (map[string]string, error)
LoadEnvironment reads reads environment variables out of vault for return.
func NewLDAPClient ¶ added in v0.4.0
func NewLDAPClient(config LDAPConfig) (*ldap.Conn, error)
NewLDAPClient constructs an LDAP client to return.
func NewSecretClient ¶ added in v0.4.0
func NewSecretClient(config VaultConfig) (*api.Client, error)
NewSecretClient receives a configuration and returns a client for Vault.
func PublicKeyFile ¶ added in v0.4.0
func PublicKeyFile(file string) ssh.AuthMethod
func SSHAgent ¶ added in v0.4.0
func SSHAgent() ssh.AuthMethod
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"` Units []InetUnit `yaml:"units,omitempty"` NativeVlanId int `yaml:"native_vlan_id"` }
type Config ¶
type Config struct { Rooms []Room `yaml:"rooms,omitempty"` Environments []EnvironmentConfig `yaml:"environments,omitempty"` Nats NatsConfig `yaml:"nats,omitempty"` Junos JunosConfig `yaml:"junos,omitempty"` Redis RedisConfig `yaml:"redis,omitempty"` HTTP HTTPConfig `yaml:"http,omitempty"` LDAP LDAPConfig `yaml:"ldap,omitempty"` Vault VaultConfig `yaml:"vault,omitempty"` RPC RPCConfig `yaml:"rpc,omitempty"` Lights LightsConfig `yaml:"lights,omitempty"` }
Config stores the items that are required to configure this project.
type EnvironmentConfig ¶ added in v0.2.0
type EnvironmentConfig struct { Name string `yaml:"name,omitempty"` SecretValues []string `yaml:"secret_values,omitempty"` }
func GetEnvironmentConfig ¶ added in v0.5.0
func GetEnvironmentConfig(environments []EnvironmentConfig, envName string) (EnvironmentConfig, error)
GetEnvironmentConfig receives a slice of environment configurations and returns the one that matches the given name.
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"` Units []InetUnit `yaml:"units"` }
type EthernetSwitching ¶ added in v0.1.0
type HTTPConfig ¶ added in v0.2.0
type HTTPConfig struct {
ListenAddress string
}
type HostData ¶ added in v0.1.0
type HostData struct { AEInterfaces []AEInterface `yaml:"ae_interfaces"` BGP BGP `yaml:"bgp"` DHCPForwardInterfaces []string `yaml:"dhcp_forward_interfaces"` DHCPServer string `yaml:"dhcp_server"` EthernetInterfaces []EthernetInterface `yaml:"eth_interfaces"` IRBInterfaces []IRBInterface `yaml:"irb_interfaces"` LLDPInterfaces []string `yaml:"lldp_interfaces"` NTPServers []string `yaml:"ntp_servers"` RouterAdvertisements []RouterAdvertisement `yaml:"router_advertisements"` Routing Routing `yaml:"routing"` PolicyOptions PolicyOptions `yaml:"policy_options"` Security Security `yaml:"security"` VLANs []VLAN `yaml:"vlans"` }
type IRBInterface ¶ added in v0.1.0
type Inventory ¶ added in v0.4.0
type Inventory struct {
// contains filtered or unexported fields
}
func (*Inventory) NetworkHosts ¶ added in v0.4.0
func (i *Inventory) NetworkHosts() ([]NetworkHost, error)
NetworkHosts retrieves the NetworkHost objects from LDAP given an LDPA connection and baseDN.
func (*Inventory) UnknownHosts ¶ added in v0.6.1
func (i *Inventory) UnknownHosts() ([]UnknownHost, error)
type JunosConfig ¶ added in v0.1.0
type LDAPConfig ¶ added in v0.2.0
type Lights ¶ added in v0.4.0
type Lights struct { RFToy *rftoy.RFToy HUE *huego.Bridge // contains filtered or unexported fields }
Lights holds the information necessary to communicate with lighting equipment.
func NewLights ¶ added in v0.4.0
func NewLights(config LightsConfig) *Lights
NewLights creates and returns a new Lights object based on the received configuration.
type LightsConfig ¶ added in v0.4.0
type LightsConfig struct { Rooms []Room `yaml:"rooms"` Hue HueConfig `yaml:"hue,omitempty"` RFToy RFToyConfig `yaml:"rftoy,omitempty"` }
type Listener ¶ added in v0.1.0
type Listener struct { Config *Config // contains filtered or unexported fields }
Listener is a znet server
func NewListener ¶ added in v0.1.0
NewListener builds a new Listener object from the received configuration.
type NatsConfig ¶ added in v0.1.0
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 Watch bool Description string MACAddress []string Environment map[string]string }
NetworkHost is a device that connects to the network.
type NetworkZone ¶ added in v0.1.0
type PolicyOptions ¶ added in v0.3.0
type PolicyOptions struct {
Statements map[string]PolicyStatement `yaml:"statements"`
}
type PolicyStatement ¶ added in v0.3.0
type PolicyStatement struct { Name string `yaml:"name"` Terms []PolicyTerm `yaml:"terms"` Then string `yaml:"then"` }
type PolicyTerm ¶ added in v0.3.0
type RFToyConfig ¶ added in v0.4.0
type RFToyConfig struct {
Endpoint string `yaml:"endpoint,omitempty"`
}
type RedisConfig ¶ added in v0.1.0
type RedisConfig struct {
Host string
}
type RouterAdvertisement ¶ added in v0.1.0
type Routing ¶ added in v0.3.0
type Routing struct { RouterID string `yaml:"router_id"` ASN int `yaml:"asn"` StaticRoutes StaticRoutes `yaml:"static_routes"` }
type Security ¶ added in v0.1.0
type Security struct { Zones []SecurityZone `yaml:"zones"` Policies []SecurityPolicies `yaml:"policies"` SimplePolicies []SimpleSecurityPolicy `yaml:"simple_policies"` NATRuleSets []SecurityNATRuleSet `yaml:"nat_rulesets"` }
type SecurityNATRule ¶ added in v0.2.0
type SecurityNATRule struct { Name string `yaml:"name"` Match SecurityNATRuleMatch `yaml:"match"` }
type SecurityNATRuleMatch ¶ added in v0.2.0
type SecurityNATRuleSet ¶ added in v0.2.0
type SecurityNATRuleSet struct { Name string `yaml:"name"` From string `yaml:"from_zone"` To string `yaml:"to_zone"` Rules []SecurityNATRule `yaml:"rules"` }
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 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 SimpleSecurityPolicy ¶ added in v0.1.0
type StaticRoute ¶ added in v0.3.0
type StaticRoutes ¶ added in v0.3.0
type StaticRoutes struct { Inet []StaticRoute `yaml:"inet"` Inet6 []StaticRoute `yaml:"inet6"` }
type UnknownHost ¶ added in v0.6.1
type VaultConfig ¶ added in v0.2.0
type Znet ¶ added in v0.1.0
type Znet struct { ConfigDir string Config Config Data Data Environment map[string]string // TODO deprecate ldapclient use at Znet, move to Inventory // ldapClient *ldap.Conn Inventory *Inventory Lights *Lights // contains filtered or unexported fields }
Znet is the core object for this project. It keeps track of the data, configuration and flow control for starting the server process.
func (*Znet) AdoptUnknownHost ¶ added in v0.6.1
func (z *Znet) AdoptUnknownHost(u UnknownHost, baseDN string)
func (*Znet) ConfigureNetworkHost ¶ added in v0.1.0
func (z *Znet) ConfigureNetworkHost(host *NetworkHost, commit bool, auth *junos.AuthMethod, show bool) error
ConfigureNetworkHost renders the templates using associated data for a network host. The hosts about which to load the templates, are retrieved from LDAP.
func (*Znet) DataForDevice ¶ added in v0.1.0
func (z *Znet) DataForDevice(host NetworkHost) HostData
DataForDevice returns HostData for a given 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) LoadData ¶ added in v0.1.0
LoadData receives a configuration directory from which to load the data for Znet.
func (*Znet) RecordUnknownHost ¶ added in v0.4.0
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.