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
3 changes: 2 additions & 1 deletion debian/python-saithrift.install
Original file line number Diff line number Diff line change
@@ -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/
16 changes: 12 additions & 4 deletions test/saithriftv2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +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 -lswsscommon
else
LIBS = -lthrift -lpthread -lsai -lsaimetadata
endif
Expand Down Expand Up @@ -74,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
Expand All @@ -97,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)
Expand Down
2 changes: 1 addition & 1 deletion test/saithriftv2/convert_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading