-
Notifications
You must be signed in to change notification settings - Fork 56
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
GNOI Implementation of OS.Activate #351
base: master
Are you sure you want to change the base?
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Files not reviewed (2)
- sonic_service_client/dbus_client_test.go: Evaluated as low risk
- common_utils/context.go: Evaluated as low risk
Comments suppressed due to low confidence (3)
gnoi_client/os/os.go:35
- [nitpick] The error message could be more descriptive. Consider changing it to 'Failed to unmarshal JSON: ' + err.Error()'.
panic(err.Error())
gnoi_client/os/os.go:39
- [nitpick] The error message could be more descriptive. Consider changing it to 'Failed to activate OS: ' + err.Error()'.
panic(err.Error())
gnoi_client/os/os.go:43
- [nitpick] The error message could be more descriptive. Consider changing it to 'Failed to marshal response: ' + err.Error()'.
panic(err.Error())
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (3)
- gnoi_client/os/verify.go: Evaluated as low risk
- common_utils/context.go: Evaluated as low risk
- gnoi_client/gnoi_client.go: Evaluated as low risk
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -56,6 +56,8 @@ func main() { | |||
switch *config.Rpc { | |||
case "Verify": | |||
gnoi_os.Verify(conn, ctx) | |||
case "Activate": |
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.
gnmi_server/gnoi.go
Outdated
@@ -161,6 +161,56 @@ func (srv *OSServer) Verify(ctx context.Context, req *gnoi_os_pb.VerifyRequest) | |||
return resp, nil | |||
} | |||
|
|||
func (srv *OSServer) Activate(ctx context.Context, req *gnoi_os_pb.ActivateRequest) (*gnoi_os_pb.ActivateResponse, error) { | |||
_, err := authenticate(srv.config, ctx, false) |
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.
Need RW permission
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.
Done.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
if err != nil { | ||
log.Errorf("Failed to activate image %s: %v", image, err) | ||
image_not_exists := os.IsNotExist(err) || | ||
(strings.Contains(strings.ToLower(err.Error()), "not") && |
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.
even with string check, could we use complete string match instead of "not" && "exist" which will have more corner cases.
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.
My main concern is error string equality check can easily have false negatives, say someone just remove a redundant space or any minor changes to the error string. Being that specific can make maintaining backend code difficult.
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
Why I did it
Support OS.Activate for GNOI.
How I did it
Implement OS.Activate.
How to verify it
On physical switch:
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)