Documentation ¶
Index ¶
- func NewRedisClient(host string) (*redis.Client, error)
- 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 JunosConfig
- type LDAPConfig
- type Listener
- type NatsConfig
- type NetworkHost
- type NetworkZone
- type RedisConfig
- type Room
- type RouterAdvertisement
- type Security
- type SecurityNATRule
- type SecurityNATRuleMatch
- type SecurityNATRuleSet
- type SecurityPolicies
- type SecurityPolicy
- type SecurityZone
- type SecurityZoneInterface
- type SimpleSecurityPolicy
- type VLAN
- type VaultConfig
- type Znet
- func (z *Znet) ConfigureNetworkHost(host *NetworkHost, commit bool, auth *junos.AuthMethod) error
- func (z *Znet) DataForDevice(host NetworkHost) HostData
- func (z *Znet) GetNetworkHosts(l *ldap.Conn, baseDN string) ([]NetworkHost, error)
- 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) LoadConfig(file string)
- func (z *Znet) LoadData(configDir string)
- func (z *Znet) LoadEnvironment() error
- func (z *Znet) NewLDAPClient(config LDAPConfig) (*ldap.Conn, error)
- func (z *Znet) NewSecretClient(config VaultConfig) (*api.Client, 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 ¶
Types ¶
type AEInterface ¶ added in v0.1.0
type Config ¶
type Config struct { Rooms []Room `yaml:"rooms,omitempty"` Endpoint string `yaml:"endpoint,omitempty"` Environments []EnvironmentConfig `yaml:"environments,omitempty"` Nats NatsConfig `yaml:"nats,omitempty"` Hue HueConfig `yaml:"hue,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"` }
Config stores the items that are required to configure this project.
type EnvironmentConfig ¶ added in v0.2.0
type EthernetInterface ¶ added in v0.1.0
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 { 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"` VLANs []VLAN `yaml:"vlans"` }
type IRBInterface ¶ added in v0.1.0
type JunosConfig ¶ added in v0.1.0
type LDAPConfig ¶ added in v0.2.0
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 RedisConfig ¶ added in v0.1.0
type RedisConfig struct {
Host string
}
type RouterAdvertisement ¶ added in v0.1.0
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 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 // 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) ConfigureNetworkHost ¶ added in v0.1.0
func (z *Znet) ConfigureNetworkHost(host *NetworkHost, commit bool, auth *junos.AuthMethod) 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) GetNetworkHosts ¶ added in v0.1.0
GetNetworkHosts retrieves the NetworkHost objects from LDAP given an LDPA connection and baseDN.
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) LoadConfig ¶ added in v0.1.0
LoadConfig receives a file path for a configuration to load.
func (*Znet) LoadData ¶ added in v0.1.0
LoadData receives a configuration directory from which to load the data for Znet.
func (*Znet) LoadEnvironment ¶ added in v0.2.0
func (*Znet) NewLDAPClient ¶ added in v0.1.0
func (z *Znet) NewLDAPClient(config LDAPConfig) (*ldap.Conn, error)
NewLDAPClient constructs an LDAP client to return.
func (*Znet) NewSecretClient ¶ added in v0.2.0
func (z *Znet) NewSecretClient(config VaultConfig) (*api.Client, error)
NewSecretClient receives a configuration and returns a client for Vault.
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.