Skip to content

Conversation

@snaragund
Copy link
Contributor

  • Deviation explicit_dco_config, transceiver_config_enable_unsupported & missing_zr_optical_channel_tunable_parameters_telemetry added.
  • TransceiveronOff sub-test is been skipped as Nokia dont support transceiver/config/enable leaf.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

- Deviation `explicit_dco_config`, `transceiver_config_enable_unsupported` & `missing_zr_optical_channel_tunable_parameters_telemetry` added.
- TransceiveronOff sub-test is been skipped as Nokia dont support transceiver/config/enable leaf.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
@snaragund snaragund requested a review from a team as a code owner November 3, 2025 17:45
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @snaragund, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of transceiver-related tests by introducing platform-specific deviations for Nokia devices. It ensures that tests gracefully handle features not supported by Nokia hardware, preventing unnecessary failures and improving test suite reliability. Additionally, the changes include a refactoring of test setup procedures to make them more efficient and consistent across different test cases.

Highlights

  • Nokia Platform Deviations: Added specific platform exceptions for Nokia devices in metadata.textproto files, including deviations for explicit_dco_config, transceiver_config_enable_unsupported, and missing_zr_optical_channel_tunable_parameters_telemetry.
  • Conditional Test Skipping: Modified transceiver tests (zrp_inventory_test.go and zrp_laser_bias_current_test.go) to conditionally skip the TransceiverOnOff sub-test for Nokia devices, as they do not support the transceiver/config/enable leaf.
  • Test Setup Refactoring: Streamlined the interface initialization and configuration logic within several test functions, moving common setup steps to an earlier stage for improved consistency and reduced redundancy.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@OpenConfigBot
Copy link

Pull Request Functional Test Report for #4772 / 3ea3f66

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Cisco 8000E status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Cisco XRd status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Juniper ncPTX status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Nokia SR Linux status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Openconfig Lemming status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Cisco 8808 status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Juniper PTX10008 status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.
Nokia 7250 IXR-10e status
status
TRANSCEIVER-7.2: Telemetry: 400ZR_PLUS Optics inventory info streaming
TRANSCEIVER-9.2: Telemetry: 400ZR_PLUS TX laser bias current telemetry values streaming.

Help

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces Nokia-specific deviations for transceiver tests and refactors the test setup logic. While the changes correctly use deviations to handle vendor-specific behavior, there are several areas for improvement. A critical bug has been introduced in zrp_inventory_test.go where logic for the second port is commented out, leaving the test incomplete. Additionally, a hardcoded time.Sleep in zrp_laser_bias_current_test.go should be replaced with a more robust gnmi.Await. There is also significant code duplication for interface setup across multiple test functions in both modified Go files, which should be refactored into a helper function to improve maintainability. Lastly, one test case silently passes when skipped via deviation, whereas it should explicitly be marked as skipped for clarity.

