sonic-sairedis icon indicating copy to clipboard operation
sonic-sairedis copied to clipboard

add support for "sai_dbg_generate_dump" API

Open aviramd opened this issue 1 year ago • 1 comments
trafficstars

This update adds support for the sai_dbg_gen_dump API, enabling the generation of a debug dump file by the SAI when there is no SAI failure. For scenarios involving SAI failures, a separate flow called dump_on_sai_failure is available.

An HLD will be publish soon with all relevant PRs

aviramd avatar Sep 25 '24 14:09 aviramd

please make build success, after that i will review this

kcudnik avatar Oct 02 '24 12:10 kcudnik

please rebase to latest master

kcudnik avatar Nov 05 '24 07:11 kcudnik

please rebase to latest master

Done

aviramd avatar Nov 06 '24 11:11 aviramd

add HLD PR: https://github.com/sonic-net/SONiC/pull/1846

aviramd avatar Nov 06 '24 11:11 aviramd

@aviramd can you fix whitespaces issue:

Checkig for white spaces ...
../proxylib/Sai.h:195:                  
../syncd/VendorSai.h:218:                    _In_ const char *dump_file_name) override;                    
../syncd/Syncd.cpp:412:    
../syncd/Syncd.cpp:434:        
../lib/ClientSai.cpp:1566:    
../lib/ClientSai.cpp:1568: 
../lib/Sai.cpp:788:    return SAI_STATUS_FAILURE; 
../lib/RedisRemoteSaiInterface.cpp:1923:    
../lib/RedisRemoteSaiInterface.cpp:1926: 
../lib/RedisRemoteSaiInterface.cpp:1932:        m_recorder->recordDbgGenDumpResponse(status);        
../lib/RedisRemoteSaiInterface.cpp:1936:    return SAI_STATUS_SUCCESS;  
../lib/Recorder.h:262:                    _In_ sai_status_t status);        
../lib/ClientServerSai.cpp:648:     
../lib/ClientServerSai.h:183:                    _In_ const char *dump_file_name) override;       
../lib/ServerSai.h:188:                    _In_ const char *dump_file_name) override;       
../lib/ServerSai.h:301:                    _In_ const swss::KeyOpFieldsValuesTuple &kco); 
../vslib/VirtualSwitchSaiInterface.h:196:                    _In_ const char *dump_file_name) override;               
../vslib/VirtualSwitchSaiInterface.h:197:                                    
../vslib/Sai.h:198:                    
../meta/SaiInterface.h:338:            
../meta/SaiInterface.h:341:                    
../meta/Meta.cpp:1427:    
ERROR: some files contain white spaces at the end of line, please fix
FAIL: checkwhitespace.sh

kcudnik avatar Nov 07 '24 08:11 kcudnik

You will also need to add some unit tests to satisfy code coverage

kcudnik avatar Nov 07 '24 13:11 kcudnik

i hink you made some mistake, you only touch test file

kcudnik avatar Nov 24 '24 15:11 kcudnik

i hink you made some mistake, you only touch test file

Yes you are right , i am working to fix it

aviramd avatar Nov 24 '24 15:11 aviramd

you can try build this on your local machine to check whether it will compile first

kcudnik avatar Nov 24 '24 17:11 kcudnik

I have some git issues on my local machine I am working to solve it , please ignore the last commit

aviramd avatar Nov 26 '24 08:11 aviramd

Is it possible to execute the sairedis unit test locally? if yes how?

aviramd avatar Nov 26 '24 16:11 aviramd

Is it possible to execute the sairedis unit test locally? if yes how?

Yes, type make check in local console

kcudnik avatar Nov 27 '24 10:11 kcudnik

just to clarify "sai_dbg_generate_dump" function was not implemented in the first place, since it's passing path to where to make dump, and OA an syncd are running in different docker containers, so path passed BY OA maybe invalid in syncd container

kcudnik avatar Nov 29 '24 09:11 kcudnik

just to clarify "sai_dbg_generate_dump" function was not implemented in the first place, since it's passing path to where to make dump, and OA an syncd are running in different docker containers, so path passed BY OA maybe invalid in syncd container

In this high-level design (HLD), the application uses a fixed path, /var/log/dbg_gen_dump.log, which is guaranteed to always exist. However, I can modify the code in the syncd container so that, before calling the SAI API, it ensures the path exists and creates it locally within the syncd container if necessary.

aviramd avatar Dec 01 '24 08:12 aviramd

to avoid so many push commits please test everything locally type "make" and "make check" to run unittests locally

kcudnik avatar Dec 04 '24 09:12 kcudnik

to avoid so many push commits please test everything locally type "make" and "make check" to run unittests locally

Is this the correct procedure for testing?

  1. Build the target.
  2. Run sonic-slave-bookworm-user.
  3. Inside the slave container, navigate to sonic/src/sonic-sairedis/tests.
  4. Run "make check". Should I install any packages after entering the slave Docker container?

Also, after building the target, a cleanup occurs, and the make file (which is auto-generated during the build) gets deleted. How can I prevent this from happening?

aviramd avatar Dec 04 '24 10:12 aviramd

no, you don't need to build entire docker you can locally ./configure --with-sai=vs locally on your machine

kcudnik avatar Dec 04 '24 13:12 kcudnik

no, you don't need to build entire docker you can locally ./configure --with-sai=vs locally on your machine

Thank you for your support! I tried running the command locally, but I encountered the following error when execute "make":

"libtool: compile: g++ ... -c AttrKeyMap.cpp -fPIC -DPIC -o .libs/libsaimeta_la-AttrKeyMap.o In file included from AttrKeyMap.cpp:3: sai_serialize.h:18:10: fatal error: swss/logger.h: No such file or directory" Any advice on how to resolve this would be appreciated!

aviramd avatar Dec 11 '24 15:12 aviramd

Yes you need to install swss-common library also from source

kcudnik avatar Dec 12 '24 07:12 kcudnik

no, you don't need to build entire docker you can locally ./configure --with-sai=vs locally on your machine

Thank you very much, I can run the tests now with 'make check'. Is it also possible to test the code coverage locally? I ran the configure command with the --enable-code-coverage=yes option. if yes, where can I see the results

aviramd avatar Dec 12 '24 16:12 aviramd

no, you don't need to build entire docker you can locally ./configure --with-sai=vs locally on your machine

Thank you very much, I can run the tests now with 'make check'. Is it also possible to test the code coverage locally? I ran the configure command with the --enable-code-coverage=yes option. if yes, where can I see the results

results are done in *gcno *gcna files, but they need to be processed, in azure pipeline gcovr results are colleted and then putt tohether, in pipeline output is done in json, and then module is preenting them in nice form on github, locally you can generate nice html, take a look gcovr help: https://gcovr.com/en/stable/output/html.html

kcudnik avatar Dec 12 '24 16:12 kcudnik

/azp run

mssonicbld avatar Dec 19 '24 06:12 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Dec 19 '24 06:12 azure-pipelines[bot]

/azp run

mssonicbld avatar Dec 19 '24 06:12 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Dec 19 '24 06:12 azure-pipelines[bot]

/azp run

mssonicbld avatar Dec 19 '24 06:12 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Dec 19 '24 06:12 azure-pipelines[bot]

/azp run

mssonicbld avatar Dec 19 '24 06:12 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Dec 19 '24 06:12 azure-pipelines[bot]

code coverage shows that dbgdump in syncd is not tested

kcudnik avatar Dec 19 '24 10:12 kcudnik