@@ -347,80 +347,6 @@ def test_sessions_flapping(
347347 duthost .no_shutdown_multiple (flapping_ports )
348348
349349
350- def test_device_unisolation (
351- duthost ,
352- ptfadapter ,
353- bgp_peers_info ,
354- setup_packet_mask_counters ,
355- announce_bgp_routes_teardown
356- ):
357- '''
358- This test is for the worst senario that all ports are flapped,
359- verify control/data plane have acceptable conergence time.
360- Steps:
361- Shut down all ports on device. (shut down T1 sessions ports on T0 DUT, shut down T0 sesssions ports on T1 DUT.)
362- Wait for routes are stable.
363- Start and keep sending packets with all routes to all portes via ptf.
364- Unshut all ports and wait for routes are stable.
365- Stop sending packets.
366- Estamite control/data plane convergence time.
367- Expected result:
368- Dataplane downtime is less than MAX_DOWNTIME_UNISOLATION.
369- '''
370- pdp = ptfadapter .dataplane
371- exp_mask = setup_packet_mask_counters
372- bgp_ports = [bgp_info [DUT_PORT ] for bgp_info in bgp_peers_info .values ()]
373- injection_dut_port = random .choice (bgp_ports )
374- injection_port = [i [PTF_PORT ] for i in bgp_peers_info .values () if i [DUT_PORT ] == injection_dut_port ][0 ]
375- logger .info ("Injection port: %s" , injection_port )
376-
377- startup_routes = get_all_bgp_ipv6_routes (duthost )
378- ecmp_routes = {r : v for r , v in startup_routes .items () if len (v [0 ]['nexthops' ]) > 1 and r not in STATIC_ROUTES }
379- pkts = generate_packets (
380- ecmp_routes ,
381- duthost .facts ['router_mac' ],
382- pdp .get_mac (0 , injection_port )
383- )
384-
385- nexthops_to_remove = [b [IPV6_KEY ] for b in bgp_peers_info .values () if b [DUT_PORT ] in bgp_ports ]
386- expected_routes = remove_nexthops_in_routes (startup_routes , nexthops_to_remove )
387- try :
388- duthost .shutdown_multiple (bgp_ports )
389- ports_shut_time = datetime .datetime .now ()
390- recovered = wait_for_ipv6_bgp_routes_recovery (
391- duthost ,
392- expected_routes ,
393- ports_shut_time ,
394- MAX_CONVERGENCE_WAIT_TIME
395- )
396- if not recovered :
397- pytest .fail ("BGP routes are not stable in long time" )
398- except Exception :
399- duthost .no_shutdown_multiple (bgp_ports )
400-
401- terminated = Event ()
402- traffic_thread = Thread (
403- target = send_packets , args = (terminated , pdp , 0 , injection_port , pkts )
404- )
405- flush_counters (pdp , exp_mask )
406- start_time = datetime .datetime .now ()
407- traffic_thread .start ()
408- duthost .no_shutdown_multiple (bgp_ports )
409- ports_startup_time = datetime .datetime .now ()
410- recovered = wait_for_ipv6_bgp_routes_recovery (
411- duthost ,
412- startup_routes ,
413- ports_startup_time ,
414- MAX_CONVERGENCE_WAIT_TIME
415- )
416- terminated .set ()
417- traffic_thread .join ()
418- end_time = datetime .datetime .now ()
419- validate_rx_tx_counters (pdp , end_time , start_time , exp_mask , MAX_DOWNTIME_UNISOLATION )
420- if not recovered :
421- pytest .fail ("BGP routes are not stable in long time" )
422-
423-
424350def test_nexthop_group_member_scale (
425351 duthost ,
426352 ptfadapter ,
@@ -515,3 +441,77 @@ def test_nexthop_group_member_scale(
515441 validate_rx_tx_counters (pdp , end_time , start_time , exp_mask , MAX_DONWTIME_NEXTHOP_GROUP_MEMBER_CHANGE )
516442 if not recovered :
517443 pytest .fail ("BGP routes are not stable in long time" )
444+
445+
446+ def test_device_unisolation (
447+ duthost ,
448+ ptfadapter ,
449+ bgp_peers_info ,
450+ setup_packet_mask_counters ,
451+ announce_bgp_routes_teardown
452+ ):
453+ '''
454+ This test is for the worst senario that all ports are flapped,
455+ verify control/data plane have acceptable conergence time.
456+ Steps:
457+ Shut down all ports on device. (shut down T1 sessions ports on T0 DUT, shut down T0 sesssions ports on T1 DUT.)
458+ Wait for routes are stable.
459+ Start and keep sending packets with all routes to all portes via ptf.
460+ Unshut all ports and wait for routes are stable.
461+ Stop sending packets.
462+ Estamite control/data plane convergence time.
463+ Expected result:
464+ Dataplane downtime is less than MAX_DOWNTIME_UNISOLATION.
465+ '''
466+ pdp = ptfadapter .dataplane
467+ exp_mask = setup_packet_mask_counters
468+ bgp_ports = [bgp_info [DUT_PORT ] for bgp_info in bgp_peers_info .values ()]
469+ injection_dut_port = random .choice (bgp_ports )
470+ injection_port = [i [PTF_PORT ] for i in bgp_peers_info .values () if i [DUT_PORT ] == injection_dut_port ][0 ]
471+ logger .info ("Injection port: %s" , injection_port )
472+
473+ startup_routes = get_all_bgp_ipv6_routes (duthost )
474+ ecmp_routes = {r : v for r , v in startup_routes .items () if len (v [0 ]['nexthops' ]) > 1 and r not in STATIC_ROUTES }
475+ pkts = generate_packets (
476+ ecmp_routes ,
477+ duthost .facts ['router_mac' ],
478+ pdp .get_mac (0 , injection_port )
479+ )
480+
481+ nexthops_to_remove = [b [IPV6_KEY ] for b in bgp_peers_info .values () if b [DUT_PORT ] in bgp_ports ]
482+ expected_routes = remove_nexthops_in_routes (startup_routes , nexthops_to_remove )
483+ try :
484+ duthost .shutdown_multiple (bgp_ports )
485+ ports_shut_time = datetime .datetime .now ()
486+ recovered = wait_for_ipv6_bgp_routes_recovery (
487+ duthost ,
488+ expected_routes ,
489+ ports_shut_time ,
490+ MAX_CONVERGENCE_WAIT_TIME
491+ )
492+ if not recovered :
493+ pytest .fail ("BGP routes are not stable in long time" )
494+ except Exception :
495+ duthost .no_shutdown_multiple (bgp_ports )
496+
497+ terminated = Event ()
498+ traffic_thread = Thread (
499+ target = send_packets , args = (terminated , pdp , 0 , injection_port , pkts )
500+ )
501+ flush_counters (pdp , exp_mask )
502+ start_time = datetime .datetime .now ()
503+ traffic_thread .start ()
504+ duthost .no_shutdown_multiple (bgp_ports )
505+ ports_startup_time = datetime .datetime .now ()
506+ recovered = wait_for_ipv6_bgp_routes_recovery (
507+ duthost ,
508+ startup_routes ,
509+ ports_startup_time ,
510+ MAX_CONVERGENCE_WAIT_TIME
511+ )
512+ terminated .set ()
513+ traffic_thread .join ()
514+ end_time = datetime .datetime .now ()
515+ validate_rx_tx_counters (pdp , end_time , start_time , exp_mask , MAX_DOWNTIME_UNISOLATION )
516+ if not recovered :
517+ pytest .fail ("BGP routes are not stable in long time" )
0 commit comments