-
Notifications
You must be signed in to change notification settings - Fork 69
T7496 Fix disabling src route #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the behavior for disabling src_route
in both IPv4 and IPv6 route-redirect settings.
- Adjust logic so
False
values now generate disable commands - Updated unit tests to expect
ip_src_route=False
and addedipv6-src-route 'disable'
assertions - Added a changelog fragment for this bugfix
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py | Change condition to val is not None so false values are handled |
tests/unit/modules/network/vyos/test_vyos_firewall_global14.py | Updated expected ip_src_route=False and added IPv6 disable command |
tests/unit/modules/network/vyos/test_vyos_firewall_global.py | Same updates as above for the non-14 version |
changelogs/fragments/T7496_firewall_global_fix_disabling_src_route.yml | Added a bugfix entry for disabling src_route |
Comments suppressed due to low confidence (2)
plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py:551
- There is a duplicate
afi = None
assignment—removing the redundant line will simplify the code and avoid confusion.
afi = None
changelogs/fragments/T7496_firewall_global_fix_disabling_src_route.yml:2
- Changelog entries should follow the
- module_name: description
format. Change the second dash to a colon for valid YAML, e.g.- vyos_firewall_global: Fix disabling src route
.
- vyos_firewall_global - Fix disabling src route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @RubenNL
Thanks for spotting this and submitting the fix.
I cloned your branch and tested against.
While it all checked out fine, I can see that when you comment the settings as follows:
- name: Testing FW global hosts: vyos_lab gather_facts: false tasks: - name: Apply the provided configuration (base config) vyos.vyos.vyos_firewall_global: config: route_redirects: - afi: ipv6 # ip_src_route: true state: replaced
this does not result in a change, while I think it should
Apparently, your code needs to cater for use case when the setting was removed from the configuration, i.e. if before it was True, and you removed it from configuration it has to be deleted completely, especially if there is ''replaced' state. What is your opinion?
Interesting find! This needs to be fixed, but in my opinion this is a different issue. "not able to disable" vs "not able to remove". |
After looking into for quite a while, with respect to my recent comment, the behaviour I am requesting seems to demand an effort (we do not use templating, and the provisioning is a bit fragile and will require rewriting a number of lines). |
I think the fix seems straightforward for the src-route setting at least. There's a longer-term issue about moving to templates that would likely improve this type of problem, but that's a project for another day. My one question is whether there's a value in writing an additional test to demonstrate being able to change states. It doesn't appear absolutely necessary, if this wouldn't work even in the absence of an existing value. Otherwise, this seems isolated enough to include in 6.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One request (fixing the bugfix statement) and one question on an additional test.
I modified one of the tests to check this, I think? |
You modified the test to only test You can probably change your reproduce case to just the setting to disabled, since the switch wasn't necessary in order to trigger the bug. |
Change Summary
Fixed disabling src route.
Types of changes
Related Task(s)
https://vyos.dev/T7496
Related PR(s)
Component(s) name
firewall(_global)
Proposed changes
Fixed the ability to disable the src_route.
How to test
First:
Then:
Observe: ipv6-src-route is still specified in the config as true. (with the current main branch)
Test results
The test results can be seen here:
failing: https://github.com/RubenNL/vyos.vyos/actions/runs/15301976749
succeeding: https://github.com/RubenNL/vyos.vyos/actions/runs/15302043258
Tested against VyOS versions:
Checklist:
changelogs/fragments
to describe the changes