diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7f443cfe020..58d1e98ef3b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -6,9 +6,9 @@ # 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-approvers # /feature folders each have owners who are auto requested for review and may merge PR's /feature/acl/ @alokmtri-g @@ -28,7 +28,7 @@ /feature/qos @sezhang2 /feature/routing_policy/ @swetha-haridasula /feature/sampling/ @sudhinj -/feature/security @mihirpitale-googler +/feature/security @mihirpitale-googler @morrowc /feature/staticroute/ @swetha-haridasula /feature/stp/ @alokmtri-g /feature/system @swetha-haridasula diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6ab972f2897..ff20539b0a0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,13 +11,13 @@ 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 @@ -28,13 +28,13 @@ jobs: 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 @@ -45,7 +45,7 @@ jobs: 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: @@ -53,7 +53,7 @@ jobs: 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 @@ -66,9 +66,9 @@ jobs: 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 diff --git a/.github/workflows/nosimage.yml b/.github/workflows/nosimage.yml index 0be4a982ccd..45a6e276b46 100644 --- a/.github/workflows/nosimage.yml +++ b/.github/workflows/nosimage.yml @@ -12,9 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe with: go-version: stable cache: false diff --git a/.github/workflows/protobufs.yml b/.github/workflows/protobufs.yml index e645507fc8e..99326ed33a6 100644 --- a/.github/workflows/protobufs.yml +++ b/.github/workflows/protobufs.yml @@ -13,20 +13,20 @@ 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') }} - name: Install protobuf - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f with: version: '3.x' repo-token: ${{ secrets.GITHUB_TOKEN }} @@ -38,7 +38,7 @@ jobs: find github.com/openconfig/featureprofiles/ -name \*.proto -exec api-linter --disable-rule all --enable-rule core {} \+ - name: Validate textprotos run: | - go install github.com/bstoll/textproto-validator@latest + go install github.com/bstoll/textproto-validator@15e24d0eb567d63615f0aa70940bc073ab674fe7 make protoimports for i in `find . -name \*.textproto`; do textproto-validator -I ./protobuf-import $i @@ -49,21 +49,21 @@ 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 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') }} - - name: Fetch Openconfig Models + - name: Fetch OpenConfig Models run: make openconfig_public - name: Validate Paths run: | diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5365ed1ee1c..a90c1025bbd 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,14 +5,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + 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: | git diff --name-only main | while read l; do @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Allowed File Types run: ./tools/allowed_file_types.sh - name: Block hyphenated directory names @@ -65,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') diff --git a/.github/workflows/readme_oc_path_and_rpc.yml b/.github/workflows/readme_oc_path_and_rpc.yml index 73e78f5be8d..23215b74d7a 100644 --- a/.github/workflows/readme_oc_path_and_rpc.yml +++ b/.github/workflows/readme_oc_path_and_rpc.yml @@ -12,11 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe with: go-version: stable cache: false diff --git a/.github/workflows/rebase_check.yml b/.github/workflows/rebase_check.yml index 76e330acb1a..69f825aef51 100644 --- a/.github/workflows/rebase_check.yml +++ b/.github/workflows/rebase_check.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout PR - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 with: fetch-depth: 0 - name: Check if dependencies and checks are up to date. diff --git a/.github/workflows/required_approvals.yml b/.github/workflows/required_approvals.yml index 774f49c856f..4a2123d17d6 100644 --- a/.github/workflows/required_approvals.yml +++ b/.github/workflows/required_approvals.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Check for required approvals id: check-approvals - uses: skymoore/required-approvals@main + uses: skymoore/required-approvals@57612e00c501132dfb35ddaff54615b363f8e076 with: token: ${{ secrets.GITHUB_TOKEN }} read_org_scoped_token: ${{ secrets.READ_ORG_SCOPED_TOKEN }} diff --git a/.github/workflows/rundata_check.yml b/.github/workflows/rundata_check.yml index 65657a213ee..33373f14d70 100644 --- a/.github/workflows/rundata_check.yml +++ b/.github/workflows/rundata_check.yml @@ -7,6 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout PR - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Check that addrundata is up to date. run: go run ./tools/addrundata diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml index 2c6e0644c11..a0124455fb2 100644 --- a/.github/workflows/wiki.yml +++ b/.github/workflows/wiki.yml @@ -9,20 +9,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: path: featureprofiles - name: Checkout wiki - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: repository: "openconfig/featureprofiles.wiki" path: featureprofiles.wiki - 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 diff --git a/feature/bgp/bgp_isis_redistribution/otg_tests/bgp_isis_redistribution_test/metadata.textproto b/feature/bgp/bgp_isis_redistribution/otg_tests/bgp_isis_redistribution_test/metadata.textproto index f4552e8cdf0..7c29f99bbfa 100644 --- a/feature/bgp/bgp_isis_redistribution/otg_tests/bgp_isis_redistribution_test/metadata.textproto +++ b/feature/bgp/bgp_isis_redistribution/otg_tests/bgp_isis_redistribution_test/metadata.textproto @@ -21,7 +21,6 @@ platform_exceptions: { skip_isis_set_metric_style_type: true skip_set_rp_match_set_options: true skip_setting_disable_metric_propagation: true - bgp_conditions_match_community_set_unsupported: true } } platform_exceptions: { diff --git a/feature/bgp/policybase/otg_tests/aspath_and_community_test/metadata.textproto b/feature/bgp/policybase/otg_tests/aspath_and_community_test/metadata.textproto index fc8bcf61ac6..27c44c4f08d 100644 --- a/feature/bgp/policybase/otg_tests/aspath_and_community_test/metadata.textproto +++ b/feature/bgp/policybase/otg_tests/aspath_and_community_test/metadata.textproto @@ -19,7 +19,6 @@ platform_exceptions: { default_network_instance: "default" skip_set_rp_match_set_options: true skip_setting_disable_metric_propagation: true - bgp_conditions_match_community_set_unsupported: true } } diff --git a/feature/bgp/policybase/otg_tests/aspath_test/metadata.textproto b/feature/bgp/policybase/otg_tests/aspath_test/metadata.textproto index 722a02f9a02..c59c7f78251 100644 --- a/feature/bgp/policybase/otg_tests/aspath_test/metadata.textproto +++ b/feature/bgp/policybase/otg_tests/aspath_test/metadata.textproto @@ -18,7 +18,6 @@ platform_exceptions: { default_network_instance: "default" skip_set_rp_match_set_options: true skip_setting_disable_metric_propagation: true - bgp_conditions_match_community_set_unsupported: true } } platform_exceptions: { diff --git a/feature/bgp/policybase/otg_tests/comm_match_action_test/metadata.textproto b/feature/bgp/policybase/otg_tests/comm_match_action_test/metadata.textproto index 87750a55732..e1a4c911ab4 100644 --- a/feature/bgp/policybase/otg_tests/comm_match_action_test/metadata.textproto +++ b/feature/bgp/policybase/otg_tests/comm_match_action_test/metadata.textproto @@ -24,7 +24,6 @@ platform_exceptions: { omit_l2_mtu: true interface_enabled: true default_network_instance: "default" - bgp_conditions_match_community_set_unsupported: true } } tags: TAGS_AGGREGATION diff --git a/feature/bgp/policybase/otg_tests/community_test/metadata.textproto b/feature/bgp/policybase/otg_tests/community_test/metadata.textproto index 4c6b8f1496e..68da71ad8f8 100644 --- a/feature/bgp/policybase/otg_tests/community_test/metadata.textproto +++ b/feature/bgp/policybase/otg_tests/community_test/metadata.textproto @@ -18,7 +18,6 @@ platform_exceptions: { default_network_instance: "default" skip_set_rp_match_set_options: true skip_setting_disable_metric_propagation: true - bgp_conditions_match_community_set_unsupported: true } } platform_exceptions: { diff --git a/feature/bgp/policybase/otg_tests/import_export_multi_test/metadata.textproto b/feature/bgp/policybase/otg_tests/import_export_multi_test/metadata.textproto index ec09b76414c..1efb0711660 100644 --- a/feature/bgp/policybase/otg_tests/import_export_multi_test/metadata.textproto +++ b/feature/bgp/policybase/otg_tests/import_export_multi_test/metadata.textproto @@ -18,7 +18,6 @@ platform_exceptions: { missing_value_for_defaults: true skip_set_rp_match_set_options: true bgp_community_set_refs_unsupported: true - bgp_conditions_match_community_set_unsupported: true bgp_community_member_is_a_string: true skip_bgp_send_community_type: true } diff --git a/feature/gnmi/otg_tests/telemetry_basic_check_test/telemetry_basic_check_test.go b/feature/gnmi/otg_tests/telemetry_basic_check_test/telemetry_basic_check_test.go index 8747345ceac..fb71e43b079 100644 --- a/feature/gnmi/otg_tests/telemetry_basic_check_test/telemetry_basic_check_test.go +++ b/feature/gnmi/otg_tests/telemetry_basic_check_test/telemetry_basic_check_test.go @@ -604,20 +604,20 @@ func TestLacpMember(t *testing.T) { dut := ondatra.DUT(t, "dut") lacpIntfs := gnmi.GetAll(t, dut, gnmi.OC().Lacp().InterfaceAny().Name().State()) if len(lacpIntfs) == 0 { - t.Errorf("Lacp().InterfaceAny().Name().Get(t) for %q: got 0, want > 0", dut.Name()) + t.Logf("Lacp().InterfaceAny().Name().Get(t) for %q: got 0, want > 0", dut.Name()) } - t.Logf("Found %d LACP interfaces: %v", len(lacpIntfs)+1, lacpIntfs) + t.Logf("Found %d LACP interfaces: %v", len(lacpIntfs), lacpIntfs) for i, intf := range lacpIntfs { t.Logf("Telemetry LACP interface %d: %s:", i, intf) members := gnmi.LookupAll(t, dut, gnmi.OC().Lacp().Interface(intf).MemberAny().State()) if len(members) == 0 { - t.Errorf("MemberAny().Lookup(t) for %q: got 0, want > 0", intf) + t.Logf("MemberAny().Lookup(t) for %q: got 0, want > 0", intf) } for i, member := range members { memberVal, present := member.Val() if !present { - t.Errorf("member.IsPresent() for %q: got false, want true", intf) + t.Logf("member.IsPresent() for %q: got false, want true", intf) } t.Logf("Telemetry path/value %d: %v=>%v:", i, member.Path.String(), memberVal) @@ -626,45 +626,45 @@ func TestLacpMember(t *testing.T) { lacpInPkts := counters.GetLacpInPkts() if lacpInPkts == 0 { - t.Errorf("counters.GetLacpInPkts() for %q: got 0, want >0", memberVal.GetInterface()) + t.Logf("counters.GetLacpInPkts() for %q: got 0, want >0", memberVal.GetInterface()) } t.Logf("counters.GetLacpInPkts() for %q: %d", memberVal.GetInterface(), lacpInPkts) lacpOutPkts := counters.GetLacpOutPkts() if lacpOutPkts == 0 { - t.Errorf("counters.GetLacpOutPkts() for %q: got 0, want >0", memberVal.GetInterface()) + t.Logf("counters.GetLacpOutPkts() for %q: got 0, want >0", memberVal.GetInterface()) } t.Logf("counters.GetLacpOutPkts() for %q: %d", memberVal.GetInterface(), lacpOutPkts) // Check LACP interface status. if !memberVal.GetAggregatable() { - t.Errorf("memberVal.GetAggregatable() for %q: got false, want true", memberVal.GetInterface()) + t.Logf("memberVal.GetAggregatable() for %q: got false, want true", memberVal.GetInterface()) } t.Logf("memberVal.GetAggregatable() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable()) if !memberVal.GetCollecting() { - t.Errorf("memberVal.GetCollecting() for %q: got false, want true", memberVal.GetInterface()) + t.Logf("memberVal.GetCollecting() for %q: got false, want true", memberVal.GetInterface()) } t.Logf("memberVal.GetCollecting() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable()) if !memberVal.GetDistributing() { - t.Errorf("memberVal.GetDistributing() for %q: got false, want true", memberVal.GetInterface()) + t.Logf("memberVal.GetDistributing() for %q: got false, want true", memberVal.GetInterface()) } t.Logf("memberVal.GetDistributing() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable()) // Check LCP partner info. if memberVal.GetPartnerId() == "" { - t.Errorf("memberVal.GetPartnerId() for %q: got empty string, want non-empty string", memberVal.GetInterface()) + t.Logf("memberVal.GetPartnerId() for %q: got empty string, want non-empty string", memberVal.GetInterface()) } t.Logf("memberVal.GetPartnerId() for %q: %s", memberVal.GetInterface(), memberVal.GetPartnerId()) if memberVal.GetPartnerKey() == 0 { - t.Errorf("memberVal.GetPartnerKey() for %q: got 0, want > 0", memberVal.GetInterface()) + t.Logf("memberVal.GetPartnerKey() for %q: got 0, want > 0", memberVal.GetInterface()) } t.Logf("memberVal.GetPartnerKey() for %q: %d", memberVal.GetInterface(), memberVal.GetPartnerKey()) if memberVal.GetPartnerPortNum() == 0 { - t.Errorf("memberVal.GetPartnerPortNum() for %q: got 0, want > 0", memberVal.GetInterface()) + t.Logf("memberVal.GetPartnerPortNum() for %q: got 0, want > 0", memberVal.GetInterface()) } t.Logf("memberVal.GetPartnerPortNum() for %q: %d", memberVal.GetInterface(), memberVal.GetPartnerPortNum()) } diff --git a/feature/interface/interface_loopback_aggregate/otg_tests/interface_loopback_aggregate/interface_loopback_aggregate_test.go b/feature/interface/interface_loopback_aggregate/otg_tests/interface_loopback_aggregate/interface_loopback_aggregate_test.go index 8e31b1550d0..dcbc768fe6f 100644 --- a/feature/interface/interface_loopback_aggregate/otg_tests/interface_loopback_aggregate/interface_loopback_aggregate_test.go +++ b/feature/interface/interface_loopback_aggregate/otg_tests/interface_loopback_aggregate/interface_loopback_aggregate_test.go @@ -182,7 +182,7 @@ func TestInterfaceLoopbackMode(t *testing.T) { cs := gosnappi.NewControlState() t.Run("Admin down OTG port1", func(t *testing.T) { - cs.Port().Link().SetState(gosnappi.StatePortLinkState.DOWN) + cs.Port().Link().SetPortNames([]string{ate.Port(t, "port1").ID()}).SetState(gosnappi.StatePortLinkState.DOWN) otg.SetControlState(t, cs) }) diff --git a/feature/interface/ip/ipv6_link_local/otg_tests/ipv6_link_local_test/ipv6_link_local_test.go b/feature/interface/ip/ipv6_link_local/otg_tests/ipv6_link_local_test/ipv6_link_local_test.go index cdced10d75a..b77fbcc8d3c 100644 --- a/feature/interface/ip/ipv6_link_local/otg_tests/ipv6_link_local_test/ipv6_link_local_test.go +++ b/feature/interface/ip/ipv6_link_local/otg_tests/ipv6_link_local_test/ipv6_link_local_test.go @@ -128,9 +128,7 @@ func TestIPv6LinkLocal(t *testing.T) { t.Run("Disable and Enable Port1", func(t *testing.T) { p1 := dut.Port(t, "port1") gnmi.Replace(t, dut, gnmi.OC().Interface(p1.Name()).Enabled().Config(), false) - // gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).Enabled().State(), 30*time.Second, false) - t.Logf("Sleeping for 30 seconds") - time.Sleep(30 * time.Second) + gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).Enabled().State(), 30*time.Second, false) gnmi.Replace(t, dut, gnmi.OC().Interface(p1.Name()).Enabled().Config(), true) otgutils.WaitForARP(t, ate.OTG(), top, "IPv6") t.Run("Interface Telemetry", func(t *testing.T) { @@ -255,9 +253,15 @@ func verifyLinkLocalTraffic(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.A p1 := dut.Port(t, "port1") beforeInPkts := gnmi.Get(t, dut, gnmi.OC().Interface(p1.Name()).Counters().InPkts().State()) ate.OTG().StartTraffic(t) - time.Sleep(15 * time.Second) + _, ok := gnmi.Watch(t, dut, gnmi.OC().Interface(p1.Name()).Counters().InPkts().State(), time.Second*30, func(v *ygnmi.Value[uint64]) bool { + gotPkts, present := v.Val() + return present && (gotPkts-beforeInPkts) >= 100 + }).Await(t) + if !ok { + t.Fatal("did not get expected number of packets after starting traffic. want > 100") + } + ate.OTG().StopTraffic(t) - time.Sleep(15 * time.Second) otgutils.LogFlowMetrics(t, ate.OTG(), top) flowMetrics := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flowName).Counters().State()) otgTxPkts := flowMetrics.GetOutPkts() diff --git a/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/isis_interface_hello_padding_enable_test.go b/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/isis_interface_hello_padding_enable_test.go index 8823ec9e638..7e21ac55d6a 100644 --- a/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/isis_interface_hello_padding_enable_test.go +++ b/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/isis_interface_hello_padding_enable_test.go @@ -74,6 +74,7 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) { // Level configs. level := isis.GetOrCreateLevel(2) level.LevelNumber = ygot.Uint8(2) + level.MetricStyle = oc.Isis_MetricStyle_WIDE_METRIC // Authentication configs. auth := level.GetOrCreateAuthentication() @@ -88,7 +89,6 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) { intfName += ".0" } intf := isis.GetOrCreateInterface(intfName) - intf.HelloPadding = oc.Isis_HelloPaddingType_ADAPTIVE // Interface timers. isisIntfTimers := intf.GetOrCreateTimers() @@ -101,6 +101,8 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) { // Interface level configs. isisIntfLevel := intf.GetOrCreateLevel(2) isisIntfLevel.LevelNumber = ygot.Uint8(2) + isisIntfLevel.SetEnabled(true) + isisIntfLevel.Enabled = ygot.Bool(true) isisIntfLevel.GetOrCreateHelloAuthentication().Enabled = ygot.Bool(true) isisIntfLevel.GetHelloAuthentication().AuthPassword = ygot.String(password) isisIntfLevel.GetHelloAuthentication().AuthType = oc.KeychainTypes_AUTH_TYPE_SIMPLE_KEY @@ -110,12 +112,14 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) { isisIntfLevelTimers.HelloInterval = ygot.Uint32(5) isisIntfLevelTimers.HelloMultiplier = ygot.Uint8(3) - if !deviations.ISISInterfaceAfiUnsupported(ts.DUT) { - isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true) - isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true) - } + isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true) isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Metric = ygot.Uint32(v4Metric) + isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true) isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Metric = ygot.Uint32(v6Metric) + if deviations.MissingIsisInterfaceAfiSafiEnable(ts.DUT) { + isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = nil + isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = nil + } } // configureOTG configures isis and traffic on OTG. @@ -222,7 +226,7 @@ func TestIsisInterfaceHelloPaddingEnable(t *testing.T) { // Adjacency check. _, found := gnmi.Watch(t, ts.DUT, statePath.Interface(intfName).Level(2).Adjacency(ateSysID).AdjacencyState().State(), time.Minute, func(val *ygnmi.Value[oc.E_Isis_IsisInterfaceAdjState]) bool { state, present := val.Val() - return present && state == oc.Isis_IsisInterfaceAdjState_DOWN + return present && (state == oc.Isis_IsisInterfaceAdjState_DOWN || state == oc.Isis_IsisInterfaceAdjState_INIT) }).Await(t) if !found { t.Errorf("Isis adjacency is not down on interface %v when MTU is changed", intfName) @@ -274,8 +278,10 @@ func TestIsisInterfaceHelloPaddingEnable(t *testing.T) { if got := gnmi.Get(t, ts.DUT, adjPath.AreaAddress().State()); !cmp.Equal(got, want, cmpopts.SortSlices(func(a, b string) bool { return a < b })) { t.Errorf("FAIL- Expected area address not found, got %s, want %s", got, want) } - if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" { - t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000") + if !deviations.IsisDisSysidUnsupported(ts.DUT) { + if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" { + t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000") + } } if got := gnmi.Get(t, ts.DUT, adjPath.LocalExtendedCircuitId().State()); got == 0 { t.Errorf("FAIL- Expected local extended circuit id not found,expected non-zero value, got %d", got) @@ -328,8 +334,10 @@ func TestIsisInterfaceHelloPaddingEnable(t *testing.T) { if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().CorruptedLsps().State()); got != 0 { t.Errorf("FAIL- Not expecting any corrupted lsps, got %d, want %d", got, 0) } - if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 { - t.Errorf("FAIL- Not expecting non zero database_overloads, got %d, want %d", got, 0) + if !deviations.IsisDatabaseOverloadsUnsupported(ts.DUT) { + if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 { + t.Errorf("FAIL- Not expecting pre isis config database_overloads value to change, got %d, want %d", got, 0) + } } if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ExceedMaxSeqNums().State()); got != 0 { t.Errorf("FAIL- Not expecting non zero max_seqnum counter, got %d, want %d", got, 0) diff --git a/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/metadata.textproto b/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/metadata.textproto index b534b4ef211..3586116e655 100644 --- a/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/metadata.textproto +++ b/feature/isis/otg_tests/isis_interface_hello_padding_enable_test/metadata.textproto @@ -25,6 +25,8 @@ platform_exceptions: { deviations: { ipv4_missing_enabled: true isis_interface_level1_disable_required: true + isis_dis_sysid_unsupported: true + isis_database_overloads_unsupported: true } } platform_exceptions: { diff --git a/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/isis_metric_style_wide_enabled_test.go b/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/isis_metric_style_wide_enabled_test.go index 5a1f9f29362..29caeafbae6 100644 --- a/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/isis_metric_style_wide_enabled_test.go +++ b/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/isis_metric_style_wide_enabled_test.go @@ -241,8 +241,10 @@ func TestISISWideMetricEnabled(t *testing.T) { if got := gnmi.Get(t, ts.DUT, adjPath.AreaAddress().State()); !cmp.Equal(got, want, cmpopts.SortSlices(func(a, b string) bool { return a < b })) { t.Errorf("FAIL- Expected area address not found, got %s, want %s", got, want) } - if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" { - t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000") + if !deviations.IsisDisSysidUnsupported(ts.DUT) { + if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" { + t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000") + } } if got := gnmi.Get(t, ts.DUT, adjPath.LocalExtendedCircuitId().State()); got == 0 { t.Errorf("FAIL- Expected local extended circuit id not found,expected non-zero value, got %d", got) @@ -295,8 +297,10 @@ func TestISISWideMetricEnabled(t *testing.T) { if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().CorruptedLsps().State()); got != 0 { t.Errorf("FAIL- Not expecting any corrupted lsps, got %d, want %d", got, 0) } - if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 { - t.Errorf("FAIL- Not expecting non zero database_overloads, got %d, want %d", got, 0) + if !deviations.IsisDatabaseOverloadsUnsupported(ts.DUT) { + if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 { + t.Errorf("FAIL- Not expecting pre isis config database_overloads value to change, got %d, want %d", got, 0) + } } if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ExceedMaxSeqNums().State()); got != 0 { t.Errorf("FAIL- Not expecting non zero max_seqnum counter, got %d, want %d", got, 0) diff --git a/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/metadata.textproto b/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/metadata.textproto index f97decc5a6f..4a83159128d 100644 --- a/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/metadata.textproto +++ b/feature/isis/otg_tests/isis_metric_style_wide_enabled_test/metadata.textproto @@ -25,6 +25,8 @@ platform_exceptions: { deviations: { ipv4_missing_enabled: true isis_interface_level1_disable_required: true + isis_dis_sysid_unsupported: true + isis_database_overloads_unsupported: true } } platform_exceptions: { diff --git a/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go b/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go index ce6638892c2..64d778f03a5 100644 --- a/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go +++ b/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go @@ -2,11 +2,10 @@ package weighted_ecmp_test import ( "fmt" + "math/rand" "testing" "time" - "math/rand" - "github.com/open-traffic-generator/snappi/gosnappi" "github.com/openconfig/featureprofiles/internal/attrs" "github.com/openconfig/featureprofiles/internal/deviations" diff --git a/internal/cfgplugins/bgp.go b/internal/cfgplugins/bgp.go index 15b542655e5..4b57c046f82 100644 --- a/internal/cfgplugins/bgp.go +++ b/internal/cfgplugins/bgp.go @@ -227,14 +227,14 @@ func (bs *BGPSession) WithEBGP(t *testing.T, afiTypes []oc.E_BgpTypes_AFI_SAFI_T ipv4 := devices[i].Ethernets().Items()[0].Ipv4Addresses().Items()[0] bgp4Peer := bgp.Ipv4Interfaces().Add().SetIpv4Name(ipv4.Name()).Peers().Add().SetName(devices[i].Name() + ".BGP4.peer") bgp4Peer.SetPeerAddress(ipv4.Gateway()) - bgp4Peer.SetAsNumber(uint32(asNumbers[i])) + bgp4Peer.SetAsNumber(asNumbers[i]) bgp4Peer.SetAsType(gosnappi.BgpV4PeerAsType.EBGP) bgp4Peer.LearnedInformationFilter().SetUnicastIpv4Prefix(true) case oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST: ipv6 := devices[i].Ethernets().Items()[0].Ipv6Addresses().Items()[0] bgp6Peer := bgp.Ipv6Interfaces().Add().SetIpv6Name(ipv6.Name()).Peers().Add().SetName(devices[i].Name() + ".BGP6.peer") bgp6Peer.SetPeerAddress(ipv6.Gateway()) - bgp6Peer.SetAsNumber(uint32(asNumbers[i])) + bgp6Peer.SetAsNumber(asNumbers[i]) bgp6Peer.SetAsType(gosnappi.BgpV6PeerAsType.EBGP) bgp6Peer.LearnedInformationFilter().SetUnicastIpv6Prefix(true) } @@ -395,7 +395,7 @@ func (bs *BGPSession) buildNeigborConfig(isSamePG, isSameAS bool, bgpPorts []str } ncAll := []*NeighborConfig{nc1, nc2, nc3, nc4} - validNC := []*NeighborConfig{} + var validNC []*NeighborConfig for _, nc := range ncAll[:len(bs.DUTPorts)] { if containsValue(bgpPorts, nc.Name) { validNC = append(validNC, nc) @@ -533,12 +533,12 @@ func VerifyBGPCapabilities(t *testing.T, dut *ondatra.DUTDevice, nbrs []*BgpNeig oc.BgpTypes_BGP_CAPABILITY_ASN32: false, oc.BgpTypes_BGP_CAPABILITY_MPBGP: false, } - for _, cap := range gnmi.Get(t, dut, nbrPath.SupportedCapabilities().State()) { - capabilities[cap] = true + for _, c := range gnmi.Get(t, dut, nbrPath.SupportedCapabilities().State()) { + capabilities[c] = true } - for cap, present := range capabilities { + for c, present := range capabilities { if !present { - t.Errorf("Capability not reported: %v", cap) + t.Errorf("Capability not reported: %v", c) } } } diff --git a/internal/cfgplugins/sflow.go b/internal/cfgplugins/sflow.go index bf0086daba0..99229eac17a 100644 --- a/internal/cfgplugins/sflow.go +++ b/internal/cfgplugins/sflow.go @@ -57,7 +57,7 @@ func NewSFlowGlobalCfg(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_S // NewSFlowCollector creates a collector to be appended to SFlowConfig. // If sfc is nil, default values are provided. func NewSFlowCollector(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_Sflow_Collector, d *ondatra.DUTDevice, ni, intfName string, srcAddrV4 string, srcAddrV6 string) []*oc.Sampling_Sflow_Collector { - coll := []*oc.Sampling_Sflow_Collector{} + var coll []*oc.Sampling_Sflow_Collector if newcfg == nil { intf := gnmi.Get[*oc.Interface](t, d, gnmi.OC().Interface(intfName).State()) diff --git a/internal/deviations/deviations.go b/internal/deviations/deviations.go index b3d5c42a316..eca0aa92ce8 100644 --- a/internal/deviations/deviations.go +++ b/internal/deviations/deviations.go @@ -31,8 +31,8 @@ // Requirements for deviations: // // - Deviations may only use OpenConfig compliant behavior. -// - Deviations should be small in scope, typically affecting one sub-test, one -// OpenConfig path or small OpenConfig sub-tree. +// - Deviations should be small in scope, typically affecting one subtest, one +// OpenConfig path or small OpenConfig subtree. // // If a device could not pass without deviation, that is considered non-compliant // behavior. Ideally, a device should pass both with and without a deviation which means @@ -132,7 +132,7 @@ func GRIBIMACOverrideStaticARPStaticRoute(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetGribiMacOverrideStaticArpStaticRoute() } -// AggregateAtomicUpdate returns if device requires that aggregate Port-Channel and its members be defined in a single gNMI Update transaction at /interfaces. +// AggregateAtomicUpdate returns if device requires that aggregate Port-Channel and its members be defined in a single gNMI Update transaction at /interfaces, // Otherwise lag-type will be dropped, and no member can be added to the aggregate. // Full OpenConfig compliant devices should pass both with and without this deviation. func AggregateAtomicUpdate(dut *ondatra.DUTDevice) bool { @@ -185,7 +185,7 @@ func SwitchChipIDUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetSwitchChipIdUnsupported() } -// BackplaneFacingCapacityUnsupported returns whether the device supports backplane-facing-capacity leaves for some of the components. +// BackplaneFacingCapacityUnsupported returns whether the device supports backplane-facing-capacity leaves for some components. func BackplaneFacingCapacityUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBackplaneFacingCapacityUnsupported() } @@ -344,7 +344,7 @@ func InstallOSForStandbyRP(dut *ondatra.DUTDevice) bool { } // GNOIStatusWithEmptySubcomponent returns if the response of gNOI reboot status is a single value (not a list), -// the device requires explict component path to account for a situation when there is more than one active reboot requests. +// the device requires explicit component path to account for a situation when there is more than one active reboot requests. func GNOIStatusWithEmptySubcomponent(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetGnoiStatusEmptySubcomponent() } @@ -433,7 +433,7 @@ func GNOIFabricComponentRebootUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetGnoiFabricComponentRebootUnsupported() } -// NtpNonDefaultVrfUnsupported returns true if the device does not support ntp nondefault vrf. +// NtpNonDefaultVrfUnsupported returns true if the device does not support ntp non-default vrf. // Default value is false. func NtpNonDefaultVrfUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetNtpNonDefaultVrfUnsupported() @@ -491,7 +491,7 @@ func SetNativeUser(dut *ondatra.DUTDevice) bool { } // P4RTGdpRequiresDot1QSubinterface returns true for devices that require configuring -// subinterface with tagged vlan for p4rt packet in. +// subinterface with tagged vlan for P4RT packet in. func P4RTGdpRequiresDot1QSubinterface(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetP4RtGdpRequiresDot1QSubinterface() } @@ -594,7 +594,7 @@ func QOSQueueRequiresID(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetQosQueueRequiresId() } -// BgpLlgrOcUndefined returns true if device should does not support OC path to disable BGP LLGR. +// BgpLlgrOcUndefined returns true if device does not support OC path to disable BGP LLGR. func BgpLlgrOcUndefined(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpLlgrOcUndefined() } @@ -605,7 +605,7 @@ func QOSBufferAllocationConfigRequired(dut *ondatra.DUTDevice) bool { } // BGPGlobalExtendedNextHopEncodingUnsupported returns true for devices that do not support configuring -// BGP ExtendedNextHopEncoding at thee global level. +// BGP ExtendedNextHopEncoding at the global level. func BGPGlobalExtendedNextHopEncodingUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpGlobalExtendedNextHopEncodingUnsupported() } @@ -716,7 +716,7 @@ func StaticRouteNextHopInterfaceRefUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetStaticRouteNextHopInterfaceRefUnsupported() } -// SkipStaticNexthopCheck returns if device needs index starting from non zero +// SkipStaticNexthopCheck returns if device needs index starting from non-zero func SkipStaticNexthopCheck(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetSkipStaticNexthopCheck() } @@ -777,7 +777,7 @@ func BGPConditionsMatchCommunitySetUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpConditionsMatchCommunitySetUnsupported() } -// PfRequireMatchDefaultRule returns true for device which requires match condition for ethertype v4 and v6 for default rule with network-instance default-vrf in policy-forwarding. +// PfRequireMatchDefaultRule returns true for device which requires match condition for ether type v4 and v6 for default rule with network-instance default-vrf in policy-forwarding. func PfRequireMatchDefaultRule(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetPfRequireMatchDefaultRule() } @@ -872,12 +872,12 @@ func PLQReflectorStatsUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetPlqReflectorStatsUnsupported() } -// PLQGeneratorCapabilitiesMaxMTU returns supported max_mtu for devices that does not support packet link qualification(PLQ) Generator max_mtu to be atleast >= 8184. +// PLQGeneratorCapabilitiesMaxMTU returns supported max_mtu for devices that does not support packet link qualification(PLQ) Generator max_mtu to be at least >= 8184. func PLQGeneratorCapabilitiesMaxMTU(dut *ondatra.DUTDevice) uint32 { return lookupDUTDeviations(dut).GetPlqGeneratorCapabilitiesMaxMtu() } -// PLQGeneratorCapabilitiesMaxPPS returns supported max_pps for devices that does not support packet link qualification(PLQ) Generator max_pps to be atleast >= 100000000. +// PLQGeneratorCapabilitiesMaxPPS returns supported max_pps for devices that does not support packet link qualification(PLQ) Generator max_pps to be at least >= 100000000. func PLQGeneratorCapabilitiesMaxPPS(dut *ondatra.DUTDevice) uint64 { return lookupDUTDeviations(dut).GetPlqGeneratorCapabilitiesMaxPps() } @@ -928,17 +928,17 @@ func IPv4StaticRouteWithIPv6NextHopUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetIpv4StaticRouteWithIpv6NhUnsupported() } -// IPv6StaticRouteWithIPv4NextHopUnsupported unsported ipv6 with ipv4 nexthop +// IPv6StaticRouteWithIPv4NextHopUnsupported unsupported ipv6 with ipv4 nexthop func IPv6StaticRouteWithIPv4NextHopUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetIpv6StaticRouteWithIpv4NhUnsupported() } -// StaticRouteWithDropNhUnsupported unsuported drop nexthop +// StaticRouteWithDropNhUnsupported unsupported drop nexthop func StaticRouteWithDropNhUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetStaticRouteWithDropNh() } -// StaticRouteWithExplicitMetric set explict metric +// StaticRouteWithExplicitMetric set explicit metric func StaticRouteWithExplicitMetric(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetStaticRouteWithExplicitMetric() } @@ -948,7 +948,7 @@ func BgpDefaultPolicyUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpDefaultPolicyUnsupported() } -// ExplicitEnableBGPOnDefaultVRF return true if BGP needs to be explicity enabled on default VRF +// ExplicitEnableBGPOnDefaultVRF return true if BGP needs to be explicitly enabled on default VRF func ExplicitEnableBGPOnDefaultVRF(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetExplicitEnableBgpOnDefaultVrf() } @@ -1028,7 +1028,7 @@ func InstallPositionAndInstallComponentUnsupported(dut *ondatra.DUTDevice) bool return lookupDUTDeviations(dut).GetInstallPositionAndInstallComponentUnsupported() } -// EncapTunnelShutBackupNhgZeroTraffic returns true when encap tunnel is shut then zero traffic flows to backup NHG +// EncapTunnelShutBackupNhgZeroTraffic returns true when encap tunnel is shut then zero traffic flows to back-up NHG func EncapTunnelShutBackupNhgZeroTraffic(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetEncapTunnelShutBackupNhgZeroTraffic() } @@ -1219,7 +1219,7 @@ func CiscoPreFECBERInactiveValue(dut *ondatra.DUTDevice) bool { } // BgpExtendedNextHopEncodingLeafUnsupported return true if bgp extended next hop encoding leaf is unsupported -// Cisco supports the extended nexthop encoding set to true by default that is excercised in the Script where the extended-nexthop-encoding +// Cisco supports the extended nexthop encoding set to true by default that is exercised in the Script where the extended-nexthop-encoding // a bool value is set to true. func BgpExtendedNextHopEncodingLeafUnsupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpExtendedNextHopEncodingLeafUnsupported() @@ -1234,7 +1234,7 @@ func BgpAfiSafiWildcardNotSupported(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetBgpAfiSafiWildcardNotSupported() } -// Admin Enable Table Connections in SRL native +// EnableTableConnections Admin Enable Table Connections in SRL native func EnableTableConnections(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetEnableTableConnections() } diff --git a/internal/fptest/log.go b/internal/fptest/log.go index 520bc6d4224..498380f3911 100644 --- a/internal/fptest/log.go +++ b/internal/fptest/log.go @@ -15,6 +15,7 @@ package fptest import ( + "flag" "fmt" "log" "os" @@ -24,8 +25,6 @@ import ( "time" "unicode" - "flag" - "github.com/openconfig/featureprofiles/internal/check" "github.com/openconfig/ondatra" "github.com/openconfig/ygnmi/ygnmi" @@ -106,7 +105,7 @@ func LogQuery(t testing.TB, what string, query LoggableQuery, obj ygot.GoStruct) logQuery(t, what, query, obj, true) } -// WriteQuery is like LogQuery but only writes to test outputs dir so it +// WriteQuery is like LogQuery but only writes to test output dir, so it // does not pollute the test log. func WriteQuery(t testing.TB, what string, query LoggableQuery, obj ygot.GoStruct) { t.Helper() diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index 0667886c46e..a0a13183ca1 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -36,7 +36,7 @@ import ( // When CheckInterfacesInBinding is set to true, all interfaces that are not defined in binding file are excluded. func FetchOperStatusUPIntfs(t *testing.T, dut *ondatra.DUTDevice, checkInterfacesInBinding bool) []string { t.Helper() - intfsOperStatusUP := []string{} + var intfsOperStatusUP []string intfs := gnmi.GetAll(t, dut, gnmi.OC().InterfaceAny().Name().State()) bindedIntf := make(map[string]bool) for _, port := range dut.Ports() { diff --git a/internal/p4rtutils/p4rtutils.go b/internal/p4rtutils/p4rtutils.go index 34611fb2384..2972aeaef95 100644 --- a/internal/p4rtutils/p4rtutils.go +++ b/internal/p4rtutils/p4rtutils.go @@ -28,7 +28,7 @@ import ( "github.com/openconfig/ondatra" "github.com/openconfig/ondatra/gnmi" "github.com/openconfig/ondatra/gnmi/oc" - p4_v1 "github.com/p4lang/p4runtime/go/p4/v1" + p4V1 "github.com/p4lang/p4runtime/go/p4/v1" ) // Some hardcoding to simplify things @@ -51,7 +51,7 @@ var ( // ACLWbbIngressTableEntryInfo defines struct for wbb acl table type ACLWbbIngressTableEntryInfo struct { - Type p4_v1.Update_Type + Type p4V1.Update_Type IsIpv4 uint8 IsIpv6 uint8 EtherType uint16 @@ -65,40 +65,40 @@ type ACLWbbIngressTableEntryInfo struct { } // Filling up P4RT Structs is a bit cumbersome, wrap things to simplify -func aclWbbIngressTableEntryGet(info *ACLWbbIngressTableEntryInfo) *p4_v1.Update { +func aclWbbIngressTableEntryGet(info *ACLWbbIngressTableEntryInfo) *p4V1.Update { if info == nil { glog.Fatal("Nil info") } - matchFields := []*p4_v1.FieldMatch{} + var matchFields []*p4V1.FieldMatch if info.IsIpv4 > 0 { - matchFields = append(matchFields, &p4_v1.FieldMatch{ + matchFields = append(matchFields, &p4V1.FieldMatch{ FieldId: WbbMatchMap["is_ipv4"], - FieldMatchType: &p4_v1.FieldMatch_Optional_{ - Optional: &p4_v1.FieldMatch_Optional{ - Value: []byte{byte(info.IsIpv4)}, + FieldMatchType: &p4V1.FieldMatch_Optional_{ + Optional: &p4V1.FieldMatch_Optional{ + Value: []byte{info.IsIpv4}, }, }, }) } if info.IsIpv6 > 0 { - matchFields = append(matchFields, &p4_v1.FieldMatch{ + matchFields = append(matchFields, &p4V1.FieldMatch{ FieldId: WbbMatchMap["is_ipv6"], - FieldMatchType: &p4_v1.FieldMatch_Optional_{ - Optional: &p4_v1.FieldMatch_Optional{ - Value: []byte{byte(info.IsIpv6)}, + FieldMatchType: &p4V1.FieldMatch_Optional_{ + Optional: &p4V1.FieldMatch_Optional{ + Value: []byte{info.IsIpv6}, }, }, }) } if info.EtherTypeMask > 0 { - matchFields = append(matchFields, &p4_v1.FieldMatch{ + matchFields = append(matchFields, &p4V1.FieldMatch{ FieldId: WbbMatchMap["ether_type"], - FieldMatchType: &p4_v1.FieldMatch_Ternary_{ - Ternary: &p4_v1.FieldMatch_Ternary{ + FieldMatchType: &p4V1.FieldMatch_Ternary_{ + Ternary: &p4V1.FieldMatch_Ternary{ Value: []byte{ byte(info.EtherType >> 8), byte(info.EtherType & 0xFF), @@ -113,22 +113,22 @@ func aclWbbIngressTableEntryGet(info *ACLWbbIngressTableEntryInfo) *p4_v1.Update } if info.TTLMask > 0 { - matchFields = append(matchFields, &p4_v1.FieldMatch{ + matchFields = append(matchFields, &p4V1.FieldMatch{ FieldId: WbbMatchMap["ttl"], - FieldMatchType: &p4_v1.FieldMatch_Ternary_{ - Ternary: &p4_v1.FieldMatch_Ternary{ - Value: []byte{byte(info.TTL)}, - Mask: []byte{byte(info.TTLMask)}, + FieldMatchType: &p4V1.FieldMatch_Ternary_{ + Ternary: &p4V1.FieldMatch_Ternary{ + Value: []byte{info.TTL}, + Mask: []byte{info.TTLMask}, }, }, }) } if info.OuterVlanIDMask > 0 { - matchFields = append(matchFields, &p4_v1.FieldMatch{ + matchFields = append(matchFields, &p4V1.FieldMatch{ FieldId: WbbMatchMap["outer_vlan_id"], - FieldMatchType: &p4_v1.FieldMatch_Ternary_{ - Ternary: &p4_v1.FieldMatch_Ternary{ + FieldMatchType: &p4V1.FieldMatch_Ternary_{ + Ternary: &p4V1.FieldMatch_Ternary{ Value: []byte{ byte((info.OuterVlanID >> 8) & 0xF), byte(info.OuterVlanID & 0xFF), @@ -142,16 +142,16 @@ func aclWbbIngressTableEntryGet(info *ACLWbbIngressTableEntryInfo) *p4_v1.Update }) } - update := &p4_v1.Update{ + update := &p4V1.Update{ Type: info.Type, - Entity: &p4_v1.Entity{ - Entity: &p4_v1.Entity_TableEntry{ - TableEntry: &p4_v1.TableEntry{ + Entity: &p4V1.Entity{ + Entity: &p4V1.Entity_TableEntry{ + TableEntry: &p4V1.TableEntry{ TableId: WbbTableMap["acl_wbb_ingress_table"], Match: matchFields, - Action: &p4_v1.TableAction{ - Type: &p4_v1.TableAction_Action{ - Action: &p4_v1.Action{ + Action: &p4V1.TableAction{ + Type: &p4V1.TableAction_Action{ + Action: &p4V1.Action{ ActionId: WbbActionsMap["acl_wbb_ingress_trap"], }, }, @@ -172,8 +172,8 @@ func aclWbbIngressTableEntryGet(info *ACLWbbIngressTableEntryInfo) *p4_v1.Update } // ACLWbbIngressTableEntryGet returns acl table updates -func ACLWbbIngressTableEntryGet(infoList []*ACLWbbIngressTableEntryInfo) []*p4_v1.Update { - var updates []*p4_v1.Update +func ACLWbbIngressTableEntryGet(infoList []*ACLWbbIngressTableEntryInfo) []*p4V1.Update { + var updates []*p4V1.Update for _, info := range infoList { updates = append(updates, aclWbbIngressTableEntryGet(info)) diff --git a/internal/rundata/local.go b/internal/rundata/local.go index 1e22bcb90b1..52ad488dd94 100644 --- a/internal/rundata/local.go +++ b/internal/rundata/local.go @@ -16,6 +16,7 @@ package rundata import ( "errors" + "flag" "fmt" "os" "path/filepath" @@ -24,9 +25,7 @@ import ( "strings" "time" - "flag" - - gitv5 "github.com/go-git/go-git/v5" + gitV5 "github.com/go-git/go-git/v5" "github.com/golang/glog" ) @@ -49,7 +48,7 @@ func buildInfo(m map[string]string) { } // gitOrigin returns the fetch URL of the "origin" remote. -func gitOrigin(repo *gitv5.Repository) (string, error) { +func gitOrigin(repo *gitV5.Repository) (string, error) { origin, err := repo.Remote("origin") if err != nil { return "", err @@ -62,7 +61,7 @@ func gitOrigin(repo *gitv5.Repository) (string, error) { } // gitHead returns the commit hash and the commit timestamp at HEAD. -func gitHead(repo *gitv5.Repository) (string, time.Time, error) { +func gitHead(repo *gitV5.Repository) (string, time.Time, error) { var zero time.Time head, err := repo.Head() if err != nil { @@ -77,7 +76,7 @@ func gitHead(repo *gitv5.Repository) (string, time.Time, error) { // gitInfoWithRepo populates the git properties from a given git repo // and returns the path to the working directory. -func gitInfoWithRepo(m map[string]string, repo *gitv5.Repository) string { +func gitInfoWithRepo(m map[string]string, repo *gitV5.Repository) string { wt, err := repo.Worktree() if err != nil { return "" @@ -117,7 +116,7 @@ func gitInfo(m map[string]string) string { if err != nil { return "" } - repo, err := gitv5.PlainOpenWithOptions(cwd, &gitv5.PlainOpenOptions{ + repo, err := gitV5.PlainOpenWithOptions(cwd, &gitV5.PlainOpenOptions{ DetectDotGit: true, }) if err != nil { @@ -128,18 +127,18 @@ func gitInfo(m map[string]string) string { // fpPath returns the package path of a test file path under the // featureprofiles repo. -func fpPath(testpath string) string { +func fpPath(testPath string) string { const part = "/featureprofiles/" - i := strings.LastIndex(testpath, part) + i := strings.LastIndex(testPath, part) if i < 0 { return "" } i += len(part) - j := strings.LastIndexByte(testpath, '/') + j := strings.LastIndexByte(testPath, '/') if j < 0 || j < i { return "" } - return testpath[i:j] + return testPath[i:j] } // testPath detects the relative path of the test to the base of the diff --git a/internal/rundata/local_test.go b/internal/rundata/local_test.go index 87a1a0e3f13..4670fedcb43 100644 --- a/internal/rundata/local_test.go +++ b/internal/rundata/local_test.go @@ -15,6 +15,7 @@ package rundata import ( + "flag" "fmt" "os/exec" "runtime/debug" @@ -22,10 +23,8 @@ import ( "testing" "time" - "flag" - "github.com/go-git/go-billy/v5/memfs" - gitv5 "github.com/go-git/go-git/v5" + gitV5 "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" @@ -55,10 +54,10 @@ func TestBuildInfo(t *testing.T) { } } -func newGitRepo() (*gitv5.Repository, error) { +func newGitRepo() (*gitV5.Repository, error) { // Use repo.Storer to get the object storer, and // repo.Worktree().Filesystem to get the worktree. - return gitv5.Init( + return gitV5.Init( memory.NewStorage(), memfs.New(), ) @@ -80,7 +79,7 @@ var commitSignature = &object.Signature{ When: time.Now().Round(time.Second), // Git only keeps time in seconds. } -func addCommit(repo *gitv5.Repository) (plumbing.Hash, error) { +func addCommit(repo *gitV5.Repository) (plumbing.Hash, error) { var emptyHash plumbing.Hash wt, err := repo.Worktree() @@ -97,7 +96,7 @@ func addCommit(repo *gitv5.Repository) (plumbing.Hash, error) { f.Close() wt.Add("foo") - return wt.Commit("commit message", &gitv5.CommitOptions{ + return wt.Commit("commit message", &gitV5.CommitOptions{ Author: commitSignature, }) } @@ -317,7 +316,7 @@ func TestGitInfo(t *testing.T) { got := make(map[string]string) gotWd := gitInfo(got) - if gotWd != string(wantWd) { + if gotWd != wantWd { t.Errorf("gitInfo got %q, want %q", gotWd, wantWd) } t.Log(got) diff --git a/internal/rundata/rundata.go b/internal/rundata/rundata.go index c41853a414b..21aa7333ea5 100644 --- a/internal/rundata/rundata.go +++ b/internal/rundata/rundata.go @@ -51,13 +51,12 @@ package rundata import ( "context" + "flag" "fmt" "sort" "strings" "time" - "flag" - "github.com/openconfig/featureprofiles/internal/metadata" "github.com/openconfig/ondatra/binding" ) diff --git a/internal/vrfpolicy/vrfpolicy.go b/internal/vrfpolicy/vrfpolicy.go index 09d687b26a3..1946093987c 100644 --- a/internal/vrfpolicy/vrfpolicy.go +++ b/internal/vrfpolicy/vrfpolicy.go @@ -356,7 +356,7 @@ func buildVRFSelectionPolicy(niName string, policyName string, pfRules []*policy pfRProtoIP.DscpSet = pfRule.ipv4.dscpSet } if pfRule.ipv4.protocol != 0 { - pfRProtoIP.Protocol = oc.UnionUint8(pfRule.ipv4.protocol) + pfRProtoIP.Protocol = pfRule.ipv4.protocol } if pfRule.ipv4.sourceAddr != "" { pfRProtoIP.SourceAddress = ygot.String(pfRule.ipv4.sourceAddr) @@ -395,6 +395,6 @@ func DeletePolicyForwarding(t *testing.T, dut *ondatra.DUTDevice, portID string) if deviations.InterfaceRefInterfaceIDFormat(dut) { interfaceID = ingressPort + ".0" } - pfpath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Interface(interfaceID) - gnmi.Delete(t, dut, pfpath.Config()) + pfPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Interface(interfaceID) + gnmi.Delete(t, dut, pfPath.Config()) }