-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add gnmi_dump tool for debug and unit test #60
Conversation
@@ -388,13 +404,11 @@ func (s *Server) Set(ctx context.Context, req *gnmipb.SetRequest) (*gnmipb.SetRe | |||
/* Add to Set response results. */ | |||
results = append(results, &res) | |||
} | |||
if s.config.EnableTranslibWrite { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment here. This should be t.Fatalf(...)
instead of t.Errorf(...)
@@ -107,6 +107,25 @@ func createServer(t *testing.T, port int64) *Server { | |||
return s | |||
} | |||
|
|||
func createReadServer(t *testing.T, port int64) *Server { | |||
certificate, err := testcert.NewCert() |
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.
As this is a helper function it should be marked as such by calling t.Helper()
at its beginning.
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.
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 ([sonic-net#56](sonic-net/sonic-gnmi#56)) * 6b0253a Add conditional check for split ([sonic-net#55](sonic-net/sonic-gnmi#55)) * ae72767 Add gnmi_dump tool for debug and unit test ([sonic-net#60](sonic-net/sonic-gnmi#60)) * 8226e46 Upgrade pipeline to use bullseye. ([sonic-net#58](sonic-net/sonic-gnmi#58)) Signed-off-by: dprital <drorp@nvidia.com>
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)