Skip to content

Commit

Permalink
fixed echo for sros
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jun 26, 2021
1 parent c2afb4b commit fdf3526
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 6 deletions.
116 changes: 116 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
linters-settings:
depguard:
list-type: blacklist
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
gci:
local-prefixes: github.com/golangci/golangci-lint
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: [argument, case, condition, return]
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 150
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exhaustive
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- revive
- rowserrcheck
- exportloopref
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- asciicheck
- gochecknoglobals
- gocognit
- godot
- godox
- goerr113
- nestif
- prealloc
- testpackage
- wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd

run:
skip-dirs:
- private
16 changes: 13 additions & 3 deletions cmd/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,24 @@ func netconfSave(cont types.GenericContainer) {
kind := cont.Labels["clab-node-kind"]
host := strings.TrimLeft(cont.Names[0], "/")

d, err := netconf.NewNetconfDriver(
host,
driverOpts := []base.Option{
base.WithAuthStrictKey(false),
base.WithAuthUsername(clab.DefaultCredentials[kind][0]),
base.WithAuthPassword(clab.DefaultCredentials[kind][1]),
base.WithTransportType(transport.StandardTransportName),
}
if kind == "vr-sros" {
// vr-sros doesn't use echo on ssh channel, so we explicitly set it here
driverOpts = append(driverOpts, base.WithNetconfServerEcho(false))
}

d, err := netconf.NewNetconfDriver(
host,
driverOpts...,
)
log.Errorf("Could not create netconf driver for %s: %+v\n", host, err)
if err != nil {
log.Errorf("Could not create netconf driver for %s: %+v\n", host, err)
}

err = d.Open()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/olekukonko/tablewriter v0.0.5-0.20201029120751-42e21c7531a3
github.com/opencontainers/runtime-spec v1.0.3-0.20210303205135-43e4633e40c1
github.com/pkg/errors v0.9.1
github.com/scrapli/scrapligo v0.0.0-20210617193454-8a38a1b551e8
github.com/scrapli/scrapligo v0.0.0-20210625212003-77e392ed290b
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.0.0
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/scrapli/scrapligo v0.0.0-20210617193454-8a38a1b551e8 h1:3f33b960RhdBe6pzdKmgBUpHLjCmKixjunVI0mGmo4o=
github.com/scrapli/scrapligo v0.0.0-20210617193454-8a38a1b551e8/go.mod h1:+csimZHh80jQXjdDdHmAIKCwiXPZvXQ7ZgKEQWmFpK8=
github.com/scrapli/scrapligo v0.0.0-20210625212003-77e392ed290b h1:+cKOQgjaiPZVYCzL0GeIx/051O3zYOrcLPFiC+qZj5s=
github.com/scrapli/scrapligo v0.0.0-20210625212003-77e392ed290b/go.mod h1:+csimZHh80jQXjdDdHmAIKCwiXPZvXQ7ZgKEQWmFpK8=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirikothe/gotextfsm v1.0.0 h1:4kKwbUziG9G+31PfLY+vI3FzYK/kcByh4ndT3NyPMkc=
Expand Down

0 comments on commit fdf3526

Please sign in to comment.