Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sudhinj/featureprofiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhinj committed Oct 29, 2024
2 parents e476a0a + e37574e commit d89eb06
Show file tree
Hide file tree
Showing 105 changed files with 6,585 additions and 1,676 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/feature/security @mihirpitale-googler
/feature/staticroute/ @swetha-haridasula
/feature/stp/ @alokmtri-g
/feature/system @self-maurya
/feature/system @swetha-haridasula
/feature/vrrp @amrindrr

# Common OTG utilities
Expand Down
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 @@ -174,6 +180,9 @@ func verifyBgpTelemetry(t *testing.T, dut *ondatra.DUTDevice, wantState oc.E_Bgp

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 +232,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 +245,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
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 @@ -19,43 +19,90 @@ Validate BGP in multipath UCMP support with link bandwidth community
* ATE port-2 and DUT port-2
* ATE port-3 and DUT port-3
* Enable an Accept-route all import-policy/export-policy for eBGP session
under the neighbor AFI/SAFI
* Create an IPv4 internal target network attached to ATE port 2 and 3
under the neighbor AFI/SAFI - IPv6 unicast and IPv4 unicast.
* Create an single IPv4 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

* RT-1.52.1: Verify use of community type

* Configure ATE port 1, 2 and 3 on different AS
* Enable multipath, set maximum-paths limit to 2, enable allow multiple
AS, and send community type to BOTH (STANDARD and EXTENDED)
* /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/peer-groups/peer-group/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/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/peer-groups/peer-group/use-multiple-paths/ebgp/link-bandwidth-ext-community/config/enabled
* Advertise equal cost paths from port2 and port3 of ATE
* Check entries in FIB for advertised prefix, it should have 2 entries
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group/next-hops
* Initiate traffic from ATE port-1 to the DUT and destined to internal
target network
* Check entire traffic should only be unequally forwarded between DUT
port2 and port3

## 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/peer-groups/peer-group/afi-safis/afi-safi/use-multiple-paths/ebgp/config/allow-multiple-as
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/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/peer-groups/peer-group/use-multiple-paths/ebgp/link-bandwidth-ext-community/config/enabled

## Telemetry Parameter Coverage

* /network-instances/network-instance/afts/ipv4-unicast/ipv4-entry/state
* /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>]/state
* /network-instances/network-instance/afts/next-hop-groups/next-hop-group/next-hops
* RT-1.52.1: Verify use of unequal community type

* 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.
* 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
* /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
* Initiate traffic from ATE port-1 to the DUT and destined to internal
target network.
* 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.\
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**
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 66% via port2
* 33% via port3
* with +/-5% tolerance

* 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:
* Advertise IPv4 and IPv6 internal target, both, form both ATE port-1 and ATE port-2 in eBGP.
* For ATE port 2 attach `link-bandwidth:23456:10K` extended-community
* 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.\
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**
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 50% via port2
* 50% via port3
* with +/-5% tolerance

* 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:
* 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.
* For ATE port 2 attach `link-bandwidth:23456:10K` extended-community
* 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.\
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**
* Check entire traffic should be unequally forwarded between DUT
port2 and port3 only
* 50% via port2
* 50% via port3
* with +/-5% tolerance

## OpenConfig Path and RPC Coverage

Expand All @@ -64,6 +111,18 @@ 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 d89eb06

Please sign in to comment.