Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saithriftv2 fixes for extensions #1533

Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c5bb56e
[doc] Add SAI metadata introduction presentation (#1487)
kcudnik Jun 6, 2022
5212f65
Add GEN_SAIRPC_OPTS to pass flags to gensairpc.pl from top-level Make…
chrispsommers Jun 25, 2022
49d03ae
Add static_cast<> to sairpcgen templates to avoid type mismatches for…
chrispsommers Jul 6, 2022
170d3c5
Add new env variable SAIRPC_EXTRA_LIBS which gets passed to final lin…
chrispsommers Jul 7, 2022
9c6a99e
Add experimental to include path.
chrispsommers Jul 9, 2022
5170c04
Add experimental headers to CPPFLAGS passed to ctypesgen.
chrispsommers Jul 10, 2022
68faf1f
Add VLAN and PortChannel test plan (#1480)
richardyu-ms Jun 19, 2022
f5539e4
[SAI-PTF] SAI PTF test structure for T0 test and VLAN,FDB sample case…
richardyu-ms Jun 20, 2022
7159969
[meta] Add sai_status_t to ancestry check (#1501)
kcudnik Jun 20, 2022
a103b06
reset sleep time during turning up ports (#1502)
RyoYang Jun 21, 2022
45f932d
[saineighbor] Bulk API support for Neighbor entries (#1504)
prsunny Jun 22, 2022
7adb04f
add vlan testcases from Group6 to Group10 (#1506)
RyoYang Jun 23, 2022
5f76920
Support counters on IP MC route entries. This is similar to the suppo…
rck-innovium Jun 23, 2022
f3aecf1
Add thr missing API into saithriftv2 missing for syncd (#1484)
vivekrnv Jun 23, 2022
98ed901
add vlan test case (#1510)
allen-xf Jun 24, 2022
1d872c1
add more waiting time for test (#1511)
richardyu-ms Jun 24, 2022
1410039
add read config_db.json (#1519)
allen-xf Jul 1, 2022
14ccb36
[Fix]Add necessary test data file for sai test (#1520)
richardyu-ms Jul 3, 2022
f4521bc
Zitingguo/add lag test (#1522)
Gfrom2016 Jul 6, 2022
eb41dfd
add teardown for testing multiple cases at a time (#1521)
allen-xf Jul 6, 2022
905da92
Added missing dependencies required to run gensairpc.pl (#1492)
chrispsommers Jul 7, 2022
c42da72
Update saitam.h (#1496)
JaiOCP Jul 7, 2022
da95162
Merge remote-tracking branch 'upstream/master' into saithriftv2-fixes…
chrispsommers Jul 11, 2022
ca88506
Pass SAIRPC_EXTRA_LIBS flag in Makefile
chrispsommers Jul 11, 2022
66b300e
Removed changes to include paths for SAI extension headers;
chrispsommers Aug 3, 2022
d8bb5a8
Merge remote-tracking branch 'upstream/master' into saithriftv2-fixes…
chrispsommers Aug 3, 2022
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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ else
SAITHRIFT_PATH=test/saithrift
endif

# Passed to genrpc.pl via "make saithrift-build":
GEN_SAIRPC_OPTS?=

# Passed to meta/Makefile via "make saithrift-build, can specify add'l libraries along with libsai
SAIRPC_EXTRA_LIBS?=
chrispsommers marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: test doc clean

doc:
Expand All @@ -37,7 +43,7 @@ test:
make -C test

saithrift-build:
make -C $(SAITHRIFT_PATH)
SAIRPC_EXTRA_LIBS="$(SAIRPC_EXTRA_LIBS)" GEN_SAIRPC_OPTS=$(GEN_SAIRPC_OPTS) make -C $(SAITHRIFT_PATH)

saithrift-install: saithrift-build
make -C $(SAITHRIFT_PATH) install
Expand Down
5 changes: 4 additions & 1 deletion meta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
# @brief This module defines SAI Metadata Makefile
#

# Passed to genrpc.pl:
GEN_SAIRPC_OPTS?=

WARNINGS = \
-ansi \
-Wall \
Expand Down Expand Up @@ -114,7 +117,7 @@ saimetadatatest.c saimetadata.c saimetadata.h: xml $(XMLDEPS) parse.pl $(CONSTHE
perl -I. parse.pl

rpc sai.thrift sai_rpc_server.cpp sai_adapter.py: xml $(XMLDEPS) gensairpc.pl
perl -Irpc gensairpc.pl
perl -Irpc gensairpc.pl $(GEN_SAIRPC_OPTS)

HEADERS = saimetadata.h $(CONSTHEADERS)

Expand Down
6 changes: 5 additions & 1 deletion meta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ Parser also forces headers to be well formated when adding new code.
To test your changes just type:

```sh
make
[GEN_SAIRPC_OPTS=<option flags>] make
```
e.g.
```
GEN_SAIRPC_OPTS="-ve" make
```
2 changes: 1 addition & 1 deletion meta/templates/sai_rpc_server_functions.tt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
[%- ######################################################################## -%]

[%- BLOCK sai_api_query -%]
status = sai_api_query(SAI_API_[% api.upper %], (void **)&[% api %]_api);
status = sai_api_query(static_cast<sai_api_t>(SAI_API_[% api.upper %]), (void **)&[% api %]_api);
if (status != SAI_STATUS_SUCCESS) {
[%- PROCESS return_error indentation = 3 status_variable = 'status' %]
}
Expand Down
4 changes: 2 additions & 2 deletions meta/templates/sai_rpc_server_helper_functions.tt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void sai_thrift_parse_[% object %]_attributes(const std::vector<sai_thrift_attri
for (uint32_t i = 0; i < thrift_attr_list.size(); i++, it++) {
attribute = (sai_thrift_attribute_t)*it;
attr_list[i].id = attribute.id;
convert_attr_thrift_to_sai(SAI_OBJECT_TYPE_[% object.upper %], attribute, &attr_list[i]);
convert_attr_thrift_to_sai(static_cast<sai_object_type_t>(SAI_OBJECT_TYPE_[% object.upper %]), attribute, &attr_list[i]);
}
[% END -%]

Expand All @@ -85,7 +85,7 @@ void sai_thrift_deparse_[% object %]_attributes(sai_attribute_t *attr_list,

for (uint32_t i = 0; i < attr_count; i++, it++) {
sai_thrift_attribute_t attribute;
convert_attr_sai_to_thrift(SAI_OBJECT_TYPE_[% object.upper %], attr_list[i], attribute);
convert_attr_sai_to_thrift(static_cast<sai_object_type_t>(SAI_OBJECT_TYPE_[% object.upper %]), attr_list[i], attribute);
thrift_attr_list.push_back(attribute);
}
[% END -%]
Expand Down
12 changes: 8 additions & 4 deletions test/saithriftv2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ METADIR := $(PREDIR)$(PREDIR)meta/

SAI_PREFIX = /usr
SAI_HEADER_DIR ?= $(SAI_PREFIX)/include/sai
SAI_EXT_HEADER_DIR ?= $(SAI_PREFIX)/include/experimental
chrispsommers marked this conversation as resolved.
Show resolved Hide resolved
SAI_LIBRARY_DIR ?= $(SAI_PREFIX)/lib
SAI_HEADERS = $(SAI_HEADER_DIR)/sai*.h

LIBS = -lthrift -lpthread
LDFLAGS = -L$(SAI_LIBRARY_DIR) -Wl,-rpath=$(SAI_LIBRARY_DIR)
CPPFLAGS = -I$(SAI_HEADER_DIR) -I. -std=c++11
CPPFLAGS = -I$(SAI_HEADER_DIR) -I$(SAI_EXT_HEADER_DIR) -I. -std=c++11

CPPFLAGS += -O0 -ggdb


# specify add'l libraries along with libsai
SAIRPC_EXTRA_LIBS?=

ifeq ($(platform),MLNX)
CDEFS = -DMLNXSAI
else
Expand Down Expand Up @@ -79,7 +83,7 @@ $(PY_SOURCES): $(METADIR)sai.thrift
$(THRIFT) -o ./ --gen py -r $^

$(SAI_PY_HEADERS): $(SAI_HEADERS)
$(CTYPESGEN) --output-language=py32 -I/usr/include -I$(SAI_HEADER_DIR) --include /usr/include/linux/limits.h $^ -o $@
$(CTYPESGEN) --output-language=py32 -I/usr/include -I$(SAI_HEADER_DIR) -I$(SAI_EXT_HEADER_DIR) --include /usr/include/linux/limits.h $^ -o $@

$(ODIR)/%.o: gen-cpp/%.cpp meta
$(CXX) $(CPPFLAGS) -c $< -o $@ -I../../meta
Expand All @@ -88,7 +92,7 @@ $(ODIR)/sai_rpc_server.o: ../../meta/sai_rpc_frontend.cpp
$(CXX) $(CPPFLAGS) -c $^ -o $@ $(CPPFLAGS) -I./gen-cpp -I../../meta -I../../inc -I../../experimental

$(ODIR)/saiserver.o: src/saiserver.cpp $(CPP_SOURCES) directories
$(CXX) $(CPPFLAGS) -c src/saiserver.cpp -o $@ $(CPPFLAGS) $(CDEFS) -I./gen-cpp -I../../inc
$(CXX) $(CPPFLAGS) -c src/saiserver.cpp -o $@ $(CPPFLAGS) $(CDEFS) -I./gen-cpp -I../../inc -I../../experimental
chrispsommers marked this conversation as resolved.
Show resolved Hide resolved

$(ODIR)/librpcserver.a: $(ODIR)/sai_rpc.o $(ODIR)/sai_types.o $(ODIR)/sai_rpc_server.o
ar rcs $(ODIR)/librpcserver.a $^
Expand All @@ -98,7 +102,7 @@ clientlib: $(PY_SOURCES) $(SAI_PY_HEADERS)

saiserver: $(ODIR)/saiserver.o $(ODIR)/librpcserver.a
$(CXX) $(LDFLAGS) $(ODIR)/sai_rpc_server.o $(ODIR)/saiserver.o -o $@ \
$(ODIR)/librpcserver.a $(LIBS)
$(ODIR)/librpcserver.a $(LIBS) $(SAIRPC_EXTRA_LIBS)

install-lib: $(ODIR)/librpcserver.a
$(INSTALL) -D $(ODIR)/librpcserver.a $(DESTDIR)/usr/lib/librpcserver.a
Expand Down