Skip to content

Commit

Permalink
Merge branch 'main' into dplore/deprecate-featureprofilefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
dplore committed Nov 13, 2024
2 parents dad6f5d + e965ab0 commit ad2bd4c
Show file tree
Hide file tree
Showing 743 changed files with 53,892 additions and 14,457 deletions.
32 changes: 26 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
# 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/acl/ @alokmtri-g
/feature/aft/ @sudhinj
/feature/bgp/ @dplore
/feature/dhcp/ @alokmtri-g
/feature/ethernet/ @ram-mac
/feature/interface/ @ram-mac
/feature/isis/ @rohit-rp
/feature/lldp/ @alokmtri-g
/feature/mpls/ @swetha-haridasula
/feature/mtu/ @swetha-haridasula
/feature/networkinstance/ @swetha-haridasula
/feature/platform/ @amrindrr
/feature/qos @sezhang2
/feature/routing_policy/ @swetha-haridasula
/feature/sampling/ @sudhinj
/feature/security @mihirpitale-googler
/feature/staticroute/ @swetha-haridasula
/feature/stp/ @alokmtri-g
/feature/system @swetha-haridasula
/feature/vrrp @amrindrr

# Order is important; the last matching pattern takes the most
# precedence.
# Common OTG utilities
/internal/otgutils/ @openconfig/featureprofiles-maintainers-otg
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
56 changes: 8 additions & 48 deletions .github/workflows/protobufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,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 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/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
4 changes: 2 additions & 2 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 Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*~
topologies/kne/testbed.kne.yml
.vscode/
.idea/
# used by `make validate_paths`
openconfig_public/
# used by `make proto/...`
Expand Down
21 changes: 8 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ The directory tree is organized as follows:
* `cloudbuild/` contains google cloud build scripts for running virtual
routers in containers on [KNE](https://github.com/openconfig/kne)
* `feature/` contains definition and tests of feature profiles.
* `feature/experimental` contains new features and tests which are not yet
categorized or not confirmed to pass on any hardware platform or software
release. When the test is deemed more mature, it is moved to the `feature/`
directory.
* `internal/` contains packages used by feature profile tests.
* `proto/` contains protobuf files for feature profiles.
* `tools/` contains code used for CI checks.
Expand Down Expand Up @@ -96,7 +92,7 @@ allowed file types, please file an issue for discussion.
## Test Suite Organization

Test suites should be placed in subdirectories formatted like
`feature/<featurename>/[<sub-feature>/]<tests|ate_tests|otg_tests|kne_tests>/<test_name>/<test_name>.go`.
`feature/<featurename>/[<sub-feature>/]<tests|otg_tests|kne_tests>/<test_name>/<test_name>.go`.
For example:

* `feature/interface/` is the collection of interface feature profiles.
Expand All @@ -107,7 +103,8 @@ For example:
* `feature/interface/singleton/feature.textproto` - defines the singleton
interface feature profile in machine readable format.
* `feature/interface/singleton/ate_tests/` contains the singleton interfaces
test suite using ATE traffic generation API.
test suite using ATE traffic generation API. Note, use of the ATE API is
deprecated and should not be used for any new test development.
* `feature/interface/singleton/otg_tests/` contains the singleton interfaces
test suite using OTG traffic generation API.
* `feature/interface/singleton/kne_tests/` contains the singleton interfaces
Expand Down Expand Up @@ -177,7 +174,7 @@ were discovered when implementing the code.
## Test Structure

Generally, a Feature Profiles ONDATRA test has the following stages: configure
DUT, configure ATE, generate and verify traffic, verify telemetry. The
DUT, configure OTG, generate and verify traffic, verify telemetry. The
configuration stages should be factored out to their own functions, and any
subtests should be run under `t.Run` so the test output clearly reflects which
parts of the test passed and which parts failed.
Expand All @@ -189,13 +186,13 @@ occurred.
```
func TestFoo(t *testing.T) {
configureDUT(t) // calls t.Fatal() on error.
configureATE(t) // calls t.Fatal() on error.
configureOTG(t) // calls t.Fatal() on error.
t.Run("Traffic", func(t *testing.T) { ... })
t.Run("Telemetry", func(t *testing.T) { ... })
}
```

In the above example, `configureDUT` and `configureATE` should not be subtests,
In the above example, `configureDUT` and `configureOTG` should not be subtests,
otherwise they could be skipped when someone specifies a test filter. The
"Traffic" and "Telemetry" subtests will both run even if there is a fatal
condition during `t.Run()`.
Expand All @@ -219,7 +216,7 @@ func TestTableDriven(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
t.Log("Description: ", c.desc)
configureDUT(t, /* parameterized by c */)
configureATE(t, /* parameterized by c */)
configureOTG(t, /* parameterized by c */)
t.Run("Traffic", func(t *testing.T) { ... })
t.Run("Telemetry", func(t *testing.T) { ... })
})
Expand Down Expand Up @@ -432,8 +429,6 @@ To contribute a pull request:
[GitHub Quickstart](https://docs.github.com/en/get-started/quickstart)
guide.

* New contributions should be in the feature/experimental directory.

1. When opening a pull request, use a descriptive title and detail. See
[Pull Request Title](#pull-request-title) below.

Expand Down Expand Up @@ -480,7 +475,7 @@ preferred format is:
```
* (M) internal/fptest/*
- Add a helper for referencing a keychain from other modules.
* (M) feature/experimental/isis/ate_tests/base_adjacencies_test
* (M) feature/isis/otg_tests/base_adjacencies_test
- Fix testing of hello-authentication to reference a specific
keychain.
- Fix authentication of *SNP packets, referencing a keychain
Expand Down
Loading

0 comments on commit ad2bd4c

Please sign in to comment.