Skip to content

Commit

Permalink
[rpc server]: Enable syncd-rpc target compilation. (sonic-net#281)
Browse files Browse the repository at this point in the history
Export switch ID variable required by SAI thrift.
  • Loading branch information
AndriiS authored and lguohan committed Jan 13, 2018
1 parent 7549258 commit 9364b7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ binary-syncd:
dh binary -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

binary-syncd-rpc: | binary-syncd
$(shell echo '--enable-rpcserver=no' > /tmp/syncd-build)
$(shell echo '--enable-rpcserver=yes' > /tmp/syncd-build)
dh clean --with autotools-dev
dh build -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
dh binary -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
Expand Down
11 changes: 11 additions & 0 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ std::set<sai_object_id_t> initViewRemovedVidSet;
*/
volatile bool g_asicInitViewMode = false;

#ifdef SAITHRIFT
/*
* SAI switch global needed for RPC server
*/
sai_object_id_t gSwitchId;
#endif

struct cmdOptions
{
int countersThreadIntervalInSeconds;
Expand Down Expand Up @@ -1755,6 +1762,10 @@ void on_switch_create_in_init_view(
sai_serialize_status(status).c_str());
}

#ifdef SAITHRIFT
gSwitchId = switch_rid;
#endif

/*
* Object was created so new object id was generated we
* need to save virtual id's to redis db.
Expand Down

0 comments on commit 9364b7e

Please sign in to comment.