Skip to content

Conversation

@emy
Copy link
Collaborator

@emy emy commented Nov 19, 2025

Is this a BUG FIX or a FEATURE ?:

Uncomment only one, leave it on its own line:

/kind bug

/kind enhancement

What this PR does / why we need it:
Add e2e test to verify VRF routes specified by vrf-name persist across node reboots. This tests the new vrf-name parameter for routes that allows referencing VRF route tables by interface name instead of numeric table-id.

The test includes:

  • Basic verification test for vrf-name route configuration
  • Reboot persistence test to ensure routes survive node restart

Special notes for your reviewer:
Depeds-on: nmstate 2.2.55

Release note:

NONE

Add e2e test to verify VRF routes specified by vrf-name persist across node reboots.
This tests the new vrf-name parameter for routes that allows referencing VRF route tables by interface name instead of numeric table-id.

The test includes:
   - Helper function vrfRouteWithVrfName() to create VRF routes using vrf-name
   - Basic verification test for vrf-name route configuration
   - Reboot persistence test to ensure routes survive node restart

Related to upstream nmstate PR: nmstate/nmstate#3016

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Emilia Desch <[email protected]>
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/enhancement dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Nov 19, 2025
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mkowalski for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gemini-code-assist
Copy link

Summary of Changes

Hello @emy, 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 network configuration testing suite by adding new end-to-end tests. These tests specifically validate the persistence of Virtual Routing and Forwarding (VRF) routes that are configured using the vrf-name parameter, ensuring they remain intact after a node reboot. This addresses a critical aspect of network reliability by confirming that VRF route tables can be referenced by interface name and maintain their state through system restarts.

Highlights

  • New E2E Test: Introduces an end-to-end test for VRF route persistence.
  • vrf-name Parameter: Specifically tests routes configured using the vrf-name parameter, which allows referencing VRF route tables by interface name instead of numeric table-id.
  • Reboot Persistence: Verifies that these VRF routes persist correctly across node reboots.
  • Configuration Verification: Includes basic verification of vrf-name route configuration.
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.

Copy link

@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 adds an e2e test to verify that VRF routes configured with vrf-name persist after a node reboot. The overall approach is good, and the new test covers the intended scenario. However, I've found a critical issue in the test helper function where the generated YAML for the network state is incorrectly indented, which would cause the test to fail. I've also suggested a refactoring in the test file to reduce code duplication and improve maintainability. Please see the detailed comments for suggestions.

Comment on lines +260 to +264
- destination: %s
metric: 150
next-hop-address: %s
next-hop-interface: %s
vrf-name: %s

Choose a reason for hiding this comment

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

critical

The YAML for the route configuration is incorrectly indented. The list item under config (the - on line 260) should be indented to be a child of config. Currently, it's at the same level, which is invalid YAML and will cause a parsing error when the state is applied.

Suggested change
- destination: %s
metric: 150
next-hop-address: %s
next-hop-interface: %s
vrf-name: %s
- destination: %s
metric: 150
next-hop-address: %s
next-hop-interface: %s
vrf-name: %s

Comment on lines +86 to +108
It("should have the VRF interface and route configured", func() {
vrfForNodeInterfaceEventually(node, vrfID).Should(Equal(vrfID))
ipAddressForNodeInterfaceEventually(node, firstSecondaryNic).Should(Equal(ipAddress))
routeNextHopInterfaceWithTableID(node, destIPAddress, vrfID).Should(Equal(firstSecondaryNic))
})

It("should persist VRF route after node reboot", func() {
Byf("Verifying VRF interface and route before reboot")
vrfForNodeInterfaceEventually(node, vrfID).Should(Equal(vrfID))
ipAddressForNodeInterfaceEventually(node, firstSecondaryNic).Should(Equal(ipAddress))
routeNextHopInterfaceWithTableID(node, destIPAddress, vrfID).Should(Equal(firstSecondaryNic))

restartNodeWithoutWaiting(node)

By("Wait for policy re-reconciled after node reboot")
policy.WaitForPolicyTransitionUpdate(TestPolicy)
policy.WaitForAvailablePolicy(TestPolicy)

Byf("Node %s was rebooted, verifying VRF route still exists", node)
vrfForNodeInterfaceEventually(node, vrfID).Should(Equal(vrfID))
ipAddressForNodeInterfaceEventually(node, firstSecondaryNic).Should(Equal(ipAddress))
routeNextHopInterfaceWithTableID(node, destIPAddress, vrfID).Should(Equal(firstSecondaryNic))
})

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce code duplication, you can extract the repeated verification logic into a helper function. The assertions on lines 87-89, 94-96, and 105-107 are identical. A helper function will make the tests cleaner and easier to read.

		verifyVrfRouteIsConfigured := func() {
			vrfForNodeInterfaceEventually(node, vrfID).Should(Equal(vrfID))
			ipAddressForNodeInterfaceEventually(node, firstSecondaryNic).Should(Equal(ipAddress))
			routeNextHopInterfaceWithTableID(node, destIPAddress, vrfID).Should(Equal(firstSecondaryNic))
		}

		It("should have the VRF interface and route configured", func() {
			verifyVrfRouteIsConfigured()
		})

		It("should persist VRF route after node reboot", func() {
			Byf("Verifying VRF interface and route before reboot")
			verifyVrfRouteIsConfigured()

			restartNodeWithoutWaiting(node)

			By("Wait for policy re-reconciled after node reboot")
			policy.WaitForPolicyTransitionUpdate(TestPolicy)
			policy.WaitForAvailablePolicy(TestPolicy)

			Byf("Node %s was rebooted, verifying VRF route still exists", node)
			verifyVrfRouteIsConfigured()
		})

@kubevirt-bot
Copy link
Collaborator

@emy: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-nmstate-e2e-handler-k8s 4a02017 link true /test pull-kubernetes-nmstate-e2e-handler-k8s

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@emy
Copy link
Collaborator Author

emy commented Nov 19, 2025

Handler e2e fails because the required nmstate version is 2.2.55 and above.

@qinqon
Copy link
Member

qinqon commented Nov 20, 2025

Handler e2e fails because the required nmstate version is 2.2.55 and above.

We need to see this test passing to merge it, although would be good to skip it if nmstate version is no the expected, the nmstate version can be check looking at the NNS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/enhancement release-note-none Denotes a PR that doesn't merit a release note. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants