Skip to content

Commit

Permalink
Merge branch 'main' into TE-1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cprabha authored May 31, 2024
2 parents e581e7d + 57039f2 commit 89ec484
Show file tree
Hide file tree
Showing 144 changed files with 5,561 additions and 1,922 deletions.
65 changes: 49 additions & 16 deletions .github/workflows/readme_oc_path_and_rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -46,21 +48,52 @@ jobs:
validate_readme_spec --feature-dir "$1" --alsologtostderr "${exemption_flags[@]}"
}
validate feature/gnoi/os
##### 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/bgp/policybase/otg_tests/import_export_multi
validate feature/aft/aft_summary/otg_tests/route_summary_counters_test
validate feature/gnmi/otg_tests/telemetry_basic_check_test
validate feature/gnmi/otg_tests/telemetry_interface_packet_counters_test
validate feature/gnmi/otg_tests/telemetry_port_speed_test
validate feature/gnmi/subscribe/tests/gnmi_sample_mode_test
validate feature/gnmi/subscribe/tests/gnmi_subscriptionlist_test
validate feature/gnoi/system/tests/chassis_reboot_status_and_cancel_test
validate feature/gnoi/system/tests/ping_test
validate feature/gnoi/system/tests/supervisor_switchover_test
validate feature/isis/otg_tests/weighted_ecmp_test
validate feature/isis/static_route_isis_redistribution
validate feature/mtu/largeippacket/otg_tests/large_ip_packet_transmission
validate feature/staticroute/otg_tests/basic_static_route_support_test
validate feature/staticroute/tests
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
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,12 @@ func TestRouteSummaryWithISIS(t *testing.T) {
}).Await(t)

dni := deviations.DefaultNetworkInstance(ts.DUT)
ipv4Entry := gnmi.Get(t, ts.DUT, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv4Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS).Counters().AftEntries().State())
if ipv4Entry == 0 {
t.Errorf("ipv4 BGP entries, got: %d, want: %d", ipv4Entry, prefixesCount)
if got, ok := gnmi.Await(t, ts.DUT, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv4Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS).Counters().AftEntries().State(), 1*time.Minute, uint64(prefixesCount)).Val(); !ok {
t.Errorf("ipv4 isis entries, got: %d, want: %d", got, prefixesCount)
}

ipv6Entry := gnmi.Get(t, ts.DUT, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv6Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS).Counters().AftEntries().State())
if ipv6Entry == 0 {
t.Errorf("ipv6 BGP entries, got: %d, want: %d", ipv6Entry, prefixesCount)
if got, ok := gnmi.Await(t, ts.DUT, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv6Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS).Counters().AftEntries().State(), 1*time.Minute, uint64(prefixesCount)).Val(); !ok {
t.Errorf("ipv6 isis entries, got: %d, want: %d", got, prefixesCount)
}
}

Expand Down Expand Up @@ -218,14 +216,12 @@ func TestRouteSummaryWithBGP(t *testing.T) {

dni := deviations.DefaultNetworkInstance(dut)
if tc.dut.ipv4 {
ipv4Entry := gnmi.Get(t, dut, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv4Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP).Counters().AftEntries().State())
if ipv4Entry == 0 {
t.Errorf("ipv4 BGP entries, got: %d, want: %d", ipv4Entry, prefixesCount)
if got, ok := gnmi.Await(t, dut, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv4Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP).Counters().AftEntries().State(), 1*time.Minute, uint64(prefixesCount)).Val(); !ok {
t.Errorf("ipv4 BGP entries, got: %d, want: %d", got, prefixesCount)
}
} else {
ipv6Entry := gnmi.Get(t, dut, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv6Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP).Counters().AftEntries().State())
if ipv6Entry == 0 {
t.Errorf("ipv4 BGP entries, got: %d, want: %d", ipv6Entry, prefixesCount)
if got, ok := gnmi.Await(t, dut, gnmi.OC().NetworkInstance(dni).Afts().AftSummaries().Ipv6Unicast().Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP).Counters().AftEntries().State(), 1*time.Minute, uint64(prefixesCount)).Val(); !ok {
t.Errorf("ipv4 BGP entries, got: %d, want: %d", got, prefixesCount)
}
}
})
Expand Down
46 changes: 46 additions & 0 deletions feature/bgp/bgp_session_mode_configuration_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# RT-1.55: BGP session mode (active/passive)

