Skip to content

Commit

Permalink
Revert "[GCU] Add rollback validation test (#5469)"
Browse files Browse the repository at this point in the history
This reverts commit 01862c7.
  • Loading branch information
wen587 authored Jun 18, 2022
1 parent 983283f commit b3148cf
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 68 deletions.
21 changes: 0 additions & 21 deletions tests/generic_config_updater/test_bgp_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@
PREFIXES_V4_RE = "ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_{}_V4 seq \d+ permit {}"
PREFIXES_V6_RE = "ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_{}_V6 seq \d+ permit {}"

def get_bgp_prefix_runningconfig(duthost):
""" Get bgp prefix config
"""
cmds = "show runningconfiguration bgp"
output = duthost.shell(cmds)
pytest_assert(not output['rc'],
"'{}' failed with rc={}".format(cmds, output['rc'])
)

# Sample:
# ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V4 seq 30 permit 10.20.0.0/16 le 32
# ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65
bgp_prefix_pattern = r"(?:ip|ipv6) prefix-list.*(?:deny|permit).*"
bgp_prefix_config = re.findall(bgp_prefix_pattern, output['stdout'])
return bgp_prefix_config

@pytest.fixture(autouse=True)
def setup_env(duthosts, rand_one_dut_hostname):
"""
Expand All @@ -46,18 +30,13 @@ def setup_env(duthosts, rand_one_dut_hostname):
rand_selected_dut: The fixture returns a randomly selected DuT.
"""
duthost = duthosts[rand_one_dut_hostname]
original_bgp_prefix_config = get_bgp_prefix_runningconfig(duthost)
create_checkpoint(duthost)

yield

try:
logger.info("Rolled back to original checkpoint")
rollback_or_reload(duthost)
current_bgp_prefix_config = get_bgp_prefix_runningconfig(duthost)
pytest_assert(set(original_bgp_prefix_config) == set(current_bgp_prefix_config),
"bgp prefix config are not suppose to change after test"
)
finally:
delete_checkpoint(duthost)

Expand Down
26 changes: 0 additions & 26 deletions tests/generic_config_updater/test_bgp_speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,6 @@ def lo_intf_ips(duthost, tbinfo):
return ip, ipv6
pytest_assert(True, "Required ipv4 and ipv6 to start the test")

def get_bgp_speaker_runningconfig(duthost):
""" Get bgp speaker config that contains src_address and ip_range
Sample output in t0:
['\n neighbor BGPSLBPassive update-source 10.1.0.32',
'\n neighbor BGPVac update-source 10.1.0.32',
'\n bgp listen range 10.255.0.0/25 peer-group BGPSLBPassive',
'\n bgp listen range 192.168.0.0/21 peer-group BGPVac']
"""
cmds = "show runningconfiguration bgp"
output = duthost.shell(cmds)
pytest_assert(not output['rc'],
"'{}' failed with rc={}".format(cmds, output['rc'])
)

# Sample:
# neighbor BGPSLBPassive update-source 10.1.0.32
# bgp listen range 192.168.0.0/21 peer-group BGPVac
bgp_speaker_pattern = r"\s+neighbor.*update-source.*|\s+bgp listen range.*"
bgp_speaker_config = re.findall(bgp_speaker_pattern, output['stdout'])
return bgp_speaker_config

@pytest.fixture(autouse=True)
def setup_env(duthosts, rand_one_dut_hostname):
Expand All @@ -84,18 +63,13 @@ def setup_env(duthosts, rand_one_dut_hostname):
rand_selected_dut: The fixture returns a randomly selected DuT.
"""
duthost = duthosts[rand_one_dut_hostname]
original_bgp_speaker_config = get_bgp_speaker_runningconfig(duthost)
create_checkpoint(duthost)

yield

try:
logger.info("Rolled back to original checkpoint")
rollback_or_reload(duthost)
current_bgp_speaker_config = get_bgp_speaker_runningconfig(duthost)
pytest_assert(set(original_bgp_speaker_config) == set(current_bgp_speaker_config),
"bgp speaker config are not suppose to change after test"
)
finally:
delete_checkpoint(duthost)

Expand Down
21 changes: 0 additions & 21 deletions tests/generic_config_updater/test_bgpl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import pytest
import re

from netaddr import IPNetwork
from tests.common.helpers.assertions import pytest_assert
Expand All @@ -15,21 +14,6 @@

logger = logging.getLogger(__name__)

def get_bgp_monitor_runningconfig(duthost):
""" Get bgp listener config
"""
cmds = "show runningconfiguration bgp"
output = duthost.shell(cmds)
pytest_assert(not output['rc'],
"'{}' failed with rc={}".format(cmds, output['rc'])
)

# Sample:
# neighbor 11.0.0.1 description BGPMonitor
bgp_listener_pattern = r"\s+neighbor.*description BGPMonitor"
bgp_listener_config = re.findall(bgp_listener_pattern, output['stdout'])
return bgp_listener_config

@pytest.fixture(autouse=True)
def setup_env(duthosts, rand_one_dut_hostname):
"""
Expand All @@ -39,18 +23,13 @@ def setup_env(duthosts, rand_one_dut_hostname):
rand_selected_dut: The fixture returns a randomly selected DuT.
"""
duthost = duthosts[rand_one_dut_hostname]
original_bgp_listener_config = get_bgp_monitor_runningconfig(duthost)
create_checkpoint(duthost)

yield

try:
logger.info("Rolled back to original checkpoint")
rollback_or_reload(duthost)
current_bgp_listener_config = get_bgp_monitor_runningconfig(duthost)
pytest_assert(set(original_bgp_listener_config) == set(current_bgp_listener_config),
"bgp listener config are not suppose to change after test"
)
finally:
delete_checkpoint(duthost)

Expand Down

0 comments on commit b3148cf

Please sign in to comment.