Skip to content
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

Merged
merged 8 commits into from
Nov 21, 2022
Merged

Add gnmi_dump tool for debug and unit test #60

merged 8 commits into from
Nov 21, 2022

Conversation

ganglyu
Copy link
Contributor

@ganglyu ganglyu commented Nov 14, 2022

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)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@@ -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 {
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnableTranslibWrite

Why removing this check? If this is significant change, add some PR description, even add it into PR title. #Closed

Copy link
Contributor Author

@ganglyu ganglyu Nov 15, 2022

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.

SetMemCounters(&globalCounters)
}

func IncCounter(name string) {
Copy link
Contributor

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?

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)
Copy link
Contributor

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.

cfg := &Config{Port: port, EnableTranslibWrite: false}
s, err := NewServer(cfg, opts)
if err != nil {
t.Errorf("Failed to create gNMI server: %v", err)
Copy link
Contributor

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()
Copy link
Contributor

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.

Copy link
Collaborator

@qiluo-msft qiluo-msft left a 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.

@ganglyu
Copy link
Contributor Author

ganglyu commented Nov 18, 2022

@tomek-US I have updated, would you like to review again?

@ganglyu ganglyu merged commit ae72767 into sonic-net:master Nov 21, 2022
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Nov 28, 2022
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>
ganglyu added a commit to sonic-net/sonic-buildimage that referenced this pull request Nov 29, 2022
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.
StormLiangMS pushed a commit to StormLiangMS/sonic-buildimage that referenced this pull request Dec 8, 2022
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.
StormLiangMS pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 10, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants