catalyst-config-auditor 1.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. catalyst_config_auditor/Custom_Parsers/NTC/README.md +19 -0
  2. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_device-tracking_database.textfsm +11 -0
  3. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_environment_all.textfsm +12 -0
  4. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_interfaces_counters.textfsm +24 -0
  5. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_interfaces_counters_errors.textfsm +12 -0
  6. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_interfaces_trunk.textfsm +36 -0
  7. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_ip_arp_inspection_interfaces.textfsm +10 -0
  8. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_ip_dhcp_snooping.textfsm +18 -0
  9. catalyst_config_auditor/Custom_Parsers/NTC/cisco_ios_show_ip_protocols.textfsm +19 -0
  10. catalyst_config_auditor/Custom_Parsers/NTC/index +9 -0
  11. catalyst_config_auditor/Custom_Parsers/TTP/README.md +6 -0
  12. catalyst_config_auditor/Custom_Parsers/TTP/show_device_tracking_database.ttp +4 -0
  13. catalyst_config_auditor/Custom_Parsers/TTP/show_interfaces_counters_errors.ttp +4 -0
  14. catalyst_config_auditor/Custom_Parsers/TTP/show_ip_arp.ttp +5 -0
  15. catalyst_config_auditor/Custom_Parsers/TTP/show_ip_arp_inspection_interfaces.ttp +4 -0
  16. catalyst_config_auditor/Custom_Parsers/TTP/show_ip_dhcp_snooping_binding.ttp +4 -0
  17. catalyst_config_auditor/Custom_Parsers/TTP/show_ip_interface_brief.ttp +4 -0
  18. catalyst_config_auditor/__init__.py +3 -0
  19. catalyst_config_auditor/__main__.py +5 -0
  20. catalyst_config_auditor/cli.py +1946 -0
  21. catalyst_config_auditor/cmd.txt +11 -0
  22. catalyst_config_auditor/variables_selection.yaml +45 -0
  23. catalyst_config_auditor-1.4.0.dist-info/METADATA +232 -0
  24. catalyst_config_auditor-1.4.0.dist-info/RECORD +28 -0
  25. catalyst_config_auditor-1.4.0.dist-info/WHEEL +5 -0
  26. catalyst_config_auditor-1.4.0.dist-info/entry_points.txt +2 -0
  27. catalyst_config_auditor-1.4.0.dist-info/licenses/LICENSE +7 -0
  28. catalyst_config_auditor-1.4.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,19 @@
