From 9393f57e186d4fae6e325e2fb0e05993acad984b Mon Sep 17 00:00:00 2001 From: sandeepsr Date: Tue, 19 Dec 2017 13:36:05 +0530 Subject: [PATCH 1/5] adding cisco_xr_show_ip_bgp_summary.template --- .../cisco_xr_show_ip_bgp_summary.template | 17 +++++++ templates/index | 1 + .../cisco_xr_show_ip_bgp_summary.parsed | 51 +++++++++++++++++++ .../cisco_xr_show_ip_bgp_summary.raw | 22 ++++++++ 4 files changed, 91 insertions(+) create mode 100644 templates/cisco_xr_show_ip_bgp_summary.template create mode 100644 tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed create mode 100644 tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.raw diff --git a/templates/cisco_xr_show_ip_bgp_summary.template b/templates/cisco_xr_show_ip_bgp_summary.template new file mode 100644 index 0000000000..968199784d --- /dev/null +++ b/templates/cisco_xr_show_ip_bgp_summary.template @@ -0,0 +1,17 @@ +Value Filldown ROUTER_ID (\d+\.\d+\.\d+\.\d+) +Value Filldown LOCAL_AS (\d+) +Value BGP_NEIGH (\d+\.\d+\.\d+\.\d+) +Value NEIGH_AS (\d+) +Value MSG_RCVD (\d+) +Value MSG_SENT (\d+) +Value IN_QUEUE (\d+) +Value OUT_QUEUE (\d+) +Value UP_DOWN (\S+) +Value STATE_PFXRCD (\S+|\d+) + + +Start + ^.*\s+${ROUTER_ID}.*\s+${LOCAL_AS} + ^${BGP_NEIGH}\s+\d+\s+${NEIGH_AS}\s+${MSG_RCVD}\s+${MSG_SENT}\s+\d+\s+${IN_QUEUE}\s+${OUT_QUEUE}\s+${UP_DOWN}\s+${STATE_PFXRCD} -> Record + +EOF \ No newline at end of file diff --git a/templates/index b/templates/index index 04ecff448a..98c953423e 100644 --- a/templates/index +++ b/templates/index @@ -165,6 +165,7 @@ cisco_xr_show_cdp_neighbors_detail.template, .*, cisco_xr, sh[[ow]] c[[dp]] neig cisco_xr_show_redundancy_summary.template, .*, cisco_xr, sh[[ow]] redun[[dancy]] summ[[ary]] cisco_xr_show_interface_brief.template, .*, cisco_xr, sh[[ow]] int[[erface]] br[[ief]] cisco_xr_admin_show_platform.template, .*, cisco_xr, adm[[in]] sh[[ow]] pla[[tform]] +cisco_xr_show_ip_bgp_summary.template, .*, cisco_xr, sh[[ow]] ip b[[gp]] s[[ummary]] cisco_xr_show_isis_neighbors.template, .*, cisco_xr, sh[[ow]] isis ne[[ighbors]] cisco_xr_show_rsvp_neighbors.template, .*, cisco_xr, sh[[ow]] rs[[vp]] neigh[[bors]] cisco_xr_show_ospf_neighbor.template, .*, cisco_xr, sh[[ow]] ospf nei[[ghbor]] diff --git a/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed new file mode 100644 index 0000000000..127190a261 --- /dev/null +++ b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed @@ -0,0 +1,51 @@ +--- + +parsed_sample: + + +- state_pfxrcd : "Idle' + neigh_as : "64924' + local_as : "64200' + out_queue : "0' + msg_sent : "64731' + bgp_neigh : "10.10.17.161' + up_down : "00:00:00' + in_queue : "0' + router_id : "30.67.35.78' + msg_rcvd : "36190' + + +- state_pfxrcd : "Active' + neigh_as : "64727' + local_as : "64200' + out_queue : "0' + msg_sent : "70941' + bgp_neigh : "10.10.128.240' + up_down : "2d14h' + in_queue : "0' + router_id : "30.67.35.78' + msg_rcvd : "68750' + + +- state_pfxrcd : "82' + neigh_as : "64727' + local_as : "64200' + out_queue : "0' + msg_sent : "76220' + bgp_neigh : "10.10.132.240' + up_down : "7w2d' + in_queue : "0' + router_id : "30.67.35.78' + msg_rcvd : "74112' + + +- state_pfxrcd : "82' + neigh_as : "64727' + local_as : "64200' + out_queue : "0' + msg_sent : "74575' + bgp_neigh : "10.10.140.240' + up_down : "4d10h' + in_queue : "0' + router_id : "30.67.35.78' + msg_rcvd : "72363' \ No newline at end of file diff --git a/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.raw b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.raw new file mode 100644 index 0000000000..f18cb8dc10 --- /dev/null +++ b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.raw @@ -0,0 +1,22 @@ +Mon Dec 18 11:13:26.959 UTC +BGP router identifier 30.67.35.78, local AS number 64200 +BGP generic scan interval 60 secs +Non-stop routing is enabled +BGP table state: Active +Table ID: 0xe0000000 RD version: 94623 +BGP main routing table version 94623 +BGP NSR Initial initsync version 2 (Reached) +BGP NSR/ISSU Sync-Group versions 0/0 +BGP scan interval 60 secs + +BGP is operating in STANDALONE mode. + + +Process RcvTblVer bRIB/RIB LabelVer ImportVer SendTblVer StandbyVer +Speaker 94623 94623 94623 94623 94623 0 + +Neighbor Spk AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down St/PfxRcd +10.10.17.161 0 64924 36190 64731 0 0 0 00:00:00 Idle +10.10.128.240 0 64727 68750 70941 0 0 0 2d14h Active +10.10.132.240 0 64727 74112 76220 94623 0 0 7w2d 82 +10.10.140.240 0 64727 72363 74575 94623 0 0 4d10h 82 \ No newline at end of file From f089376bd4f5ac6bc615109e48a36141a3910d37 Mon Sep 17 00:00:00 2001 From: Sandeep Rawat Date: Tue, 19 Dec 2017 14:13:29 +0530 Subject: [PATCH 2/5] fixing the quotes --- .../cisco_xr_show_ip_bgp_summary.parsed | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed index 127190a261..531b9e8454 100644 --- a/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed +++ b/tests/cisco_xr/show_ip_bgp_summary/cisco_xr_show_ip_bgp_summary.parsed @@ -3,49 +3,49 @@ parsed_sample: -- state_pfxrcd : "Idle' - neigh_as : "64924' - local_as : "64200' - out_queue : "0' - msg_sent : "64731' - bgp_neigh : "10.10.17.161' - up_down : "00:00:00' - in_queue : "0' - router_id : "30.67.35.78' - msg_rcvd : "36190' - - -- state_pfxrcd : "Active' - neigh_as : "64727' - local_as : "64200' - out_queue : "0' - msg_sent : "70941' - bgp_neigh : "10.10.128.240' - up_down : "2d14h' - in_queue : "0' - router_id : "30.67.35.78' - msg_rcvd : "68750' - - -- state_pfxrcd : "82' - neigh_as : "64727' - local_as : "64200' - out_queue : "0' - msg_sent : "76220' - bgp_neigh : "10.10.132.240' - up_down : "7w2d' - in_queue : "0' - router_id : "30.67.35.78' - msg_rcvd : "74112' - - -- state_pfxrcd : "82' - neigh_as : "64727' - local_as : "64200' - out_queue : "0' - msg_sent : "74575' - bgp_neigh : "10.10.140.240' - up_down : "4d10h' - in_queue : "0' - router_id : "30.67.35.78' - msg_rcvd : "72363' \ No newline at end of file +- state_pfxrcd : 'Idle' + neigh_as : '64924' + local_as : '64200' + out_queue : '0' + msg_sent : '64731' + bgp_neigh : '10.10.17.161' + up_down : '00:00:00' + in_queue : '0' + router_id : '30.67.35.78' + msg_rcvd : '36190' + + +- state_pfxrcd : 'Active' + neigh_as : '64727' + local_as : '64200' + out_queue : '0' + msg_sent : '70941' + bgp_neigh : '10.10.128.240' + up_down : '2d14h' + in_queue : '0' + router_id : '30.67.35.78' + msg_rcvd : '68750' + + +- state_pfxrcd : '82' + neigh_as : '64727' + local_as : '64200' + out_queue : '0' + msg_sent : '76220' + bgp_neigh : '10.10.132.240' + up_down : '7w2d' + in_queue : '0' + router_id : '30.67.35.78' + msg_rcvd : '74112' + + +- state_pfxrcd : '82' + neigh_as : '64727' + local_as : '64200' + out_queue : '0' + msg_sent : '74575' + bgp_neigh : '10.10.140.240' + up_down : '4d10h' + in_queue : '0' + router_id : '30.67.35.78' + msg_rcvd : '72363' From 238fe198abe5a576b5c9b11aaf4c314780c0e7dd Mon Sep 17 00:00:00 2001 From: Sandeep Rawat Date: Fri, 22 Dec 2017 16:09:29 +0530 Subject: [PATCH 3/5] adding ^$$ -> Error "LINE NOT FOUND" to template --- templates/cisco_xr_show_ip_bgp_summary.template | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/cisco_xr_show_ip_bgp_summary.template b/templates/cisco_xr_show_ip_bgp_summary.template index 968199784d..830a359039 100644 --- a/templates/cisco_xr_show_ip_bgp_summary.template +++ b/templates/cisco_xr_show_ip_bgp_summary.template @@ -13,5 +13,7 @@ Value STATE_PFXRCD (\S+|\d+) Start ^.*\s+${ROUTER_ID}.*\s+${LOCAL_AS} ^${BGP_NEIGH}\s+\d+\s+${NEIGH_AS}\s+${MSG_RCVD}\s+${MSG_SENT}\s+\d+\s+${IN_QUEUE}\s+${OUT_QUEUE}\s+${UP_DOWN}\s+${STATE_PFXRCD} -> Record + ^\s*$$ + ^$$ -> Error "LINE NOT FOUND" -EOF \ No newline at end of file +EOF From 9a4fa4bf8aefeb4766afc36dbb983a2761738ea2 Mon Sep 17 00:00:00 2001 From: Sandeep Rawat Date: Fri, 22 Dec 2017 17:08:00 +0530 Subject: [PATCH 4/5] updating : ^.* -> Error "LINE NOT FOUND" to template --- templates/cisco_xr_show_ip_bgp_summary.template | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/templates/cisco_xr_show_ip_bgp_summary.template b/templates/cisco_xr_show_ip_bgp_summary.template index 830a359039..9a059ccc88 100644 --- a/templates/cisco_xr_show_ip_bgp_summary.template +++ b/templates/cisco_xr_show_ip_bgp_summary.template @@ -11,9 +11,15 @@ Value STATE_PFXRCD (\S+|\d+) Start - ^.*\s+${ROUTER_ID}.*\s+${LOCAL_AS} - ^${BGP_NEIGH}\s+\d+\s+${NEIGH_AS}\s+${MSG_RCVD}\s+${MSG_SENT}\s+\d+\s+${IN_QUEUE}\s+${OUT_QUEUE}\s+${UP_DOWN}\s+${STATE_PFXRCD} -> Record - ^\s*$$ - ^$$ -> Error "LINE NOT FOUND" + ^.*\s+${ROUTER_ID}.*number\s+${LOCAL_AS} -> Begin +Begin + ^Neighbor\s+.*Spk -> Neighbors + +Neighbors + ^${BGP_NEIGH}\s+\d+\s+${NEIGH_AS}\s+${MSG_RCVD}\s+${MSG_SENT}\s+\d+\s+${IN_QUEUE}\s+${OUT_QUEUE}\s+${UP_DOWN}\s+${STATE_PFXRCD} -> Record + ^\s+$$ + ^$$ + ^.* -> Error "LINE NOT FOUND" + EOF From dadb2cb49f39a0e588593c318a2ece25813cdf31 Mon Sep 17 00:00:00 2001 From: Sandeep Rawat Date: Sat, 23 Dec 2017 17:09:29 +0530 Subject: [PATCH 5/5] update state_pfxrcd regex --- templates/cisco_xr_show_ip_bgp_summary.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cisco_xr_show_ip_bgp_summary.template b/templates/cisco_xr_show_ip_bgp_summary.template index 9a059ccc88..99f30c3a27 100644 --- a/templates/cisco_xr_show_ip_bgp_summary.template +++ b/templates/cisco_xr_show_ip_bgp_summary.template @@ -7,7 +7,7 @@ Value MSG_SENT (\d+) Value IN_QUEUE (\d+) Value OUT_QUEUE (\d+) Value UP_DOWN (\S+) -Value STATE_PFXRCD (\S+|\d+) +Value STATE_PFXRCD (\S+) Start