cfgplugins.InterfaceConfig(t, dut, dp1)
cfgplugins.InterfaceConfig(t, dut, dp2)
tr1 := gnmi.Get(t, dut, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
//tr2 := gnmi.Get(t, dut, gnmi.OC().Interface(dp2.Name()).Transceiver().State())
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The definition for tr2 has been commented out. This variable is needed to re-enable the transceiver on the second port later in the test (line 204). Please uncomment this line to fix the test logic.

Suggested change
//tr2 := gnmi.Get(t, dut, gnmi.OC().Interface(dp2.Name()).Transceiver().State())
tr2 := gnmi.Get(t, dut, gnmi.OC().Interface(dp2.Name()).Transceiver().State())

gnmi.Update(t, dut, gnmi.OC().Component(dp1.Name()).Name().Config(), dp1.Name())
gnmi.Update(t, dut, gnmi.OC().Component(tr1).Transceiver().Enabled().Config(), true)
gnmi.Update(t, dut, gnmi.OC().Component(dp2.Name()).Name().Config(), dp2.Name())
//gnmi.Update(t, dut, gnmi.OC().Component(tr2).Transceiver().Enabled().Config(), true)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The logic to re-enable the transceiver for the second port (dp2) has been commented out. This prevents the second interface from coming back up, which contradicts the test's intent and the log message on line 209. Please uncomment this line to restore the correct behavior.

Suggested change
//gnmi.Update(t, dut, gnmi.OC().Component(tr2).Transceiver().Enabled().Config(), true)
gnmi.Update(t, dut, gnmi.OC().Component(tr2).Transceiver().Enabled().Config(), true)

gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_DOWN)
t.Logf("%v operational status is: %v", dp1.Name(), gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State()))
t.Log("Wait to update telemetry")
time.Sleep(80 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using a fixed time.Sleep makes the test brittle and unnecessarily slow. The comment "Wait to update telemetry" indicates a wait for a state change. It is much better practice to use gnmi.Await to poll for the specific condition you are waiting for. This makes the test more robust and efficient.

dut := ondatra.DUT(t, "dut")
dp1 := dut.Port(t, "port1")
dp2 := dut.Port(t, "port2")
fptest.ConfigureDefaultNetworkInstance(t, dut)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This call to fptest.ConfigureDefaultNetworkInstance(t, dut) is redundant, as the same function is called again on line 82 within this test. Please remove this duplicate call to improve code clarity.

Comment on lines +142 to +148
dp1 := dut.Port(t, "port1")
dp2 := dut.Port(t, "port2")
fptest.ConfigureDefaultNetworkInstance(t, dut)
operationalMode = uint16(*operationalModeFlag)
cfgplugins.InterfaceInitialize(t, dut, operationalMode)
cfgplugins.InterfaceConfig(t, dut, dp1)
cfgplugins.InterfaceConfig(t, dut, dp2)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is significant code duplication for interface and port setup between TestInventoryInterfaceFlap (lines 70-77) and TestInventoryTransceiverOnOff (lines 142-148). Consider creating a helper function to encapsulate this common setup logic. This would improve maintainability and reduce redundancy.

Comment on lines 158 to 192
func TestZRLaserBiasCurrentStateTransceiverOnOff(t *testing.T) {
if operationalModeFlag != nil {
dut1 := ondatra.DUT(t, "dut")
if !deviations.TransceiverConfigEnableUnsupported(dut1) {
dp1 := dut1.Port(t, "port1")
dp2 := dut1.Port(t, "port2")
t.Logf("dut1: %v", dut1)
t.Logf("dut1 dp1 name: %v", dp1.Name())
operationalMode = uint16(*operationalModeFlag)
} else {
t.Fatalf("Please specify the vendor-specific operational-mode flag")
operationalMode = cfgplugins.InterfaceInitialize(t, dut1, operationalMode)
cfgplugins.InterfaceConfig(t, dut1, dp1)
cfgplugins.InterfaceConfig(t, dut1, dp2)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
transceiverState := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
// Check if TRANSCEIVER is of type 400ZR_PLUS
// Uncomment once the Ondatra OC release version is fixed.
// if dp1.PMD() != ondatra.PMD400GBASEZRP {
// t.Fatalf("%s Transceiver is not 400ZR_PLUS its of type: %v", transceiverState, dp1.PMD())
// }
componentName := components.OpticalChannelComponentFromPort(t, dut1, dp1)
component := gnmi.OC().Component(componentName)
p1Stream := samplestream.New(t, dut1, component.OpticalChannel().LaserBiasCurrent().State(), 10*time.Second)
defer p1Stream.Close()
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
// power off interface transceiver
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Name().Config(), transceiverState)
// for transceiver disable, the input needs to be the transceiver name instead of the interface name
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), false)
// Cannot use Interface_OperStatus_DOWN here as the interface is "Not Present"
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
// power on interface transceiver
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), true)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
}
dut1 := ondatra.DUT(t, "dut")
dp1 := dut1.Port(t, "port1")
dp2 := dut1.Port(t, "port2")
t.Logf("dut1: %v", dut1)
t.Logf("dut1 dp1 name: %v", dp1.Name())
och1 := components.OpticalChannelComponentFromPort(t, dut1, dp1)
och2 := components.OpticalChannelComponentFromPort(t, dut1, dp2)
cfgplugins.ConfigOpticalChannel(t, dut1, och1, frequency, targetOutputPower, operationalMode)
cfgplugins.ConfigOpticalChannel(t, dut1, och2, frequency, targetOutputPower, operationalMode)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
transceiverState := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
// Check if TRANSCEIVER is of type 400ZR_PLUS
// Uncomment once the Ondatra OC release version is fixed.
// if dp1.PMD() != ondatra.PMD400GBASEZRP {
// t.Fatalf("%s Transceiver is not 400ZR_PLUS its of type: %v", transceiverState, dp1.PMD())
// }
componentName := components.OpticalChannelComponentFromPort(t, dut1, dp1)
component := gnmi.OC().Component(componentName)
p1Stream := samplestream.New(t, dut1, component.OpticalChannel().LaserBiasCurrent().State(), 10*time.Second)
defer p1Stream.Close()
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
// power off interface transceiver
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Name().Config(), transceiverState)
// for transceiver disable, the input needs to be the transceiver name instead of the interface name
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), false)
// Cannot use Interface_OperStatus_DOWN here as the interface is "Not Present"
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
// power on interface transceiver
gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), true)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
verifyLaserBiasCurrentAll(t, p1Stream, dut1)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