1
+ # NTC / TextFSM directory
2
+
3
+ Put your `cisco_ios_<command>.textfsm` files here and optionally register them in `index`.
4
+
5
+ The auditor accepts two discovery modes:
6
+
7
+ 1. `index` file with NTC syntax: `Template, Hostname, Platform, Command` plus mappings.
8
+ 2. Direct filename convention, e.g. `cisco_ios_show_interfaces_trunk.textfsm`.
9
+
10
+ The default `--ntc-dir` is `Custom_Parsers/NTC`, resolved from the working directory or beside the script. A full official collection in `Custom_Parsers/NTC/templates/index` is also accepted.
11
+
12
+ Install: `python -m pip install ntc-templates textfsm`.
13
+
14
+ The example templates in this package are based on **illustrative CLI formats**. Several IOS-XE releases and chassis differ. Test each template with `--parser-test` and representative saved outputs before relying on the Excel results. The original Commands_Output.txt is always retained.
15
+
16
+ Example:
17
+ ```
18
+ python Catalyst_Config_Auditor.py --parser-test "show interfaces trunk" --input examples/show_interfaces_trunk.txt --parser ntc
19
+ ```
@@ -0,0 +1,11 @@
1
+ # Supports common IPv4 database layouts. Platform/version differences require local tests.
2
+ Value Required IP_ADDRESS (\d{1,3}(?:\.\d{1,3}){3})
3
+ Value MAC_ADDRESS ((?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4}|(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2})
4
+ Value VLAN (\d+)
5
+ Value INTERFACE (\S+)
6
+ Value STATE (\S+)
7
+
8
+ Start
9
+ ^\s*${IP_ADDRESS}\s+${MAC_ADDRESS}\s+${VLAN}\s+${INTERFACE}\s+${STATE}\s*$$ -> Record
10
+ ^\s*${IP_ADDRESS}\s+${MAC_ADDRESS}\s+${INTERFACE}\s+${VLAN}\s+${STATE}\s*$$ -> Record
11
+ ^\s*${IP_ADDRESS}\s+${MAC_ADDRESS}\s+${VLAN}\s+${INTERFACE}\s*$$ -> Record
@@ -0,0 +1,12 @@
1
+ # Catalyst IOS-XE - selected fan/power/temperature status rows.
2
+ Value SWITCH (\d+)
3
+ Value COMPONENT (\S+(?:\s+\S+)?)
4
+ Value STATUS (\S+(?:\s+\S+)?)
5
+ Value TEMPERATURE_C (\d+(?:\.\d+)?)
6
+
7
+ Start
8
+ ^\s*Switch\s+${SWITCH}\s+FAN\s+${COMPONENT}\s+is\s+${STATUS}\s*$$ -> Record
9
+ ^\s*FAN\s+${COMPONENT}\s+is\s+${STATUS}\s*$$ -> Record
10
+ ^\s*(?:Power Supply|POWER SUPPLY|PSU)\s+${COMPONENT}\s+is\s+${STATUS}\s*$$ -> Record
11
+ ^\s*SYSTEM TEMPERATURE\s+is\s+${STATUS}\s*$$ -> Record
12
+ ^\s*Temperature\s*:\s*${TEMPERATURE_C}\s*(?:C|Degree Celsius|degrees C)?\s*$$ -> Record
@@ -0,0 +1,24 @@
1
+ # The two counter blocks yield separate rows; pivot/merge rows by PORT for Excel.
2
+ Value Required PORT (\S+)
3
+ Value IN_OCTETS (\d+)
4
+ Value IN_UCAST (\d+)
5
+ Value IN_MCAST (\d+)
6
+ Value IN_BCAST (\d+)
7
+ Value OUT_OCTETS (\d+)
8
+ Value OUT_UCAST (\d+)
9
+ Value OUT_MCAST (\d+)
10
+ Value OUT_BCAST (\d+)
11
+
12
+ Start
13
+ ^\s*Port\s+InOctets\s+InUcastPkts\s+InMcastPkts\s+InBcastPkts\s*$$ -> InCounters
14
+ ^\s*Port\s+OutOctets\s+OutUcastPkts\s+OutMcastPkts\s+OutBcastPkts\s*$$ -> OutCounters
15
+
16
+ InCounters
17
+ ^\s*${PORT}\s+${IN_OCTETS}\s+${IN_UCAST}\s+${IN_MCAST}\s+${IN_BCAST}\s*$$ -> Record
18
+ ^\s*Port\s+OutOctets\s+OutUcastPkts\s+OutMcastPkts\s+OutBcastPkts\s*$$ -> OutCounters
19
+ ^\s*Port\s+InOctets\s+InUcastPkts\s+InMcastPkts\s+InBcastPkts\s*$$ -> InCounters
20
+
21
+ OutCounters
22
+ ^\s*${PORT}\s+${OUT_OCTETS}\s+${OUT_UCAST}\s+${OUT_MCAST}\s+${OUT_BCAST}\s*$$ -> Record
23
+ ^\s*Port\s+InOctets\s+InUcastPkts\s+InMcastPkts\s+InBcastPkts\s*$$ -> InCounters
24
+ ^\s*Port\s+OutOctets\s+OutUcastPkts\s+OutMcastPkts\s+OutBcastPkts\s*$$ -> OutCounters
@@ -0,0 +1,12 @@
1
+ # Common Catalyst error counter table variants.
2
+ Value Required PORT (\S+)
3
+ Value ALIGN_ERR (\d+)
4
+ Value FCS_ERR (\d+)
5
+ Value XMIT_ERR (\d+)
6
+ Value RCV_ERR (\d+)
7
+ Value UNDERSIZE (\d+)
8
+ Value OUTDISCARDS (\d+)
9
+
10
+ Start
11
+ ^\s*${PORT}\s+${ALIGN_ERR}\s+${FCS_ERR}\s+${XMIT_ERR}\s+${RCV_ERR}\s+${UNDERSIZE}\s+${OUTDISCARDS}\s*$$ -> Record
12
+ ^\s*${PORT}\s+${ALIGN_ERR}\s+${FCS_ERR}\s+${XMIT_ERR}\s+${RCV_ERR}\s*$$ -> Record
@@ -0,0 +1,36 @@
1
+ # Multiple tables in IOS-XE; rows should be merged by PORT for Excel.
2
+ Value Required PORT (\S+)
3
+ Value MODE (\S+)
4
+ Value ENCAPSULATION (\S+)
5
+ Value STATUS (\S+)
6
+ Value NATIVE_VLAN (\S+)
7
+ Value ALLOWED_VLANS (\S+)
8
+ Value ACTIVE_VLANS (\S+)
9
+ Value FORWARDING_VLANS (\S+)
10
+
11
+ Start
12
+ ^\s*Port\s+Mode\s+Encapsulation\s+Status\s+Native vlan\s*$$ -> StatusTable
13
+ ^\s*Port\s+Vlans allowed on trunk\s*$$ -> AllowedTable
14
+ ^\s*Port\s+Vlans allowed and active in management domain\s*$$ -> ActiveTable
15
+ ^\s*Port\s+Vlans in spanning tree forwarding state and not pruned\s*$$ -> ForwardTable
16
+
17
+ StatusTable
18
+ ^\s*${PORT}\s+${MODE}\s+${ENCAPSULATION}\s+${STATUS}\s+${NATIVE_VLAN}\s*$$ -> Record
19
+ ^\s*Port\s+Vlans allowed on trunk\s*$$ -> AllowedTable
20
+ ^\s*Port\s+Vlans allowed and active in management domain\s*$$ -> ActiveTable
21
+ ^\s*Port\s+Vlans in spanning tree forwarding state and not pruned\s*$$ -> ForwardTable
22
+
23
+ AllowedTable
24
+ ^\s*${PORT}\s+${ALLOWED_VLANS}\s*$$ -> Record
25
+ ^\s*Port\s+Vlans allowed and active in management domain\s*$$ -> ActiveTable
26
+ ^\s*Port\s+Vlans in spanning tree forwarding state and not pruned\s*$$ -> ForwardTable
27
+ ^\s*Port\s+Mode\s+Encapsulation\s+Status\s+Native vlan\s*$$ -> StatusTable
28
+
29
+ ActiveTable
30
+ ^\s*${PORT}\s+${ACTIVE_VLANS}\s*$$ -> Record
31
+ ^\s*Port\s+Vlans in spanning tree forwarding state and not pruned\s*$$ -> ForwardTable
32
+ ^\s*Port\s+Vlans allowed on trunk\s*$$ -> AllowedTable
33
+
34
+ ForwardTable
35
+ ^\s*${PORT}\s+${FORWARDING_VLANS}\s*$$ -> Record
36
+ ^\s*Port\s+Mode\s+Encapsulation\s+Status\s+Native vlan\s*$$ -> StatusTable
@@ -0,0 +1,10 @@
1
+ # Supports whitespace-separated and pipe-separated table examples.
2
+ Value Required INTERFACE (\S+)
3
+ Value TRUST_STATE (\S+)
4
+ Value RATE_PPS (\S+)
5
+ Value BURST_INTERVAL (\S+)
6
+
7
+ Start
8
+ ^\s*${INTERFACE}\s+${TRUST_STATE}\s+${RATE_PPS}\s+${BURST_INTERVAL}\s*$$ -> Record
9
+ ^\s*${INTERFACE}\s+${TRUST_STATE}\s+${RATE_PPS}\s*$$ -> Record
10
+ ^\s*${INTERFACE}\s*\|\s*${TRUST_STATE}\s*\|\s*${RATE_PPS}\s*$$ -> Record
@@ -0,0 +1,18 @@
1
+ # Key summary settings and per-port trust/rate rows.
2
+ Value SWITCH_STATUS (\S+)
3
+ Value CONFIGURED_VLANS (\S+)
4
+ Value OPERATIONAL_VLANS (\S+)
5
+ Value OPTION82 (\S+)
6
+ Value INTERFACE (\S+)
7
+ Value TRUST (\S+)
8
+ Value RATE_PPS (\S+)
9
+
10
+ Start
11
+ ^\s*Switch DHCP snooping is ${SWITCH_STATUS}\s*$$ -> Record
12
+ ^\s*DHCP snooping is configured on following VLANs:\s*${CONFIGURED_VLANS}\s*$$ -> Record
13
+ ^\s*DHCP snooping is operational on following VLANs:\s*${OPERATIONAL_VLANS}\s*$$ -> Record
14
+ ^\s*Insertion of option 82 is ${OPTION82}\s*$$ -> Record
15
+ ^\s*Interface\s+Trusted\s+Rate limit \(pps\)\s*$$ -> Interfaces
16
+
17
+ Interfaces
18
+ ^\s*${INTERFACE}\s+${TRUST}\s+${RATE_PPS}\s*$$ -> Record
@@ -0,0 +1,19 @@
1
+ # Summary records by protocol; this does not decode all nested protocol detail.
2
+ Value Filldown PROTOCOL ([^"\r\n]+)
3
+ Value REDISTRIBUTING (.+)
4
+ Value NETWORK (.+)
5
+ Value DISTANCE (.+)
6
+
7
+ Start
8
+ ^\s*Routing Protocol is "${PROTOCOL}"\s*$$ -> Record
9
+ ^\s*Redistributing:\s+${REDISTRIBUTING}\s*$$ -> Record
10
+ ^\s*Distance:\s+${DISTANCE}\s*$$ -> Record
11
+ ^\s*Routing for Networks:\s*$$ -> Networks
12
+
13
+ Networks
14
+ ^\s{4,}${NETWORK}\s*$$ -> Record
15
+ ^\s*Routing Information Sources:\s*$$ -> Start
16
+ ^\s*Distance:\s+${DISTANCE}\s*$$ -> Start
17
+ ^\s*Routing Protocol is "${PROTOCOL}"\s*$$ -> Start
18
+
19
+ EOF
@@ -0,0 +1,9 @@
1
+ Template, Hostname, Platform, Command
2
+ cisco_ios_show_interfaces_counters_errors.textfsm, .*, cisco_ios, sh[[ow]] int[[erfaces]] cou[[nters]] er[[rors]]
3
+ cisco_ios_show_ip_arp_inspection_interfaces.textfsm, .*, cisco_ios, sh[[ow]] ip arp insp[[ection]] int[[erfaces]]
4
+ cisco_ios_show_device-tracking_database.textfsm, .*, cisco_ios, sh[[ow]] device-tracking database
5
+ cisco_ios_show_interfaces_counters.textfsm, .*, cisco_ios, sh[[ow]] int[[erfaces]] cou[[nters]]
6
+ cisco_ios_show_interfaces_trunk.textfsm, .*, cisco_ios, sh[[ow]] int[[erfaces]] trunk
7
+ cisco_ios_show_environment_all.textfsm, .*, cisco_ios, sh[[ow]] env[[ironment]] all
8
+ cisco_ios_show_ip_dhcp_snooping.textfsm, .*, cisco_ios, sh[[ow]] ip dhcp snoop[[ing]]$
9
+ cisco_ios_show_ip_protocols.textfsm, .*, cisco_ios, sh[[ow]] ip prot[[ocols]]$
@@ -0,0 +1,6 @@
1
+ # TTP templates
2
+
3
+ Optional Text Template Parser templates from v1.3.8. Use the filenames `show_<command>.ttp`. These parsers run before NTC in auto mode **except** that proven built-in Python parsers for certain tables are preferred to avoid partial multi-section output.
4
+
5
+ Test with `--parser-test "show ip arp" --input examples/show_ip_arp.txt --parser ttp`.
6
+ Outputs vary by IOS-XE version; treat the supplied patterns as starting points, not guaranteed full coverage.
@@ -0,0 +1,4 @@
1
+ <!-- Cisco IOS-XE show device-tracking database: IP MAC VLAN interface state. -->
2
+ <group name="entries*" method="table">
3
+ {{ ip | IP }} {{ mac | MAC }} {{ vlan | DIGIT }} {{ interface }} {{ state }}
4
+ </group>
@@ -0,0 +1,4 @@
1
+ <!-- Cisco IOS-XE show interfaces counters errors: 7-column variant. -->
2
+ <group name="interfaces*" method="table">
3
+ {{ port | re("[A-Za-z]+[0-9][^ ]*") }} {{ align_err }} {{ fcs_err }} {{ xmit_err }} {{ rcv_err }} {{ undersize }} {{ outdiscards }}
4
+ </group>
@@ -0,0 +1,5 @@
1
+ <!-- Cisco IOS-XE show ip arp: supports standard IPv4 ARPA rows. -->
2
+ <group name="entries*" method="table">
3
+ Internet {{ ip | IP }} {{ age }} {{ mac }} ARPA {{ interface }}
4
+ Internet {{ ip | IP }} {{ age }} {{ mac }} ARPA {{ interface }} *
5
+ </group>
@@ -0,0 +1,4 @@
1
+ <!-- Cisco IOS-XE show ip arp inspection interfaces: tabular variant. -->
2
+ <group name="interfaces*" method="table">
3
+ {{ interface | re("[A-Za-z]+[0-9][^ ]*") }} {{ trust | re("(?:Trusted|Untrusted)") }} {{ rate }} {{ burst }}
4
+ </group>
@@ -0,0 +1,4 @@
1
+ <!-- Cisco IOS-XE show ip dhcp snooping binding: six-field binding table. -->
2
+ <group name="bindings*" method="table">
3
+ {{ mac | MAC }} {{ ip | IP }} {{ lease }} {{ type }} {{ vlan | DIGIT }} {{ interface }}
4
+ </group>
@@ -0,0 +1,4 @@
1
+ <!-- Cisco IOS-XE show ip interface brief; status can have multiple words. -->
2
+ <group name="interfaces*" method="table">
3
+ {{ interface | re("[A-Za-z]+[0-9][^ ]*") }} {{ ip }} {{ ok }} {{ method }} {{ status | ORPHRASE }} {{ protocol }}
4
+ </group>
@@ -0,0 +1,3 @@
1
+ """Catalyst Config Auditor: read-only IOS-XE collection and offline reporting."""
2
+
3
+ __version__ = "1.4.0"
@@ -0,0 +1,5 @@
1
+ """Run with ``python -m catalyst_config_auditor``."""
2
+ from .cli import main
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())