Open for Voting

Cisco Submode conditional configuration templates

When policies dictate that Access ports, Trunk ports or Shutdown ports must conform with certain templates, there is no way to automate a recursive check of each interface submode and apply the appropriate template.  For example:

Interface FastEthernet 0/24

description Access port example

switchport access vlan 200

switchport mode access

no cdp enable

spanning-tree portfast

spanning-tree bpdufilter enable

!

interface GigabitEthernet0/1

description Trunk port example

switchport trunk encapsulation do1q

switchport trunk native vlan 999

switchport mode trunk

!

interface GigabitEtehrnet0/2

description shutdown port example

switchport access vlan 666

shutdown

I would like to have a method that would

1) identify with a regular expression the start of a block

- "interface .*?Ethernet.*?"

2) have an option to identify the block by some element that will establish which template to use

- "exist [^shutdown$]" AND "absent [^description Keep turned on.*]"

3) identify with a regular expression the end of a block

- "^!$"

4) have template that is checked within just that block

i.e. if the port is hard shutdown, it should have no user configuration applied to it.

5) Option to check just the first instance of the block, or all instances of the block within a given devices' configuration.