## Summary

* Validate the correct behavior of BGP session establishment in both active and passive modes.
* Verify the accurate reflection of BGP transport mode in telemetry output.
* Confirm the functionality of passive mode configuration at both the neighbor and peer group levels.

## Topology

DUT Port1 (AS 65501) ---eBGP --- ATE Port1 (AS 65502)

## Procedure

* Configure both DUT and ATE to operate in BGP passive mode under the neighbor section.
* Verify that the BGP adjacency will not be established.
* Verify the telemetry path output to confirm that the neighbor's BGP transport mode is displayed as "passive for the DUT.
* Configure BGP session on ATE to operate in BGP active mode when interacting with DUT.
* Verify that a BGP adjacency is established between the ATE and DUT
* Verify the telemetry path output to confirm that the neighbor's BGP transport mode is displayed as "passive for the DUT.
* Redo the same above steps but configure the passive mode under the peer group instead of the bgp neighbor configuration.

## 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:
## Config paths
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/transport/config/passive-mode:
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/transport/config/passive-mode:

## State paths
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/transport/state/passive-mode:
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/transport/state/passive-mode:

rpcs:
gnmi:
gNMI.Set:
gNMI.Subscribe:
```
## Minimum DUT platform requirement
* MFF - A modular form factor device containing LINECARDs, FABRIC and redundant CONTROLLER_CARD components
* FFF - fixed form factor
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ Validate BGP in multipath scenario
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=<id>]/state
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group/next-hops

## Protocol/RPC Parameter Coverage
## OpenConfig Path and RPC Coverage

* gNMI
* Set
* Subscribe

```yaml
rpcs:
gnmi:
gNMI.Get:
gNMI.Subscribe:

