-
Notifications
You must be signed in to change notification settings - Fork 29
Sectional Exiting at Parent Level #142
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: master
Are you sure you want to change the base?
Conversation
a37b7d2 to
dafc47a
Compare
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 pull request fixes issue #130 by implementing support for sectional exit text at the parent indentation level in Cisco XR configurations. The issue reported that commands like end-set, end-policy, and similar exit statements were being incorrectly indented in diff output when they should appear at the parent level (no indentation).
Changes:
- Added
exit_text_parent_levelboolean field toSectionalExitingRulemodel to control exit text indentation behavior - Implemented
sectional_exit_text_parent_levelproperty inHConfigChildto check if a node's exit text should be at parent level - Updated
lines()method to adjust indentation depth when generating exit text based on the parent level flag - Configured 7 Cisco XR sectional exiting rules to use parent-level exit text (route-policy, prefix-set, policy-map, class-map, community-set, extcommunity-set, template)
- Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| hier_config/models.py | Added exit_text_parent_level field to SectionalExitingRule with default value False |
| hier_config/child.py | Added sectional_exit_text_parent_level property and updated lines() method to adjust indentation depth for exit text |
| hier_config/platforms/cisco_xr/driver.py | Configured 7 sectional exiting rules with exit_text_parent_level=True for Cisco XR constructs that require unindented exit text |
| tests/test_hier_config.py | Added comprehensive unit tests for sectional_exit_text_parent_level property and HConfigChildren methods |
| tests/test_driver_cisco_xr.py | Added integration tests verifying correct indentation behavior for all Cisco XR sectional exiting rules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "prefix-set TEST_PREFIX", | ||
| " 192.0.2.0/24", | ||
| "end-set", | ||
| ) |
Copilot
AI
Jan 18, 2026
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.
Consider adding a test case that verifies the specific remediation scenario described in issue #130. The test should:
- Create a running config with a prefix-set containing multiple entries
- Create a generated config with the same prefix-set but with some entries removed
- Generate the remediation config using config_to_get_to
- Verify that the remediation config outputs with 'end-set' at the parent level (no indentation)
This would directly test the fix for the reported issue where the diff output was incorrectly indenting 'end-set'.
Closes #130