Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
version: "2"

#########################
#########################
## Golang Linter rules ##
Expand All @@ -10,6 +12,7 @@
run:
timeout: 10m
issues:
new-from-rev: origin/main
exclude-rules:
- path: _test\.go
linters:
Expand All @@ -27,26 +30,27 @@ linters:
enable:
- gosec
- unconvert
- goimports
- gofmt
- gocritic
- govet
- revive
- staticcheck
- unconvert
- unparam
- unused
- wastedassign
- whitespace
linters-settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
gocritic:
disabled-checks:
- singleCaseSwitch
- appendAssign
revive:
ignore-generated-header: true
severity: warning
settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
gocritic:
disabled-checks:
- singleCaseSwitch
- appendAssign
revive:
ignore-generated-header: true
severity: warning
formatters:
enable:
- gofmt
- goimports
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
go:
uses: openconfig/common-ci/.github/workflows/go.yml@v0.2.0
uses: openconfig/common-ci/.github/workflows/go.yml@v0.3.0
with:
coverage-excludes-regex: /cloudbuild
tests-excludes-regex: /cloudbuild
Expand All @@ -18,4 +18,4 @@ jobs:
go-versions: "['1.21']"

linter:
uses: openconfig/common-ci/.github/workflows/linter.yml@v0.2.0
uses: openconfig/common-ci/.github/workflows/linter.yml@v0.3.0
20 changes: 14 additions & 6 deletions topo/node/drivenets/drivenets.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,24 @@ var (
// https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=gnmi
22: {
Names: []string{"ssh"},
Inside: 9339,
Inside: 22,
},
830: {
Names: []string{"netconf"},
Inside: 830,
},
50051: {
Names: []string{"gnmi"},
Names: []string{"grpc"},
Inside: 50051,
},
51337: {
Names: []string{"gnmi"},
Inside: 51337,
},
52443: {
Names: []string{"gnmi-ssl"},
Inside: 52443,
},
},
Config: &tpb.Config{
ConfigFile: "default",
Expand Down Expand Up @@ -121,7 +129,7 @@ var clientFn = func(c *rest.Config) (clientset.Interface, error) {
}

func (n *Node) Create(ctx context.Context) error {
if n.Impl.Proto.Model != modelCdnos {
if n.Proto.Model != modelCdnos {
return fmt.Errorf("cannot create an instance of an unknown model")
}
return n.cdnosCreate(ctx)
Expand Down Expand Up @@ -171,7 +179,7 @@ func (n *Node) cdnosCreate(ctx context.Context) error {
ConfigFile: config.ConfigFile,
InitImage: config.InitImage,
Ports: ports,
InterfaceCount: len(nodeSpec.Interfaces),
InterfaceCount: len(nodeSpec.Interfaces) + 1,
InitSleep: int(config.Sleep),
Resources: node.ToResourceRequirements(nodeSpec.Constraints),
Labels: nodeSpec.Labels,
Expand Down Expand Up @@ -200,7 +208,7 @@ func (n *Node) cdnosCreate(ctx context.Context) error {
}

func (n *Node) Status(ctx context.Context) (node.Status, error) {
if n.Impl.Proto.Model != modelCdnos {
if n.Proto.Model != modelCdnos {
return node.StatusUnknown, fmt.Errorf("invalid model specified")
}
return n.cdnosStatus(ctx)
Expand Down Expand Up @@ -228,7 +236,7 @@ func (n *Node) cdnosStatus(ctx context.Context) (node.Status, error) {
}

func (n *Node) Delete(ctx context.Context) error {
if n.Impl.Proto.Model != modelCdnos {
if n.Proto.Model != modelCdnos {
return fmt.Errorf("unknown model")
}
return n.cdnosDelete(ctx)
Expand Down
Loading