Skip to content
Merged
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
1 change: 1 addition & 0 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@
generate_golden_config_db:
topo_name: "{{ topo }}"
port_index_map: "{{ port_index_map | default({}) }}"
hwsku: "{{ hwsku }}"
become: true

- name: Use minigraph case
Expand Down
15 changes: 9 additions & 6 deletions ansible/library/announce_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ def generate_routes(family, podset_number, tor_number, tor_subnet_number,
nexthop_v6, tor_subnet_size, max_tor_subnet_number, topo,
router_type="leaf", tor_index=None, set_num=None,
no_default_route=False, core_ra_asn=CORE_RA_ASN,
ipv6_address_pattern=IPV6_ADDRESS_PATTERN_DEFAULT_VALUE):
ipv6_address_pattern=IPV6_ADDRESS_PATTERN_DEFAULT_VALUE,
tor_default_route=False):
routes = []
if not no_default_route and router_type != "tor":
if not no_default_route and (router_type != "tor" or tor_default_route):
default_route_as_path = get_uplink_router_as_path(
router_type, spine_asn)

Expand Down Expand Up @@ -525,7 +526,7 @@ def fib_t0(topo, ptf_ip, no_default_route=False, action="announce"):
change_routes(action, ptf_ip, port6, routes_v6)


def fib_t1_lag(topo, ptf_ip, no_default_route=False, action="announce"):
def fib_t1_lag(topo, ptf_ip, no_default_route=False, action="announce", tor_default_route=False):
common_config = topo['configuration_properties'].get('common', {})
podset_number = common_config.get("podset_number", PODSET_NUMBER)
tor_number = common_config.get("tor_number", TOR_NUMBER)
Expand Down Expand Up @@ -576,7 +577,7 @@ def fib_t1_lag(topo, ptf_ip, no_default_route=False, action="announce"):
None, leaf_asn_start, tor_asn_start,
nhipv4, nhipv6, tor_subnet_size, max_tor_subnet_number, "t1",
router_type=router_type, tor_index=tor_index,
no_default_route=no_default_route)
no_default_route=no_default_route, tor_default_route=tor_default_route)
if aggregate_routes_v4:
filterout_subnet_ipv4(aggregate_routes, routes_v4)
routes_v4.extend(aggregate_routes_v4)
Expand All @@ -587,7 +588,8 @@ def fib_t1_lag(topo, ptf_ip, no_default_route=False, action="announce"):
nhipv4, nhipv6, tor_subnet_size, max_tor_subnet_number, "t1",
router_type=router_type, tor_index=tor_index,
no_default_route=no_default_route,
ipv6_address_pattern=ipv6_address_pattern)
ipv6_address_pattern=ipv6_address_pattern,
tor_default_route=tor_default_route)
if aggregate_routes_v6:
filterout_subnet_ipv6(aggregate_routes, routes_v6)
routes_v6.extend(aggregate_routes_v6)
Expand Down Expand Up @@ -1338,6 +1340,7 @@ def main():
topo['configuration'].pop(vm_name)

is_storage_backend = "backend" in topo_name
tor_default_route = "t1-isolated" in topo_name

topo_type = get_topo_type(topo_name)

Expand All @@ -1350,7 +1353,7 @@ def main():
module.exit_json(changed=True)
elif topo_type == "t1" or topo_type == "smartswitch-t1":
fib_t1_lag(
topo, ptf_ip, no_default_route=is_storage_backend, action=action)
topo, ptf_ip, no_default_route=is_storage_backend, action=action, tor_default_route=tor_default_route)
module.exit_json(changed=True)
elif topo_type == "t2":
fib_t2_lag(topo, ptf_ip, action=action)
Expand Down
41 changes: 39 additions & 2 deletions ansible/library/generate_golden_config_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,28 @@

logger = logging.getLogger(__name__)

LOSSY_HWSKU = frozenset({'Arista-7060X6-64PE-C256S2', 'Arista-7060X6-64PE-C224O8',
'Mellanox-SN5600-C256S1', 'Mellanox-SN5600-C224O8',
'Arista-7060X6-64PE-B-C512S2', 'Arista-7060X6-64PE-B-C448O16',
'Mellanox-SN5640-C512S2', 'Mellanox-SN5640-C448O16'})