When deviations.TransceiverConfigEnableUnsupported(dut1) is true, this test function completes without running any checks or indicating that it was skipped. This can be misleading. It's better to explicitly skip the test in an else block using t.Skip() to make the test results clearer, as is done in zrp_inventory_test.go.

func TestZRLaserBiasCurrentStateTransceiverOnOff(t *testing.T) {
	dut1 := ondatra.DUT(t, "dut")
	if !deviations.TransceiverConfigEnableUnsupported(dut1) {
		dp1 := dut1.Port(t, "port1")
		dp2 := dut1.Port(t, "port2")
		t.Logf("dut1: %v", dut1)
		t.Logf("dut1 dp1 name: %v", dp1.Name())
		operationalMode = uint16(*operationalModeFlag)
		operationalMode = cfgplugins.InterfaceInitialize(t, dut1, operationalMode)
		cfgplugins.InterfaceConfig(t, dut1, dp1)
		cfgplugins.InterfaceConfig(t, dut1, dp2)
		gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
		transceiverState := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
		// Check if TRANSCEIVER is of type 400ZR_PLUS
		// Uncomment once the Ondatra OC release version is fixed.
		// if dp1.PMD() != ondatra.PMD400GBASEZRP {
		// 	t.Fatalf("%s Transceiver is not 400ZR_PLUS its of type: %v", transceiverState, dp1.PMD())
		// }
		componentName := components.OpticalChannelComponentFromPort(t, dut1, dp1)
		component := gnmi.OC().Component(componentName)
		p1Stream := samplestream.New(t, dut1, component.OpticalChannel().LaserBiasCurrent().State(), 10*time.Second)
		defer p1Stream.Close()
		verifyLaserBiasCurrentAll(t, p1Stream, dut1)
		// power off interface transceiver
		gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Name().Config(), transceiverState)
		// for transceiver disable, the input needs to be the transceiver name instead of the interface name
		gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), false)
		// Cannot use Interface_OperStatus_DOWN here as the interface is "Not Present"
		verifyLaserBiasCurrentAll(t, p1Stream, dut1)
		// power on interface transceiver
		gnmi.Update(t, dut1, gnmi.OC().Component(transceiverState).Transceiver().Enabled().Config(), true)
		gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)
		verifyLaserBiasCurrentAll(t, p1Stream, dut1)
	} else {
		t.Skip("Skipping sub-test as transceiver Enable/Disable leaf not supported")
	}
}

@coveralls
Copy link

Pull Request Test Coverage Report for Build 19044056506

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 11.066%

Totals Coverage Status
Change from base Build 19025222368: 0.0%
Covered Lines: 2224
Relevant Lines: 20097

💛 - Coveralls

@snaragund snaragund changed the title TRANSCEIVER-7.2/9.2 fix TRANSCEIVER-7.2 & 9.2 fix Nov 3, 2025
Copy link
Contributor

@AmrNJ AmrNJ left a comment

Choose a reason for hiding this comment

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

LGTM

@rohit-rp rohit-rp merged commit 928c4c5 into openconfig:main Nov 7, 2025
14 of 15 checks passed
goabhinav pushed a commit to goabhinav/featureprofiles that referenced this pull request Nov 12, 2025
- Deviation `explicit_dco_config`, `transceiver_config_enable_unsupported` & `missing_zr_optical_channel_tunable_parameters_telemetry` added.
- TransceiveronOff sub-test is been skipped as Nokia dont support transceiver/config/enable leaf.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
ElodinLaarz pushed a commit to ElodinLaarz/featureprofiles that referenced this pull request Nov 24, 2025
- Deviation `explicit_dco_config`, `transceiver_config_enable_unsupported` & `missing_zr_optical_channel_tunable_parameters_telemetry` added.
- TransceiveronOff sub-test is been skipped as Nokia dont support transceiver/config/enable leaf.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
raviv-arista pushed a commit to raviv-arista/featureprofiles that referenced this pull request Dec 12, 2025
- Deviation `explicit_dco_config`, `transceiver_config_enable_unsupported` & `missing_zr_optical_channel_tunable_parameters_telemetry` added.
- TransceiveronOff sub-test is been skipped as Nokia dont support transceiver/config/enable leaf.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants