This is a checklist which can help you modify the existing commands/scripts in sonic-utilities to support multi-asic behaviour
The following is a list of conventions that have been adopted to transition single-asic commands to support multi-asic:
- Use multi_asic_util decorators like
@multi_asic_util.run_on_multi_asic
, for wrapping top-level functions - Across all commands we assume that if no namespace is specified on a multi-asic device, we should perform the operation across all namespaces
- Make the output explicitly mention which namespace it is operating on
- Add a new test file for multi asic named:
multi_asic_<cmd-name>_test.py
and inherit common functions like setup and teardown from single asic test file - Verify functionality by testing your change on multi-asic and single-asic linecards in T2 topology
- Verify your changes in T0 and T1 topology DUTs
- Previously,
ip netns
was used to set namespaces, however, this is discouraged because it conflicts with how multi_asic_util warppers implementation of namespaces
- Do not use unix_sockets to connect to databases
- Modify the sample example to include documentation about multi_asic functionality
- Each newly added function must have a docstring explaining its purpose
- Prefer using testData dict instead of manually specifying the test commands and outputs
- You might need to modify the mock_tables in
test/mock_tables/asic<number>/
to support your test cases - Call top level commands like show/config instead of the actual cmds to verify the test behaviour
- Modify abstracted commands like show/main.py, clear/main.py, config/main.py etc to support namespace argument
- Use click instead of argparse for commands
- Use click argument validation instead of manually adding validation logic within main. The former is cleaner and more readable
- Aim for the most minimal change you can make
- Run pre-commit checks before pushing to avoid static test failures in upstream PR
- Add PR to chassis project for timely review and approval
ecnconfig: sonic-net/sonic-utilities#3062
mmuconfig: sonic-net/sonic-utilities#3061
pg-drop: sonic-net/sonic-utilities#3058
Contact: hpandya@arista.com