Add gnmi_dump tool for debug and unit test#60
Add gnmi_dump tool for debug and unit test#60ganglyu merged 8 commits intosonic-net:masterfrom ganglyu:gnmi_dump
Conversation
| /* Add to Set response results. */ | ||
| results = append(results, &res) | ||
| } | ||
| if s.config.EnableTranslibWrite { |
There was a problem hiding this comment.
I move the check to line 353 to simplify logic for set fail, when EnableTranslibWrite is false, no need to authenticate and no need to update result.
common_utils/context.go
Outdated
| SetMemCounters(&globalCounters) | ||
| } | ||
|
|
||
| func IncCounter(name string) { |
There was a problem hiding this comment.
Why use string as an index? If an enum were used then there would be no need for the loop in line 81, right?
gnmi_server/server_test.go
Outdated
| func createReadServer(t *testing.T, port int64) *Server { | ||
| certificate, err := testcert.NewCert() | ||
| if err != nil { | ||
| t.Errorf("could not load server key pair: %s", err) |
There was a problem hiding this comment.
This should be t.Fatalf(...) as t.Errorf(...) does not stop execution of the test and it will continue despite lack of the certificate.
gnmi_server/server_test.go
Outdated
| cfg := &Config{Port: port, EnableTranslibWrite: false} | ||
| s, err := NewServer(cfg, opts) | ||
| if err != nil { | ||
| t.Errorf("Failed to create gNMI server: %v", err) |
There was a problem hiding this comment.
Similar comment here. This should be t.Fatalf(...) instead of t.Errorf(...)
| } | ||
|
|
||
| func createReadServer(t *testing.T, port int64) *Server { | ||
| certificate, err := testcert.NewCert() |
There was a problem hiding this comment.
As this is a helper function it should be marked as such by calling t.Helper() at its beginning.
qiluo-msft
left a comment
There was a problem hiding this comment.
LGTM. Please also check with other reviewers.
|
@tomek-US I have updated, would you like to review again? |
Update sonic-gnmi submodule pointer to include the following: * 99bfa8f Remove LOGLEVEL DB since is no longer used ([#56](sonic-net/sonic-gnmi#56)) * 6b0253a Add conditional check for split ([#55](sonic-net/sonic-gnmi#55)) * ae72767 Add gnmi_dump tool for debug and unit test ([#60](sonic-net/sonic-gnmi#60)) * 8226e46 Upgrade pipeline to use bullseye. ([#58](sonic-net/sonic-gnmi#58)) Signed-off-by: dprital <[email protected]>
Why I did it Submodule update for sonic-gnmi Incorporates: 8226e46 Upgrade pipeline to use bullseye. (sonic-net/sonic-gnmi#58) ae72767 Add gnmi_dump tool for debug and unit test (sonic-net/sonic-gnmi#60) 6b0253a Add conditional check for split (sonic-net/sonic-gnmi#55) 99bfa8f Remove LOGLEVEL DB since is no longer used (sonic-net/sonic-gnmi#56) 54806a8 Support new gnmi config interface in telemetry container. (sonic-net/sonic-gnmi#7) How I did it Move submodule How to verify it Check build pipeline.
Why I did it Submodule update for sonic-gnmi Incorporates: 8226e46 Upgrade pipeline to use bullseye. (sonic-net/sonic-gnmi#58) ae72767 Add gnmi_dump tool for debug and unit test (sonic-net/sonic-gnmi#60) 6b0253a Add conditional check for split (sonic-net/sonic-gnmi#55) 99bfa8f Remove LOGLEVEL DB since is no longer used (sonic-net/sonic-gnmi#56) 54806a8 Support new gnmi config interface in telemetry container. (sonic-net/sonic-gnmi#7) How I did it Move submodule How to verify it Check build pipeline.
Why I did it Submodule update for sonic-gnmi Incorporates: 8226e46 Upgrade pipeline to use bullseye. (sonic-net/sonic-gnmi#58) ae72767 Add gnmi_dump tool for debug and unit test (sonic-net/sonic-gnmi#60) 6b0253a Add conditional check for split (sonic-net/sonic-gnmi#55) 99bfa8f Remove LOGLEVEL DB since is no longer used (sonic-net/sonic-gnmi#56) 54806a8 Support new gnmi config interface in telemetry container. (sonic-net/sonic-gnmi#7) How I did it Move submodule How to verify it Check build pipeline.
Why I did it
Add tool for debug and unit test.
How I did it
Use share memory to support counters.
Move check for EnableTranslibWrite to beginning of Set(). This change will simplify the logic for gnmi set fail, and no need to authenticate when EnableTranslibWrite is false.
How to verify it
Build image and run unit 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)