Skip to content

Commit

Permalink
fix BGP multipath ECMP test
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya committed Oct 23, 2024
1 parent dcbc957 commit eaa4f57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
package bgp_multipath_ecmp_test

import (
"math/rand"
"slices"
"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 Down Expand Up @@ -60,7 +59,7 @@ func configureOTG(t *testing.T, bs *cfgplugins.BGPSession) {
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 +97,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 Down Expand Up @@ -135,7 +134,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,16 +202,16 @@ 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()
pgUseMulitplePaths := bgp.GetOrCreatePeerGroup(cfgplugins.BGPPeerGroup1).GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).GetOrCreateUseMultiplePaths()
pgUseMultiplePaths := 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)
pgUseMultiplePaths.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

0 comments on commit eaa4f57

Please sign in to comment.