Documentation ¶
Overview ¶
Package godevman - common godevman package
Index ¶
- Constants
- func BitMap(bytes []byte) map[int]bool
- func IfStatStr(n int64) string
- func IfTypeStr(n int64) string
- func IntAbs(val int64) uint64
- func NewDevice(p *Dparams) (*device, error)
- func RandomString(l int) string
- func SplitLineEnd(s string) []string
- func TcpReq(req, host, port string) ([]byte, error)
- func UpTimeString(ut, lc uint64) string
- type Address
- type BackupInfo
- type BackupParams
- type CliCmdOpts
- type CliParams
- type D1qVlanBrPort
- type D1qVlanInfo
- type DevBackupReader
- type DevBackupper
- type DevCliWriter
- type DevConfReader
- type DevEnergyMeterReader
- type DevFreqSyncReader
- type DevGenReader
- type DevHwReader
- type DevIfReader
- type DevIfWriter
- type DevInvReader
- type DevIp6Reader
- type DevIpReader
- type DevLicStatusReader
- type DevMobReader
- type DevOnusReader
- type DevOspfReader
- type DevPhaseSyncReader
- type DevRlReader
- type DevSensorsReader
- type DevSwReader
- type DevSysReader
- type DevSysWriter
- type DevVlanReader
- type DevWebSessManager
- type Dparams
- type EReadings
- type EcsReadings1
- type EcsStatus1
- type FreqSyncInfo
- type GenInfo
- type IfInfo
- type IfStack
- type InvInfo
- type IpIfInfo
- type IpInfo
- type LicStatusInfo
- type MobSignal
- type MyRoundTripper
- type OnuInfo
- type OnuPort
- type PhaseSyncInfo
- type RauInfo
- type RfInfo
- type RlRadioFeIfInfo
- type RlRadioIfInfo
- type SensorVal
- type SnmpCred
- type System
- type UbiOltInterface
- type UbiOltInterfaceIdentification
- type UbiOltInterfaceLag
- type UbiOltInterfacePonSet
- type UbiOltInterfacePortSet
- type UbiOltInterfaceSfp
- type UbiOltInterfaceStatus
- type UbiOltInterfaces
- type UbiOltStatistics
- type UbiOltVlans
- type UbiOnuInfo
- type UbiOnuSettings
- type UbiOnusInfo
- type UbiOnusSettings
- type ValBool
- type ValF64
- type ValI64
- type ValInt
- type ValString
- type ValU64
Constants ¶
const Version = "0.0.1-devel.3"
Version of release
Variables ¶
This section is empty.
Functions ¶
func RandomString ¶
Returns a random string of [a-z,A-Z,0-9] chars of submitted lenght
func SplitLineEnd ¶
Split string on newline Splits on and removes `\s*?\r?\n` from line end
func UpTimeString ¶
Returns human readable UpTime string. "ut" - upTime as returned by snmp agent (Time Ticks) "lc" - last change (Time Ticks). Submit 0 to get current upTime string
Types ¶
type Address ¶
type Address struct { Cidr *string `json:"cidr"` Origin interface{} `json:"origin"` Type *string `json:"type"` Version *string `json:"version"` }
Ubiquiti specific OLT interface info type used by device web API
type BackupInfo ¶
last backup info
type BackupParams ¶
type BackupParams struct { // IP of backup target system TargetIp string // Device identifier. Default is device ip // Will be used as first part of backup file name DevIdent string // Base path for backups (if device type needs it) BasePath string // Credentials Cred []string }
Info needed for Device backup
type CliCmdOpts ¶
type CliCmdOpts struct { // Parse errors from cli output after submitting commands // Default false ChkErr bool // Run commands in privilrged mode (applicable on some device types) // Default false Priv bool }
CLI command exec options
type CliParams ¶
type CliParams struct { // Prompt re pattern // Default depends on device type // Keep it as is if you are not sure PromptRe string // Cli errors re pattern // Default depends on device type // Keep it as is if you are not sure ErrRe string // Default "22" for ssh and "23" for telnet Port string // Full path to unencrypted PEM-encoded private key file // If declared PublicKeys method for remote authentication will be used KeyPath string // Private key passphrase if any KeySecret string // Valid values are "\r\n" or "\n" // Default depends on device type // Keep it as is if you are not sure LineEnd string // CLI session credentials Cred []string // Commands which will be executed first on session start // Default depends on device type // Keep it as is if you are not sure PreCmds []string // Commands which will be executed to gracefully close session // Default depends on device type // Keep it as is if you are not sure DisconnectCmds []string // Use telnet instead of ssh. Default false Telnet bool // Session timeout (sec) // Depends on device type // Keep it as is if you are not sure Timeout int }
CLI session parameters
type D1qVlanInfo ¶
type D1qVlanInfo struct { Ports map[int]*D1qVlanBrPort Name string }
Dot1Q VLAN info (Boolean in Ports map indicates untagged vlan)
type DevBackupReader ¶
type DevBackupReader interface {
LastBackup() (*BackupInfo, error)
}
Get backup info
type DevBackupper ¶
type DevBackupper interface { // Backup device config DoBackup() error }
Backup initiator
type DevCliWriter ¶
type DevCliWriter interface { // Execute cli commands RunCmds([]string, *CliCmdOpts) ([]string, error) }
CLI releated functionality
type DevConfReader ¶
Get running config
type DevEnergyMeterReader ¶
Get energy readings
type DevFreqSyncReader ¶
type DevFreqSyncReader interface {
FreqSyncInfo() (*FreqSyncInfo, error)
}
Get Frequency Sync info
type DevGenReader ¶
Get Power Generator info
type DevHwReader ¶
Get Hardware info
type DevIfReader ¶
type DevIfReader interface { IfInfo([]string, ...string) (map[string]*IfInfo, error) // Get ifNumber IfNumber() (int64, error) // Get interfaces stack info IfStack() (IfStack, error) }
Functionality related to interfaces
type DevIfWriter ¶
type DevInvReader ¶
type DevInvReader interface { InvInfo([]string, ...string) (map[string]*InvInfo, error) // Get interface to inventory relations IfInventory() (map[int]int, error) }
Functionality related to inventory
type DevIp6Reader ¶
Functionality related to Get IPv6 addresses
type DevIpReader ¶
type DevIpReader interface { IpInfo(...string) (map[string]*IpInfo, error) IpIfInfo(...string) (map[string]*IpIfInfo, error) }
Functionality related to IP addresses
type DevLicStatusReader ¶
type DevLicStatusReader interface {
LicStatusInfo() (*LicStatusInfo, error)
}
Get License status info
type DevMobReader ¶
Mobile signal related functionality
type DevOnusReader ¶
Get ONU info
type DevOspfReader ¶
type DevOspfReader interface { OspfAreaRouters() (map[string][]string, error) OspfAreaStatus() (map[string]string, error) OspfNbrStatus() (map[string]string, error) }
Get OSPF info
type DevPhaseSyncReader ¶
type DevPhaseSyncReader interface {
PhaseSyncInfo() (*PhaseSyncInfo, error)
}
Get Phase Sync info
type DevRlReader ¶
type DevRlReader interface { RlInfo() (map[string]*RlRadioIfInfo, error) RlNbrInfo() (map[string]*RlRadioFeIfInfo, error) }
Get RL neighbour info
type DevSensorsReader ¶
type DevSensorsReader interface {
Sensors([]string) (map[string]map[string]map[string]SensorVal, error)
}
Get environment sensors info
type DevSysReader ¶
Get system info
type DevSysWriter ¶
type DevSysWriter interface { SetSysName(string) error SetContact(string) error SetLocation(string) error }
Set system info
type DevVlanReader ¶
type DevVlanReader interface { D1qVlans() (map[string]string, error) // Get dot1q vlans BrPort2IfIdx() (map[string]int, error) // Get dot1q vlan to port relations D1qVlanInfo() (map[string]*D1qVlanInfo, error) }
Functionality related to dot1q vlans
type DevWebSessManager ¶
type DevWebSessManager interface { WebAuth([]string) error WebSession() *http.Client WebLogout() error }
Functionality related to web connection authentication
type Dparams ¶
type Dparams struct { // ip of device Ip string // sysObjectId of Device // Will be not discovered If present SysObjectId string // Timezone for time related actions // Default is Europe/Tallinn TimeZone string // Websession credentials WebCred []string BackupParams BackupParams SnmpCred SnmpCred CliParams CliParams }
Parameters for new Device object initialization
type EReadings ¶
type EReadings struct {
// contains filtered or unexported fields
}
Energy Readings
type EcsReadings1 ¶
type EcsStatus1 ¶
type EcsStatus1 struct { XMLName xml.Name `xml:"root"` Chardata string `xml:",chardata"` Name string `xml:"name"` Type string `xml:"type"` Class string `xml:"class"` Text string `xml:"text"` }
ECS specific system info type used by device web API
type FreqSyncInfo ¶
type FreqSyncInfo struct { SrcsQaLevel map[string]string ClockMode ValString ClockQaLevel ValString }
Frequency Sync info
type GenInfo ¶
type GenInfo struct { GenMode ValString BreakerState ValString EngineState ValString GenPower SensorVal RunHours SensorVal BatteryVolt SensorVal GenFreq SensorVal GenCurrentL1 SensorVal GenCurrentL2 SensorVal GenCurrentL3 SensorVal CoolantTemp SensorVal MainsVoltL3 SensorVal MainsVoltL2 SensorVal GenVoltL2 SensorVal FuelConsum SensorVal MainsVoltL1 SensorVal FuelLevel SensorVal GenVoltL3 SensorVal GenVoltL1 SensorVal NumStarts ValU64 }
Power Generator info
type IfInfo ¶
type IfInfo struct {
Descr, Name, Alias, Mac, LastStr, TypeStr, AdminStr, OperStr ValString
Type, Mtu, Admin, Oper ValI64
Speed, Last, InOctets, InPkts, InUcast, InMcast, InBcast, InDiscards,
InErrors, OutOctets, OutPkts, OutUcast, OutMcast, OutBcast, OutDiscards,
OutErrors ValU64
}
Interface info
type InvInfo ¶
type InvInfo struct {
Descr, Position, HwProduct, HwRev, Serial, Manufacturer, Model, SwProduct,
SwRev ValString
Physical bool
ParentId ValI64
}
Inventory info
type LicStatusInfo ¶
License Status info
type MobSignal ¶
type MobSignal struct {
Registration, Technology, Band, Operator, Ber, CellId, Signal, SignalBars, Imei, Sinr, Rssi, Rsrp, Rsrq SensorVal
}
Mobile modem signal data
type MyRoundTripper ¶
type MyRoundTripper struct {
// contains filtered or unexported fields
}
Add additional default headers
type OnuInfo ¶
type OnuInfo struct { Model ValString Mac ValString UpTimeStr ValString ConTimeStr ValString Error ValString Version ValString OltPort ValString Name ValString Ports map[string]OnuPort TxBytes SensorVal TxPower SensorVal RxPower SensorVal Ram SensorVal Distance SensorVal CpuTemp SensorVal CpuUsage SensorVal DownLimit SensorVal Uplimit SensorVal RxBytes SensorVal ConTime ValU64 UpTime ValU64 Online ValBool Enabled ValBool }
type PhaseSyncInfo ¶
type PhaseSyncInfo struct { SrcsState map[string]string ParentGmIdent ValString ParentGmClass ValString State ValString HopsToGm ValU64 }
Phase Sync info
type RfInfo ¶
type RfInfo struct { Name ValString Descr ValString Status ValString Mute ValBool IfIdx ValInt EntityIdx ValInt TxCapacity ValInt PowerIn ValF64 PowerOut ValF64 Snr ValF64 }
Radiolink radio interface info
type RlRadioFeIfInfo ¶
type RlRadioFeIfInfo struct { SysName ValString Ip ValString FeIfDescr ValString IfIdx ValInt FeIfIdx ValInt EntityIdx ValInt TxCapacity ValInt PowerIn ValF64 PowerOut ValF64 }
Radiolink FarEnd radio interface info
type RlRadioIfInfo ¶
type SnmpCred ¶
type SnmpCred struct { // [username|community] User string // [authentication protocol] (NoAuth|MD5|SHA) Prot string // [authentication protocol pass phrase] Pass string // [security level] (noAuthNoPriv|authNoPriv|authPriv) Slevel string // [privacy protocol] (NoPriv|DES|AES|AES192|AES256|AES192C|AES256C) PrivProt string // [privacy protocol pass phrase] PrivPass string // [snmp version] (1|2|3) Ver int }
SNMP credentials for snmp session
type UbiOltInterface ¶
type UbiOltInterface struct { Addresses []Address `json:"addresses"` Identification UbiOltInterfaceIdentification `json:"identification,omitempty"` Pon UbiOltInterfaceSfp `json:"pon,omitempty"` Status UbiOltInterfaceStatus `json:"status,omitempty"` Port UbiOltInterfaceSfp `json:"port,omitempty"` Lag UbiOltInterfaceLag `json:"lag,omitempty"` }
type UbiOltInterfaceLag ¶
type UbiOltInterfaceLag struct { Static *bool `json:"static"` Interfaces []interface{} `json:"interfaces"` }
type UbiOltInterfacePonSet ¶
type UbiOltInterfacePonSet struct { Pon UbiOltInterfaceSfp `json:"pon,omitempty"` Identification UbiOltInterfaceIdentification `json:"identification,omitempty"` Status UbiOltInterfaceStatus `json:"status,omitempty"` Addresses []Address `json:"addresses"` }
type UbiOltInterfacePortSet ¶
type UbiOltInterfacePortSet struct { Port UbiOltInterfaceSfp `json:"port,omitempty"` Identification UbiOltInterfaceIdentification `json:"identification,omitempty"` Status UbiOltInterfaceStatus `json:"status,omitempty"` Addresses []Address `json:"addresses"` }
type UbiOltInterfaceSfp ¶
type UbiOltInterfaceStatus ¶
type UbiOltInterfaces ¶
type UbiOltInterfaces []UbiOltInterface
type UbiOltStatistics ¶
type UbiOltStatistics []struct { Interfaces []struct { ID *string `json:"id"` Name *string `json:"name"` Statistics struct { RxBroadcast *uint64 `json:"rxBroadcast"` RxBytes *uint64 `json:"rxBytes"` RxErrors *uint64 `json:"rxErrors"` RxMulticast *uint64 `json:"rxMulticast"` RxPackets *uint64 `json:"rxPackets"` RxRate *uint64 `json:"rxRate"` TxBroadcast *uint64 `json:"txBroadcast"` TxBytes *uint64 `json:"txBytes"` TxErrors *uint64 `json:"txErrors"` TxMulticast *uint64 `json:"txMulticast"` TxPackets *uint64 `json:"txPackets"` TxRate *uint64 `json:"txRate"` } `json:"statistics,omitempty"` } `json:"interfaces"` Device struct { RAM struct { Free *int `json:"free"` Total *int `json:"total"` Usage *int `json:"usage"` } `json:"ram"` FanSpeeds []struct { Value *float64 `json:"value"` } `json:"fanSpeeds"` Power []struct { PsuType *string `json:"psuType"` Current *float64 `json:"current,omitempty"` Power *float64 `json:"power,omitempty"` Voltage *float64 `json:"voltage,omitempty"` Connected *bool `json:"connected"` } `json:"power"` Signals []interface{} `json:"signals"` Storage []struct { Name *string `json:"name"` SysName *string `json:"sysName"` Type *string `json:"type"` Size *int `json:"size"` Temperature *float64 `json:"temperature"` Used *int `json:"used"` } `json:"storage"` Temperatures []struct { Value *float64 `json:"value"` } `json:"temperatures"` CPU []struct { Identifier *string `json:"identifier"` Temperature *float64 `json:"temperature"` Usage *int `json:"usage"` } `json:"cpu"` Uptime int `json:"uptime"` } `json:"device"` Timestamp int64 `json:"timestamp"` }
Ubiquiti specific OLT statistics type used by device web API
type UbiOltVlans ¶
type UbiOltVlans struct { Trunks []interface{} `json:"trunks"` Vlans []struct { Name string `json:"name"` Type string `json:"type"` Participation []struct { Interface struct { ID string `json:"id"` } `json:"interface"` Mode string `json:"mode"` } `json:"participation"` ID int `json:"id"` } `json:"vlans"` }
Ubiquiti specific VLANs type used by device web API
type UbiOnuInfo ¶
type UbiOnuInfo struct { Router struct{} `json:"router"` System struct { CPU *float64 `json:"cpu"` Mem *float64 `json:"mem"` Temperature struct { CPU *float64 `json:"cpu"` } `json:"temperature"` Uptime *uint64 `json:"uptime"` Voltage *float64 `json:"voltage"` } `json:"system"` Statistics struct { RxBytes *int64 `json:"rxBytes"` RxRate *int `json:"rxRate"` TxBytes *int64 `json:"txBytes"` TxRate *int `json:"txRate"` } `json:"statistics"` Mac *string `json:"mac"` Error *string `json:"error"` FirmwareHash *string `json:"firmwareHash"` Serial *string `json:"serial"` Connected *bool `json:"connected"` FirmwareVersion *string `json:"firmwareVersion"` TxPower *float64 `json:"txPower"` OltPort *int `json:"oltPort"` LaserBias *float64 `json:"laserBias"` RxPower *float64 `json:"rxPower"` Distance *int `json:"distance"` ConnectionTime *uint64 `json:"connectionTime"` Authorized *bool `json:"authorized"` UpgradeStatus struct { FailureReason string `json:"failureReason"` Status string `json:"status"` } `json:"upgradeStatus"` Ports []struct { ID *string `json:"id"` Speed *string `json:"speed"` Plugged *bool `json:"plugged"` } `json:"ports"` }
Ubiquiti specific ONU info type used by device web API
type UbiOnuSettings ¶
type UbiOnuSettings struct { Services struct { HTTPPort *int `json:"httpPort"` SSHPort *int `json:"sshPort"` TelnetPort *int `json:"telnetPort"` SSHEnabled *bool `json:"sshEnabled"` TelnetEnabled *bool `json:"telnetEnabled"` UbntDiscoveryEnabled *bool `json:"ubntDiscoveryEnabled"` } `json:"services"` BandwidthLimit struct { Download struct { Enabled *bool `json:"enabled"` Limit *int `json:"limit"` } `json:"download"` Upload struct { Enabled *bool `json:"enabled"` Limit *int `json:"limit"` } `json:"upload"` } `json:"bandwidthLimit"` Enabled *bool `json:"enabled"` Name *string `json:"name"` LanAddress *string `json:"lanAddress"` Model *string `json:"model"` Mode *string `json:"mode"` AdminPassword *string `json:"adminPassword"` LanProvisioned *bool `json:"lanProvisioned"` Notes *string `json:"notes"` Serial *string `json:"serial"` Wifi struct { Channel *string `json:"channel"` ChannelWidth *string `json:"channelWidth"` Country *string `json:"country"` CountryListID *string `json:"countryListId"` TxPower *float64 `json:"txPower"` Enabled *bool `json:"enabled"` Provisioned *bool `json:"provisioned"` Networks []struct { AuthMode *string `json:"authMode"` Key *string `json:"key"` Ssid *string `json:"ssid"` HideSSID *bool `json:"hideSSID"` } `json:"networks"` } `json:"wifi"` Ports []struct { ID *string `json:"id"` Speed *string `json:"speed"` } `json:"ports"` BridgeMode struct { Ports []struct { Port *string `json:"port"` NativeVLAN *int `json:"nativeVLAN"` IncludeVLANs []int `json:"includeVLANs"` } `json:"ports"` } `json:"bridgeMode"` RouterMode struct { RouterAdvertisement struct { Mode *string `json:"mode"` Prefix *string `json:"prefix"` } `json:"routerAdvertisement"` DhcpPool struct { RangeStart *string `json:"rangeStart"` RangeStop *string `json:"rangeStop"` } `json:"dhcpPool"` PppoePassword *string `json:"pppoePassword"` DhcpServerMode *string `json:"dhcpServerMode"` WanMode6 *string `json:"wanMode6"` PppoeUser *string `json:"pppoeUser"` WanMode *string `json:"wanMode"` Gateway *string `json:"gateway"` Gateway6 *string `json:"gateway6"` DhcpRelay *string `json:"dhcpRelay"` LanAddress6 *string `json:"lanAddress6"` LanMode6 *string `json:"lanMode6"` WanAddress6 *string `json:"wanAddress6"` PppoeMode *string `json:"pppoeMode"` WanAddress *string `json:"wanAddress"` FirewallEnabled6 *bool `json:"firewallEnabled6"` Ipv6Enabled *bool `json:"ipv6Enabled"` DhcpLeaseTime *int `json:"dhcpLeaseTime"` WanVLAN *int `json:"wanVLAN"` UpnpEnabled *bool `json:"upnpEnabled"` WanAccessBlocked *bool `json:"wanAccessBlocked"` DNSProxyEnabled *bool `json:"dnsProxyEnabled"` DNSResolvers []interface{} `json:"dnsResolvers"` PortForwards []interface{} `json:"portForwards"` Nat struct { Ftp bool `json:"ftp"` Pptp bool `json:"pptp"` Rtsp bool `json:"rtsp"` Sip bool `json:"sip"` } `json:"nat"` } `json:"routerMode"` }
Ubiquiti specific ONU settings type used by device web API
type UbiOnusInfo ¶
type UbiOnusInfo []UbiOnuInfo
type UbiOnusSettings ¶
type UbiOnusSettings []UbiOnuSettings
Source Files ¶
- common_cli.go
- common_snmp.go
- common_web.go
- dev_ceragon.go
- dev_cisco.go
- dev_comap.go
- dev_ecs_emeter.go
- dev_eltek_dist_plant_7.go
- dev_eltek_enexus.go
- dev_ericsson_ml_pt.go
- dev_ericsson_ml_tn.go
- dev_interfaces.go
- dev_juniper.go
- dev_linux.go
- dev_martem.go
- dev_mikrotik.go
- dev_moxa.go
- dev_rittal.go
- dev_ruggedcom.go
- dev_stulz.go
- dev_teltonika.go
- dev_ubiquiti.go
- dev_ups.go
- dev_valere.go
- dev_viola.go
- dev_viola_nosnmp.go
- godevman.go
- helpers.go
- helpers_snmp.go