From fc4879600b01d5b1deb7d3f8972906f16fc46014 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Tue, 2 Jun 2026 11:05:14 -0700 Subject: [PATCH 1/6] feat: modify saithriftv2 makefile; phase 1, task 1 Signed-off-by: Nicholas Ching --- test/saithriftv2/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/saithriftv2/Makefile b/test/saithriftv2/Makefile index 7cd624bc5..38e1897c1 100644 --- a/test/saithriftv2/Makefile +++ b/test/saithriftv2/Makefile @@ -39,6 +39,9 @@ endif ifeq ($(platform),vs) LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq +else ifeq ($(platform),vpp) +LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq \ + -lvlib -lvlibapi -lvppapiclient -lvlibmemoryclient -lvppinfra else LIBS = -lthrift -lpthread -lsai -lsaimetadata endif From fef924ea801e3823c39190a6a0a69098f8bc7b1d Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Wed, 10 Jun 2026 11:36:50 -0700 Subject: [PATCH 2/6] fix: index error on stringification Signed-off-by: Nicholas Ching --- test/saithriftv2/convert_header.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/saithriftv2/convert_header.py b/test/saithriftv2/convert_header.py index 2c5a958cf..9c08aac34 100644 --- a/test/saithriftv2/convert_header.py +++ b/test/saithriftv2/convert_header.py @@ -47,7 +47,7 @@ class sai_common_api(SAIEnum): import enum class SAIEnum(enum.IntEnum): def __str__(self): - return super().__str__().split(\".\")[1]\n""" + return self.name\n""" ENUM_PREFIX = "enum__sai_" SAI_NAME = "SAI" ENUM_TYPE = "= c_int" From cbd37b52f29d253b3614911cb7fd37f8c5979fe6 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Mon, 15 Jun 2026 07:18:21 -0700 Subject: [PATCH 3/6] feat: enable SWSS debug logging in saiserver (link swsscommon) Signed-off-by: Nicholas Ching --- test/saithriftv2/Makefile | 4 ++-- test/saithriftv2/src/saiserver.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/saithriftv2/Makefile b/test/saithriftv2/Makefile index 38e1897c1..6cfeac2e7 100644 --- a/test/saithriftv2/Makefile +++ b/test/saithriftv2/Makefile @@ -38,10 +38,10 @@ CTYPESGEN = /usr/local/bin/ctypesgen.py endif ifeq ($(platform),vs) -LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq +LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq -lswsscommon else ifeq ($(platform),vpp) LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq \ - -lvlib -lvlibapi -lvppapiclient -lvlibmemoryclient -lvppinfra + -lvlib -lvlibapi -lvppapiclient -lvlibmemoryclient -lvppinfra -lswsscommon else LIBS = -lthrift -lpthread -lsai -lsaimetadata endif diff --git a/test/saithriftv2/src/saiserver.cpp b/test/saithriftv2/src/saiserver.cpp index 331274506..121f4495e 100644 --- a/test/saithriftv2/src/saiserver.cpp +++ b/test/saithriftv2/src/saiserver.cpp @@ -21,6 +21,7 @@ #include #include #include "sai_rpc.h" +#include #define UNREFERENCED_PARAMETER(P) (P) @@ -269,6 +270,9 @@ void handleInitScript(const std::string& initScript) int main(int argc, char* argv[]) { + swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); + swss::Logger::getInstance().swssOutputNotify("saiserver", "STDOUT"); + int rv = 0; auto options = handleCmdLine(argc, argv); From 80bd1c97999a35416c85ee3766648d5986699bd0 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Mon, 15 Jun 2026 07:19:35 -0700 Subject: [PATCH 4/6] chore: install Python bindings to python3 dist-packages for bookworm Signed-off-by: Nicholas Ching --- debian/python-saithrift.install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/python-saithrift.install b/debian/python-saithrift.install index b98491588..2823a1da2 100644 --- a/debian/python-saithrift.install +++ b/debian/python-saithrift.install @@ -1 +1,2 @@ -debian/usr/local/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages/ +#compatiable with bookworm python 3.11 environment and build with python3 +debian/usr/local/local/lib/python3*/dist-packages/* /usr/lib/python3/dist-packages/ From bd953b5120e8889187367da0e3aa100e9d62f3d1 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Wed, 24 Jun 2026 14:10:04 -0700 Subject: [PATCH 5/6] fix: remove sonic-swss logger from saiserver Signed-off-by: Nicholas Ching --- test/saithriftv2/src/saiserver.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/saithriftv2/src/saiserver.cpp b/test/saithriftv2/src/saiserver.cpp index 121f4495e..331274506 100644 --- a/test/saithriftv2/src/saiserver.cpp +++ b/test/saithriftv2/src/saiserver.cpp @@ -21,7 +21,6 @@ #include #include #include "sai_rpc.h" -#include #define UNREFERENCED_PARAMETER(P) (P) @@ -270,9 +269,6 @@ void handleInitScript(const std::string& initScript) int main(int argc, char* argv[]) { - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); - swss::Logger::getInstance().swssOutputNotify("saiserver", "STDOUT"); - int rv = 0; auto options = handleCmdLine(argc, argv); From 554b7874d38dfccb74f9c11f493a216191e96e43 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Tue, 30 Jun 2026 14:55:58 -0700 Subject: [PATCH 6/6] fix: serialize saithriftv2 Thrift generation for parallel Trixie builds Signed-off-by: Nicholas Ching --- test/saithriftv2/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/saithriftv2/Makefile b/test/saithriftv2/Makefile index 6cfeac2e7..3f4afe3b8 100644 --- a/test/saithriftv2/Makefile +++ b/test/saithriftv2/Makefile @@ -77,18 +77,23 @@ $(METADIR)sai.thrift: # rm gen-cpp/gen-py is needed since thrift don't override existing files # even if sai.thrift file changed :( -$(CPP_SOURCES): $(METADIR)sai.thrift +gen-cpp/sai_rpc.cpp: $(METADIR)sai.thrift rm -rf gen-cpp $(THRIFT) -o ./ --gen cpp -r $^ -$(PY_SOURCES): $(METADIR)sai.thrift +$(filter-out gen-cpp/sai_rpc.cpp, $(CPP_SOURCES)): gen-cpp/sai_rpc.cpp + +gen-py/sai/sai_rpc.py: $(METADIR)sai.thrift rm -rf gen-py $(THRIFT) -o ./ --gen py -r $^ $(INSTALL) -vCD $(METADIR)sai_adapter.py gen-py/sai/sai_adapter.py +$(filter-out gen-py/sai/sai_rpc.py, $(PY_SOURCES)): gen-py/sai/sai_rpc.py + # TODO should depend on ../../inc/sai*.h ../../experimental/sai*.h and not /usr/include/sai/sai*.h $(SAI_PY_HEADERS): $(SAI_HEADERS) + mkdir -p gen-py/sai $(CTYPESGEN) --output-language=py32 -I/usr/include -I$(SAI_HEADER_DIR) -I../../experimental -I../../custom --include /usr/include/linux/limits.h $^ -o $@ python3 convert_header.py -i $(SAI_PY_HEADERS) -o ./new_header.py mv $(SAI_PY_HEADERS) ./sai_headers.py.bk @@ -100,7 +105,7 @@ $(METADIR)saimetadata.h: $(ODIR)/%.o: gen-cpp/%.cpp $(CXX) $(CPPFLAGS) -c $< -o $@ -$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h +$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h $(CPP_SOURCES) $(CXX) $(CPPFLAGS) -c $(METADIR)sai_rpc_frontend.cpp -o $@ -I$(METADIR) -I./gen-cpp -I../../inc -I../../experimental -I../../custom $(ODIR)/saiserver.o: src/saiserver.cpp src/switch_sai_rpc_server.h $(CPP_SOURCES)