Skip to content

Commit

Permalink
Merge branch 'main' into ANCX_QOS11
Browse files Browse the repository at this point in the history
  • Loading branch information
charantejag504 authored Apr 29, 2024
2 parents f1bdec7 + 87f3397 commit 4805969
Show file tree
Hide file tree
Showing 761 changed files with 74,473 additions and 26,015 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Build
run: go build -v ./...
test:
Expand All @@ -33,15 +32,14 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
# Dependency for Go module github.com/google/gopacket
- name: Install libpcap-dev
run: sudo apt-get -y install libpcap-dev
Expand All @@ -50,26 +48,33 @@ jobs:
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov

static_analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.21'
# Go & staticcheck build cache require a lot of disk space. Reclaim extra
# space for the container by removing unnecessary tooling.
- name: Free additional disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo mv "${HOME}/.cache" /mnt/cache
ln -s /mnt/cache "${HOME}/.cache"
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/staticcheck
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
# Dependency for Go module github.com/google/gopacket
- name: Install libpcap-dev
run: sudo apt-get -y install libpcap-dev
Expand All @@ -93,11 +98,13 @@ jobs:
#
# goimports does not support "gofmt -s" so both goimports and gofmt are
# required.
if goimports -d . | grep '^'; then
exit 1
fi
find . -name "*.go" | egrep -v "pb.go$" | while read l; do
if goimports -d $l | grep '^'; then
exit 1;
fi;
done
- name: Get revive
run: go install github.com/mgechev/revive@latest
run: go install github.com/mgechev/revive@v1.3.4
- name: Run revive
run: revive ./...
- name: Get staticcheck
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/nosimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: NOSImage validation script

on:
push:
branches: [ main ]
pull_request:
schedule:
- cron: "49 0 * * *"

jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
cache: false
- name: Generate Examples and Check No Diff
run: |
cd tools/nosimage
go run example/generate_example.go -file-path example/example_nosimageprofile.textproto
go run example/generate_example.go -file-path example/example_nosimageprofile_invalid.textproto -invalid
git diff --exit-code --ignore-all-space --ignore-blank-lines
- name: Validate Good Example
run: |
cd tools/nosimage
go run validate/validate.go -file example/example_nosimageprofile.textproto; rm -rf tmp
- name: Validate Bad Example
run: |
cd tools/nosimage
if go run validate/validate.go -file example/example_nosimageprofile_invalid.textproto; then
echo "Validation passed, but failure expected"
exit 1
fi
rm -rf tmp
59 changes: 11 additions & 48 deletions .github/workflows/protobufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
Expand All @@ -25,7 +25,6 @@ jobs:
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Install protobuf
uses: arduino/setup-protoc@v1
with:
Expand All @@ -34,51 +33,16 @@ jobs:
- name: Lint protobufs
run: |
go install github.com/googleapis/api-linter/cmd/api-linter@latest
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} "${PROTOBUF_IMPORT_DIR}"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
find . -name \*.proto -exec api-linter -I./"${PROTOBUF_IMPORT_DIR}" --disable-rule all --enable-rule core {} \+
- name: Compile topology binding textprotos
make protoimports
cd protobuf-import
find github.com/openconfig/featureprofiles/ -name \*.proto -exec api-linter --disable-rule all --enable-rule core {} \+
- name: Validate textprotos
run: |
fail=0
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} \"${PROTOBUF_IMPORT_DIR}\"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
for i in `find topologies/ -type f -name "*.binding"`; do
if ! output=$(protoc -I="${PROTOBUF_IMPORT_DIR}" --proto_path=topologies/proto --encode=openconfig.testing.Binding topologies/proto/binding.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
go install github.com/bstoll/textproto-validator@latest
make protoimports
for i in `find . -name \*.textproto`; do
textproto-validator -I ./protobuf-import $i
done
if [ "$fail" == "1" ]; then exit 1; fi
- name: Compile feature profile textprotos
run: |
fail=0
for i in `find feature/ -type f -name "feature.textproto"`; do
if ! output=$(protoc --encode=openconfig.profiles.FeatureProfile proto/feature.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
done
if [ "$fail" == "1" ]; then exit 1; fi
validate_oc_paths:
name: Validate OpenConfig Paths
Expand All @@ -87,19 +51,18 @@ jobs:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Fetch Openconfig Models
run: make openconfig_public
- name: Validate Paths
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Pull Request
on: [pull_request]
jobs:
check_style:
name: Check style against CONTRIBUTING.md
check_ips:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Perl
uses: perl-actions/install-with-cpanm@v1
with:
Expand All @@ -14,9 +15,24 @@ jobs:
uses: actions/checkout@v3
- name: IP Addresses Assignment
run: |
find . -name \*.go -exec ./tools/check_ip_addresses.pl \{} +
git diff --name-only main | while read l; do
./tools/check_ip_addresses.pl $l;
done
check_style:
name: Check style against CONTRIBUTING.md
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Allowed File Types
run: ./tools/allowed_file_types.sh
- name: Block hyphenated directory names
run: |
if ! find ./feature -type d -name '*-*' -print -exec false {} +; then
echo "Hyphenated directories are not allowed. Please use a different separator like underscore."
exit 1
fi
- name: Enum
run: |
fail=0
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/readme_oc_path_and_rpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: README OpenConfig Path and RPC Coverage

on:
push:
branches: [ main ]
pull_request:
schedule:
- cron: "49 0 * * *"

jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
cache: false

- name: Validate Validation Script
run: |
cd tools/validate_readme_spec
./validate_readme_spec_test.sh
- name: Validate Template README
run: |
go install ./tools/validate_readme_spec
validate_readme_spec -alsologtostderr doc/test-requirements-template.md
- name: Validate Test READMEs
run: |
go install ./tools/validate_readme_spec
# TODO: Remove -feature-dir argument after all READMEs have converted to the new format.
validate_readme_spec -alsologtostderr -feature-dir feature/bgp/policybase/otg_tests/import_export_multi
5 changes: 2 additions & 3 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Build Wiki
run: |
pushd featureprofiles.wiki
Expand Down
Loading

0 comments on commit 4805969

Please sign in to comment.