Skip to content

Commit

Permalink
Merge branch 'main' into patch-6
Browse files Browse the repository at this point in the history
  • Loading branch information
dplore authored Oct 29, 2024
2 parents 6d996c0 + 4906b43 commit 1c8c277
Show file tree
Hide file tree
Showing 56 changed files with 5,350 additions and 1,313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,24 @@ func bgpCreateNbr(bgpParams *bgpTestParams, dut *ondatra.DUTDevice) *oc.NetworkI
global := bgp.GetOrCreateGlobal()
global.As = ygot.Uint32(bgpParams.localAS)
global.RouterId = ygot.String(dutAttrs.IPv4)
global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)

// Note: we have to define the peer group even if we aren't setting any policy because it's
// invalid OC for the neighbor to be part of a peer group that doesn't exist.
pg := bgp.GetOrCreatePeerGroup(peerGrpName)
pg.PeerAs = ygot.Uint32(dutAS)
pg.PeerGroupName = ygot.String(peerGrpName)
pgT := pg.GetOrCreateTransport()
pgT.LocalAddress = ygot.String(dutAttrs.IPv4)
pg.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)

nv4 := bgp.GetOrCreateNeighbor(ateAttrs.IPv4)
nv4.PeerGroup = ygot.String(peerGrpName)
nv4.PeerAs = ygot.Uint32(ateAS)
nv4.Enabled = ygot.Bool(true)

nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
nv4T := nv4.GetOrCreateTransport()
nv4T.LocalAddress = ygot.String(dutAttrs.IPv4)
nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)

