diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml index 07cf99e4..b6a56531 100644 --- a/.github/linters/.golangci.yml +++ b/.github/linters/.golangci.yml @@ -1,4 +1,6 @@ --- +version: "2" + ######################### ######################### ## Golang Linter rules ## @@ -10,6 +12,7 @@ run: timeout: 10m issues: + new-from-rev: origin/main exclude-rules: - path: _test\.go linters: @@ -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 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c230a47b..d503ebb9 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 @@ -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 diff --git a/topo/node/drivenets/drivenets.go b/topo/node/drivenets/drivenets.go index 56fb895a..d0672a75 100644 --- a/topo/node/drivenets/drivenets.go +++ b/topo/node/drivenets/drivenets.go @@ -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", @@ -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) @@ -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, @@ -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) @@ -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)