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
74 changes: 41 additions & 33 deletions tests/bgp/test_passive_peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
from tests.common.config_reload import config_reload
from tests.common.devices.eos import EosHost
from tests.common.helpers.bgp import get_vtysh_cmd_for_asic
from tests.common.helpers.constants import DEFAULT_NAMESPACE
from tests.common.utilities import wait_until
from tests.bgp.bgp_helpers import eos_bgp_neighbor_config_parents
Expand Down Expand Up @@ -160,9 +161,11 @@ def check_bgp_neighbor_state(duthost, asic_index, neigh_ip, should_be_establishe

def test_bgp_passive_peering_ipv4(setup):
# configure passive EBGP peering session on DUT and ensure adjacency stays established (IPv4)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} passive"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v4'])
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} passive"'.format(
setup['dut_asn'], setup['peer_group_v4']),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand All @@ -171,10 +174,11 @@ def test_bgp_passive_peering_ipv4(setup):
"BGP IPv4 session not established after configuring passive peering"

# configure password on DUT and ensure the adjacency is not established (IPv4)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v4'],
peer_password)
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['dut_asn'], setup['peer_group_v4'], peer_password),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand All @@ -186,11 +190,11 @@ def test_bgp_passive_peering_ipv4(setup):

# configure password on Neighbor and ensure the adjacency is established (IPv4)
if setup['is_sonic']:
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['neigh_asic_index'],
setup['neigh_asn'],
setup['dut_ip_v4'],
peer_password)
cmd = get_vtysh_cmd_for_asic(
setup['neighhost'], setup['neigh_asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['neigh_asn'], setup['dut_ip_v4'], peer_password),
)
setup['neighhost'].shell(cmd, module_ignore_errors=True)
else:
cmd = ["neighbor {} password 0 {}".format(setup['dut_ip_v4'], peer_password)]
Expand All @@ -204,10 +208,11 @@ def test_bgp_passive_peering_ipv4(setup):
"BGP IPv4 session not established after configuring matching password"

# configure mismatch password on DUT and ensure the adjacency is not established (IPv4)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v4'],
wrong_password)
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['dut_asn'], setup['peer_group_v4'], wrong_password),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand All @@ -218,9 +223,11 @@ def test_bgp_passive_peering_ipv4(setup):

def test_bgp_passive_peering_ipv6(setup):
# configure passive EBGP peering session on DUT and ensure adjacency stays established (IPv6)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} passive"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v6'])
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} passive"'.format(
setup['dut_asn'], setup['peer_group_v6']),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand All @@ -229,10 +236,11 @@ def test_bgp_passive_peering_ipv6(setup):
"BGP IPv6 session not established after configuring passive peering"

# configure password on DUT and ensure the adjacency is not established (IPv6)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v6'],
peer_password)
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['dut_asn'], setup['peer_group_v6'], peer_password),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand All @@ -242,12 +250,11 @@ def test_bgp_passive_peering_ipv6(setup):

# configure password on Neighbor and ensure the adjacency is established (IPv6)
if setup['is_sonic']:
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.\
format(
setup['neigh_asic_index'],
setup['neigh_asn'],
setup['dut_ip_v6'],
peer_password)
cmd = get_vtysh_cmd_for_asic(
setup['neighhost'], setup['neigh_asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['neigh_asn'], setup['dut_ip_v6'], peer_password),
)
setup['neighhost'].shell(cmd, module_ignore_errors=True)
else:
cmd = ["neighbor {} password 0 {}".format(setup['dut_ip_v6'], peer_password)]
Expand All @@ -261,10 +268,11 @@ def test_bgp_passive_peering_ipv6(setup):
"BGP IPv6 session not established after configuring matching password"

# configure mismatch password on DUT and ensure the adjacency is not established (IPv6)
cmd = 'vtysh -n {} -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(setup['asic_index'],
setup['dut_asn'],
setup['peer_group_v6'],
wrong_password)
cmd = get_vtysh_cmd_for_asic(
setup['duthost'], setup['asic_index'],
'vtysh -c "config" -c "router bgp {}" -c "neighbor {} password {}"'.format(
setup['dut_asn'], setup['peer_group_v6'], wrong_password),
)
setup['duthost'].shell(cmd, module_ignore_errors=True)

assert wait_until(BGP_WAIT_TIMEOUT, BGP_WAIT_INTERVAL, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ bgp/test_ipv6_nlri_over_ipv4.py:
conditions:
- asic_type in ['vs'] and 't2' in topo_name
reason: This test case either cannot pass or should be skipped on virtual chassis
bgp/test_passive_peering.py:
skip:
conditions:
- asic_type in ['vs'] and 't2' in topo_name
reason: This test case either cannot pass or should be skipped on virtual chassis
bgp/test_prefix_list.py:
skip:
conditions:
Expand Down
Loading