Skip to content

Commit

Permalink
Fix template for Eltex's command 'show interface' (#1813)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxim Shpak <[email protected]>
  • Loading branch information
PavloSkliarenko and Maxim Shpak authored Aug 9, 2024
1 parent 035c74b commit d3483fb
Show file tree
Hide file tree
Showing 7 changed files with 532 additions and 3 deletions.
40 changes: 37 additions & 3 deletions ntc_templates/templates/eltex_show_interface.textfsm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Value INTERFACE ([a-zA-Z\-]+\s*(\d+(/\d+)*)?)
Value INTERFACE ([a-zA-Z\-]+\s*(?:\d+(?:/\d+)*)?)
Value STATUS (.*)
Value IFACE_INDEX (\d+)
Value MAC_ADDRESS ([a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5})
Expand All @@ -17,7 +17,8 @@ Value FEC_STATUS (\S+)
Value MDIX_MODE_STATUS (\S+)
Value IFACE_IN_PO_NUM (\d+)
Value ACTIVE_IFACE_IN_PO_NUM (\d+)
Value List IFACE_IN_PO ([a-zA-Z\-]+\s*(\d+(/\d+)*)?)
Value MIN_IFACE_REQUIRED_IN_PO_NUM (\d+)
Value List IFACE_IN_PO ([a-zA-Z\-]+\s*(?:\d+(?:/\d+)*)?)
Value List IFACE_IN_PO_BANDWIDTH (\d+[a-zA-Z]+)
Value List IFACE_IN_PO_STATUS (.*)
Value SUM_BANDWIDTH ([a-zA-Z0-9]+)
Expand Down Expand Up @@ -48,6 +49,9 @@ Value List OUTPUT_QUEUE_PACKETS_PASSED (\d+)
Value List OUTPUT_QUEUE_PACKETS_DROPPED (\d+)

Start
^\s*Load\s+balancing\s*:.*$$
^\s*Gathering\s+information...\s*$$
^\s*Channel\s+Ports\s*$$ -> Columns2
^\s*-+\s*show\s+interfaces\s+\S+\s*-+\s*$$ -> Continue.Record
^\s*-+\s*show\s+interfaces\s+\S+\s*-+\s*$$
^\s*${INTERFACE}\s+is\s+${STATUS}\s+\(.*\)\s*$$
Expand All @@ -66,7 +70,7 @@ Start
^\s*(?:\d+baseT/(?:Full|Half))\s+${LINK_MODES}\s*$$ -> Continue
^\s*(?:\d+baseT/(?:Full|Half)).*$$
^\s*Link\s+aggregation\s+type\s+is\s+${LINK_AGGREGATION_TYPE}\s*$$
^\s*No.\s+of\s+members\s+in\s+this\s+port-channel:\s+${IFACE_IN_PO_NUM}\s+\(active\s+${ACTIVE_IFACE_IN_PO_NUM}\)\s*$$
^\s*No.\s+of\s+members\s+in\s+this\s+port-channel:\s+${IFACE_IN_PO_NUM}\s+\(active\s+${ACTIVE_IFACE_IN_PO_NUM}(?:,\s+minimum\s+required\s+${MIN_IFACE_REQUIRED_IN_PO_NUM})?\)\s*$$
^\s*${IFACE_IN_PO},.*,\s*${IFACE_IN_PO_BANDWIDTH}\s+\(${IFACE_IN_PO_STATUS}\)\s*$$
^\s*Active\s+bandwidth\s+is\s+${SUM_BANDWIDTH}\s*$$
^\s*Flow\s+control\s+is\s+${FLOW_CONTROL_STATUS},\s+MDIX\s+mode\s+is\s+${MDIX_MODE_STATUS}\s*$$
Expand All @@ -87,3 +91,33 @@ Start
^\s*${OUTPUT_QUEUE_NUM}\s*:\s*${OUTPUT_QUEUE_PACKETS_PASSED}/${OUTPUT_QUEUE_PACKETS_DROPPED}\s*$$
^\s*$$
^. -> Error

Columns2
^\s*-+(?:\s+-+)*\s*$$
^[a-zA-Z\-]+\s*(?:\d+(?:/\d+)*)?.* -> Continue.Record
^${INTERFACE}(?:\s+.*?\:\s*${IFACE_IN_PO})?.*$$ -> Continue
^[a-zA-Z\-]+\s*(\d+(/\d+)*)?\s+.*?\:\s*(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){1}${IFACE_IN_PO}.*$$ -> Continue
^[a-zA-Z\-]+\s*(\d+(/\d+)*)?\s+.*?\:\s*(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){2}${IFACE_IN_PO}.*$$ -> Continue
^[a-zA-Z\-]+\s*(\d+(/\d+)*)?\s+.*?\:\s*(?:[a-z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-Z\-]+\s*(\d+(/\d+)*)?,){5}${IFACE_IN_PO}.*$$ -> Continue
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){6}${IFACE_IN_PO}.*$$ -> Continue
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){7}${IFACE_IN_PO}.*$$ -> Continue
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){8}${IFACE_IN_PO}.*$$ -> Continue
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){9}${IFACE_IN_PO}.*$$ -> Continue
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,){10}${IFACE_IN_PO}.*$$ -> Continue
^[a-zA-Z\-]+\s*(\d+(/\d+)*)?(?:\s+.*?\:\s*(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,)*[a-zA-Z\-]+\s*(\d+(/\d+)*),?)?\s*$$
^\s+(?:[a-zA-Z\-]+\s*(\d+(/\d+)*)?,)*[a-zA-Z\-]+\s*(\d+(/\d+)*)\s*$$
^\s*$$
^. -> Error
Loading

0 comments on commit d3483fb

Please sign in to comment.