From 9dbadd5440efaa355392e4c9536b8b07c12d440e Mon Sep 17 00:00:00 2001 From: Pramod Maurya Date: Thu, 24 Oct 2024 20:55:24 +0530 Subject: [PATCH] fix BGP multipath ECMP test (#3534) --- .../bgp_multipath_ecmp_test.go | 27 ++++++------------- .../metadata.textproto | 7 ++--- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/bgp_multipath_ecmp_test.go b/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/bgp_multipath_ecmp_test.go index 6991c940414..f22f1b4ed3c 100644 --- a/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/bgp_multipath_ecmp_test.go +++ b/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/bgp_multipath_ecmp_test.go @@ -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" @@ -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 ) @@ -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 } @@ -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") @@ -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() @@ -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) @@ -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() @@ -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 ") diff --git a/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/metadata.textproto b/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/metadata.textproto index 7c594707925..905c4d35d27 100644 --- a/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/metadata.textproto +++ b/feature/bgp/multipath/otg_tests/bgp_multipath_ecmp_test/metadata.textproto @@ -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 } } @@ -20,6 +21,7 @@ platform_exceptions: { } deviations: { bgp_max_multipath_paths_unsupported: true + multipath_unsupported_neighbor_or_afisafi: true } } platform_exceptions: { @@ -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 \ No newline at end of file