Skip to content
Open
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 @@ -25,7 +25,6 @@ platform_exceptions: {
deviations: {
interface_enabled: true
explicit_dco_config: true
eth_channel_ingress_parameters_unsupported: true
breakout_mode_unsupported_for_eight_hundred_gb: true
port_speed_duplex_mode_unsupported_for_interface_config: true
explicit_breakout_interface_config: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ platform_exceptions: {
deviations: {
interface_enabled: true
explicit_dco_config: true
eth_channel_ingress_parameters_unsupported: true
breakout_mode_unsupported_for_eight_hundred_gb: true
port_speed_duplex_mode_unsupported_for_interface_config: true
explicit_breakout_interface_config: true
Expand Down
1 change: 1 addition & 0 deletions internal/fptest/runtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func testbedPathFromMetadata() (string, error) {
mpb.Metadata_TESTBED_DUT_ATE_8LINKS: "atedut_8.testbed",
mpb.Metadata_TESTBED_DUT_400ZR: "dut_400zr.testbed",
mpb.Metadata_TESTBED_DUT_400ZR_PLUS: "dut_400zr_plus.testbed",
mpb.Metadata_TESTBED_DUT_800ZR: "dut_800zr.testbed",
mpb.Metadata_TESTBED_DUT_400ZR_100G_4LINKS: "dut_400zr_100g_4links.testbed",
mpb.Metadata_TESTBED_DUT_400FR_100G_4LINKS: "dut_400fr_100g_4links.testbed",
mpb.Metadata_TESTBED_DUT_2LINKS: "dut_2links.testbed",
Expand Down
34 changes: 4 additions & 30 deletions internal/telemetry/transceiver/zr_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TerminalDevicePathsTest(t *testing.T, tp *TunableParamters) {

t.Logf("\n*** Configure interfaces with Operational Mode: %v, Optical Frequency: %v, Target Power: %v\n\n\n", operationalMode, frequency, targetOpticalPower)
params := &cfgplugins.ConfigParameters{
Enabled: false, // Set to false to avoid the interface being enabled at startup.
Enabled: true,
Frequency: frequency,
TargetOpticalPower: targetOpticalPower,
OperationalMode: operationalMode,
Expand All @@ -84,18 +84,6 @@ func TerminalDevicePathsTest(t *testing.T, tp *TunableParamters) {
defer interfaceStreams[p.Name()].Close()
}

// Ensure all interfaces are DOWN after the config push.
for _, p := range dut.Ports() {
validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, interfaceStreams[p.Name()])
validateOTNChannelTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, otnStreams[p.Name()])
validateEthernetChannelTelemetry(t, dut, p, params, ethStreams[p.Name()])
}

t.Logf("\n*** Bringing UP all interfaces\n\n\n")
for _, p := range dut.Ports() {
params.Enabled = true
cfgplugins.ToggleInterfaceState(t, dut, p, params)
}
for _, p := range dut.Ports() {
validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, interfaceStreams[p.Name()])
validateOTNChannelTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, otnStreams[p.Name()])
Expand Down Expand Up @@ -152,7 +140,7 @@ func PlatformPathsTest(t *testing.T, tp *TunableParamters) {

t.Logf("\n*** Configure interfaces with Operational Mode: %v, Optical Frequency: %v, Target Power: %v\n\n\n", operationalMode, frequency, targetOpticalPower)
params := &cfgplugins.ConfigParameters{
Enabled: false, // Set to false to avoid the interface being enabled at startup.
Enabled: true,
Frequency: frequency,
TargetOpticalPower: targetOpticalPower,
OperationalMode: operationalMode,
Expand Down Expand Up @@ -180,24 +168,10 @@ func PlatformPathsTest(t *testing.T, tp *TunableParamters) {
defer tempSensorStreams[p.Name()].Close()
}

// Ensure all interfaces are DOWN after the config push.
for _, p := range dut.Ports() {
validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, interfaceStreams[p.Name()])
validateTranscieverTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, trStreams[p.Name()])
validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, tempSensorStreams[p.Name()])
validateOpticalChannelTelemetry(t, p, params, oc.Interface_OperStatus_DOWN, ochStreams[p.Name()])
validateHWPortTelemetry(t, dut, p, params, hwPortStreams[p.Name()])
}

t.Logf("\n*** Bringing UP all interfaces\n\n\n")
for _, p := range dut.Ports() {
params.Enabled = true
cfgplugins.ToggleInterfaceState(t, dut, p, params)
}
for _, p := range dut.Ports() {
validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, interfaceStreams[p.Name()])
validateTranscieverTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, trStreams[p.Name()])
validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, tempSensorStreams[p.Name()])
validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, tempSensorStreams[p.Name()])
validateOpticalChannelTelemetry(t, p, params, oc.Interface_OperStatus_UP, ochStreams[p.Name()])
validateHWPortTelemetry(t, dut, p, params, hwPortStreams[p.Name()])
}
Comment on lines 171 to 177
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block of code for validating the 'UP' state of platform telemetry is duplicated later in the function (lines 191-197). To improve maintainability and reduce redundancy, consider extracting this logic into a dedicated helper function, for example validatePlatformTelemetryUp, and call it here and on line 191.

Here's a possible implementation for the helper function:

func validatePlatformTelemetryUp(t *testing.T, dut *ondatra.DUTDevice, params *cfgplugins.ConfigParameters, interfaceStreams map[string]*samplestream.SampleStream[*oc.Interface], trStreams map[string]*samplestream.SampleStream[*oc.Component], tempSensorStreams map[string]*samplestream.SampleStream[*oc.Component], ochStreams map[string]*samplestream.SampleStream[*oc.Component], hwPortStreams map[string]*samplestream.SampleStream[*oc.Component]) {
	t.Helper()
	for _, p := range dut.Ports() {
		validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, interfaceStreams[p.Name()])
		validateTranscieverTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, trStreams[p.Name()])
		validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, tempSensorStreams[p.Name()])
		validateOpticalChannelTelemetry(t, p, params, oc.Interface_OperStatus_UP, ochStreams[p.Name()])
		validateHWPortTelemetry(t, dut, p, params, hwPortStreams[p.Name()])
	}
}
				validatePlatformTelemetryUp(t, dut, params, interfaceStreams, trStreams, tempSensorStreams, ochStreams, hwPortStreams)

Expand All @@ -223,7 +197,7 @@ func PlatformPathsTest(t *testing.T, tp *TunableParamters) {
for _, p := range dut.Ports() {
validateInterfaceTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, interfaceStreams[p.Name()])
validateTranscieverTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, trStreams[p.Name()])
validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_DOWN, tempSensorStreams[p.Name()])
validateTempSensorTelemetry(t, dut, p, params, oc.Interface_OperStatus_UP, tempSensorStreams[p.Name()])
validateOpticalChannelTelemetry(t, p, params, oc.Interface_OperStatus_UP, ochStreams[p.Name()])
validateHWPortTelemetry(t, dut, p, params, hwPortStreams[p.Name()])
}
Expand Down
Loading