Skip to content

Commit

Permalink
Add SaveOnSet
Browse files Browse the repository at this point in the history
  • Loading branch information
rlucus committed Jun 8, 2023
1 parent 53fca81 commit 63d1461
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gnmi_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"github.com/Azure/sonic-mgmt-common/translib"
"github.com/Azure/sonic-mgmt-common/translib/transformer"
log "github.com/golang/glog"
"github.com/golang/protobuf/proto"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
Expand Down Expand Up @@ -141,7 +140,7 @@ func NewServer(config *Config, opts []grpc.ServerOption) (*Server, error) {
s: s,
config: config,
clients: map[string]*Client{},
SaveStartupConfig: SaveOnSetDisabled,
SaveStartupConfig: saveOnSetDisabled,
}
var err error
if srv.config.Port < 0 {
Expand Down Expand Up @@ -382,17 +381,17 @@ func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetRe
return &gnmipb.GetResponse{Notification: notifications}, nil
}

// SaveOnSetEnabled saves configuration to a file
func SaveOnSetEnabled() {
if err := transformer.SaveStartupConfig(); err != nil {
// saveOnSetEnabled saves configuration to a file
func saveOnSetEnabled() {
if err := translib.SaveStartupConfig(); err != nil {
log.Errorf("Saving startup config failed: %v", err)
} else {
log.Errorf("Success! Startup config has been saved!")
log.Info("Success! Startup config has been saved!")
}
}

// SaveOnSetDisabeld does nothing.
func SaveOnSetDisabled() {}
func saveOnSetDisabled() {}

func (s *Server) Set(ctx context.Context, req *gnmipb.SetRequest) (*gnmipb.SetResponse, error) {
common_utils.IncCounter(common_utils.GNMI_SET)
Expand Down

0 comments on commit 63d1461

Please sign in to comment.