-
Notifications
You must be signed in to change notification settings - Fork 274
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
[sonic-db-cli]: SONiC DB CLI for DPU objects #837
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cc25de8
dpu db support by cli
Pterosaur df2a357
update configure.ac
Pterosaur a34560c
Fix macro defined
Pterosaur c5347ba
Update config header
Pterosaur b2d05a4
Update config header
Pterosaur 8a087c0
Add return
Pterosaur d289a9f
Add noreturn
Pterosaur 6960e17
Disable warning
Pterosaur a843445
Add config.h to bazel BUILD
Pterosaur c8b17a0
Fix bug
Pterosaur bbab5f6
Update Azp
Pterosaur c3151f9
Add test
Pterosaur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,15 @@ CFLAGS_COMMON+=" -fstack-protector-strong" | |
|
||
AC_SUBST(CFLAGS_COMMON) | ||
|
||
AC_CHECK_LIB([dashapi], [PbBinaryToJsonString], [ | ||
AC_DEFINE(DASH_API_INSTALLED, 1, [Define if DASH API is installed]) | ||
LIBS="$LIBS -ldashapi" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. swss-common is widely used, it is awkward to ask others to install dashapi.
|
||
], | ||
[ | ||
CFLAGS_COMMON+=" -Wno-suggest-attribute=noreturn" | ||
]) | ||
|
||
|
||
AC_CONFIG_FILES([ | ||
Makefile | ||
]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
#include <string> | ||
#include <ctime> | ||
#include <getopt.h> | ||
#include <stdlib.h> | ||
|
||
#include "common/dbconnector.h" | ||
#include "sonic-db-cli/sonic-db-cli.h" | ||
|
||
|
@@ -539,4 +541,34 @@ TEST(sonic_db_cli, test_cli_not_throw_exception) | |
initializeConfig); | ||
|
||
EXPECT_EQ(1, exit_code); | ||
} | ||
} | ||
|
||
TEST(sonic_db_cli, test_cli_hgetall_pb) | ||
{ | ||
char *args[6]; | ||
args[0] = "sonic-db-cli"; | ||
args[1] = "TEST_DB"; | ||
|
||
// clear database | ||
args[2] = "FLUSHDB"; | ||
auto output = runCli(3, args); | ||
EXPECT_EQ("True\n", output); | ||
|
||
// restore binary pb message to TEST_DB | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
EXPECT_EQ(system("cat ./tests/cli_test_data/pb_appliance.bin " | ||
"| redis-cli -n 15 -x restore 'DASH_APPLIANCE_TABLE:123' 0"), | ||
0); | ||
|
||
string target_json = | ||
"{\n" | ||
" \"sip\": {\n" | ||
" \"ipv4\": 16777482\n" | ||
" },\n" | ||
" \"vm_vni\": 4321\n" | ||
"}\n\n"; | ||
|
||
args[2] = "hgetall"; | ||
args[3] = R"(DASH_APPLIANCE_TABLE:123)"; | ||
output = runCli(4, args); | ||
EXPECT_EQ(target_json, output); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add one blank before
const
.