Skip to content

Commit

Permalink
Merge branch 'main' into TUN13
Browse files Browse the repository at this point in the history
  • Loading branch information
charantejag504 authored Jun 5, 2024
2 parents 2cd3861 + 2661cfd commit e6e8f0f
Show file tree
Hide file tree
Showing 204 changed files with 7,789 additions and 3,196 deletions.
69 changes: 66 additions & 3 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 All @@ -27,10 +29,71 @@ jobs:
- name: Validate Template README
run: |
go install ./tools/validate_readme_spec
validate_readme_spec -alsologtostderr doc/test-requirements-template.md
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
exemption_flags=(
--non-test-readme security/gnsi/certz/test_data/README.md
--non-test-readme experimental/p4rt/README.md
--non-test-readme feature/security/gnsi/acctz/README.md
)
# TODO: Just use this one line after all READMEs have converted to the new format.
# validate_readme_spec --alsologtostderr "${exemption_flags[@]}"
function validate() {
validate_readme_spec --feature-dir "$1" --alsologtostderr "${exemption_flags[@]}"
}
##### BEGIN: Validate Changed Test READMEs # TODO: Remove this section after all are converted.
# Adapted from rebase_check.yml
# Notes:
# * Do not use ${GITHUB_REF}, github.sha, or HEAD because they are
# the merged commit of the pull request and main. There are no
# outdated files in the merged commit.
# * refs/pull/${pr_number}/head is not available, so use
# github.event.pull_request.head.sha which is the "head sha" of
# the event that triggered the pull request.
# * Do not use github.event.pull_request.base.sha because it is
# the base when the pull request was created, not after a rebase.
# Ask git merge-base to tell us a suitable base.
readonly HEAD="${{ github.event.pull_request.head.sha }}"
if [ ! -z "${HEAD}" ]; then
readonly BASE="$(git merge-base origin/main "${HEAD}")"
affected_readmes=()
for f in $(git diff --name-only "${BASE}" "${HEAD}" | grep -E '^\W*feature' | xargs -r dirname | sort -u | sed 's/$/\/README.md/'); do
if [ -f "$f" ]; then
affected_readmes+=("$f")
fi
done
echo "########## READMEs in changed directories to be validated (including ones to be exempted):"
printf '%s\n' "${affected_readmes[@]}"
echo "########## Validating READMEs in changed directories:"
for f in "${affected_readmes[@]}"; do
validate_readme_spec --alsologtostderr "${exemption_flags[@]}" "${f}"
done
fi
##### END: Validate Changed Test READMEs #####
echo "########## Validating already-converted READMEs:"
validate feature/aft
validate feature/bgp/policybase/otg_tests/import_export_multi_test
validate feature/gnmi
validate feature/gnoi
validate feature/isis
validate feature/mtu
validate feature/networkinstance
validate feature/security
validate feature/staticroute
validate feature/system/management
validate feature/system/gnmi/cliorigin/tests/mixed_oc_cli_origin_support_test
validate feature/system/ntp/tests/system_ntp_test
validate feature/qos/otg_tests/bursty_traffic_test
4 changes: 2 additions & 2 deletions doc/test-requirements-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ paths:
# interface configuration
/interfaces/interface/config/description:
/interfaces/interface/config/enabled:
# name of chassis component
# name of chassis and linecard components
/components/component/state/name:
platform_type: "CHASSIS"
platform_type: ["CHASSIS", "LINECARD"]

rpcs:
gnmi:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ Establish eBGP sessions between ATE:port1 and DUT:port1 and another between ATE:
* Advertise prefixes from ATE port-1, observe received prefixes at ATE port-2 for IPv4 and IPv6
* Validate total number of entries of AFT for IPv4 and IPv6

## Config Parameter Coverage
## OpenConfig Path and RPC Coverage

The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here.

