hier_config icon indicating copy to clipboard operation
hier_config copied to clipboard

Ability to add pre and post processing of config

Open empi89 opened this issue 6 years ago • 5 comments

I am adding functionality for HPE Comware switches. However, as VLAN configuration mixes multiple vlans into the same configuration statement things are getting a bit complicated. I have written a pre/post processor for dealing with it. However from architectural standpoints this is a mess.

Could you please advise on a more generic approach to implement it?

See my request for comments branch on this: https://github.com/empi89/hier_config/tree/rfc-pre-and-postprocessing

empi89 avatar Oct 27 '19 17:10 empi89

In my environment, I solve these types of issues with post running and compiled config load fixups. These fixups happen before the running and compiled config comparison to build remediation conifg. See the below example. I'm open to these sorts of fixups being part of the project.

running config

vlan 1-3,5

compiled config

vlan 1
  name ABCD
vlan 2,3,5

Would be normalized to the following in the running config:

vlan 1
vlan 2
vlan 3
vlan 5

And would be normalized to the following in the running config:

vlan 1
  name ABCD
vlan 2
vlan 3
vlan 5

Then, the resulting remediation config would reflect the appropriate changes:

vlan 1
  name ABCD

aedwardstx avatar Oct 29 '19 16:10 aedwardstx

Thanks for your feedback on this!

So you would like to have a more generic post-load processor integrated? I would say that this approach would also work for comware here and I can change the code in this way.

What would be your approach to integrate those post-load processors into the existing architecture?

empi89 avatar Oct 31 '19 09:10 empi89

I have changed the branch a bit. Is this as you intended?

empi89 avatar Nov 03 '19 12:11 empi89

I have similar issues with VLAN ranges. I think additionally to the Comware specific changes a generic approach would be helpful.

v0tti avatar Mar 07 '22 09:03 v0tti

This may be helpful to help manage vlan configurations https://netutils.readthedocs.io/en/latest/netutils/vlan/index.html

itdependsnetworks avatar Jul 15 '22 15:07 itdependsnetworks