def is_full_lossy_hwsku(hwsku):
"""
Return True if the platform is lossy-only and PFCWD should default to ‘disable’.
"""
return hwsku in LOSSY_HWSKU


class GenerateGoldenConfigDBModule(object):
def __init__(self):
self.module = AnsibleModule(argument_spec=dict(topo_name=dict(required=True, type='str'),
port_index_map=dict(require=False, type='dict', default=None)),
port_index_map=dict(require=False, type='dict', default=None),
hwsku=dict(require=False, type='str', default=None)),
supports_check_mode=True)
self.topo_name = self.module.params['topo_name']
self.port_index_map = self.module.params['port_index_map']
self.hwsku = self.module.params['hwsku']

def generate_mgfx_golden_config_db(self):
rc, out, err = self.module.run_command("sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data")
Expand Down Expand Up @@ -97,6 +111,23 @@ def generate_mx_golden_config_db(self):
gold_config_db.update(dhcp_server_config_obj)
return gold_config_db

def generate_full_lossy_golden_config_db(self):
rc, out, err = self.module.run_command("sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data")
if rc != 0:
self.module.fail_json(msg="Failed to get config from minigraph: {}".format(err))

# Generate config table from init_cfg.ini
ori_config_db = json.loads(out)

golden_config_db = {}
if "DEVICE_METADATA" in ori_config_db:
golden_config_db["DEVICE_METADATA"] = ori_config_db["DEVICE_METADATA"]
if ("localhost" in golden_config_db["DEVICE_METADATA"] and
"default_pfcwd_status" in golden_config_db["DEVICE_METADATA"]["localhost"]):
golden_config_db["DEVICE_METADATA"]["localhost"]["default_pfcwd_status"] = "disable"

return json.dumps(golden_config_db, indent=4)

def check_version_for_bmp(self):
output_version = device_info.get_sonic_version_info()
build_version = output_version['build_version']
Expand Down Expand Up @@ -269,14 +300,20 @@ def generate_ft2_golden_config_db(self):
return json.dumps({"PORT": port_config}, indent=4)

def generate(self):
module_msg = "Success to generate golden_config_db.json"
# topo check
if self.topo_name == "mx" or "m0" in self.topo_name:
config = self.generate_mgfx_golden_config_db()
module_msg = module_msg + " for mgfx"
elif self.topo_name == "t1-28-lag":
config = self.generate_smartswitch_golden_config_db()
self.module.run_command("sudo rm -f {}".format(TEMP_SMARTSWITCH_CONFIG_PATH))
module_msg = module_msg + " for smartswitch"
elif self.topo_name in ["ft2-64"]:
config = self.generate_ft2_golden_config_db()
elif self.hwsku and is_full_lossy_hwsku(self.hwsku):
module_msg = module_msg + " for full lossy hwsku"
config = self.generate_full_lossy_golden_config_db()
else:
config = "{}"

Expand All @@ -291,7 +328,7 @@ def generate(self):
temp_file.write(config)
self.module.run_command("sudo rm -f {}".format(TEMP_DHCP_SERVER_CONFIG_PATH))
self.module.run_command("sudo rm -f {}".format(TEMP_SMARTSWITCH_CONFIG_PATH))
self.module.exit_json(change=True, msg="Success to generate golden_config_db.json")
self.module.exit_json(change=True, msg=module_msg)


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ r, ".* ERR ntpd.*: statistics directory .* does not exist or is unwriteable, err
r, ".* NOTICE ntpd.*: ERR: ntpd exiting on signal 15.*"

# Race condition while removing a vlan member, no functionality impact
r, ". *ERR swss#orchagent: :- update: FdbOrch MOVE notification: Failed to get port by bridge port ID.*"
r, ". *ERR swss#orchagent.*Failed to get port by bridge port ID.*"

# https://github.com/sonic-net/sonic-buildimage/issues/7895
# https://github.com/Azure/sonic-sairedis/issues/582
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2745,5 +2745,7 @@ wan/lacp/test_wan_lag_min_link.py::test_lag_min_link:
zmq/test_gnmi_zmq.py:
skip:
reason: "Test is for smartswitch"
conditions_logical_operator: or
conditions:
- "'arista' in platform"
- "'isolated' in topo_name"
10 changes: 0 additions & 10 deletions tests/common/snappi_tests/snappi_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import snappi
import sys
import random
import snappi_convergence
from tests.common.helpers.assertions import pytest_require
from tests.common.errors import RunAnsibleModuleFail
from ipaddress import ip_address, IPv4Address, IPv6Address
Expand Down Expand Up @@ -543,15 +542,6 @@ def tgen_ports(duthost, conn_graph_facts, fanout_graph_facts): # noqa F811
return snappi_ports


