Skip to content

Commit 67cf96e

Browse files
chore: add Cisco NX-OS Provider types
1 parent 17d1fcf commit 67cf96e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+728309
-4
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ linters:
186186
- builtin$
187187
- examples$
188188
- internal/provider/openconfig
189+
- internal/provider/cisco/nxos/genyang
189190

190191
output:
191192
formats:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ install-kustomize: FORCE
4242

4343
fmt: FORCE install-gofumpt
4444
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
45-
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')
45+
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig|internal/provider/cisco/nxos/genyang')
4646

4747
# Run the e2e tests against a k8s cluster.
4848
test-e2e: FORCE
@@ -188,7 +188,7 @@ ifeq ($(GO_TESTPKGS),)
188188
GO_TESTPKGS := ./...
189189
endif
190190
# which packages to measure coverage for
191-
GO_COVERPKGS := $(shell go list ./... | grep -E '/internal' | grep -Ev '/internal/provider/openconfig')
191+
GO_COVERPKGS := $(shell go list ./... | grep -E '/internal' | grep -Ev '/internal/provider/openconfig|internal/provider/cisco/nxos/genyang')
192192
# to get around weird Makefile syntax restrictions, we need variables containing nothing, a space and comma
193193
null :=
194194
space := $(null) $(null)

Makefile.maker.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ controllerGen:
1616

1717
coverageTest:
1818
only: "/internal"
19-
except: "/internal/provider/openconfig"
19+
except: "/internal/provider/openconfig|internal/provider/cisco/nxos/genyang"
2020

2121
dockerfile:
2222
enabled: false
@@ -28,6 +28,7 @@ golangciLint:
2828
createConfig: true
2929
skipDirs:
3030
- internal/provider/openconfig
31+
- internal/provider/cisco/nxos/genyang
3132
timeout: 10m
3233

3334
goReleaser:
@@ -80,7 +81,7 @@ verbatim: |
8081
8182
fmt: FORCE install-gofumpt
8283
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
83-
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')
84+
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig|internal/provider/cisco/nxos/genyang')
8485
8586
# Run the e2e tests against a k8s cluster.
8687
test-e2e: FORCE
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
Cisco-NX-OS-device.yang
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:generate ./gen.sh
5+
package nxos
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
VERSION=10.4-4
5+
6+
set -e
7+
8+
cd "$(dirname "$0")" || exit 1
9+
10+
if [ ! -f "Cisco-NX-OS-device.yang" ]; then
11+
curl -fsSLO https://raw.githubusercontent.com/YangModels/yang/refs/heads/main/vendor/cisco/nx/$VERSION/Cisco-NX-OS-device.yang
12+
fi
13+
14+
rm -r genyang
15+
mkdir genyang
16+
17+
go run github.com/openconfig/ygot/generator@v0.32.0 \
18+
-structs_split_files_count=50 \
19+
-exclude_state \
20+
-generate_append \
21+
-generate_getters \
22+
-generate_simple_unions \
23+
-generate_populate_defaults \
24+
-output_dir=./genyang \
25+
-package_name=genyang \
26+
Cisco-NX-OS-device.yang
27+
28+
go install golang.org/x/tools/cmd/goimports@latest
29+
goimports -w .
30+
31+
go install github.com/google/addlicense@latest
32+
addlicense -c "SAP SE or an SAP affiliate company and IronCore contributors" -s=only -y "$(date +%Y)" .
33+
34+
find . -type f -name "*.go" -exec sed -i.bak '1s|// Copyright|// SPDX-FileCopyrightText:|' {} \;
35+
find . -type f -name "*.bak" -delete

internal/provider/cisco/nxos/genyang/enum.go

Lines changed: 28881 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)