openconfig / featureprofiles

Feature Profiles are groups of OpenConfig paths and tests which verify their behavior
Apache License 2.0
52 stars 149 forks source link

SEC-3.1: Authentication : Missing the Encoding: gpb.Encoding_JSON_IETF when running gnmi.Get #753

Open avaneesh90 opened 2 years ago

avaneesh90 commented 2 years ago

Describe the bug SEC-3.1: Authentication : Missing the Encoding: gpb.Encoding_JSON_IETF when running gnmi.Get Encoding need to add in https://github.com/openconfig/featureprofiles/blob/main/feature/experimental/security/aaa/kne_tests/tls_authentication_over_grpc_test/tls_authentication_over_grpc_test.go#L142

t.Log("Trying credentials with GNMI Get") _, err = gnmi.Get(ctx, &gpb.GetRequest{ Path: []gpb.Path{{ Elem: []gpb.PathElem{ {Name: "system"}, {Name: "config"}, {Name: "hostname"}}}, }, Type: gpb.GetRequest_CONFIG, Encoding: gpb.Encoding_JSON_IETF, >>>>>> this configuration is missing }) if tc.wantErr != (err != nil) { if tc.wantErr { t.Errorf("gnmi.Get nil error when error expected for user %q", tc.user) } else { t.Errorf("gnmi.Get unexpected error for user %q: %v", tc.user, err) } }

It seems that the script is not setting any value(json/json_ietf/proto/…) for ’Encoding’ field of GNMI GetRequest. getResponse, err := gnmiClient.Get(

To Reproduce Steps to reproduce the behavior: Run the SEC-3.1: Authentication script and script will fail with encoding missing

Expected behavior Script should get output of gnmi.Get

jasdeep-hundal commented 1 year ago

Per proto3 specs, when the message is parsed the Encoding value should default to 'JSON' (the zero value of the enum): https://developers.google.com/protocol-buffers/docs/proto3#default.

I don't think the bug is in the test here.

joannc2022 commented 1 year ago

Adding Encoding JSON_IETF for SEC-3.1_tls_authentication #771