netdevops / hier_config

Hierarchical Configuration
MIT License
126 stars 24 forks source link

IOS XR end-set should not be indented #130

Open mpenning opened 5 months ago

mpenning commented 5 months ago

As one can see here, hier_config IOS XR diff end-set should not be indented... explicitly, this seems to be (slightly) wrong in hier_config version 2.2.3...

Contents of before.txt...

prefix-set ALL
  0.0.0.0/0 eq 32
end-set
!
prefix-set PEERINGS
  1.1.1.1/32,
  2.2.2.2/32,
  10.0.1.0/24,
  172.16.0.0/12,
  192.168.3.0/26
end-set

Contents of after.txt...

prefix-set ALL
  0.0.0.0/0 eq 32
end-set
!
prefix-set PEERINGS
  1.1.1.1/32,
  172.16.0.0/12,
  192.168.3.0/26
end-set

ciscoconfparse2 uses hier_config for all diffs... The diff end-set is indented when it shouldn't be, but I think that will be cosmetic... sadly I don't have an IOS XR system to test against...

(py311_test) mpenning@mudslide:~/$ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ciscoconfparse2 import Diff
>>> diff = Diff('before.txt', 'after.txt', syntax='iosxr')
>>> diff.get_diff()
['prefix-set PEERINGS', '  1.1.1.1/32,', '  172.16.0.0/12,', '  192.168.3.0/26', '  end-set']
>>>