## Telemetry Parameter Coverage
```yaml
paths:
## Config Paths ##

/network-instances/network-instance/afts/aft-summaries/ipv4-unicast/protocols/protocol/state/counters/aft-entries
/network-instances/network-instance/afts/aft-summaries/ipv6-unicast/protocols/protocol/state/counters/aft-entries
## State Paths ##
/network-instances/network-instance/afts/aft-summaries/ipv4-unicast/protocols/protocol/state/counters/aft-entries:
/network-instances/network-instance/afts/aft-summaries/ipv6-unicast/protocols/protocol/state/counters/aft-entries:

## Protocol/RPC Parameter Coverage
rpcs:
gnmi:
gNMI.Subscribe:
```
## Control Protocol Coverage
BGP
IS-IS
## Minimum DUT Platform Requirement
vRX

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,14 @@ 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

* gNMI
* Set
* Subscribe
## OpenConfig Path and RPC Coverage

```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,11 +107,17 @@ 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().SetCount(1000).SetStep("0.0.0.1").SetStart(bs.ATEPorts[0].IPv4)
v4.Dst().Increment().SetCount(4).SetStep("0.0.0.1").SetStart(prefixesStart)
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)
}

func verifyECMPLoadBalance(t *testing.T, ate *ondatra.ATEDevice, pc int, expectedLinks int) {
dut := ondatra.DUT(t, "dut")
framesTx := gnmi.Get(t, ate.OTG(), gnmi.OTG().Port(ate.Port(t, "port1").ID()).Counters().OutFrames().State())
expectedPerLinkFms := framesTx / uint64(expectedLinks)
t.Logf("Total packets %d flow through the %d links and expected per link packets %d", framesTx, expectedLinks, expectedPerLinkFms)
Expand All @@ -113,12 +135,15 @@ func verifyECMPLoadBalance(t *testing.T, ate *ondatra.ATEDevice, pc int, expecte
t.Logf("Traffic %d is in expected range: %d - %d, Load balance Test Passed", framesRx, min, max)
got++
} else {
t.Errorf("Traffic is expected in range %d - %d but got %d. Load balance Test Failed", min, max, framesRx)
if !deviations.BgpMaxMultipathPathsUnsupported(dut) {
t.Errorf("Traffic is expected in range %d - %d but got %d. Load balance Test Failed", min, max, framesRx)
}
}
}

if got != expectedLinks {
t.Errorf("invalid number of load balancing interfaces, got: %d want %d", got, expectedLinks)
if !deviations.BgpMaxMultipathPathsUnsupported(dut) {
if got != expectedLinks {
t.Errorf("invalid number of load balancing interfaces, got: %d want %d", got, expectedLinks)
}
}
}

Expand Down Expand Up @@ -174,15 +199,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 All @@ -195,8 +227,12 @@ func TestBGPSetup(t *testing.T) {
prefix := prefixesStart + "/" + strconv.Itoa(prefixP4Len)
ipv4Entry := gnmi.Get[*oc.NetworkInstance_Afts_Ipv4Entry](t, bs.DUT, aftsPath.Ipv4Entry(prefix).State())
hopGroup := gnmi.Get[*oc.NetworkInstance_Afts_NextHopGroup](t, bs.DUT, aftsPath.NextHopGroup(ipv4Entry.GetNextHopGroup()).State())
if got, want := len(hopGroup.NextHop), tc.expectedPaths; got != want {
t.Errorf("prefix: %s, found %d hops, want %d", ipv4Entry.GetPrefix(), got, want)
if deviations.BgpMaxMultipathPathsUnsupported(bs.DUT) {
tc.expectedPaths = 3
} else {
if got, want := len(hopGroup.NextHop), tc.expectedPaths; got != want {
t.Errorf("prefix: %s, found %d hops, want %d", ipv4Entry.GetPrefix(), got, want)
}
}

sleepTime := time.Duration(totalPackets/trafficPps) + 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ platform_exceptions: {
}
deviations: {
ipv4_missing_enabled: true
skip_afi_safi_path_for_bgp_multiple_as: true
}
}
platform_exceptions: {
platform: {
vendor: JUNIPER
}
deviations: {
bgp_max_multipath_paths_unsupported: true
}
}
platform_exceptions: {
Expand All @@ -37,3 +46,4 @@ platform_exceptions: {
}
}
tags: TAGS_DATACENTER_EDGE

Loading

0 comments on commit e6e8f0f

Please sign in to comment.