Skip to content

Commit

Permalink
use trans_util for save on set
Browse files Browse the repository at this point in the history
  • Loading branch information
rlucus committed Oct 30, 2023
1 parent add7f88 commit 7f7fb7c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions gnmi_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
"bytes"
"errors"
"fmt"
"net"
"strings"
"sync"

log "github.com/golang/glog"
"github.com/golang/protobuf/proto"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
Expand All @@ -14,16 +18,13 @@ import (
spb_gnoi "github.com/sonic-net/sonic-gnmi/proto/gnoi"
spb_jwt_gnoi "github.com/sonic-net/sonic-gnmi/proto/gnoi/jwt"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
transutil "github.com/Azure/sonic-gnmi/transl_utils"
transutil "github.com/sonic-net/sonic-gnmi/transl_utils"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"
"net"
"strings"
"sync"
)

var (
Expand Down Expand Up @@ -56,14 +57,14 @@ type AuthTypes map[string]bool
type Config struct {
// Port for the Server to listen on. If 0 or unset the Server will pick a port
// for this Server.
Port int64
LogLevel int
Threshold int
UserAuth AuthTypes
Port int64
LogLevel int
Threshold int
UserAuth AuthTypes
EnableTranslibWrite bool
EnableNativeWrite bool
ZmqAddress string
IdleConnDuration int
EnableNativeWrite bool
ZmqAddress string
IdleConnDuration int
}

var AuthLock sync.Mutex
Expand Down Expand Up @@ -145,10 +146,10 @@ func NewServer(config *Config, opts []grpc.ServerOption) (*Server, error) {
reflection.Register(s)

srv := &Server{
s: s,
config: config,
clients: map[string]*Client{},
SaveStartupConfig: saveOnSetDisabled,
s: s,
config: config,
clients: map[string]*Client{},
SaveStartupConfig: saveOnSetDisabled,
// ReqFromMaster point to a function that is called to verify if
// the request comes from a master controller.
ReqFromMaster: ReqFromMasterDisabledMA,
Expand Down Expand Up @@ -613,7 +614,7 @@ func ReqFromMasterEnabledMA(req *gnmipb.SetRequest, masterEID *uint128) error {
// Role will be implemented later.
return status.Errorf(codes.Unimplemented, "MA: Role is not implemented")
}

reqEID = uint128{High: ma.ElectionId.High, Low: ma.ElectionId.Low}
// Use the election ID that is in the last extension, so, no 'break' here.
}
Expand Down

0 comments on commit 7f7fb7c

Please sign in to comment.