-
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
Support new gnmi config interface in telemetry container. #7
Conversation
azure-pipelines.yml
Outdated
@@ -40,7 +40,7 @@ stages: | |||
DIFF_COVER_WORKING_DIRECTORY: $(System.DefaultWorkingDirectory)/sonic-gnmi | |||
|
|||
container: | |||
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest | |||
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye:latest |
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.
go.mod
Outdated
@@ -5,10 +5,11 @@ go 1.12 | |||
require ( | |||
github.com/Azure/sonic-mgmt-common v0.0.0-00010101000000-000000000000 | |||
github.com/Workiva/go-datastructures v1.0.50 | |||
github.com/agiledragon/gomonkey/v2 v2.8.0 | |||
github.com/agiledragon/gomonkey/v2 v2.9.0 |
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.
Makefile
Outdated
@@ -18,7 +18,15 @@ TEST_FILES=$(wildcard *_test.go) | |||
TELEMETRY_TEST_DIR = build/tests/gnmi_server | |||
TELEMETRY_TEST_BIN = $(TELEMETRY_TEST_DIR)/server.test | |||
ifeq ($(ENABLE_TRANSLIB_WRITE),y) | |||
BLD_FLAGS := -tags gnmi_translib_write | |||
ifeq ($(ENABLE_NATIVE_WRITE),y) |
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.
Makefile
Outdated
@@ -41,38 +49,48 @@ $(GO_DEPS): go.mod $(PATCHES) | |||
patch -d vendor -p0 < patches/gnmi_cli.all.patch | |||
patch -d vendor -p0 < patches/gnmi_set.patch | |||
patch -d vendor -p0 < patches/gnmi_get.patch | |||
patch -d vendor -p0 < patches/path.patch |
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.
Makefile
Outdated
endif | ||
|
||
# TODO: Create a new repo for this lib, sonic-restapi and sonic-gnmi can share this lib |
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.
"google.golang.org/grpc/status" | ||
"google.golang.org/grpc/codes" | ||
"os/user" | ||
"encoding/json" | ||
jwt "github.com/dgrijalva/jwt-go" | ||
) | ||
|
||
func RebootSystem(fileName string) error { |
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.
Use reboot to implement "config reload", and please refer to: https://github.com/openconfig/gnoi/blob/main/system/system.proto#L131
gnmi_server/gnoi.go
Outdated
func (srv *Server) Reboot(ctx context.Context, req *gnoi_system_pb.RebootRequest) (*gnoi_system_pb.RebootResponse, error) { | ||
fileName := common_utils.GNMI_WORK_PATH + "/config_db.json.tmp" | ||
//return nil, status.Errorf(codes.Unimplemented, "hit test point") |
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.
gnmi_server/server.go
Outdated
@@ -274,26 +284,32 @@ func (s *Server) checkEncodingAndModel(encoding gnmipb.Encoding, models []*gnmip | |||
|
|||
// Get implements the Get RPC in gNMI spec. | |||
func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetResponse, error) { | |||
common_utils.IncCounter("GNMI get") |
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.
Is it a placeholder function (with TODO comment)? or how did you cancel a reboot? In reply to: 1258650635 In reply to: 1258650635 In reply to: 1258650635 In reply to: 1258650635 In reply to: 1258650635 Refers to: gnmi_server/gnoi.go:66 in 71e5e09. [](commit_id = 71e5e09, deletion_comment = False) |
patches/path.patch
Outdated
@@ -0,0 +1,37 @@ | |||
--- ./github.com/jipanyang/gnxi/utils/xpath/path.go |
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.
Could you add some file level comment to explain why a patch is needed, and how do you achieve it?
ref: https://stackoverflow.com/a/20911434/2514803
sonic_data_client/events_client.go
Outdated
@@ -275,7 +275,7 @@ func get_events(evtc *EventClient) { | |||
for { | |||
|
|||
rc, evt := C_recv_evt(evtc.subs_handle) | |||
log.V(7).Infof("C.event_receive_wrap rc=%d evt:%s", rc, (*C.char)(str_ptr)) | |||
log.V(7).Infof("C.event_receive_wrap rc=%d evt:%v", rc, (*C.char)(str_ptr)) |
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.
@@ -204,7 +204,7 @@ func (c *TranslClient) StreamRun(q *queue.PriorityQueue, stop chan struct{}, w * | |||
return | |||
} | |||
default: | |||
log.V(1).Infof("Bad Subscription Mode for client %s ", c) |
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.
typedef void *db_connector_t; | ||
|
||
// DBConnector::DBConnector(int db, std::string hostname, int port, unsigned int timeout) | ||
db_connector_t db_connector_new(int db, const char *hostname, int port, unsigned int timeout); |
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.
Did you try SWIG?
http://zacg.github.io/blog/2013/06/06/calling-c-plus-plus-code-from-go-with-swig/ #Closed
This pull request introduces 1 alert when merging 81700b4 into 6b0253a - view on LGTM.com new alerts:
Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog. |
/azp run sonic-net.sonic-gnmi |
Azure Pipelines successfully started running 1 pipeline(s). |
gnmi_server/server.go
Outdated
} | ||
|
||
func IsNativeOrigin(origin string) bool { | ||
return origin == "sonic-db" || origin == "sonic-yang" |
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.
gnmi_server/server.go
Outdated
return origin, nil | ||
} | ||
for i, path := range paths { | ||
if origin == "" { |
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 will fix this.
gnmi_server/server.go
Outdated
@@ -274,6 +277,26 @@ func (s *Server) checkEncodingAndModel(encoding gnmipb.Encoding, models []*gnmip | |||
return nil | |||
} | |||
|
|||
func ParseOrigin(origin string, paths []*gnmipb.Path) (string, error) { |
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 will fix this.
/azp run sonic-net.sonic-gnmi |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run sonic-net.sonic-gnmi |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Signed-off-by: Gang Lv ganglv@microsoft.com
Why I did it
Update telemetry container to support new gnmi config interface.
How I did it
Use new target to support mixed schema, and we can enable/disable telemetry and gnmi config interface.
How to verify it
Build target 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)