sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
196 stars 716 forks source link

rand_one_dut_hostname cannot be used with enum_asic_index #7627

Open SuvarnaMeenakshi opened 1 year ago

SuvarnaMeenakshi commented 1 year ago

Description

Steps to reproduce the issue:

  1. Run test that uses combination on rand_one_dut_hostname and enum_asic_index fixtures in a multi-dut testbed, with each dut in different hwsku or different number of asics.
  2. The test fails as the enum_asic_index is generated without the context of which was the random dut that was selected. so enum_asic_index will contain list of asics of first DUT in the testbed.
  3. This is because duts_selected does not include duts selected in rand_one_dut_hostname fixture. https://github.com/sonic-net/sonic-mgmt/blob/master/tests/conftest.py#L1315
    if duts_selected is None:
        duts_selected = [tbinfo["duts"][0]]
  4. This caused failure in cacl/test_ebtables_application.py in chassis testbed. This PR https://github.com/sonic-net/sonic-mgmt/pull/7617 fixes the test case to run using enum_rand_one_per_hwsku_hostname as the test has to be run on each hwsku.

Describe the results you received: Any test using rand_one_dut_hostname and enum_asic_index can cause failure when accessing the asic instance of the DUT selected, if asic_instance is not present in the dut selected. one example is failure described in https://github.com/sonic-net/sonic-mgmt/pull/7617

Describe the results you expected: enum_asic_index should be generated for rand_one_dut_hostname

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
yxieca commented 1 year ago

@SuvarnaMeenakshi are you able to update the enumeration logic to enable multi-asic, or do you need help?

yxieca commented 1 year ago

Suggest to create a new combined selector, which will randomly choose a dut than randomize the asic index accordingly. Using 2 fixtures would have issue raised here.

SuvarnaMeenakshi commented 1 year ago

Suggest to create a new combined selector, which will randomly choose a dut than randomize the asic index accordingly. Using 2 fixtures would have issue raised here.

We generally use two fixtures, but the combination of mapping right asic_index to the dut host selected is managed in conftest logic. This logic has to include rand_one_dut_hostname.

I will be able to work on this but might need some investigation to ensure that the changes work well for tests that use rand_one_dut_hostname fixture, I cannot take it up this month.