And now my template/MASK:============== mpls ldp router-id 192.168.130.5 nsr graceful-restart backoff 5 10 session protection neighbor 192.168.130.1 password encrypted pwd1 neighbor 192.168.130.2 password encrypted pwd2 neighbor 192.168.130.25 password encrypted pwd3 igp sync delay 10 label allocate for LLAF ! log neighbor nsr ! interface TenGigE0/0/0/0 ! interface TenGigE0/1/0/0 ! interface TenGigE0/7/0/0 ! ! ==============
So I read all device config in a string and match with /..../s against template above; before actual match the template updated with $mask_tmp =~ s/__REGEX__/^\\n+/g; Easy part is to match the template against the configuration when eg. number of neighbor or interface statements is the same on all devices. But that is not the case, so I'm looking for idea how to match (and capture necessary parameters such as IP numbers of all neighbors) irrespective of number of neighbors/interfaces in actual config. TIA====================================================================== =|MASK|mpls ldp|= ====================================================================== (mpls ldp) (router-id) (__REGEX__) nsr graceful-restart backoff 5 10 session protection (neighbor) (__REGEX__) password encrypted __REGEX__ (neighbor) (__REGEX__) password encrypted __REGEX__ (neighbor) (__REGEX__) password encrypted __REGEX__ igp sync delay 10 label allocate for LLAF ! log neighbor nsr ! interface (__REGEX__) ! interface (__REGEX__) ! ! ======================================================================
In reply to Template-based router configuration audit by ccie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |