Skip to content

Commit

Permalink
XR SHOW DROPS NP ALL: Add new templated
Browse files Browse the repository at this point in the history
CHANGES TO EXISTING PROPOSAL:
- Remove State Changes:
  * There was little regex being avoided by them,
  * Logic did not require state change for accurate capturing
- Move Record to happen on "Node" and "NP" lines
- Make `NP` Required to prevent capturing an empty entry on "Node" lines
- Remove `EOF` in order to capture last group now that `Record` does not happen on `-`
  • Loading branch information
jmcgill298 committed Jan 27, 2019
1 parent 3271dde commit 29a883a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 97 deletions.
177 changes: 83 additions & 94 deletions templates/cisco_xr_show_drops_np_all.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Value Filldown LOCATION (\S+)
Value NP (\d+)
Value Required NP (\d+)
Value BFD_NEIGHBOR_DROP (\d+)
Value BFD_REMOTE_PUNT_DISC_0_DROP (\d+)
Value DROP_FRM_CRC_ERR_ILKN0 (\d+)
Expand Down Expand Up @@ -76,96 +76,85 @@ Value RSV_MLDP_EGR_DROP (\d+)
Value UNKNOWN_L2_ON_L3_DISCARD (\d+)

Start
^\s*Node: ${LOCATION}:
^\-+
^\s+$$
^$$
^No NP ${NP} Drops -> NO_NP_DROPS_HEADER
^NP ${NP} Drops: -> NP_HEADER
^.* -> Error "LINE NOT FOUND"

NO_NP_DROPS_HEADER
^\-+ -> Record Start

NP_HEADER
^\-+ -> NP_SECTION

NP_SECTION
^BFD_NEIGHBOR_DROP +${BFD_NEIGHBOR_DROP}
^BFD_REMOTE_PUNT_DISC_0_DROP +${BFD_REMOTE_PUNT_DISC_0_DROP}
^DROP_FRM_CRC_ERR_ILKN0 +${DROP_FRM_CRC_ERR_ILKN0}
^DROP_FRM_CRC_ERR_ILKN1 +${DROP_FRM_CRC_ERR_ILKN1}
^DROP_FRM_CRC_ERR_ILKN2 +${DROP_FRM_CRC_ERR_ILKN2}
^DROP_FRM_CRC_ERR_SGMII0 +${DROP_FRM_CRC_ERR_SGMII0}
^DROP_FRM_CRC_ERR_SG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_DROP}
^MPLS_TTL_ONE_PUNT_EXCD +${MPLS_TTL_ONE_PUNT_EXCD}
^NP_SECTION +${NP_SECTION}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0 +${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1 +${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0_MONITOR +${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0_MONITOR}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1_MONITOR +${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1_MONITOR}
^PARSE_DROP_IN_UIDB_DOWN +${PARSE_DROP_IN_UIDB_DOWN}
^PARSE_DROP_IN_UIDB_TCAM_MISS +${PARSE_DROP_IN_UIDB_TCAM_MISS}
^PARSE_DROP_IPV4_DISABLED +${PARSE_DROP_IPV4_DISABLED}
^PARSE_DROP_IPV4_CHECKSUM_ERROR +${PARSE_DROP_IPV4_CHECKSUM_ERROR}
^PARSE_DROP_IPV4_LENGTH_ERROR +${PARSE_DROP_IPV4_LENGTH_ERROR}
^PARSE_L3_TAGGED_PUNT_DROP +${PARSE_L3_TAGGED_PUNT_DROP}
^PARSE_OPEN_NETWORK_SERVICE_KEY_ACTION_UNKNOWN +${PARSE_OPEN_NETWORK_SERVICE_KEY_ACTION_UNKNOWN}
^PARSE_EGR_INJ_PKT_TYP_UNKNOWN +${PARSE_EGR_INJ_PKT_TYP_UNKNOWN}
^PARSE_UNKNOWN_NPH_TYPE_DROP +${PARSE_UNKNOWN_NPH_TYPE_DROP}
^PUNT_ADJ_EXCD +${PUNT_ADJ_EXCD}
^PUNT_IFIB_OSPF_OPT_EXCD +${PUNT_IFIB_OSPF_OPT_EXCD}
^PUNT_IPV4_ADJ_NULL_RTE_EXCD +${PUNT_IPV4_ADJ_NULL_RTE_EXCD}
^PUNT_NO_MATCH_EXCD +${PUNT_NO_MATCH_EXCD}
^PUNT_STATISTICS_EXCD +${PUNT_STATISTICS_EXCD}
^RSV_DROP_EGR_LAG_NO_MATCH +${RSV_DROP_EGR_LAG_NO_MATCH}
^RSV_DROP_EGR_UIDB_DOWN +${RSV_DROP_EGR_UIDB_DOWN}
^RSV_DROP_EGR_UIDB_NO_MATCH +${RSV_DROP_EGR_UIDB_NO_MATCH}
^RSV_DROP_IFIB_TTL_CHECK +${RSV_DROP_IFIB_TTL_CHECK}
^RSV_DROP_IN_L3_NOT_MYMAC +${RSV_DROP_IN_L3_NOT_MYMAC}
^RSV_DROP_ING_BFD +${RSV_DROP_ING_BFD}
^RSV_DROP_IPM4_EGR_FILTER_DROP +${RSV_DROP_IPM4_EGR_FILTER_DROP}
^RSV_DROP_IPM4_EGR_RPF_FAIL_DROP +${RSV_DROP_IPM4_EGR_RPF_FAIL_DROP}
^RSV_DROP_IPM4_EGR_TTL_DROP +${RSV_DROP_IPM4_EGR_TTL_DROP}
^RSV_DROP_IPM4_NO_OLIST +${RSV_DROP_IPM4_NO_OLIST}
^RSV_DROP_IPM4_NO_OLIST_REP +${RSV_DROP_IPM4_NO_OLIST_REP}
^RSV_DROP_IPV4_DROP_NULL_RTE +${RSV_DROP_IPV4_DROP_NULL_RTE}
^RSV_DROP_IPV4_NRLDI_NOT_LOCAL +${RSV_DROP_IPV4_NRLDI_NOT_LOCAL}
^RSV_DROP_IPV4_RXADJ_DROP +${RSV_DROP_IPV4_RXADJ_DROP}
^RSV_DROP_IPV4_TXADJ_NO_MATCH +${RSV_DROP_IPV4_TXADJ_NO_MATCH}
^RSV_DROP_MPLS_LEAF_NO_MATCH +${RSV_DROP_MPLS_LEAF_NO_MATCH}
^RSV_DROP_MPLS_LEAF_NO_MATCH_MONITOR +${RSV_DROP_MPLS_LEAF_NO_MATCH_MONITOR}
^RSV_DROP_MPLS_NRLDI_NO_MATCH +${RSV_DROP_MPLS_NRLDI_NO_MATCH}
^RSV_DROP_MPLS_NRLDI_NOT_LOCAL +${RSV_DROP_MPLS_NRLDI_NOT_LOCAL}
^RSV_DROP_MPLS_RXADJ_DROP +${RSV_DROP_MPLS_RXADJ_DROP}
^RSV_DROP_MPLS_TXADJ_NO_MATCH +${RSV_DROP_MPLS_TXADJ_NO_MATCH}
^RSV_DROP_NHINDEX +${RSV_DROP_NHINDEX}
^RSV_EGR_LAG_NOT_LOCAL_DROP_CNT +${RSV_EGR_LAG_NOT_LOCAL_DROP_CNT}
^RSV_MLDP_EGR_DROP +${RSV_MLDP_EGR_DROP}
^UNKNOWN_L2_ON_L3_DISCARD +${UNKNOWN_L2_ON_L3_DISCARD}
^\-+ -> Record Start
^.* -> Error "LINE NOT FOUND"

EOF
^\s*Node:\s+\S+ -> Continue.Record
^\s*Node:\s+${LOCATION}:
^-+
^(?:No\s+)?NP -> Continue.Record
^No\s+NP\s+${NP}\s+Drops
^NP\s+${NP}\s+Drops:
^BFD_NEIGHBOR_DROP\s+${BFD_NEIGHBOR_DROP}
^BFD_REMOTE_PUNT_DISC_0_DROP\s+${BFD_REMOTE_PUNT_DISC_0_DROP}
^DROP_FRM_CRC_ERR_ILKN0\s+${DROP_FRM_CRC_ERR_ILKN0}
^DROP_FRM_CRC_ERR_ILKN1\s+${DROP_FRM_CRC_ERR_ILKN1}
^DROP_FRM_CRC_ERR_ILKN2\s+${DROP_FRM_CRC_ERR_ILKN2}
^DROP_FRM_CRC_ERR_SGMII0\s+${DROP_FRM_CRC_ERR_SGMII0}
^DROP_FRM_CRC_ERR_SGMII1\s+${DROP_FRM_CRC_ERR_SGMII1}
^DROP_FRM_CRC_ERR_SGMII2\s+${DROP_FRM_CRC_ERR_SGMII2}
^DROP_FRM_CRC_ERR_SGMII3\s+${DROP_FRM_CRC_ERR_SGMII3}
^DROP_FRM_CRC_ERR_XAUI4\s+${DROP_FRM_CRC_ERR_XAUI4}
^DROP_FRM_CRC_ERR_XAUI5\s+${DROP_FRM_CRC_ERR_XAUI5}
^DROP_FRM_CRC_ERR_XAUI6\s+${DROP_FRM_CRC_ERR_XAUI6}
^DROP_FRM_FRM_ERR_ILKN0\s+${DROP_FRM_FRM_ERR_ILKN0}
^DROP_FRM_FRM_ERR_ILKN1\s+${DROP_FRM_FRM_ERR_ILKN1}
^DROP_FRM_FRM_ERR_ILKN2\s+${DROP_FRM_FRM_ERR_ILKN2}
^DROP_FRM_FRM_ERR_SGMII0\s+${DROP_FRM_FRM_ERR_SGMII0}
^DROP_FRM_FRM_ERR_SGMII1\s+${DROP_FRM_FRM_ERR_SGMII1}
^DROP_FRM_FRM_ERR_SGMII2\s+${DROP_FRM_FRM_ERR_SGMII2}
^DROP_FRM_FRM_ERR_SGMII3\s+${DROP_FRM_FRM_ERR_SGMII3}
^DROP_FRM_FRM_ERR_XAUI4\s+${DROP_FRM_FRM_ERR_XAUI4}
^DROP_FRM_FRM_ERR_XAUI5\s+${DROP_FRM_FRM_ERR_XAUI5}
^DROP_FRM_FRM_ERR_XAUI6\s+${DROP_FRM_FRM_ERR_XAUI6}
^DROP_FRM_RUNT\s+${DROP_FRM_RUNT}
^IPV4_BFD_EXCD\s+${IPV4_BFD_EXCD}
^IPV4_FRAG_NEEDED_PUNT_EXCD\s+${IPV4_FRAG_NEEDED_PUNT_EXCD}
^IPV4_TTL_ERROR_EXCD\s+${IPV4_TTL_ERROR_EXCD}
^MDF_PUNT_POLICE_DROP\s+${MDF_PUNT_POLICE_DROP}
^MDF_RPF_FAIL_DROP\s+${MDF_RPF_FAIL_DROP}
^MODIFY_PUNT_REASON_MISS_DROP\s+${MODIFY_PUNT_REASON_MISS_DROP}
^MPLS_TTL_ONE_PUNT_EXCD\s+${MPLS_TTL_ONE_PUNT_EXCD}
^NP_SECTION\s+${NP_SECTION}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0\s+${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1\s+${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0_MONITOR\s+${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_0_MONITOR}
^PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1_MONITOR\s+${PARSE_FAST_DISCARD_LOW_PRIORITY_DROP_1_MONITOR}
^PARSE_DROP_IN_UIDB_DOWN\s+${PARSE_DROP_IN_UIDB_DOWN}
^PARSE_DROP_IN_UIDB_TCAM_MISS\s+${PARSE_DROP_IN_UIDB_TCAM_MISS}
^PARSE_DROP_IPV4_DISABLED\s+${PARSE_DROP_IPV4_DISABLED}
^PARSE_DROP_IPV4_CHECKSUM_ERROR\s+${PARSE_DROP_IPV4_CHECKSUM_ERROR}
^PARSE_DROP_IPV4_LENGTH_ERROR\s+${PARSE_DROP_IPV4_LENGTH_ERROR}
^PARSE_L3_TAGGED_PUNT_DROP\s+${PARSE_L3_TAGGED_PUNT_DROP}
^PARSE_OPEN_NETWORK_SERVICE_KEY_ACTION_UNKNOWN\s+${PARSE_OPEN_NETWORK_SERVICE_KEY_ACTION_UNKNOWN}
^PARSE_EGR_INJ_PKT_TYP_UNKNOWN\s+${PARSE_EGR_INJ_PKT_TYP_UNKNOWN}
^PARSE_UNKNOWN_NPH_TYPE_DROP\s+${PARSE_UNKNOWN_NPH_TYPE_DROP}
^PUNT_ADJ_EXCD\s+${PUNT_ADJ_EXCD}
^PUNT_IFIB_OSPF_OPT_EXCD\s+${PUNT_IFIB_OSPF_OPT_EXCD}
^PUNT_IPV4_ADJ_NULL_RTE_EXCD\s+${PUNT_IPV4_ADJ_NULL_RTE_EXCD}
^PUNT_NO_MATCH_EXCD\s+${PUNT_NO_MATCH_EXCD}
^PUNT_STATISTICS_EXCD\s+${PUNT_STATISTICS_EXCD}
^RSV_DROP_EGR_LAG_NO_MATCH\s+${RSV_DROP_EGR_LAG_NO_MATCH}
^RSV_DROP_EGR_UIDB_DOWN\s+${RSV_DROP_EGR_UIDB_DOWN}
^R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${RSV_DROP_MPLS_TXADJ_NO_MATCH}
^RSV_DROP_NHINDEX\s+${RSV_DROP_NHINDEX}
^RSV_EGR_LAG_NOT_LOCAL_DROP_CNT\s+${RSV_EGR_LAG_NOT_LOCAL_DROP_CNT}
^RSV_MLDP_EGR_DROP\s+${RSV_MLDP_EGR_DROP}
^UNKNOWN_L2_ON_L3_DISCARD\s+${UNKNOWN_L2_ON_L3_DISCARD}
^\s*$$
^. -> Error "LINE NOT FOUND"
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ MODIFY_PUNT_REASON_MISS_DROP 2
NP 7 Drops:
----------------------------------------------------------------
MODIFY_PUNT_REASON_MISS_DROP 3
----------------------------------------------------------------
----------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ MODIFY_PUNT_REASON_MISS_DROP 4
NP 7 Drops:
----------------------------------------------------------------
MODIFY_PUNT_REASON_MISS_DROP 4
----------------------------------------------------------------
----------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ MODIFY_PUNT_REASON_MISS_DROP 4
NP 7 Drops:
----------------------------------------------------------------
MODIFY_PUNT_REASON_MISS_DROP 3
----------------------------------------------------------------
----------------------------------------------------------------

0 comments on commit 29a883a

Please sign in to comment.