Skip to content

Commit

Permalink
Merge branch 'main' into healthz_cisco
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeya-remilla authored Sep 24, 2024
2 parents 5c80e2b + 275b0c1 commit 6891655
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func configureDUTLinkLocalInterface(t *testing.T, dut *ondatra.DUTDevice) {
if deviations.InterfaceEnabled(dut) && !deviations.IPv4MissingEnabled(dut) {
dstSubInt4.Enabled = ygot.Bool(true)
}
dutDst.IPv6Len = 128
if deviations.LinkLocalMaskLen(dut) {
dutDst.IPv6Len = 128
}
Expand Down
18 changes: 11 additions & 7 deletions feature/sflow/otg_tests/sflow_base_test/sflow_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ var (
IPv6Len: plenIPv6,
MAC: "02:00:02:01:01:01",
}

loopbackSubIntfNum = 1

dutlo0Attrs = attrs.Attributes{
Desc: "Loopback ip",
IPv4: "203.0.113.1",
Expand Down Expand Up @@ -173,7 +176,12 @@ func TestSFlowTraffic(t *testing.T) {

ate := ondatra.ATE(t, "ate")

loopbackIntfName := netutil.LoopbackInterface(t, dut, 1)
switch dut.Vendor() {
case ondatra.JUNIPER:
loopbackSubIntfNum = 0
}

loopbackIntfName := netutil.LoopbackInterface(t, dut, loopbackSubIntfNum)

// Configure DUT
if !deviations.InterfaceConfigVRFBeforeAddress(dut) {
Expand All @@ -200,7 +208,7 @@ func TestSFlowTraffic(t *testing.T) {

t.Run("SFLOW-1.1_ReplaceDUTConfigSFlow", func(t *testing.T) {
sfBatch := &gnmi.SetBatch{}
cfgplugins.NewSFlowGlobalCfg(t, sfBatch, nil, dut, mgmtVRF, loopbackIntfName)
cfgplugins.NewSFlowGlobalCfg(t, sfBatch, nil, dut, mgmtVRF, loopbackIntfName, dutlo0Attrs.IPv4, dutlo0Attrs.IPv6)
sfBatch.Set(t, dut)

gotSamplingConfig := gnmi.Get(t, dut, gnmi.OC().Sampling().Sflow().Config())
Expand Down Expand Up @@ -239,10 +247,6 @@ func TestSFlowTraffic(t *testing.T) {
testFlowFixed(t, ate, config, IPv6)
})
})

defer func() {
gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(mgmtVRF).Config())
}()
}

func testFlowFixed(t *testing.T, ate *ondatra.ATEDevice, config gosnappi.Config, ip IPType) {
Expand Down Expand Up @@ -354,7 +358,7 @@ func addInterfacesToVRF(t *testing.T, dut *ondatra.DUTDevice, vrfname string, in
}

func configureLoopbackOnDUT(t *testing.T, dut *ondatra.DUTDevice) {
loopbackIntfName := netutil.LoopbackInterface(t, dut, 1)
loopbackIntfName := netutil.LoopbackInterface(t, dut, loopbackSubIntfNum)
loop := dutlo0Attrs.NewOCInterface(loopbackIntfName, dut)
loop.Type = oc.IETFInterfaces_InterfaceType_softwareLoopback
loop.Description = ygot.String(fmt.Sprintf("Port %s", loopbackIntfName))
Expand Down
18 changes: 5 additions & 13 deletions internal/cfgplugins/sflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// configuration including any deviations for the device.
// If sfglobal is nil, default values are provided.
// The SFlow configuration is returned to give the caller an option to override default values.
func NewSFlowGlobalCfg(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_Sflow, d *ondatra.DUTDevice, ni, intfName string) *oc.Sampling_Sflow {
func NewSFlowGlobalCfg(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_Sflow, d *ondatra.DUTDevice, ni, intfName string, srcAddrV4 string, srcAddrV6 string) *oc.Sampling_Sflow {
c := new(oc.Sampling_Sflow)

if newcfg == nil {
Expand All @@ -41,7 +41,7 @@ func NewSFlowGlobalCfg(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_S
c.Dscp = ygot.Uint8(8)
c.GetOrCreateInterface(d.Port(t, "port1").Name()).Enabled = ygot.Bool(true)
c.GetOrCreateInterface(d.Port(t, "port2").Name()).Enabled = ygot.Bool(true)
coll := NewSFlowCollector(t, batch, nil, d, ni, intfName)
coll := NewSFlowCollector(t, batch, nil, d, ni, intfName, srcAddrV4, srcAddrV6)
for _, col := range coll {
c.AppendCollector(col)
}
Expand All @@ -56,7 +56,7 @@ func NewSFlowGlobalCfg(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_S

// NewSFlowCollector creates a collector to be appended to SFlowConfig.
// If sfc is nil, default values are provided.
func NewSFlowCollector(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_Sflow_Collector, d *ondatra.DUTDevice, ni, intfName string) []*oc.Sampling_Sflow_Collector {
func NewSFlowCollector(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_Sflow_Collector, d *ondatra.DUTDevice, ni, intfName string, srcAddrV4 string, srcAddrV6 string) []*oc.Sampling_Sflow_Collector {
coll := []*oc.Sampling_Sflow_Collector{}

if newcfg == nil {
Expand All @@ -76,11 +76,7 @@ func NewSFlowCollector(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_S
helpers.GnmiCLIConfig(t, d, sFlowSourceAddressCli)
}
} else {
addresses := []string{}
for _, addr := range intf.GetSubinterface(0).GetIpv4().Address {
addresses = append(addresses, addr.GetIp())
}
cV4.SetSourceAddress(addresses[0])
cV4.SetSourceAddress(srcAddrV4)
}
cV4.SetNetworkInstance(ni)
coll = append(coll, cV4)
Expand All @@ -98,11 +94,7 @@ func NewSFlowCollector(t *testing.T, batch *gnmi.SetBatch, newcfg *oc.Sampling_S
helpers.GnmiCLIConfig(t, d, sFlowSourceAddressCli)
}
} else {
addresses := []string{}
for _, addr := range intf.GetSubinterface(0).GetIpv6().Address {
addresses = append(addresses, addr.GetIp())
}
cV6.SetSourceAddress(addresses[0])
cV6.SetSourceAddress(srcAddrV6)
}
cV6.SetNetworkInstance(ni)
coll = append(coll, cV6)
Expand Down
1 change: 1 addition & 0 deletions internal/fptest/runtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func testbedPathFromMetadata() (string, error) {
mpb.Metadata_TESTBED_DUT_ATE_9LINKS_LAG: "atedut_9_lag.testbed",
mpb.Metadata_TESTBED_DUT_DUT_ATE_2LINKS: "dutdutate.testbed",
mpb.Metadata_TESTBED_DUT_ATE_8LINKS: "atedut_8.testbed",
mpb.Metadata_TESTBED_DUT_400ZR: "dut_400zr.testbed",
}
testbedFile, ok := testbedToFile[testbed]
if !ok {
Expand Down
16 changes: 8 additions & 8 deletions testregistry.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -381,19 +381,19 @@ test: {
test: {
id: "PF-1.1"
description: "IPv4/IPv6 policy-forwarding to indirect NH matching DSCP/TC"
readme: "https://github.com/openconfig/featureprofiles/feature/policy_forwarding/otg_tests/match_dscp_indirect_next_hop/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/policy_forwarding/otg_tests/match_dscp_indirect_next_hop/README.md"
exec: " "
}
test: {
id: "PF-1.2"
description: "Policy-based traffic GRE Encapsulation to IPv4 GRE tunnel"
readme: "https://github.com/openconfig/featureprofiles/feature/policy_forwarding/encapsulation/otg_tests/encap_gre_ipv4/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/policy_forwarding/encapsulation/otg_tests/encap_gre_ipv4/README.md"
exec: " "
}
test: {
id: "PLT-1.1"
description: "Interface breakout Test"
readme: "https://github.com/openconfig/featureprofiles/feature/experimental/platform/tests/breakout_configuration/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/experimental/platform/tests/breakout_configuration/README.md"
exec: " "
}
test: {
Expand Down Expand Up @@ -568,17 +568,17 @@ test: {
test: {
id: "RT-1.32"
description: "BGP policy actions - MED, LocPref, prepend, flow-control"
readme: "https://github.com/openconfig/featureprofiles/feature/bgp/policybase/otg_tests/actions-MED_LocPref_prepend_flow-control/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/bgp/policybase/otg_tests/actions-MED_LocPref_prepend_flow-control/README.md"
exec: " "
}
test: {
id: "RT-1.33"
readme: "https://github.com/openconfig/featureprofiles/feature/bgp/policybase/otg_tests/prefix_set_test/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/bgp/policybase/otg_tests/prefix_set_test/README.md"
}
test: {
id: "RT-1.34"
description: "Administrative Distance test for iBGP and eBGP"
readme: "https://github.com/openconfig/featureprofiles/feature/bgp/admin_distance/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/bgp/admin_distance/README.md"
exec: " "
}
test: {
Expand Down Expand Up @@ -679,7 +679,7 @@ test: {
test: {
id: "RT-2.2"
description: "IS-IS LSP Updates"
readme: "https://github.com/openconfig/featureprofiles/feature/experimental/isis/otg_tests/lsp_updates_test/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/experimental/isis/otg_tests/lsp_updates_test/README.md"
}
test: {
id: "RT-2.6"
Expand Down Expand Up @@ -1520,7 +1520,7 @@ test: {
test: {
id: "gNMI-1.20"
description: "Telemetry: Optics Thresholds"
readme: "https://github.com/openconfig/featureprofiles/feature/experimental/platform/tests/optics_thresholds_test/README.md"
readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/experimental/platform/tests/optics_thresholds_test/README.md"
exec: " "
}
test: {
Expand Down

0 comments on commit 6891655

Please sign in to comment.