Skip to content

Commit

Permalink
Clean-up Mikrotik username suffix.
Browse files Browse the repository at this point in the history
  • Loading branch information
udhos committed Mar 27, 2017
1 parent 8e3daa5 commit a704adc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type DevAttributes struct {
ErrlogHistSize int // max number of lines in errlog history
PostLoginPromptPattern string // mikrotik: Please press "Enter" to continue!
PostLoginPromptResponse string // mikrotik: \r\n
UsernameAppend string // mikrotik: +cte

// readTimeout: per-read timeout (protection against inactivity)
// matchTimeout: full match timeout (protection against slow sender -- think 1 byte per second)
Expand Down
5 changes: 1 addition & 4 deletions dev/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ type Device struct {

// Username gets the username for login into a device.
func (d *Device) Username() string {
if d.Model() == "mikrotik" {
return d.DevConfig.LoginUser + "+cte"
}
return d.DevConfig.LoginUser
return d.DevConfig.LoginUser + d.DevConfig.Attr.UsernameAppend
}

// Printf formats device-specific messages into logs.
Expand Down
1 change: 1 addition & 0 deletions dev/model_mikrotik.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func registerModelMikrotik(logger hasPrintf, t *DeviceTable) {
a.CommandReadTimeout = 20 * time.Second // larger timeout for slow 'sh run'
a.CommandMatchTimeout = 30 * time.Second // larger timeout for slow 'sh run'
a.QuoteSentCommandsFormat = `##[%s]`
a.UsernameAppend = "+cte"

m := &Model{name: "mikrotik"}
m.defaultAttr = a
Expand Down

0 comments on commit a704adc

Please sign in to comment.