Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_bgp_neighbors_detail IOS-XE #1185

Merged
merged 9 commits into from
Apr 29, 2020
6 changes: 4 additions & 2 deletions napalm/ios/utils/textfsm_templates/ip_bgp_all_sum.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Value MSG_SENT (\d+)
Value TBL_VER (\d+)
Value IN_Q (\d+)
Value OUT_Q (\d+)
Value UP (\w+)
Value UP (\S+)
Value PREFIX_RECV (.*)

Start
Expand All @@ -18,7 +18,9 @@ Start
^Neighbor\s+V -> Table

Table
^${NEIGHBOR} -> Continue
^\s+${BGP_VER}\s+${REMOTE_AS}\s+${MSG_RECV}\s+${MSG_SENT}\s+${TBL_VER}\s+${IN_Q}\s+${OUT_Q}\s+${UP}\s+${PREFIX_RECV} -> Record Table
^${NEIGHBOR}\s+${BGP_VER}\s+${REMOTE_AS}\s+${MSG_RECV}\s+${MSG_SENT}\s+${TBL_VER}\s+${IN_Q}\s+${OUT_Q}\s+${UP}\s+${PREFIX_RECV} -> Record Table
^\s* -> Clearall Start
^$$ -> Clearall Start

EOF
2 changes: 1 addition & 1 deletion napalm/ios/utils/textfsm_templates/ip_bgp_neigh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Value DESCRIPTION (.*)
Value ROUTER_ID (\S+)
Value BGP_STATE (\w+)
Value UP (\w+)
Value UPTIME (\w+)
Value UPTIME (\S+)
Value LAST_READ (.*)
Value LAST_WRITE (.*)
Value HOLDTIME (\d+)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,43 @@
"output_updates": 2480,
"received_prefix_count": 45717,
"holdtime": 180
},
{
"suppress_4byte_as": false,
"local_as_prepend": false,
"connection_state": "Established",
"multihop": false,
"input_messages": 6974686,
"output_messages": 138790,
"previous_connection_state": "",
"remove_private_as": false,
"multipath": false,
"messages_queued_out": 0,
"keepalive": 60,
"remote_as": 7922,
"local_port": 21958,
"active_prefix_count": 45715,
"configured_holdtime": 0,
"routing_table": "global",
"flap_count": 0,
"suppressed_prefix_count": 0,
"local_address": "2001:559::2",
"remote_port": 179,
"input_updates": 6974616,
"configured_keepalive": 0,
"router_id": "68.86.1.1",
"export_policy": "BGP-TRANSIT-IPv6-OUT",
"local_as": 1,
"remote_address": "2001:559::3",
"advertised_prefix_count": 2,
"local_address_configured": true,
"import_policy": "BGP-COMCAST-IPv6-IN",
"last_event": "",
"accepted_prefix_count": 45717,
"up": true,
"output_updates": 2480,
"received_prefix_count": 45717,
"holdtime": 180
}
]
},
Expand Down Expand Up @@ -159,4 +196,4 @@
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ BGP activity 3436532/2710503 prefixes, 19215241/17575537 paths, scan interval 60

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:559::1 4 7922 6944479 138054 116434201 0 0 12w2d 45646
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure your changes don't break the existing behaviour, please don't change this file and provide a separate test case with the output you're seeing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The show_ip_bgp_all_sum.txt is the base for the whole test. Following your suggestion I've added a new neighbor to the list and kept all the original neighbors in place. Please let me know if this makes sense to you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually prefer to avoid changing this file when fixing a bug (as probably you won't see both outputs, i.e., in both 12:22:20 and 12w2d format at the same time -- but never say never Cisco is Cisco lol), and have a separate test case; that means, another set of files under a directory, e.g., test/ios/mocked_data/test_get_bgp_neighbors_detail/<some test case name>/.
But this change is small enough we can leave this pass...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, it all makes sense now. I wasn't quite sure how the test framework works. Thank you for the explanation, I'll keep it in mind for the next time!

2001:559::3
4 7922 6944479 138054 116434201 0 0 12:22:20 45646

For address family: VPNv4 Unicast
BGP router identifier 1.1.1.1, local AS number 1
Expand All @@ -53,4 +55,4 @@ BGP using 10206888 total bytes of memory
BGP activity 3436532/2710503 prefixes, 19215241/17575537 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
169.255.22.1 4 1 101841 100528 6668 0 0 9w0d 440
169.255.22.1 4 1 101841 100528 6668 0 0 9w0d 440
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@

BGP neighbor is 2001:559::3, remote AS 7922, external link
Description: Comcast IPv6 Transit
Inherits from template PEER-SESSION-AS7922 for session parameters
BGP version 4, remote router ID 68.86.1.1
BGP state = Established, up for 12w2d
Last read 00:00:01, last write 00:00:35, hold time is 180, keepalive interval is 60 seconds
Neighbor sessions:
1 active, is not multisession capable (disabled)
Neighbor capabilities:
Route refresh: advertised and received(new)
Four-octets ASN Capability: advertised and received
Address family IPv6 Unicast: advertised and received
Graceful Restart Capability: advertised and received
Remote Restart timer is 120 seconds
Address families advertised by peer:
IPv6 Unicast (was preserved
Enhanced Refresh Capability: advertised
Multisession Capability:
Stateful switchover support enabled: NO for session 1
Message statistics:
InQ depth is 0
OutQ depth is 0

Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 2480 6974616
Keepalives: 136309 69
Route Refresh: 0 0
Total: 138790 6974686
Do log neighbor state changes (via global configuration)
Default minimum time between advertisement runs is 30 seconds

For address family: IPv6 Unicast
Session: 2001:559::3
BGP table version 117061141, neighbor version 117061129/117061141
Output queue size : 0
Index 1, Advertise bit 0
1 update-group member
Inherits from template PEER-POLICY-COMCAST-IPv6
My AS number is allowed for 10 number of times
NEXT_HOP is always this router for eBGP paths
Inbound path policy configured
Outbound path policy configured
Incoming update prefix filter list is BGP-BOGONS-IPv6-IN
Outgoing update prefix filter list is BGP-TRANSIT-IPv6-OUT
Route map for incoming advertisements is BGP-COMCAST-IPv6-IN
Route map for outgoing advertisements is BGP-TRANSIT-IPv6-OUT
Slow-peer detection is disabled
Slow-peer split-update-group dynamic is disabled
Sent Rcvd
Prefix activity: ---- ----
Prefixes Current: 2 45717 (Consumes 6948984 bytes)
Prefixes Total: 4958 8328487
Implicit Withdraw: 4956 7470835
Explicit Withdraw: 0 811935
Used as bestpath: n/a 45715
Used as multipath: n/a 0
Used as secondary: n/a 0

Outbound Inbound
Local Policy Denied Prefixes: -------- -------
Other Policies: 112415977 n/a
Total: 112415977 0
Number of NLRIs in the update sent: max 2, min 0
Last detected as dynamic slow peer: never
Dynamic slow peer recovered: never
Refresh Epoch: 1
Last Sent Refresh Start-of-rib: never
Last Sent Refresh End-of-rib: never
Last Received Refresh Start-of-rib: never
Last Received Refresh End-of-rib: never
Sent Rcvd
Refresh activity: ---- ----
Refresh Start-of-RIB 0 0
Refresh End-of-RIB 0 0

Address tracking is enabled, the RIB does have a route to 2001:559::3
Connections established 1; dropped 0
Last reset never
External BGP neighbor configured for connected checks (single-hop no-disable-connected-check)
Interface associated: GigabitEthernet0/0/4 (peering address in same link)
Transport(tcp) path-mtu-discovery is enabled
Graceful-Restart is enabled, restart-time 120 seconds, stalepath-time 360 seconds
SSO is disabled
Connection state is ESTAB, I/O status: 1, unread input bytes: 0
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1
Local host: 2001:559::2, Local port: 21958
Foreign host: 2001:559::3, Foreign port: 179
Connection tableid (VRF): 0
Maximum output segment queue size: 50

Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x1BED85262):
Timer Starts Wakeups Next
Retrans 138767 0 0x0
TimeWait 0 0 0x0
AckHold 2425311 1956394 0x0
SendWnd 0 0 0x0
KeepAlive 0 0 0x0
GiveUp 0 0 0x0
PmtuAger 7470660 7470659 0x1BED853C2
DeadWait 0 0 0x0
Linger 0 0 0x0
ProcessQ 0 0 0x0

iss: 3500006922 snduna: 3502837353 sndnxt: 3502837353
irs: 2409182929 rcvnxt: 3188305548

sndwnd: 65022 scale: 0 maxrcvwnd: 16384
rcvwnd: 16164 scale: 0 delrcvwnd: 220

SRTT: 1000 ms, RTTO: 1003 ms, RTV: 3 ms, KRTT: 0 ms
minRTT: 1 ms, maxRTT: 1000 ms, ACK hold: 200 ms
uptime: -1 ms, Sent idletime: 1099 ms, Receive idletime: 1299 ms
Status Flags: active open
Option Flags: nagle, path mtu capable
IP Precedence value : 6

Datagrams (max data segment is 1440 bytes):
Rcvd: 2561857 (out of order: 0), with data: 2431970, total data bytes: 779122618
Sent: 2570215 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 2570215, total data bytes: 105639038

Packets received in fast path: 0, fast processed: 0, slow path: 0
fast lock acquisition failures: 0, slow path: 0
TCP Semaphore 0x7F2543BB2160 FREE