@pytest.fixture(scope='module')
def cvg_api(snappi_api_serv_ip,
snappi_api_serv_port):
api = snappi_convergence.api(location=snappi_api_serv_ip + ':' + str(snappi_api_serv_port), ext='ixnetwork')
yield api
if getattr(api, 'assistant', None) is not None:
api.assistant.Session.remove()


def snappi_multi_base_config(duthost_list,
snappi_ports,
snappi_api,
Expand Down
54 changes: 49 additions & 5 deletions tests/route/test_route_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,40 @@ def get_route_scale_per_role(tbinfo, ip_version):
return set_num_routes


def get_l3_alpm_template_from_config_bcm(duthost):
"""
Get l3_alpm_template from config.bcm file
:param duthost: DUT host object
:return: l3_alpm_template value
"""
ls_command = "docker exec syncd cat /etc/sai.d/sai.profile | grep SAI_INIT_CONFIG_FILE"
ls_output = duthost.shell(ls_command, module_ignore_errors=True)['stdout']
# Check if the file exists
if ls_output:
file_name = ls_output.split("=")[-1].strip()
logging.info("Config bcm file found:{}".format(file_name))
# Read the config.bcm file and find the l3_alpm_template variable
cat_command = "docker exec syncd cat {} | grep l3_alpm_template".format(file_name)
cat_output = duthost.shell(cat_command, module_ignore_errors=True)['stdout']
if cat_output:
# Extract the value of l3_alpm_template
l3_alpm_template = cat_output.split(":")[-1].strip()
logging.info("l3_alpm_template found:{}".format(l3_alpm_template))
return int(l3_alpm_template)
else:
logging.info("Unable to find l3_alpm_template in config.bcm file")
raise RuntimeError(
"Unable to find l3_alpm_template in config.bcm file"
)
# If the file does not exist, raise an error
else:
logging.info("Unable to find config.bcm file in /etc/sai.d/sai.profile")
raise RuntimeError(
"Unable to find config.bcm file in /etc/sai.d/sai.profile"
)
return None


@pytest.fixture
def check_config(duthosts, enum_rand_one_per_hwsku_frontend_hostname, enum_rand_one_frontend_asic_index, tbinfo):
if tbinfo["topo"]["type"] in ["m0", "mx"]:
Expand All @@ -66,14 +100,24 @@ def check_config(duthosts, enum_rand_one_per_hwsku_frontend_hostname, enum_rand_
return

asic = duthost.facts["asic_type"]
platform = duthost.facts["platform"]
asic_id = enum_rand_one_frontend_asic_index

if (asic == "broadcom"):
broadcom_cmd = "bcmcmd -n " + str(asic_id) if duthost.is_multi_asic else "bcmcmd"
alpm_cmd = "{} {}".format(broadcom_cmd, '"conf show l3_alpm_enable"')
alpm_enable = duthost.command(alpm_cmd)["stdout_lines"][2].strip()
logger.info("Checking config: {}".format(alpm_enable))
pytest_assert(alpm_enable == "l3_alpm_enable=2", "l3_alpm_enable is not set for route scaling")
if "7060x6_64pe" in platform:
# For all TH5 family devices, l3_alpm_template is set in config.bcm
# * 1 - Combined (By default)
# * 2 - Parallel
pytest_assert(
get_l3_alpm_template_from_config_bcm(duthost) == 1,
"l3_alpm_template is not set for route scaling"
)
else:
broadcom_cmd = "bcmcmd -n " + str(asic_id) if duthost.is_multi_asic else "bcmcmd"
alpm_cmd = "{} {}".format(broadcom_cmd, '"conf show l3_alpm_enable"')
alpm_enable = duthost.command(alpm_cmd)["stdout_lines"][2].strip()
logger.info("Checking config: {}".format(alpm_enable))
pytest_assert(alpm_enable == "l3_alpm_enable=2", "l3_alpm_enable is not set for route scaling")


@pytest.fixture(autouse=True)
Expand Down
Loading