switch bgpParams.transportMode {
Expand Down Expand Up @@ -152,10 +158,15 @@ func bgpClearConfig(t *testing.T, dut *ondatra.DUTDevice) {
}

// verifyBgpTelemetry checks that the dut has an established BGP session with reasonable settings.
func verifyBgpTelemetry(t *testing.T, dut *ondatra.DUTDevice, wantState oc.E_Bgp_Neighbor_SessionState, transMode string) {
func verifyBgpTelemetry(t *testing.T, dut *ondatra.DUTDevice, wantState oc.E_Bgp_Neighbor_SessionState, transMode string, transModeOnATE string) {
statePath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp()
nbrPath := statePath.Neighbor(ateAttrs.IPv4)

if deviations.BgpSessionStateIdleInPassiveMode(dut) {
if transModeOnATE == nbrLvlPassive || transModeOnATE == peerLvlPassive {
t.Logf("BGP session state idle is supported in passive mode, transMode: %s, transModeOnATE: %s", transMode, transModeOnATE)
wantState = oc.Bgp_Neighbor_SessionState_IDLE
}
}
// Get BGP adjacency state
t.Log("Checking BGP neighbor to state...")
_, ok := gnmi.Watch(t, dut, nbrPath.SessionState().State(), time.Minute, func(val *ygnmi.Value[oc.E_Bgp_Neighbor_SessionState]) bool {
Expand All @@ -168,12 +179,16 @@ func verifyBgpTelemetry(t *testing.T, dut *ondatra.DUTDevice, wantState oc.E_Bgp
}
status := gnmi.Get(t, dut, nbrPath.SessionState().State())
t.Logf("BGP adjacency for %s: %s", ateAttrs.IPv4, status)
t.Logf("wantState: %s, status: %s", wantState, status)
if status != wantState {
t.Errorf("BGP peer %s status got %d, want %d", ateAttrs.IPv4, status, wantState)
}

nbrTransMode := gnmi.Get(t, dut, nbrPath.Transport().State())
pgTransMode := gnmi.Get(t, dut, statePath.PeerGroup(peerGrpName).Transport().State())
t.Logf("Neighbor level passive mode is set to %v on DUT", nbrTransMode.GetPassiveMode())
t.Logf("Peer group level passive mode is set to %v on DUT", pgTransMode.GetPassiveMode())

// Check transport mode telemetry.
switch transMode {
case nbrLvlPassive:
Expand Down Expand Up @@ -223,9 +238,11 @@ func configureATE(t *testing.T, ateParams *bgpTestParams) gosnappi.Config {

switch ateParams.transportMode {
case nbrLvlPassive:
peerBGP.Advanced().SetPassiveMode(true)
case peerLvlPassive:
peerBGP.Advanced().SetPassiveMode(true)
case peerLvlActive:
peerBGP.Advanced().SetPassiveMode(false)
case nbrLvlActive:
peerBGP.Advanced().SetPassiveMode(false)
}
Expand All @@ -234,7 +251,7 @@ func configureATE(t *testing.T, ateParams *bgpTestParams) gosnappi.Config {
}

func verifyOTGBGPTelemetry(t *testing.T, otg *otg.OTG, c gosnappi.Config) {
//nbrPath := gnmi.OTG().BgpPeer("ateSrc.BGP4.peer")
// nbrPath := gnmi.OTG().BgpPeer("ateSrc.BGP4.peer")
t.Log("OTG telemetry does not support checking transport mode.")
}

Expand Down Expand Up @@ -314,7 +331,7 @@ func TestBgpSessionModeConfiguration(t *testing.T) {
ate.OTG().StartProtocols(t)

t.Logf("Verify BGP telemetry")
verifyBgpTelemetry(t, dut, tc.wantBGPState, tc.dutTransportMode)
verifyBgpTelemetry(t, dut, tc.wantBGPState, tc.dutTransportMode, tc.otgTransportMode)

t.Logf("Verify BGP telemetry on otg")
verifyOTGBGPTelemetry(t, ate.OTG(), tc.ateConf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platform_exceptions: {
deviations: {
ipv4_missing_enabled: true
connect_retry: true
bgp_session_state_idle_in_passive_mode: true
}
}
platform_exceptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
package bgp_multipath_ecmp_test

import (
"slices"
"math/rand"
"sort"
"strconv"
"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 @@ -40,9 +38,8 @@ const (
prefixesCount = 4
pathID = 1
maxPaths = 2
trafficPps = 100000
kneTrafficPps = 1000
totalPackets = 12000000
trafficPps = 1000
totalPackets = 120000
lossTolerancePct = 0
lbToleranceFms = 20
)
Expand All @@ -51,16 +48,12 @@ func TestMain(m *testing.M) {
fptest.RunTests(m)
}

var (
kneDeviceModelList = []string{"ncptx"}
)

func configureOTG(t *testing.T, bs *cfgplugins.BGPSession) {
devices := bs.ATETop.Devices().Items()
byName := func(i, j int) bool { return devices[i].Name() < devices[j].Name() }
sort.Slice(devices, byName)
for i, otgPort := range bs.ATEPorts {
if i == 0 {
if i < 2 {
continue
}

Expand Down Expand Up @@ -98,7 +91,7 @@ func configureFlow(t *testing.T, bs *cfgplugins.BGPSession) {
bs.ATETop.Flows().Clear()

var rxNames []string
for i := 1; i < len(bs.ATEPorts); i++ {
for i := 2; i < len(bs.ATEPorts); i++ {
rxNames = append(rxNames, bs.ATEPorts[i].Name+".BGP4.peer.rr4")
}
flow := bs.ATETop.Flows().Add().SetName("flow")
Expand All @@ -110,10 +103,6 @@ func configureFlow(t *testing.T, bs *cfgplugins.BGPSession) {
flow.Size().SetFixed(1500)
flow.Rate().SetPps(trafficPps)

if slices.Contains(kneDeviceModelList, bs.DUT.Model()) {
flow.Rate().SetPps(kneTrafficPps)
}

e := flow.Packet().Add().Ethernet()
e.Src().SetValue(bs.ATEPorts[0].MAC)
v4 := flow.Packet().Add().Ipv4()
Expand All @@ -135,7 +124,7 @@ func verifyECMPLoadBalance(t *testing.T, ate *ondatra.ATEDevice, pc int, expecte
max := expectedPerLinkFms + (expectedPerLinkFms * lbToleranceFms / 100)

got := 0
for i := 2; i <= pc; i++ {
for i := 3; i <= pc; i++ {
framesRx := gnmi.Get(t, ate.OTG(), gnmi.OTG().Port(ate.Port(t, "port"+strconv.Itoa(i)).ID()).Counters().InFrames().State())
if framesRx <= lbToleranceFms {
t.Logf("Skip: Traffic through port%d interface is %d", i, framesRx)
Expand Down Expand Up @@ -203,7 +192,7 @@ func TestBGPSetup(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
bs := cfgplugins.NewBGPSession(t, cfgplugins.PortCount4, nil)
bs.WithEBGP(t, []oc.E_BgpTypes_AFI_SAFI_TYPE{oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST}, []string{"port2", "port3", "port4"}, true, !tc.enableMultiAS)
bs.WithEBGP(t, []oc.E_BgpTypes_AFI_SAFI_TYPE{oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST}, []string{"port3", "port4"}, true, !tc.enableMultiAS)
dni := deviations.DefaultNetworkInstance(bs.DUT)
bgp := bs.DUTConf.GetOrCreateNetworkInstance(dni).GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").GetOrCreateBgp()
gEBGP := bgp.GetOrCreateGlobal().GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).GetOrCreateUseMultiplePaths().GetOrCreateEbgp()
Expand All @@ -212,7 +201,7 @@ func TestBGPSetup(t *testing.T) {
t.Logf("Enable Multipath")
pgUseMulitplePaths.Enabled = ygot.Bool(true)
t.Logf("Enable Maximum Paths")
gEBGP.MaximumPaths = ygot.Uint32(maxPaths)
bgp.GetOrCreateGlobal().GetOrCreateUseMultiplePaths().GetOrCreateEbgp().MaximumPaths = ygot.Uint32(maxPaths)
}
if tc.enableMultiAS && !deviations.SkipSettingAllowMultipleAS(bs.DUT) && deviations.SkipAfiSafiPathForBgpMultipleAs(bs.DUT) {
t.Logf("Enable MultiAS ")
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_setting_allow_multiple_as: true
skip_afi_safi_path_for_bgp_multiple_as: true
}
}
Expand All @@ -20,6 +21,7 @@ platform_exceptions: {
}
deviations: {
bgp_max_multipath_paths_unsupported: true
multipath_unsupported_neighbor_or_afisafi: true
}
}
platform_exceptions: {
Expand All @@ -42,8 +44,7 @@ platform_exceptions: {
interface_enabled: true
default_network_instance: "default"
missing_value_for_defaults: true
skip_setting_allow_multiple_as: false
skip_setting_allow_multiple_as: true
}
}
tags: TAGS_DATACENTER_EDGE

tags: TAGS_DATACENTER_EDGE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

Validate BGP in multipath UCMP support with link bandwidth community

NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/issues/3520

## Testbed type

[TESTBED_DUT_ATE_4LINKS](https://github.com/openconfig/featureprofiles/blob/main/topologies/atedut_4.testbed)
Expand All @@ -23,7 +21,7 @@ NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/
* Enable an Accept-route all import-policy/export-policy for eBGP session
under the neighbor AFI/SAFI - IPv6 unicast and IPv4 unicast.
* Create an single IPv4 internal target network attached to ATE port 2 and 3
* [TODO] Create an single IPv6 internal target network attached to ATE port 2 and 3
* Create an single IPv6 internal target network attached to ATE port 2 and 3


### Tests
Expand All @@ -33,13 +31,13 @@ NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/
* Test Configuration
* Configure ATE port 1, 2 and 3 on different AS, with boths AFI/SAFI
* Advertise IPv4 and IPv6 internal target, both, form both ATE port-1 and ATE port-2 in eBGP.
* [TODO] For ATE port 2 attach `link-bandwidth:23456:10K` extended-community
* [TODO] For ATE port 3 attach `link-bandwidth:23456:5K` extended-community
* For ATE port 2 attach `link-bandwidth:23456:10K` extended-community
* For ATE port 3 attach `link-bandwidth:23456:5K` extended-community
* Enable multipath, set maximum-paths limit to 2, enable allow multiple
AS, and send community type to [STANDARD, EXTENDED, LARGE]
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/use-multiple-paths/config/enabled
* [TODO] /network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as
* [TODO] /network-instances/network-instance/protocols/protocol/bgp/globalp/afi-safis/afi-safi/use-multiple-paths/ebgp/config/maximum-paths
* /network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as
* /network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/maximum-paths
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/config/send-community-type
* /network-instances/network-instance/protocols/protocol/bgp/global/use-multiple-paths/ebgp/link-bandwidth-ext-community/config/enabled
* Advertise equal cost paths from port2 and port3 of ATE
Expand All @@ -48,20 +46,20 @@ NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/
* Use UDP traffic with src and dst port randomly selected from 1-65535 range for each packet. Or equivalent pattern guaranteeng high entropy of traffic.
* Behaviour Validation
* Check entries in AFT for advertised prefix, it should have 2 entries.\
[TODO] The `weight` leafs of next-hops shall be in 2:1 ratio.
The `weight` leafs of next-hops shall be in 2:1 ratio.
* Find next-hop-group IDs for both internal target networks:
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv4 internal target network]/state/**next-hop-group**
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv6 internal target network]/state/**next-hop-group**
* using next-hop-group as key find number and weight of next-hops of both internal target network
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/index
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/**weight**
* [TODO] Check entire traffic should be unequally forwarded between DUT
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 66% via port2
* 33% via port3
* with +/-5% tolerance

* [TODO] RT-1.52.2: Verify use of equal community type
* RT-1.52.2: Verify use of equal community type

* Test Configuration
Use test configuration as in RT-1.52.1 above with following modifications:
Expand All @@ -70,20 +68,20 @@ NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/
* For ATE port 3 attach `link-bandwidth:23456:10K` extended-community
* Behaviour Validation
* Check entries in AFT for advertised prefix, it should have 2 entries.\
[TODO] The `weight` leafs of next-hops shall be in 1:1 ratio.
The `weight` leafs of next-hops shall be in 1:1 ratio.
* Find next-hop-group IDs for both internal target networks:
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv4 internal target network]/state/**next-hop-group**
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv6 internal target network]/state/**next-hop-group**
* using next-hop-group as key find number and weight of next-hops of both internal target network
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/index
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/**weight**
* [TODO] Check entire traffic should be unequally forwarded between DUT
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 50% via port2
* 50% via port3
* with +/-5% tolerance

* [TODO] RT-1.52.3: Verify BGP multipath when some path missing link-bandwidth extended-community
* RT-1.52.3: Verify BGP multipath when some path missing link-bandwidth extended-community

* Test Configuration
Use test configuration as in RT-1.52.1 above with following modifications:
Expand All @@ -93,40 +91,38 @@ NOTE: [TODO] items are tracked at https://github.com/openconfig/featureprofiles/
* For ATE port 3 **DO NOT** attach any link-bandwidth extended-community
* Behaviour Validation
* Check entries in AFT for advertised prefix, it should have 2 entries.\
[TODO] The `weight` leafs of next-hops shall be in 1:1 ratio.
The `weight` leafs of next-hops shall be in 1:1 ratio.
* Find next-hop-group IDs for both internal target networks:
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv4 internal target network]/state/**next-hop-group**
* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry[prefix=IPv6 internal target network]/state/**next-hop-group**
* using next-hop-group as key find number and weight of next-hops of both internal target network
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/index
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=next-hop-group ID]/next-hops/next-hop/state/**weight**
* [TODO] Check entire traffic should be unequally forwarded between DUT
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 50% via port2
* 50% via port3
* with +/-5% tolerance


## Config Parameter Coverage

* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/use-multiple-paths/config/enabled
* /network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as
* /network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/maximum-paths
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/config/send-community-type
* /network-instances/network-instance/protocols/protocol/bgp/global/use-multiple-paths/ebgp/link-bandwidth-ext-community/config/enabled

## Telemetry Parameter Coverage

* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry/state/next-hop-group
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group[id=<id>]/next-hops/next-hop[index=<index>]/state/weight

## OpenConfig Path and RPC Coverage

```yaml
rpcs:
gnmi:
gNMI.Get:
gNMI.Subscribe:
paths:
## Config Parameter Coverage
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/use-multiple-paths/config/enabled:
/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as:
/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/use-multiple-paths/ebgp/config/maximum-paths:
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/config/send-community-type:
/network-instances/network-instance/protocols/protocol/bgp/global/use-multiple-paths/ebgp/link-bandwidth-ext-community/config/enabled:

## Telemetry Parameter Coverage
/network-instances/network-instance/afts/ipv4-unicast/ipv4-entry/state/next-hop-group:
/network-instances/network-instance/afts/next-hop-groups/next-hop-group/next-hops/next-hop/state/weight:

```
## Required DUT platform

Expand Down
Loading

0 comments on commit 1c8c277

Please sign in to comment.