Skip to content

Commit

Permalink
Merge branch 'openconfig:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rszarecki authored Oct 1, 2024
2 parents 81ad7f1 + 5f9d2a4 commit 7c3f93a
Show file tree
Hide file tree
Showing 622 changed files with 59,153 additions and 12,617 deletions.
26 changes: 20 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# Each line is a file pattern followed by one or more owners.
# Order is important; the last matching pattern takes the most
# precedence.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @openconfig/featureprofiles-maintainers will be requested for
# review when someone opens a pull request.
* @openconfig/featureprofiles-maintainers @openconfig/featureprofiles-quattro-tl
* @openconfig/featureprofiles-maintainers

# Tests which are ported from ate_tests to otg_tests may be reviewed by this team.
**/otg_tests/** @openconfig/featureprofiles-maintainers-otg @openconfig/featureprofiles-maintainers @openconfig/featureprofiles-quattro-tl
/internal/otgutils/ @openconfig/featureprofiles-maintainers-otg @openconfig/featureprofiles-maintainers @openconfig/featureprofiles-quattro-tl
# /feature folders each have owners who are auto requested for review and may merge PR's
/feature/bgp/ @dplore
/feature/ethernet/ @ram-mac
/feature/interface/ @ram-mac
/feature/isis/ @rohit-rp
/feature/mpls/ @swetha-haridasula
/feature/mtu/ @swetha-haridasula
/feature/networkinstance/ @swetha-haridasula
/feature/policy_forwarding/ @swetha-haridasula
/feature/qos @sezhang2
/feature/routing_policy/ @swetha-haridasula
/feature/security @mihirpitale-googler
/feature/staticroute/ @swetha-haridasula
/feature/system @self-maurya
/feature/vrrp @amrindrr

# Order is important; the last matching pattern takes the most
# precedence.
# Common OTG utilities
/internal/otgutils/ @openconfig/featureprofiles-maintainers-otg
13 changes: 7 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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: Build
run: go build -v ./...
test:
Expand All @@ -41,7 +40,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-
# Dependency for Go module github.com/google/gopacket
- name: Install libpcap-dev
run: sudo apt-get -y install libpcap-dev
Expand All @@ -65,6 +63,8 @@ jobs:
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
Expand All @@ -75,7 +75,6 @@ jobs:
~/.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 @@ -99,9 +98,11 @@ 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/[email protected]
- name: Run revive
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/nosimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ jobs:
- 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
go generate ./example
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
go run validate/validate.go -file example/valid_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
for file in example/invalid-*.textproto; do
if go run validate/validate.go -file "$file"; then
echo "Validation passed for $file, but failure expected"
exit 1
fi
done
rm -rf tmp
58 changes: 8 additions & 50 deletions .github/workflows/protobufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,56 +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
# Copy all of the proto files into the right directory.
fp_proto_dir="${PROTOBUF_IMPORT_DIR}/github.com/openconfig/featureprofiles"
mkdir -p "${fp_proto_dir}"
cp --parents `find -name \*.proto` "${fp_proto_dir}"
# 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
cd "${fp_proto_dir}"
find . -name \*.proto -exec api-linter -I"${OLDPWD}"/"${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
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
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
validate_oc_paths:
name: Validate OpenConfig Paths
Expand All @@ -104,7 +63,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: 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
99 changes: 99 additions & 0 deletions .github/workflows/readme_oc_path_and_rpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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
with:
fetch-depth: 0
- 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
exemption_flags=(
--non-test-readme feature/security/gnsi/certz/test_data/README.md
--non-test-readme feature/experimental/p4rt/README.md
--non-test-readme feature/security/gnsi/acctz/README.md
)
# TODO: Just use this one line after all READMEs have converted to the new format.
# validate_readme_spec --alsologtostderr "${exemption_flags[@]}"
function validate() {
validate_readme_spec --feature-dir "$1" --alsologtostderr "${exemption_flags[@]}"
}
##### BEGIN: Validate Changed Test READMEs # TODO: Remove this section after all are converted.
# Adapted from rebase_check.yml
# Notes:
# * Do not use ${GITHUB_REF}, github.sha, or HEAD because they are
# the merged commit of the pull request and main. There are no
# outdated files in the merged commit.
# * refs/pull/${pr_number}/head is not available, so use
# github.event.pull_request.head.sha which is the "head sha" of
# the event that triggered the pull request.
# * Do not use github.event.pull_request.base.sha because it is
# the base when the pull request was created, not after a rebase.
# Ask git merge-base to tell us a suitable base.
readonly HEAD="${{ github.event.pull_request.head.sha }}"
if [ ! -z "${HEAD}" ]; then
readonly BASE="$(git merge-base origin/main "${HEAD}")"
affected_readmes=()
for f in $(git diff --name-only "${BASE}" "${HEAD}" | grep -E '^\W*feature' | xargs -r dirname | sort -u | sed 's/$/\/README.md/'); do
if [ -f "$f" ]; then
affected_readmes+=("$f")
fi
done
echo "########## READMEs in changed directories to be validated (including ones to be exempted):"
printf '%s\n' "${affected_readmes[@]}"
echo "########## Validating READMEs in changed directories:"
for f in "${affected_readmes[@]}"; do
validate_readme_spec --alsologtostderr "${exemption_flags[@]}" "${f}"
done
fi
##### END: Validate Changed Test READMEs #####
echo "########## Validating already-converted READMEs:"
validate feature/aft
validate feature/bgp/policybase/otg_tests/import_export_multi_test
validate feature/gnmi
validate feature/gnoi
validate feature/isis
validate feature/mtu
validate feature/networkinstance
validate feature/security
validate feature/staticroute
validate feature/system/management
validate feature/system/gnmi/cliorigin/tests/mixed_oc_cli_origin_support_test
validate feature/system/ntp/tests/system_ntp_test
validate feature/qos/otg_tests/bursty_traffic_test
5 changes: 2 additions & 3 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: featureprofiles
- name: Checkout wiki
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: "openconfig/featureprofiles.wiki"
path: featureprofiles.wiki
Expand All @@ -28,7 +28,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: Build Wiki
run: |
pushd featureprofiles.wiki
Expand Down
Loading

0 comments on commit 7c3f93a

Please sign in to comment.