Skip to content
Open
Show file tree
Hide file tree
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
57 changes: 12 additions & 45 deletions tests/snappi_tests/bgp/files/bgp_convergence_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run_bgp_local_link_failover_test(cvg_api,
multipath,
number_of_routes,
route_type,
port_speed,):
):
"""
Run Local link failover test

Expand All @@ -33,7 +33,6 @@ def run_bgp_local_link_failover_test(cvg_api,
multipath: ecmp value for BGP config
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
port_count = multipath+1

Expand All @@ -48,7 +47,7 @@ def run_bgp_local_link_failover_test(cvg_api,
port_count,
number_of_routes,
route_type,
port_speed,)
)

"""
Run the convergence test by flapping all the rx
Expand All @@ -61,9 +60,6 @@ def run_bgp_local_link_failover_test(cvg_api,
number_of_routes,
route_type,)

""" Cleanup the dut configs after getting the convergence numbers """
cleanup_config(duthost)


def run_bgp_remote_link_failover_test(cvg_api,
duthost,
Expand All @@ -72,7 +68,7 @@ def run_bgp_remote_link_failover_test(cvg_api,
multipath,
number_of_routes,
route_type,
port_speed,):
):
"""
Run Remote link failover test

Expand All @@ -83,7 +79,6 @@ def run_bgp_remote_link_failover_test(cvg_api,
iteration: number of iterations for running convergence test on a port
multipath: ecmp value for BGP config
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
port_count = multipath+1
""" Create bgp config on dut """
Expand All @@ -97,7 +92,7 @@ def run_bgp_remote_link_failover_test(cvg_api,
port_count,
number_of_routes,
route_type,
port_speed,)
)

"""
Run the convergence test by withdrawing all the route ranges
Expand All @@ -110,9 +105,6 @@ def run_bgp_remote_link_failover_test(cvg_api,
number_of_routes,
route_type,)

""" Cleanup the dut configs after getting the convergence numbers """
cleanup_config(duthost)


def run_rib_in_convergence_test(cvg_api,
duthost,
Expand All @@ -121,7 +113,7 @@ def run_rib_in_convergence_test(cvg_api,
multipath,
number_of_routes,
route_type,
port_speed,):
):
"""
Run RIB-IN Convergence test

Expand All @@ -133,7 +125,6 @@ def run_rib_in_convergence_test(cvg_api,
multipath: ecmp value for BGP config
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
port_count = multipath+1

Expand All @@ -148,7 +139,7 @@ def run_rib_in_convergence_test(cvg_api,
port_count,
number_of_routes,
route_type,
port_speed,)
)

"""
Run the convergence test by withdrawing all routes at once and
Expand All @@ -161,9 +152,6 @@ def run_rib_in_convergence_test(cvg_api,
number_of_routes,
route_type,)

""" Cleanup the dut configs after getting the convergence numbers """
cleanup_config(duthost)


def run_RIB_IN_capacity_test(cvg_api,
duthost,
Expand All @@ -172,7 +160,7 @@ def run_RIB_IN_capacity_test(cvg_api,
start_value,
step_value,
route_type,
port_speed,):
):
"""
Run RIB-IN Capacity test

Expand All @@ -184,7 +172,6 @@ def run_RIB_IN_capacity_test(cvg_api,
start_value: start value of number of routes
step_value: step value of routes to be incremented at every iteration
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
port_count = multipath+1
""" Create bgp config on dut """
Expand All @@ -199,10 +186,7 @@ def run_RIB_IN_capacity_test(cvg_api,
start_value,
step_value,
route_type,
port_speed,)

""" Cleanup the dut configs after getting the convergence numbers """
cleanup_config(duthost)
)


def duthost_bgp_config(duthost,
Expand Down Expand Up @@ -295,7 +279,7 @@ def __tgen_bgp_config(cvg_api,
port_count,
number_of_routes,
route_type,
port_speed,):
):
"""
Creating BGP config on TGEN

