Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions ansible/roles/test/files/ptftests/advanced-reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ def disconnect(self):

def run(self):
data = {}
samples = {}
debug_data = {}
run_once = False
log_first_line = None
quit_enabled = False
routing_works = True
self.connect()

cur_time = time.time()
Expand Down Expand Up @@ -161,6 +161,12 @@ def run(self):
portchannel_output = "\n".join(portchannel_output.split("\r\n")[1:-1])
sample["po_changetime"] = json.loads(portchannel_output, strict=False)['interfaces']['Port-Channel1']['lastStatusChangeTimestamp']

# Expect the routes remains during BGP graceful restart
po_ip_route_output = self.do_cmd("show ip route bgp | grep Port-Channel1 | wc -l")
po_ip_route_output = "\n".join(po_ip_route_output.split("\r\n")[1:-1])
po_route = int(po_ip_route_output)
info["po_route"] = po_route

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe v5_routing_ok and v6 routing ok has the route, you do not need to do another show ip route bgp.

if not run_once:
self.ipv4_gr_enabled, self.ipv6_gr_enabled, self.gr_timeout = self.parse_bgp_neighbor_once(bgp_neig_output)
if self.gr_timeout is not None:
Expand Down Expand Up @@ -208,6 +214,7 @@ def run(self):
cli_data['lacp'] = self.check_series_status(data, "lacp", "LACP session")
cli_data['bgp_v4'] = self.check_series_status(data, "bgp_route_v4", "BGP v4 routes")
cli_data['bgp_v6'] = self.check_series_status(data, "bgp_route_v6", "BGP v6 routes")
cli_data['po_route'] = self.check_series_status(data, "po_route", "PortChannel learned routes")
cli_data['po'] = self.check_change_time(samples, "po_changetime", "PortChannel interface")

return self.fails, self.info, cli_data, log_data
Expand Down Expand Up @@ -772,11 +779,12 @@ def runTest(self):
self.log("LACP/BGP were down for (extracted from cli):")
self.log("-"*50)
for ip in sorted(self.cli_info.keys()):
self.log(" %s - lacp: %7.3f (%d) po_events: (%d) bgp v4: %7.3f (%d) bgp v6: %7.3f (%d)" \
% (ip, self.cli_info[ip]['lacp'][1], self.cli_info[ip]['lacp'][0], \
self.cli_info[ip]['po'][1], \
self.cli_info[ip]['bgp_v4'][1], self.cli_info[ip]['bgp_v4'][0],\
self.cli_info[ip]['bgp_v6'][1], self.cli_info[ip]['bgp_v6'][0]))
self.log(" %s - lacp: %7.3f (%d) po_events: (%d) po_routes: (%d) bgp v4: %7.3f (%d) bgp v6: %7.3f (%d)"
% (ip, self.cli_info[ip]['lacp'][1], self.cli_info[ip]['lacp'][0],
self.cli_info[ip]['po'][1],
self.cli_info[ip]['po_route'][1],
self.cli_info[ip]['bgp_v4'][1], self.cli_info[ip]['bgp_v4'][0],
self.cli_info[ip]['bgp_v6'][1], self.cli_info[ip]['bgp_v6'][0]))

self.log("-"*50)
self.log("Extracted from VM logs:")
Expand Down