Skip to content

Commit

Permalink
Merge branch 'main' into TE-3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
cprabha authored May 31, 2024
2 parents 884a57c + 57039f2 commit 29279a1
Show file tree
Hide file tree
Showing 98 changed files with 3,703 additions and 1,828 deletions.
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

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 29279a1

Please sign in to comment.