Skip to content

Commit

Permalink
Merge branch 'main' into DP13
Browse files Browse the repository at this point in the history
  • Loading branch information
charantejag504 authored Apr 29, 2024
2 parents 8e80d3e + 87f3397 commit 2cf1790
Show file tree
Hide file tree
Showing 290 changed files with 18,293 additions and 4,156 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,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 Down
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
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
43 changes: 33 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
GO_PROTOS:=proto/feature_go_proto/feature.pb.go proto/metadata_go_proto/metadata.pb.go proto/ocpaths_go_proto/ocpaths.pb.go proto/ocrpcs_go_proto/ocrpcs.pb.go proto/nosimage_go_proto/nosimage.pb.go topologies/proto/binding/binding.pb.go

.PHONY: all clean protos validate_paths protoimports
all: openconfig_public protos validate_paths

openconfig_public:
tools/clone_oc_public.sh openconfig_public

.PHONY: validate_paths
validate_paths: openconfig_public proto/feature_go_proto/feature.pb.go
go run -v tools/validate_paths.go \
-alsologtostderr \
Expand All @@ -23,23 +29,31 @@ validate_paths: openconfig_public proto/feature_go_proto/feature.pb.go
--yang_skip_roots=$(CURDIR)/openconfig_public/release/models/wifi \
--feature_files=${FEATURE_FILES}

proto/feature_go_proto/feature.pb.go: proto/feature.proto
mkdir -p proto/feature_go_proto
protoc --proto_path=proto --go_out=./ --go_opt=Mfeature.proto=proto/feature_go_proto feature.proto
protos: $(GO_PROTOS)

proto/metadata_go_proto/metadata.pb.go: proto/metadata.proto
mkdir -p proto/metadata_go_proto
protoimports:
# Set directory to hold symlink
mkdir -p protobuf-import
# Remove any existing symlinks & empty directories
find protobuf-import -type l -delete
find protobuf-import -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
# Get ondatra & kne modules we use and create required directory structure
go list -f 'protobuf-import/{{ .Path }}' -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f 'protobuf-import/{{ .Path }}' -m github.com/openconfig/kne | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlinks
go list -f '{{ .Dir }} protobuf-import/{{ .Path }}' -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
go list -f '{{ .Dir }} protobuf-import/{{ .Path }}' -m github.com/openconfig/kne | xargs -L1 -- ln -s
ln -s $(ROOT_DIR) protobuf-import/github.com/openconfig/featureprofiles

proto/feature_go_proto/feature.pb.go: proto/feature.proto
mkdir -p proto/feature_go_proto
protoc --proto_path=proto --go_out=./ --go_opt=Mfeature.proto=proto/feature_go_proto feature.proto
goimports -w proto/feature_go_proto/feature.pb.go

proto/metadata_go_proto/metadata.pb.go: proto/metadata.proto protoimports
mkdir -p proto/metadata_go_proto
protoc -I='protobuf-import' --proto_path=proto --go_out=./ --go_opt=Mmetadata.proto=proto/metadata_go_proto metadata.proto
goimports -w proto/metadata_go_proto/metadata.pb.go

Expand All @@ -53,7 +67,16 @@ proto/ocrpcs_go_proto/ocrpcs.pb.go: proto/ocrpcs.proto
protoc --proto_path=proto --go_out=./ --go_opt=Mocrpcs.proto=proto/ocrpcs_go_proto ocrpcs.proto
goimports -w proto/ocrpcs_go_proto/ocrpcs.pb.go

proto/nosimage_go_proto/nosimage.pb.go: proto/nosimage.proto
proto/nosimage_go_proto/nosimage.pb.go: proto/nosimage.proto protoimports
mkdir -p proto/nosimage_go_proto
protoc -I="${GOPATH}/src" --proto_path=proto --go_out=./proto/nosimage_go_proto --go_opt=paths=source_relative --go_opt=Mnosimage.proto=proto/nosimage_go_proto --go_opt=Mgithub.com/openconfig/featureprofiles/proto/ocpaths.proto=github.com/openconfig/featureprofiles/proto/ocpaths_go_proto --go_opt=Mgithub.com/openconfig/featureprofiles/proto/ocrpcs.proto=github.com/openconfig/featureprofiles/proto/ocrpcs_go_proto nosimage.proto
protoc -I='protobuf-import' --proto_path=proto --go_out=./proto/nosimage_go_proto --go_opt=paths=source_relative --go_opt=Mnosimage.proto=proto/nosimage_go_proto --go_opt=Mgithub.com/openconfig/featureprofiles/proto/ocpaths.proto=github.com/openconfig/featureprofiles/proto/ocpaths_go_proto --go_opt=Mgithub.com/openconfig/featureprofiles/proto/ocrpcs.proto=github.com/openconfig/featureprofiles/proto/ocrpcs_go_proto nosimage.proto
goimports -w proto/nosimage_go_proto/nosimage.pb.go

topologies/proto/binding/binding.pb.go: topologies/proto/binding.proto protoimports
mkdir -p topologies/proto/binding
protoc -I='protobuf-import' --proto_path=topologies/proto --go_out=. --go_opt=Mbinding.proto=topologies/proto/binding binding.proto
goimports -w topologies/proto/binding/binding.pb.go

clean:
rm -f $(GO_PROTOS)
rm -rf protobuf-import openconfig_public
54 changes: 26 additions & 28 deletions doc/test-requirements-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Use this template to document the requirements for a new test to be imple
title: ''
labels: enhancement
assignees: ''

