-
Notifications
You must be signed in to change notification settings - Fork 52
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
Read full config with gnmi get #143
Conversation
@@ -337,7 +337,9 @@ func (c *MixedDbClient) populateDbtablePath(path *gnmipb.Path, value *gnmipb.Typ | |||
|
|||
tblPath.dbNamespace = dbNamespace | |||
tblPath.dbName = targetDbName | |||
tblPath.tableName = stringSlice[1] | |||
if len(stringSlice) > 1 { |
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.
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.
Updated.
// Did no provide table name | ||
// Get all tables in the DB | ||
if tblPath.dbName == "COUNTERS_DB" { | ||
return fmt.Errorf("Can not read all tables in COUNTERS_DB") |
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.
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.
tables in COUNTERS_DB other than COUNTERS table doesn't have keys.
So, I prefer not to implement it today.
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.
I have Added TODO and new unit test.
@@ -430,7 +434,9 @@ func (c *MixedDbClient) makeJSON_redis(msi *map[string]interface{}, key *string, | |||
// TODO: Use Yang model to identify leaf-list | |||
if key == nil && op == nil { | |||
for f, v := range mfv { | |||
if strings.HasSuffix(f, "@") { | |||
if f == "NULL" { | |||
continue |
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.
Hard to understand the new branch. Could you add some code comment? #Closed
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.
Updated
Can template like "/*" be the part solution? gnmi_get ... -xpath "/sonic-db:CONFIG_DB/*" It will get all the fields but suddenly (bug or feature) delete table keys (like PORT, FLEX_COUNTER_TABLE etc.). So, for example, all Ethernet ports from PORT are in same area with other keys:
So up here: ACL and BUFFER_POOL_WATERMARK – are from FLEX_COUNTER_TABLE; Ethernet* – from PORT; "config" – from CRM. I see kind of solution to run multiple get request with different tables like "/sonic-db:CONFIG_DB/PORT", "/sonic-db:CONFIG_DB/CRM", "/sonic-db:CONFIG_DB/FLEX_COUNTER_TABLE" and so on. And then aggregate these data in one JSON file. |
We will support wildcard in the future. |
Why I did it
Need to read full config for SONiC
How I did it
Read CONFIG DB and convert to json.
How to verify it
Verified with unit test and end2end test.
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)