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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ following fields.
| Parameter | Description |
|---|---|
| `config_type` | Output configuration format: `YAML_CONFIG` (XGS), `KEY_VALUE_CONFIG` (DNX), or `JSON_CONFIG`. |
| `config_gen_type` | Generation profile, `DEFAULT` or `HW_TEST`. Conditional settings in both ASIC families may select on it. |
| `config_gen_type` | Generation profile, e.g. `DEFAULT` or `HW_TEST`, matching the `AsicConfigGenType` enum. Conditional settings in both ASIC families may select on it. |
| `exact_match` | XGS. Enables exact-match forwarding table entries. |
| `mmu_lossless` | XGS. Enables MMU lossless mode for PFC and RDMA workloads. |
| `port_config` | DNX. Port-map profile name, for example `default` or `18*400G-4`. Conditional settings select the profile by exact name and the topology family by prefix, for example `dual_stage`. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@
"global": {"fpem_mem_entries_width": 1, "fpem_mem_entries": 65536}
}
},
{
"name": "hw_test_uncached_port_stats",
"description": "Enables uncached port statistics for hardware tests.",
"condition": {"source": "asic_config_params", "param": "config_gen_type", "equals": "HW_TEST"},
"apply": {
"global": {"sai_uncached_port_stats": "0x1"}
}
},
{
"name": "dlb_config",
"description": "Enables Dynamic Load Balancing settings for ECMP groups.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@
"platform_sai_overrides": {
"sai_eapol_trap_use_bcast_mac": "1"
},
"conditional_settings": [
{
"name": "uncached_port_stats_for_tests",
"description": "Enables uncached port statistics for the hardware test and link test profiles.",
"condition": {
"source": "asic_config_params",
"param": "config_gen_type",
"in": ["HW_TEST", "LINK_TEST"]
},
"apply": {
"global": {"sai_uncached_port_stats": "0x1"}
}
}
],
"features": {
"generate_dlb_config": true,
"generate_low_clock_freq_settings": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,11 @@ bcm_device:
global_flexctr_egr_pool_num_reserved: 5
global_flexctr_egr_op_profile_num_reserved: 10
global_flexctr_egr_group_num_reserved: 1
sai_uncached_port_stats: 0x1
ecmp_dlb_port_speeds: 1
l3_ecmp_member_secondary_mem_size: 4096
sai_rdma_udf_disable: 1
sai_l3_byte1_udf_disable: 1
sai_uncached_port_stats: 0x1
...
---
device:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
"l3_ecmp_member_secondary_mem_size": "16384"
}
}
},
{
"name": "uncached_port_stats_for_tests",
"description": "Enables uncached port statistics for the hardware test and link test profiles.",
"condition": {
"source": "asic_config_params",
"param": "config_gen_type",
"in": ["HW_TEST", "LINK_TEST"]
},
"apply": {
"global": {"sai_uncached_port_stats": "0x1"}
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1405,11 +1405,11 @@ bcm_device:
global_flexctr_egr_pool_num_reserved: 5
global_flexctr_egr_op_profile_num_reserved: 10
global_flexctr_egr_group_num_reserved: 1
sai_uncached_port_stats: 0x1
ecmp_dlb_port_speeds: 1
l3_ecmp_member_secondary_mem_size: 16384
sai_rdma_udf_disable: 1
sai_l3_byte1_udf_disable: 1
sai_uncached_port_stats: 0x1
...
---
device:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
},
"config_gen_type": {
"type": "string",
"enum": ["DEFAULT", "HW_TEST"],
"enum": ["DEFAULT", "HW_TEST", "BENCHMARK", "LINK_TEST"],
"description": "Configuration generation profile. Controls which vendor configuration profile is applied. Values must match the AsicConfigGenType enum in fboss/agent/hw/config/asic_config_v2.thrift."
},
"port_config": {
Expand Down
67 changes: 26 additions & 41 deletions fboss/lib/asic_config_v3/test/validate_asic_configs_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import sys
import unittest
from enum import Enum
from typing import Any, NamedTuple, Optional
from typing import Any, ClassVar, NamedTuple, Optional
from unittest.mock import patch

import yaml
from yaml.nodes import MappingNode, ScalarNode, SequenceNode

from fboss.lib.asic_config_v3.base_generator import resolve_variant_config
from fboss.lib.asic_config_v3.gen import get_generator, get_output_filename
from fboss.lib.asic_config_v3.paths import AsicConfigPaths, discover_platforms
from yaml.nodes import MappingNode, ScalarNode, SequenceNode


class ComparisonResult(Enum):
Expand Down Expand Up @@ -84,17 +85,14 @@ class TestValidateAsicConfigV3Contents(unittest.TestCase):
# truth is the YAML embedded in a materialized agent config. Keyed by the
# variant's effective ``config_gen_type`` so that any platform declaring
# one of these gen types is picked up without editing this table.
_MATERIALIZED_REFERENCE_DIRS = {
_MATERIALIZED_REFERENCE_DIRS: ClassVar[dict[str, str]] = {
"HW_TEST": os.path.join("oss", "hw_test_configs"),
"BENCHMARK": os.path.join("oss", "hw_bench_configs"),
"LINK_TEST": os.path.join("oss", "link_test_configs"),
}
_MATERIALIZED_REFERENCE_SUFFIX = ".agent.materialized_JSON"
_MATERIALIZED_YAML_PATH = (
"platform",
"chip",
"asicConfig",
"common",
"yamlConfig",
)
_MATERIALIZED_REFERENCE_LINK_TEST_SUFFIX = ".materialized_JSON"
_MATERIALIZED_YAML_PATH = ("platform", "chip", "asicConfig", "common", "yamlConfig")
_MAX_DIFF_LINES = 200

def _reference_filename(self, platform: str, variant: str, extension: str) -> str:
Expand Down Expand Up @@ -131,9 +129,12 @@ def _materialized_reference_path(
reference_dir = self._MATERIALIZED_REFERENCE_DIRS.get(config_gen_type)
if reference_dir is None:
return None
return os.path.join(
reference_dir, f"{platform}{self._MATERIALIZED_REFERENCE_SUFFIX}"
suffix = (
self._MATERIALIZED_REFERENCE_LINK_TEST_SUFFIX
if config_gen_type == "LINK_TEST"
else self._MATERIALIZED_REFERENCE_SUFFIX
)
return os.path.join(reference_dir, f"{platform}{suffix}")

def _read_reference(
self,
Expand Down Expand Up @@ -176,10 +177,7 @@ def _canonicalize_yaml_node(self, node: Any) -> tuple[Any, ...]:
)
if isinstance(node, MappingNode):
entries = [
(
self._canonicalize_yaml_node(key),
self._canonicalize_yaml_node(value),
)
(self._canonicalize_yaml_node(key), self._canonicalize_yaml_node(value))
for key, value in node.value
]
return ("mapping", node.tag, tuple(sorted(entries, key=repr)))
Expand Down Expand Up @@ -221,10 +219,7 @@ def _print_summary(self, records: list[ComparisonRecord]) -> None:
),
file=sys.stderr,
)
print(
" ".join("-" * width for width in widths),
file=sys.stderr,
)
print(" ".join("-" * width for width in widths), file=sys.stderr)
for row in rows:
print(
" ".join(
Expand Down Expand Up @@ -339,10 +334,7 @@ def _get_generated_output(
)

stale_generated_file = generated_path if generated != checked_in else None
return (
GeneratedOutput(output_filename, generated, stale_generated_file),
None,
)
return (GeneratedOutput(output_filename, generated, stale_generated_file), None)

def _verify_variant(
self,
Expand Down Expand Up @@ -370,19 +362,12 @@ def _verify_variant(
)
try:
reference_path, reference = self._read_reference(
paths,
materialized_relative_path,
platform,
variant,
output_filename,
paths, materialized_relative_path, platform, variant, output_filename
)
except FileNotFoundError as error:
return VariantVerification(
ComparisonRecord(
platform,
variant,
str(error.filename),
"REFERENCE_MISSING",
platform, variant, str(error.filename), "REFERENCE_MISSING"
),
stale_generated_file=stale_generated_file,
error=(
Expand Down Expand Up @@ -488,8 +473,7 @@ def test_generated_files_match_internal_references(self) -> None:

def test_comparison_result_classification(self) -> None:
self.assertEqual(
self._compare("key: value\n", "key: value\n"),
ComparisonResult.BYTE_MATCH,
self._compare("key: value\n", "key: value\n"), ComparisonResult.BYTE_MATCH
)
self.assertEqual(
self._compare("first: 1\nsecond: 2\n", "second: 2\nfirst: 1\n"),
Expand Down Expand Up @@ -517,12 +501,13 @@ def test_content_mismatch_is_listed_and_fails(self) -> None:
)
stderr = io.StringIO()

with patch("sys.stderr", stderr):
with self.assertRaisesRegex(
AssertionError,
"1 ASIC config v3 variant.*test_platform/test_variant",
):
self._assert_verification_success(results)
with (
patch("sys.stderr", stderr),
self.assertRaisesRegex(
AssertionError, "1 ASIC config v3 variant.*test_platform/test_variant"
),
):
self._assert_verification_success(results)

output = stderr.getvalue()
self.assertIn("CONTENT_MISMATCH platform variants:", output)
Expand Down
Loading