---

# Instructions for this template
Expand All @@ -28,40 +27,39 @@ Write a few sentences or paragraphs describing the purpose and scope of the test

## Procedure

* Test environment setup
* Description of procedure to configure ATE and DUT with pre-requisites making it possible to cover the intended paths and RPC's.

* TestID-x.y.z - Name of subtest
* Step 1
* Step 2
* Validation and pass fail criteria
* Validation and pass/fail criteria

* TestID-x.y.z - Name of subtest
* Step 1
* Step 2
* Validation and pass fail criteria

## Config Parameter Coverage

Add list of OpenConfig 'config' paths used in this test, if any.

## Telemetry Parameter Coverage

Add list of OpenConfig 'state' paths used in this test, if any.

## Protocol/RPC Parameter Coverage

Add list of OpenConfig RPC's (gNMI, gNOI, gNSI, gRIBI) used in the list, if any.

For example:

* gNMI
* Set
* Subscribe
* gNOI
* System
* KillProcess
* Healthz
* Get
* Check
* Artifact
* Validation and pass/fail criteria

## OpenConfig Path and RPC Coverage

This example yaml defines the OC paths intended to be covered by this test. OC paths used for test environment setup are not required to be listed here.

```yaml
paths:
# interface configuration
/interfaces/interface/config/description:
/interfaces/interface/config/enabled:
# name of chassis component
/components/component/state/name:
platform_type: "CHASSIS"

rpcs:
gnmi:
gNMI.Set:
union_replace: true
gNMI.Subscribe:
on_change: true
```
## Required DUT platform
Expand Down
2 changes: 2 additions & 0 deletions feature/acl/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "acl"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# proto-file: third_party/openconfig/featureprofiles/proto/metadata.proto
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto
# proto-message: Metadata

uuid: "ef34466c-37da-4133-8d03-40ebe2a5168a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (d *dutData) Configure(t *testing.T, dut *ondatra.DUTDevice) {
if !d.ipv4 {
aftType = oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST
}
bgpOC := cfgplugins.BuildBGPOCConfig(t, dut, d.routerID, aftType, d.neighborConfig)
bgpOC := cfgplugins.BuildBGPOCConfig(t, dut, d.routerID, []oc.E_BgpTypes_AFI_SAFI_TYPE{aftType}, d.neighborConfig)

for _, a := range []attrs.Attributes{dutPort1, dutPort2} {
ocName := dut.Port(t, a.Name).Name()
Expand Down
3 changes: 3 additions & 0 deletions feature/aft/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "aft"
Expand Down
3 changes: 3 additions & 0 deletions feature/bgp/addpath/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "bgp_addpath"
Expand Down
3 changes: 3 additions & 0 deletions feature/bgp/aspath/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "bgp_aspath"
Expand Down
3 changes: 3 additions & 0 deletions feature/bgp/bestpath/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "bgp_bestpath"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const (
bgpName = "BGP"
maskLenExact = "exact"
dummyAS = uint32(64655)
dutAS = uint32(65656)
ateAS = uint32(65657)
dutAS = uint32(64656)
ateAS = uint32(64657)
v4Route = "203.10.113.0"
v4TrafficStart = "203.10.113.1"
v4DummyRoute = "192.51.100.0"
Expand All @@ -59,6 +59,8 @@ const (
v6PrefixSet = "prefix-set-v6"
v6FlowName = "flow-v6"
v6CommunitySet = "community-set-v6"
peerGrpNamev4 = "BGP-PEER-GROUP-V4"
peerGrpNamev6 = "BGP-PEER-GROUP-V6"
)

var (
Expand Down Expand Up @@ -214,13 +216,19 @@ func setupEBGPAndAdvertise(t *testing.T, ts *isissession.TestSession) {
g.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
g.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Enabled = ygot.Bool(true)

pgv4 := bgp.GetOrCreatePeerGroup(peerGrpNamev4)
pgv4.PeerGroupName = ygot.String(peerGrpNamev4)
pgv6 := bgp.GetOrCreatePeerGroup(peerGrpNamev6)
pgv6.PeerGroupName = ygot.String(peerGrpNamev6)
nV4 := bgp.GetOrCreateNeighbor(isissession.ATETrafficAttrs.IPv4)
nV4.SetPeerAs(ateAS)
nV4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
nV4.PeerGroup = ygot.String(peerGrpNamev4)

nV6 := bgp.GetOrCreateNeighbor(isissession.ATETrafficAttrs.IPv6)
nV6.SetPeerAs(ateAS)
nV6.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Enabled = ygot.Bool(true)
nV6.PeerGroup = ygot.String(peerGrpNamev6)
gnmi.Update(t, ts.DUT, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).Config(), dni)

// setup eBGP on ATE port2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ platform_exceptions: {
bgp_conditions_match_community_set_unsupported: true
}
}
platform_exceptions: {
platform: {
vendor: JUNIPER
}
deviations: {
isis_level_enabled: true
}
}
3 changes: 3 additions & 0 deletions feature/bgp/dynamicneighbors/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "bgp_dynamicneighbors"
Expand Down
3 changes: 3 additions & 0 deletions feature/bgp/feature.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# proto-file: github.com/openconfig/featureprofiles/proto/feature.proto
# proto-message: FeatureProfile

id {
name: "bgp"
Expand Down
Loading

0 comments on commit 2cf1790

Please sign in to comment.