Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix BGP multipath ECMP test #3534

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading