Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteInterfaces(currentSession *JunosSession, interfaceNames []string) error
- func DisableSwitchInterface(currentSession *JunosSession, switchInterface string) error
- func DumpInterfaceConfigs(currentSession *JunosSession, switchInterfaces []string) error
- func EnableSwitchInterface(currentSession *JunosSession, switchInterface string) error
- func IsSwitchInterfaceUp(currentSession *JunosSession, switchInterface string) (bool, error)
- func RemoveAllConfigurationFromInterfaces(currentSession *JunosSession, switchInterfaces []string) error
- func RestoreSwitchInterfacesConfiguration(currentSession *JunosSession, switchInterfaces []string) error
- func SetNonLacpLag(currentSession *JunosSession, slaveInterfaceNames []string, ...) error
- func SetVlanOnTrunkInterface(currentSession *JunosSession, vlan, switchInterface string) error
- type InterfaceStatus
- type JunosSession
- func (j *JunosSession) ApplyConfigInterface(config string) error
- func (j *JunosSession) Close()
- func (j *JunosSession) Config(commands []string) error
- func (j *JunosSession) GetInterfaceConfig(switchInterface string) (string, error)
- func (j *JunosSession) RunOperationalCMD(cmd string) (string, error)
- type SwitchCredentials
Constants ¶
const ( // SetAction represents the action to set a configuration. SetAction = "set" // DeleteAction represents the action to delete a configuration. DeleteAction = "delete" )
Variables ¶
var InterfaceConfigs []string
InterfaceConfigs stores configuration strings for switch interfaces.
Functions ¶
func DeleteInterfaces ¶
func DeleteInterfaces(currentSession *JunosSession, interfaceNames []string) error
DeleteInterfaces deletes given interfaces.
func DisableSwitchInterface ¶
func DisableSwitchInterface(currentSession *JunosSession, switchInterface string) error
DisableSwitchInterface disables a specified switch interface.
func DumpInterfaceConfigs ¶
func DumpInterfaceConfigs(currentSession *JunosSession, switchInterfaces []string) error
DumpInterfaceConfigs fetches and stores interface configurations for the specified switch interfaces.
func EnableSwitchInterface ¶
func EnableSwitchInterface(currentSession *JunosSession, switchInterface string) error
EnableSwitchInterface enables a specified switch interface.
func IsSwitchInterfaceUp ¶
func IsSwitchInterfaceUp(currentSession *JunosSession, switchInterface string) (bool, error)
IsSwitchInterfaceUp checks if a switch interface is up.
func RemoveAllConfigurationFromInterfaces ¶
func RemoveAllConfigurationFromInterfaces(currentSession *JunosSession, switchInterfaces []string) error
RemoveAllConfigurationFromInterfaces removes all configuration from given switch interfaces.
func RestoreSwitchInterfacesConfiguration ¶
func RestoreSwitchInterfacesConfiguration(currentSession *JunosSession, switchInterfaces []string) error
RestoreSwitchInterfacesConfiguration restores the configuration of specified switch interfaces.
func SetNonLacpLag ¶
func SetNonLacpLag(currentSession *JunosSession, slaveInterfaceNames []string, aggregatedInterfaceName string) error
SetNonLacpLag configures non-LACP Link Aggregated ports on Junos devices.
func SetVlanOnTrunkInterface ¶
func SetVlanOnTrunkInterface(currentSession *JunosSession, vlan, switchInterface string) error
SetVlanOnTrunkInterface configures VLAN on a trunk interface.
Types ¶
type InterfaceStatus ¶
type InterfaceStatus struct { InterfaceInformation []struct { PhysicalInterface []struct { Name []struct { Data string `json:"data"` } `json:"name"` AdminStatus []struct { Data string `json:"data"` Attributes struct { JunosFormat string `json:"junos:format"` } `json:"attributes"` } `json:"admin-status"` OperStatus []struct { Data string `json:"data"` } `json:"oper-status"` MTU []struct { Data string `json:"data"` } `json:"mtu"` Speed []struct { Data string `json:"data"` } `json:"speed"` } `json:"physical-interface"` } `json:"interface-information"` }
InterfaceStatus represents the status information of a network interface.
type JunosSession ¶
type JunosSession struct { Session *netconf.Session SwitchCredentials SwitchCredentials }
JunosSession represents a connection to a Juniper network device.
func NewSession ¶
func NewSession(host, user, password string) (*JunosSession, error)
NewSession establishes a new connection to a Junos device that we will use to run our commands against.
func (*JunosSession) ApplyConfigInterface ¶
func (j *JunosSession) ApplyConfigInterface(config string) error
ApplyConfigInterface applies given interface configuration to a switch.
func (*JunosSession) Close ¶
func (j *JunosSession) Close()
Close disconnects the session to the device.
func (*JunosSession) Config ¶
func (j *JunosSession) Config(commands []string) error
Config sends commands to a Juniper switch.
func (*JunosSession) GetInterfaceConfig ¶
func (j *JunosSession) GetInterfaceConfig(switchInterface string) (string, error)
GetInterfaceConfig returns configuration for given interface.
func (*JunosSession) RunOperationalCMD ¶
func (j *JunosSession) RunOperationalCMD(cmd string) (string, error)
RunOperationalCMD executes any operational mode command, such as "show" or "request".
type SwitchCredentials ¶
type SwitchCredentials struct { // User is the username for authenticating with the switch. User string // Password is the password for authenticating with the switch. Password string // SwitchIP is the IP address of the network switch. SwitchIP string }
SwitchCredentials stores the authentication and connection details for a network switch.
func NewSwitchCredentials ¶
func NewSwitchCredentials() (*SwitchCredentials, error)
NewSwitchCredentials is the constructor for the SwitchCredentials object.