diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-06-30 14:18:50 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-30 21:18:50 +1000 |
| commit | 0e10d136ef280ca147b6f1e332072f6ba14c8844 (patch) | |
| tree | c1f99833376e15b4b47e01d28d20f12ba4a4c123 /tests | |
| parent | 6d7a2184e970624f74f333931f7f70a1f900f7b5 (diff) | |
| download | vyos.vyos-0e10d136ef280ca147b6f1e332072f6ba14c8844.tar.gz vyos.vyos-0e10d136ef280ca147b6f1e332072f6ba14c8844.zip | |
T8522: fix parse_icmp_attr() split delimiter and UnboundLocalError (#464)
* Add easy-wins improvement spec for vyos.vyos collection
Covers five phases: formatting compliance, runtime.yml redirect fix,
deprecated feature cleanup, missing unit tests, and template deduplication.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add implementation plan for easy-wins improvements
15 tasks across 5 phases: formatting compliance, runtime.yml bugfix,
deprecated code cleanup, missing unit tests, template deduplication.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update spec and plan with architect review corrections
Key changes:
- Defer Phase 5 (template deduplication) to v7.0.0: route_maps
are not identical, BGP dedup blocked by Python module-level
scoping, OSPF has fundamentally different command paradigms
- Add .git-blame-ignore-revs step to Phase 1
- Add missing test cases: overridden/rendered for resource modules,
aggregate/purge/with_address for vyos_vlan
- Fix incorrect claim that version.py LooseVersion is unused
- Add sequential merge requirement to preamble
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: add .worktrees/ and .claude/ to .gitignore
* T8522: fix parse_icmp_attr() split delimiter and UnboundLocalError
- Use val.split("/") instead of val.split(".") when parsing type/code pairs
- In the numeric-only branch, use int(val) instead of the undefined type_no variable
- Cast both type and code to int for consistent typing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* T8522: remove unrelated planning docs and gitignore changes
These files were included from local main branch commits unrelated
to this bugfix. This commit removes them to keep the PR scoped.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* T8522: add parsed test for legacy type/code ICMP format
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/modules/network/vyos/test_vyos_firewall_rules13.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_rules13.py b/tests/unit/modules/network/vyos/test_vyos_firewall_rules13.py index 1af61752..edce123b 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_rules13.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_rules13.py @@ -1576,3 +1576,17 @@ class TestVyosFirewallRulesModule13(TestVyosModule): ] self.maxDiff = None self.execute_module(changed=True, commands=commands) + + def test_vyos_firewall_rules_parsed_icmp_type_code(self): + """parse_icmp_attr: legacy 'type/code' token parses into integer type and code.""" + raw = ( + "set firewall name TEST rule 1 action 'accept'\n" + "set firewall name TEST rule 1 protocol 'icmp'\n" + "set firewall name TEST rule 1 icmp type '3/4'\n" + ) + set_module_args(dict(running_config=raw, state="parsed")) + result = self.execute_module(changed=False) + parsed = result["parsed"] + rule = parsed[0]["rule_sets"][0]["rules"][0] + self.assertEqual(rule["icmp"]["type"], 3) + self.assertEqual(rule["icmp"]["code"], 4) |