Expand All @@ -304,7 +288,6 @@ def __tgen_bgp_config(cvg_api,
port_count: multipath + 1
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
global NG_LIST
conv_config = cvg_api.convergence_config()
Expand All @@ -331,7 +314,7 @@ def __tgen_bgp_config(cvg_api,
layer1.ieee_media_defaults = False
layer1.auto_negotiation.rs_fec = True
layer1.auto_negotiation.link_training = False
layer1.speed = port_speed
layer1.speed = temp_tg_port[0]['speed']
layer1.auto_negotiate = False

def create_v4_topo():
Expand Down Expand Up @@ -751,7 +734,7 @@ def get_RIB_IN_capacity(cvg_api,
start_value,
step_value,
route_type,
port_speed,):
):
"""
Args:
cvg_api (pytest fixture): snappi API
Expand All @@ -760,7 +743,6 @@ def get_RIB_IN_capacity(cvg_api,
start_value: Start value of the number of BGP routes
step_value: Step value of the number of BGP routes to be incremented
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used in test
"""
def tgen_capacity(routes):
conv_config = cvg_api.convergence_config()
Expand All @@ -787,7 +769,7 @@ def tgen_capacity(routes):
layer1.ieee_media_defaults = False
layer1.auto_negotiation.rs_fec = True
layer1.auto_negotiation.link_training = False
layer1.speed = port_speed
layer1.speed = temp_tg_port[0]['speed']
layer1.auto_negotiate = False

def create_v4_topo():
Expand Down Expand Up @@ -981,18 +963,3 @@ def run_traffic(routes):
logger.info("\n%s" % tabulate(
[['RIB-IN Capacity Test', max_routes]], headers=columns, tablefmt="psql"))


def cleanup_config(duthost):
"""
Cleaning up dut config at the end of the test

Args:
duthost (pytest fixture): duthost fixture
"""
duthost.command("sudo cp {} {}".format(
"/etc/sonic/config_db_backup.json", "/etc/sonic/config_db.json"))
duthost.shell("sudo config reload -y \n")
logger.info("Wait until all critical services are fully started")
pytest_assert(wait_until(360, 10, 1, duthost.critical_services_fully_started),
"Not all critical services are fully started")
logger.info('Convergence Test Completed')
4 changes: 2 additions & 2 deletions tests/snappi_tests/bgp/test_bgp_convergence_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


@pytest.mark.parametrize('multipath', [2])
@pytest.mark.parametrize('start_routes', [500])
@pytest.mark.parametrize('routes_step', [500])
@pytest.mark.parametrize('start_routes', [5000])
@pytest.mark.parametrize('routes_step', [5000])
@pytest.mark.parametrize('stop_routes', [16000])
@pytest.mark.parametrize('route_type', ['IPv4'])
def test_bgp_convergence_performance(cvg_api, # noqa F811
Expand Down
6 changes: 2 additions & 4 deletions tests/snappi_tests/bgp/test_bgp_local_link_failover.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@pytest.mark.parametrize('convergence_test_iterations', [1])
@pytest.mark.parametrize('number_of_routes', [1000])
@pytest.mark.parametrize('route_type', ['IPv4'])
@pytest.mark.parametrize('port_speed', ['speed_100_gbps'])
def test_bgp_convergence_for_local_link_failover(cvg_api, # noqa F811
duthost,
tgen_ports, # noqa F811
Expand All @@ -22,7 +21,7 @@ def test_bgp_convergence_for_local_link_failover(cvg_api, # no
convergence_test_iterations,
number_of_routes,
route_type,
port_speed,):
):
"""
Topo:
TGEN1 --- DUT --- TGEN(2..N)
Expand Down Expand Up @@ -51,7 +50,6 @@ def test_bgp_convergence_for_local_link_failover(cvg_api, # no
convergence_test_iterations: number of iterations the link failure test has to be run for a port
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
# convergence_test_iterations, multipath, number_of_routes and
# route_type parameters can be modified as per user preference
Expand All @@ -62,4 +60,4 @@ def test_bgp_convergence_for_local_link_failover(cvg_api, # no
multipath,
number_of_routes,
route_type,
port_speed,)
)
8 changes: 3 additions & 5 deletions tests/snappi_tests/bgp/test_bgp_remote_link_failover.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@pytest.mark.parametrize('convergence_test_iterations', [1])
@pytest.mark.parametrize('number_of_routes', [1000])
@pytest.mark.parametrize('route_type', ['IPv4'])
@pytest.mark.parametrize('port_speed', ['speed_100_gbps'])
def test_bgp_convergence_for_remote_link_failover(cvg_api, # noqa F811
duthost,
tgen_ports, # noqa F811
Expand All @@ -22,7 +21,7 @@ def test_bgp_convergence_for_remote_link_failover(cvg_api, # no
convergence_test_iterations,
number_of_routes,
route_type,
port_speed,):
):
"""
Topo:
TGEN1 --- DUT --- TGEN(2..N)
Expand Down Expand Up @@ -51,15 +50,14 @@ def test_bgp_convergence_for_remote_link_failover(cvg_api, # no
convergence_test_iterations: number of iterations the cp/dp convergence test has to be run for a port
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
# convergence_test_iterations, multipath, number_of_routes,
# port_speed and route_type parameters can be modified as per user preference
# route_type parameters can be modified as per user preference
run_bgp_remote_link_failover_test(cvg_api,
duthost,
tgen_ports,
convergence_test_iterations,
multipath,
number_of_routes,
route_type,
port_speed,)
)
10 changes: 4 additions & 6 deletions tests/snappi_tests/bgp/test_bgp_rib_in_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

@pytest.mark.parametrize('multipath', [2])
@pytest.mark.parametrize('start_value', [1000])
@pytest.mark.parametrize('step_value', [1000])
@pytest.mark.parametrize('step_value', [10000])
@pytest.mark.parametrize('route_type', ['IPv4'])
@pytest.mark.parametrize('port_speed', ['speed_100_gbps'])
def test_RIB_IN_capacity(cvg_api, # noqa F811
duthost,
tgen_ports, # noqa F811
Expand All @@ -22,7 +21,7 @@ def test_RIB_IN_capacity(cvg_api, # noqa F811
start_value,
step_value,
route_type,
port_speed,):
):
"""
Topo:
TGEN1 --- DUT --- TGEN(2..N)
Expand Down Expand Up @@ -51,14 +50,13 @@ def test_RIB_IN_capacity(cvg_api, # noqa F811
start_value: Start value of the number of BGP routes
step_value: Step value of the number of BGP routes to be incremented
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
# multipath, start_value, step_value and route_type, port_speed parameters can be modified as per user preference
# multipath, start_value, step_value and route_type parameters can be modified as per user preference
run_RIB_IN_capacity_test(cvg_api,
duthost,
tgen_ports,
multipath,
start_value,
step_value,
route_type,
port_speed,)
)
8 changes: 3 additions & 5 deletions tests/snappi_tests/bgp/test_bgp_rib_in_convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@pytest.mark.parametrize('convergence_test_iterations', [1])
@pytest.mark.parametrize('number_of_routes', [1000])
@pytest.mark.parametrize('route_type', ['IPv4'])
@pytest.mark.parametrize('port_speed', ['speed_100_gbps'])
def test_rib_in_convergence(cvg_api, # noqa F811
duthost,
tgen_ports, # noqa F811
Expand All @@ -22,7 +21,7 @@ def test_rib_in_convergence(cvg_api, # noqa F811
convergence_test_iterations,
number_of_routes,
route_type,
port_speed,):
):
"""
Topo:
TGEN1 --- DUT --- TGEN(2..N)
Expand Down Expand Up @@ -52,9 +51,8 @@ def test_rib_in_convergence(cvg_api, # noqa F811
convergence_test_iterations: number of iterations the link failure test has to be run for a port
number_of_routes: Number of IPv4/IPv6 Routes
route_type: IPv4 or IPv6 routes
port_speed: speed of the port used for test
"""
# convergence_test_iterations, multipath, number_of_routes port_speed and
# convergence_test_iterations, multipath, number_of_routes and
# route_type parameters can be modified as per user preference
run_rib_in_convergence_test(cvg_api,
duthost,
Expand All @@ -63,4 +61,4 @@ def test_rib_in_convergence(cvg_api, # noqa F811
multipath,
number_of_routes,
route_type,
port_speed,)
)
Loading