Describe the bug
On Cisco IOS, unnamed VLANs can be rendered collapsed onto a single comma/range line (e.g. vlan 69,381). When such a collapsed line is present in the running config, hier_config treats that whole line as one config object. If the intended config lists those VLANs as separate blocks, the literal line vlan 69,381 is absent from the intended config, so hier_config negates the entire line — emitting a destructive no vlan 69,381 that removes both VLANs (and any config under them), then re-adds them. A simple rename of an already-named VLAN works fine; the bug is specific to collapsed, unnamed VLAN lines.
To Reproduce
Steps to reproduce the behavior:
- Running config contains a collapsed VLAN line:
vlan 69,381
- Intended config lists them as separate blocks, e.g.
vlan 69 / name newname and vlan 381
- Build a remediation with
WorkflowRemediation (or config_to_get_to)
- See
no vlan 69,381 in the remediation output
i.e.:
from hier_config import get_hconfig, WorkflowRemediation, Platform
running = get_hconfig(Platform.CISCO_IOS, "vlan 69,381\n")
intended = get_hconfig(Platform.CISCO_IOS, "vlan 69\n name newname\nvlan 381\n")
print(WorkflowRemediation(running, intended).remediation_config_filtered_text(include_tags={}, exclude_tags={}))
will print:
no vlan 69,381 <--- the bug
vlan 69
name newname
vlan 381
Expected behavior
The above example should ONLY produce the below, as no vlans are actually getting removed.
Desktop (please complete the following information):
- Driver: CISCO_IOS (also affects IOS-XE via the same driver)
- Hier Config Version: 3.6.0
Additional context
The HP ProCurve driver already handles the analogous case (it splits comma-separated VLAN lists at load time). The Cisco IOS driver has no equivalent. Fix: a post-load callback that splits collapsed comma/range VLAN id lists (vlan 69,381, vlan 10-12) into one vlan <id> block each, so they diff block-to-block.
Describe the bug
On Cisco IOS, unnamed VLANs can be rendered collapsed onto a single comma/range line (e.g.
vlan 69,381). When such a collapsed line is present in the running config, hier_config treats that whole line as one config object. If the intended config lists those VLANs as separate blocks, the literal linevlan 69,381is absent from the intended config, so hier_config negates the entire line — emitting a destructiveno vlan 69,381that removes both VLANs (and any config under them), then re-adds them. A simple rename of an already-named VLAN works fine; the bug is specific to collapsed, unnamed VLAN lines.To Reproduce
Steps to reproduce the behavior:
vlan 69,381vlan 69/name newnameandvlan 381WorkflowRemediation(orconfig_to_get_to)no vlan 69,381in the remediation outputi.e.:
will print:
Expected behavior
The above example should ONLY produce the below, as no vlans are actually getting removed.
Desktop (please complete the following information):
Additional context
The HP ProCurve driver already handles the analogous case (it splits comma-separated VLAN lists at load time). The Cisco IOS driver has no equivalent. Fix: a post-load callback that splits collapsed comma/range VLAN id lists (
vlan 69,381,vlan 10-12) into onevlan <id>block each, so they diff block-to-block.