Skip to content

Commit

Permalink
Revert "[GCU E2E Testing] Update RDMA GCU E2E Tests (#8341) (#8583)" (#…
Browse files Browse the repository at this point in the history
…8659)

This reverts commit e22b1fe.
  • Loading branch information
bingwang-ms authored Jun 19, 2023
1 parent 187f7a7 commit c0a9fd5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 204 deletions.
137 changes: 0 additions & 137 deletions tests/generic_config_updater/gcu_field_operation_validators.conf.json

This file was deleted.

53 changes: 2 additions & 51 deletions tests/generic_config_updater/gu_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import json
import logging
import pytest
Expand All @@ -11,8 +10,6 @@

CONTAINER_SERVICES_LIST = ["swss", "syncd", "radv", "lldp", "dhcp_relay", "teamd", "bgp", "pmon", "telemetry", "acms"]
DEFAULT_CHECKPOINT_NAME = "test"
GCU_FIELD_OPERATION_CONF_FILE = "gcu_field_operation_validators.conf.json"
GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku"

def generate_tmpfile(duthost):
"""Generate temp file
Expand Down Expand Up @@ -270,51 +267,5 @@ def check_vrf_route_for_intf(duthost, vrf_name, intf_name, is_ipv4=True):
address_family = "ip" if is_ipv4 else "ipv6"
output = duthost.shell("show {} route vrf {} | grep -w {}".format(address_family, vrf_name, intf_name))

pytest_assert(not output['rc'], "Route not found for {} in vrf {}".format(intf_name, vrf_name))


def get_gcu_field_operations_conf():
conf_path = os.path.join(os.path.dirname(__file__), GCU_FIELD_OPERATION_CONF_FILE)
with open(conf_path, 'r') as s:
gcu_conf = json.load(s)
return gcu_conf


def get_asic_name(duthost):
asic_type = duthost.facts["asic_type"]
asic = "unknown"
gcu_conf = get_gcu_field_operations_conf()
asic_mapping = gcu_conf["helper_data"]["rdma_config_update_validator"]
if asic_type == 'cisco-8000':
asic = "cisco-8000"
elif asic_type == 'mellanox' or asic_type == 'vs' or asic_type == 'broadcom':
hwsku = duthost.shell(GET_HWSKU_CMD)['stdout'].rstrip('\n')
if asic_type == 'mellanox' or asic_type == 'vs':
spc1_hwskus = asic_mapping["mellanox_asics"]["spc1"]
if hwsku.lower() in [spc1_hwsku.lower() for spc1_hwsku in spc1_hwskus]:
asic = "spc1"
return asic
if asic_type == 'broadcom' or asic_type == 'vs':
broadcom_asics = asic_mapping["broadcom_asics"]
for asic_shorthand, hwskus in broadcom_asics.items():
for hwsku_cur in hwskus:
if hwsku_cur.lower() in hwsku.lower():
asic = asic_shorthand
break
else:
continue
break

return asic


def is_valid_platform_and_version(duthost, table, scenario):
asic = get_asic_name(duthost)
os_version = duthost.os_version
if asic == "unknown":
return False
if "master" or "internal" in os_version:
return True
gcu_conf = get_gcu_field_operations_conf()
version_required = gcu_conf["tables"][table]["validator_data"]["rdma_config_update_validator"][scenario][asic][0:6]
return os_version >= version_required
pytest_assert(not output['rc'],
"Route not found for {} in vrf {}".format(intf_name, vrf_name))
12 changes: 4 additions & 8 deletions tests/generic_config_updater/test_ecn_config_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from tests.common.helpers.assertions import pytest_assert
from tests.common.utilities import wait_until
from tests.common.helpers.dut_utils import verify_orchagent_running_or_assert
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success, expect_op_failure
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success
from tests.generic_config_updater.gu_utils import generate_tmpfile, delete_tmpfile
from tests.generic_config_updater.gu_utils import create_checkpoint, delete_checkpoint, rollback_or_reload
from tests.generic_config_updater.gu_utils import is_valid_platform_and_version

pytestmark = [
pytest.mark.topology('any'),
Expand Down Expand Up @@ -95,11 +94,8 @@ def test_ecn_config_updates(duthost, ensure_dut_readiness, configdb_field, opera
"value": "{}".format(value)})

try:
if is_valid_platform_and_version(duthost, "WRED_PROFILE", "ECN tuning"):
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
expect_op_success(duthost, output)
ensure_application_of_updated_config(duthost, configdb_field, ",".join(values))
else:
expect_op_failure(output)
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
expect_op_success(duthost, output)
ensure_application_of_updated_config(duthost, configdb_field, ",".join(values))
finally:
delete_tmpfile(duthost, tmpfile)
8 changes: 2 additions & 6 deletions tests/generic_config_updater/test_incremental_qos.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success, expect_res_success, expect_op_failure
from tests.generic_config_updater.gu_utils import generate_tmpfile, delete_tmpfile
from tests.generic_config_updater.gu_utils import create_checkpoint, delete_checkpoint, rollback_or_reload
from tests.generic_config_updater.gu_utils import is_valid_platform_and_version

pytestmark = [
pytest.mark.topology('t0'),
Expand Down Expand Up @@ -220,10 +219,7 @@ def test_incremental_qos_config_updates(duthost, tbinfo, ensure_dut_readiness, c

try:
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
if is_valid_platform_and_version(duthost, "BUFFER_POOL", "Shared/headroom pool size changes"):
expect_op_success(duthost, output)
ensure_application_of_updated_config(duthost, configdb_field, value)
else:
expect_op_failure(output)
expect_op_success(duthost, output)
ensure_application_of_updated_config(duthost, configdb_field, value)
finally:
delete_tmpfile(duthost, tmpfile)
3 changes: 1 addition & 2 deletions tests/generic_config_updater/test_pfcwd_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success, expect_res_success, expect_op_failure
from tests.generic_config_updater.gu_utils import generate_tmpfile, delete_tmpfile
from tests.generic_config_updater.gu_utils import create_checkpoint, delete_checkpoint, rollback_or_reload
from tests.generic_config_updater.gu_utils import is_valid_platform_and_version

pytestmark = [
pytest.mark.asic('mellanox'),
Expand Down Expand Up @@ -151,7 +150,7 @@ def test_pfcwd_interval_config_updates(duthost, ensure_dut_readiness, operation,
try:
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)

if is_valid_config_update and is_valid_platform_and_version(duthost, "PFC_WD", "PFCWD enable/disable"):
if is_valid_config_update:
expect_op_success(duthost, output)
ensure_application_of_updated_config(duthost, value)
else:
Expand Down

0 comments on commit c0a9fd5

Please sign in to comment.