```

## Required DUT platform

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"testing"
"time"

"math/rand"

"github.com/open-traffic-generator/snappi/gosnappi"
"github.com/openconfig/featureprofiles/internal/cfgplugins"
"github.com/openconfig/featureprofiles/internal/deviations"
Expand All @@ -37,8 +39,8 @@ const (
prefixesCount = 4
pathID = 1
maxPaths = 2
trafficPps = 1000
totalPackets = 120000
trafficPps = 100000
totalPackets = 12000000
lossTolerancePct = 0
lbToleranceFms = 20
)
Expand Down Expand Up @@ -69,10 +71,24 @@ func configureOTG(t *testing.T, bs *cfgplugins.BGPSession) {
bgp4PeerRoute.AddPath().SetPathId(pathID)
}

configureFlow(bs)
configureFlow(t, bs)
}

func randRange(t *testing.T, start, end uint32, count int) []uint32 {
if count > int(end-start) {
t.Fatal("randRange: count greater than end-start.")
}
rand.New(rand.NewSource(time.Now().UnixNano()))
var result []uint32
for len(result) < count {
diff := end - start
randomValue := rand.Int31n(int32(diff)) + int32(start)
result = append(result, uint32(randomValue))
}
return result
}

func configureFlow(bs *cfgplugins.BGPSession) {
func configureFlow(t *testing.T, bs *cfgplugins.BGPSession) {
bs.ATETop.Flows().Clear()

var rxNames []string
Expand All @@ -91,6 +107,11 @@ func configureFlow(bs *cfgplugins.BGPSession) {
e := flow.Packet().Add().Ethernet()
e.Src().SetValue(bs.ATEPorts[0].MAC)
v4 := flow.Packet().Add().Ipv4()
v4.Src().Increment().SetStart(bs.ATEPorts[0].IPv4).SetCount(prefixesCount)
v4.Dst().Increment().SetStart(prefixesStart).SetCount(prefixesCount)
udp := flow.Packet().Add().Udp()
udp.SrcPort().SetValues(randRange(t, 34525, 65535, 500))
udp.DstPort().SetValues(randRange(t, 49152, 65535, 500))
v4.Src().SetValue(bs.ATEPorts[0].IPv4)
v4.Dst().SetValue(prefixesStart)
}
Expand Down Expand Up @@ -174,15 +195,22 @@ func TestBGPSetup(t *testing.T) {
gEBGP := bgp.GetOrCreateGlobal().GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).GetOrCreateUseMultiplePaths().GetOrCreateEbgp()
pgUseMulitplePaths := bgp.GetOrCreatePeerGroup(cfgplugins.BGPPeerGroup1).GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).GetOrCreateUseMultiplePaths()
if tc.enableMultipath {
t.Logf("Enable Multipath")
pgUseMulitplePaths.Enabled = ygot.Bool(true)
t.Logf("Enable Maximum Paths")
gEBGP.MaximumPaths = ygot.Uint32(maxPaths)
}
if tc.enableMultiAS && !deviations.SkipSettingAllowMultipleAS(bs.DUT) {
if tc.enableMultiAS && !deviations.SkipSettingAllowMultipleAS(bs.DUT) && deviations.SkipAfiSafiPathForBgpMultipleAs(bs.DUT) {
t.Logf("Enable MultiAS ")
gEBGP := bgp.GetOrCreateGlobal().GetOrCreateUseMultiplePaths().GetOrCreateEbgp()
gEBGP.AllowMultipleAs = ygot.Bool(true)
}
if tc.enableMultiAS && !deviations.SkipSettingAllowMultipleAS(bs.DUT) && !deviations.SkipAfiSafiPathForBgpMultipleAs(bs.DUT) {
t.Logf("Enable MultiAS ")
gEBGP.AllowMultipleAs = ygot.Bool(true)
}

configureOTG(t, bs)

bs.PushAndStart(t)

t.Logf("Verify DUT BGP sessions up")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platform_exceptions: {
}
deviations: {
ipv4_missing_enabled: true
skip_afi_safi_path_for_bgp_multiple_as: true
}
}
platform_exceptions: {
Expand All @@ -37,3 +38,4 @@ platform_exceptions: {
}
}
tags: TAGS_DATACENTER_EDGE

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func configureOTG(t *testing.T, bs *cfgplugins.BGPSession) {
routeAddress.SetPrefix(prefixP4Len)
routeAddress.SetCount(prefixesCount)
bgp4PeerRoute.AddPath().SetPathId(pathID)
bgp4PeerRoute.ExtendedCommunities().Items()[0].NonTransitive2OctetAsType().LinkBandwidthSubtype().SetBandwidth(float32(linkBw[i-2] * 1000))
bgp4PeerRoute.ExtendedCommunities().Add().NonTransitive2OctetAsType().LinkBandwidthSubtype().SetBandwidth(float32(linkBw[i-2] * 1000))
}

configureFlow(bs)
Expand Down
12 changes: 8 additions & 4 deletions feature/bgp/policybase/otg_tests/chained_policies_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,15 @@ For each section of configuration below, prepare a gnmi.SetBatch with all the c
* /network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/loc-rib/routes/route/prefix
* /network-instances/network-instance/protocols/protocol/bgp/rib/attr-sets/attr-set/state/med

## Protocol/RPC Parameter Coverage

* gNMI
* Subscribe (ONCE)
* Set (REPLACE)
## OpenConfig Path and RPC Coverage
```yaml
rpcs:
gnmi:
gNMI.Get:
gNMI.Subscribe:

```

## Required DUT platform

Expand Down
Loading

0 comments on commit 89ec484

Please sign in to comment.