Skip to content

Commit

Permalink
cisco ios show ip interface: Incorporate #229 into #322 (#326)
Browse files Browse the repository at this point in the history
* Update index/test_index_order.py to match master (resolve conflicts)

* Another attempt to fix conflicts

* Removed duplicate entry for this template

* NEW TEMPLATE UPDATES:

BREAKING CHANGES:
  * Change IP Address and Mask to use lists for interfaces with multiple addresses
    - `IP_ADDRESS`
    - `MASK`

FIXES:
  * Correct template order in index file
  * Add catch-all to raise an Error on unmatched lines
  * Add regex matches for all known lines in test file
  * Remove ending `}` from MTU regex to accurately capture MTU size

NEW CAPTURE GROUPS:
  * `VRF`: Captures VRF interface is assigned to

GENERAL ENHANCEMENTS:
  * Make all spaces uses `\s+`
  * Update `IP_ADDRESS` to account for IPv4 and IPv6 Addresses
  * Allow for `IP_ADDRESS` to be present without `MASK`
  * Simplify regex for `LINK_STATUS`
  * Allow for spaces in ACL matches:
    - `OUTGOING_ACL`
    - `INBOUND_ACL`

TEST FILES:
  * Add parsed data for additional `VRF` capture group
  * Update parsed file to reflect changes

* Temporarily rename test files'

Added cisco_ios_show_ip_interface to index

* Rebase with master to fix conflicts:

* Rename test files to avoid conflicting names
* Add additional capture groups to template and existing parsed file
  • Loading branch information
jmcgill298 authored Jan 8, 2019
1 parent ea7aab1 commit 2de420c
Show file tree
Hide file tree
Showing 5 changed files with 1,221 additions and 414 deletions.
31 changes: 25 additions & 6 deletions templates/cisco_ios_show_ip_interface.template
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
Value INTF (\S+)
Value Required INTF (\S+)
Value LINK_STATUS (.+?)
Value PROTOCOL_STATUS (.+?)
Value Required IPADDR (\S+?)
Value MASK (\d*)
Value List IPADDR (\S+?)
Value List MASK (\d*)
Value VRF (\S+)
Value MTU (\d+)
Value List IP_HELPER (\d+\.\d+\.\d+\.\d+)
Value OUTGOING_ACL (.*?)
Value INBOUND_ACL (.*?)


Start
^\S -> Continue.Record
^${INTF}\s+is\s+${LINK_STATUS},\s+line\s+protocol\s+is\s+${PROTOCOL_STATUS}\s*$$
^\s+Internet\s+address\s+is\s+${IPADDR}/*${MASK}\s*$$
^\s+Internet\s+address\s+is\s+${IPADDR}/?${MASK}\s*$$
^\s+Secondary\s+address\s+${IPADDR}/?${MASK}\s*$$
^.+VPN\s+Routing/Forwarding\s+"${VRF}"
^\s+MTU\s+is\s+${MTU}\s+bytes
^\s+Helper\s+address(es|)\s(is|are)\s+${IP_HELPER}\s*$$ -> HELPERS
^\s+Outgoing\s+(?:Common\s+)?access\s+list\s+is\s+not\s+set
^\s+Outgoing\s+(?:Common\s+)?access\s+list\s+is\s+${OUTGOING_ACL}\s*$$
^\s+Inbound\s+(?:Common\s+)?access\s+list\s+is\s+not\s+set
^\s+Inbound\s+(?:Common\s+)?access\s+list\s+is\s+${INBOUND_ACL}\s*$$
^\s+Internet\s+protocol
^\s+Interface\s+is\s+unnumbered
^\s+Broadcast
^\s+Multicast
^\s+2[2-5]\d\.
^\s+Address\s+determined
^\s+Directed
^\s+MTU
^\s+Helper
^\s+Directed
Expand All @@ -33,8 +48,12 @@ Start
^\s+Policy
^\s+Network\s+address\s+
^\s+BGP
^\s+Input
^\s+(Input|Output|Post)\s+.*features
^\s+IPv4\s+WCCP
^\s+Output
^\s*$$
^. -> Error

HELPERS
^\s+${IP_HELPER}\s*$$
^\s+Directed -> Start
^.* -> Error
5 changes: 2 additions & 3 deletions templates/index
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# First line is the header fields for columns and is mandatory.
# Regular expressions are supported in all fields except the first.
# Last field supports variable length command completion.
Expand Down Expand Up @@ -150,8 +149,8 @@ cisco_ios_show_platform_diag.template, .*, cisco_ios, sh[[ow]] plat[[form]] di[[
cisco_ios_show_processes_cpu.template, .*, cisco_ios, sh[[ow]] proc[[esses]] [[cpu]]
cisco_ios_show_spanning-tree.template, .*, cisco_ios, sh[[ow]] sp[[anning-tree]]
cisco_ios_show_standby_brief.template, .*, cisco_ios, sh[[ow]] standby br[[ief]]
cisco_ios_show_ip_interface.template, .*, cisco_ios, sh[[ow]] ip in[[terface]]
cisco_ios_show_power_status.template, .*, cisco_ios, sh[[ow]] pow[[er]] st[[atus]]
cisco_ios_show_ip_interface.template, .*, cisco_ios, sh[[ow]] ip int[[erface]]
cisco_ios_show_power_status.template, .*, cisco_ios, sh[[ow]] pow[[er]] st[[atus]]
cisco_ios_show_access-list.template, .*, cisco_ios, sh[[ow]] acc[[ess-list]]
cisco_ios_show_isdn_status.template, .*, cisco_ios, sh[[ow]] isd[[n]] st[[atus]]
cisco_ios_show_interfaces.template, .*, cisco_ios, sh[[ow]] int[[erfaces]]
Expand Down
Loading

0 comments on commit 2de420c

Please sign in to comment.