Skip to content

Commit

Permalink
Merge branch 'main' into fixing_testregistry_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya authored Dec 26, 2024
2 parents 4bcfd5d + f7a6330 commit 032222c
Show file tree
Hide file tree
Showing 862 changed files with 82,095 additions and 17,203 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

36 changes: 29 additions & 7 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
# 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
# @openconfig/featureprofiles-approvers will be requested for
# review when someone opens a pull request.
* @openconfig/featureprofiles-maintainers @openconfig/featureprofiles-quattro-tl
* @openconfig/featureprofiles-approvers

# 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/ @openconfig/featureprofiles-owner-acl
/feature/aft/ @openconfig/featureprofiles-owner-aft
/feature/bgp/ @openconfig/featureprofiles-owner-bgp
/feature/dhcp/ @alokmtri-g
/feature/ethernet/ @ram-mac
/feature/gribi/ @nflath @nachikethas @xw-g
/feature/interface/ @openconfig/featureprofiles-owner-interface
/feature/isis/ @openconfig/featureprofiles-owner-isis
/feature/lldp/ @openconfig/featureprofiles-owner-lldp
/feature/mpls/ @openconfig/featureprofiles-owner-mpls
/feature/mtu/ @openconfig/featureprofiles-owner-mtu
/feature/networkinstance/ @openconfig/featureprofiles-owner-networkinstance
/feature/platform/ @openconfig/featureprofiles-owner-platform
/feature/platform/transceiver @openconfig/featureprofiles-owner-platform-transceiver
/feature/qos @openconfig/featureprofiles-owner-qos
/feature/routing_policy/ @swetha-haridasula
/feature/sampling/ @sudhinj
/feature/security @openconfig/featureprofiles-owner-security
/feature/staticroute/ @openconfig/featureprofiles-owner-staticroute
/feature/stp/ @alokmtri-g
/feature/system @openconfig/featureprofiles-owner-system
/feature/vrrp @amrindrr

# Order is important; the last matching pattern takes the most
# precedence.
# Common OTG utilities
/internal/otgutils/ @openconfig/featureprofiles-maintainers-otg
35 changes: 18 additions & 17 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,49 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6
- name: Set up Go
uses: actions/setup-go@v2.1.3
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4
with:
go-version: 1.21.x
- name: Cache
uses: actions/cache@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6
- name: Set up Go
uses: actions/setup-go@v2.1.3
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4
with:
go-version: 1.21.x
- name: Cache
uses: actions/cache@v3
uses: actions/cache@f4b3439a656ba812b8cb417d2d49f9c810103092
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
- run: go test -v -coverprofile=profile.cov $(go list ./... | grep -v /.*test.*)
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
uses: shogo82148/actions-goveralls@7b1bd2871942af030d707d6574e5f684f9891fb2
with:
path-to-profile: profile.cov
static_analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4
with:
go-version: '1.21'
# Go & staticcheck build cache require a lot of disk space. Reclaim extra
Expand All @@ -65,17 +63,18 @@ 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
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Cache
uses: actions/cache@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
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 @@ -99,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
42 changes: 42 additions & 0 deletions .github/workflows/nosimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: stable
cache: false
- name: Generate Examples and Check No Diff
run: |
cd tools/nosimage
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/valid_example_nosimageprofile.textproto; rm -rf tmp
- name: Validate Bad Example
run: |
cd tools/nosimage
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
74 changes: 16 additions & 58 deletions .github/workflows/protobufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,99 +13,57 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4
with:
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Cache
uses: actions/cache@v3
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c
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: Install protobuf
uses: arduino/setup-protoc@v1
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- 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@15e24d0eb567d63615f0aa70940bc073ab674fe7
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
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4
with:
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v3
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c
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
- name: Fetch OpenConfig Models
run: make openconfig_public
- name: Validate Paths
run: |
Expand Down
30 changes: 23 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup Perl
uses: perl-actions/install-with-cpanm@v1
uses: perl-actions/install-with-cpanm@10d60f00b4073f484fc29d45bfbe2f776397ab3d
with:
install: |
Net::IP
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- 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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- 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 Expand Up @@ -49,9 +65,9 @@ jobs:
name: OTG Changes Required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Check if OTG changes required
uses: actions/github-script@v6
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
script: |
const script = require('./.github/workflows/required_otg_changes_check.js')
Expand Down
Loading

0 comments on commit 032222c

Please sign in to comment.