Skip to content
Snippets Groups Projects
Commit aab71381 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

go fmt

parent d1e02a15
No related branches found
No related tags found
9 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!195DO NOT MERGE 2,!194DO NOT MERGE! just for testing,!147Commit-Confirm Mechanic for PND,!138Develop
Pipeline #68933 passed
...@@ -41,7 +41,7 @@ var commitCmd = &cobra.Command{ ...@@ -41,7 +41,7 @@ var commitCmd = &cobra.Command{
Use: "commit", Use: "commit",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Short: "Commit the given change for the active PND", Short: "Commit the given change for the active PND",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return cli.HTTPGet( return cli.HTTPGet(
apiEndpoint, apiEndpoint,
......
...@@ -41,7 +41,7 @@ var confirmCmd = &cobra.Command{ ...@@ -41,7 +41,7 @@ var confirmCmd = &cobra.Command{
Use: "confirm", Use: "confirm",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Short: "Confirms the given change for the active PND", Short: "Confirms the given change for the active PND",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return cli.HTTPGet( return cli.HTTPGet(
apiEndpoint, apiEndpoint,
......
...@@ -40,7 +40,7 @@ import ( ...@@ -40,7 +40,7 @@ import (
var listCmd = &cobra.Command{ var listCmd = &cobra.Command{
Use: "list", Use: "list",
Short: "Lists all committed changes", Short: "Lists all committed changes",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return cli.HTTPGet( return cli.HTTPGet(
apiEndpoint, apiEndpoint,
......
...@@ -40,7 +40,7 @@ import ( ...@@ -40,7 +40,7 @@ import (
var listPendingCmd = &cobra.Command{ var listPendingCmd = &cobra.Command{
Use: "listPending", Use: "listPending",
Short: "Lists all committed changes", Short: "Lists all committed changes",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return cli.HTTPGet( return cli.HTTPGet(
apiEndpoint, apiEndpoint,
......
...@@ -118,7 +118,7 @@ func DialContext(ctx context.Context, cfg *Config) (pb.GNMIClient, error) { ...@@ -118,7 +118,7 @@ func DialContext(ctx context.Context, cfg *Config) (pb.GNMIClient, error) {
if cfg.TLS || cfg.CAFile != "" || cfg.CertFile != "" || cfg.Token != "" { if cfg.TLS || cfg.CAFile != "" || cfg.CertFile != "" || cfg.Token != "" {
tlsConfig := &tls.Config{ tlsConfig := &tls.Config{
MinVersion: tls.VersionTLS12, MinVersion: tls.VersionTLS12,
} }
if cfg.CAFile != "" { if cfg.CAFile != "" {
b, err := ioutil.ReadFile(cfg.CAFile) b, err := ioutil.ReadFile(cfg.CAFile)
......
...@@ -23,14 +23,14 @@ const ( ...@@ -23,14 +23,14 @@ const (
// CtxKeyOpts context key for gnmi.SubscribeOptions // CtxKeyOpts context key for gnmi.SubscribeOptions
CtxKeyOpts CtxKeyType = "opts" CtxKeyOpts CtxKeyType = "opts"
// CtxKeyConfig is a context key for gnmi.Config // CtxKeyConfig is a context key for gnmi.Config
CtxKeyConfig = "config" CtxKeyConfig = "config"
CtxKeyOperation = "op" CtxKeyOperation = "op"
) )
var opmap = map[Operation]string{ var opmap = map[Operation]string{
TRANSPORT_UPDATE: "update", TRANSPORT_UPDATE: "update",
TRANSPORT_REPLACE: "replace", TRANSPORT_REPLACE: "replace",
TRANSPORT_DELETE: "delete", TRANSPORT_DELETE: "delete",
} }
// Gnmi implements the Transport interface and provides an SBI with the // Gnmi implements the Transport interface and provides an SBI with the
...@@ -104,8 +104,8 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error { ...@@ -104,8 +104,8 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error {
} }
} }
opts := make([]interface{},0) opts := make([]interface{}, 0)
for _,o := range args { for _, o := range args {
attrs, ok := o.([]string) attrs, ok := o.([]string)
if !ok { if !ok {
return &ErrInvalidTypeAssertion{ return &ErrInvalidTypeAssertion{
...@@ -122,8 +122,6 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error { ...@@ -122,8 +122,6 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error {
Val: attrs[1], Val: attrs[1],
}) })
} }
// Loop over args and create ops and exts // Loop over args and create ops and exts
// Invalid args cause unhealable error // Invalid args cause unhealable error
...@@ -181,7 +179,9 @@ func (g *Gnmi) applyDiff(ctx context.Context, payload ...interface{}) error { ...@@ -181,7 +179,9 @@ func (g *Gnmi) applyDiff(ctx context.Context, payload ...interface{}) error {
} }
diff, err := ygot.Diff(oldstate, newstate) diff, err := ygot.Diff(oldstate, newstate)
if err != nil {return err} if err != nil {
return err
}
req := &gpb.SetRequest{} req := &gpb.SetRequest{}
if diff.Update != nil { if diff.Update != nil {
switch op { switch op {
......
...@@ -19,4 +19,4 @@ func TestMain(m *testing.M) { ...@@ -19,4 +19,4 @@ func TestMain(m *testing.M) {
log.Fatal(err) log.Fatal(err)
} }
os.Exit(m.Run()) os.Exit(m.Run())
} }
\ No newline at end of file
...@@ -37,4 +37,4 @@ func (r Restconf) GetOptions() interface{} { ...@@ -37,4 +37,4 @@ func (r Restconf) GetOptions() interface{} {
// ProcessResponse not yet implemented // ProcessResponse not yet implemented
func (r Restconf) ProcessResponse(resp interface{}, root interface{}, models *ytypes.Schema) error { func (r Restconf) ProcessResponse(resp interface{}, root interface{}, models *ytypes.Schema) error {
return &ErrNotYetImplemented{} return &ErrNotYetImplemented{}
} }
\ No newline at end of file
...@@ -5,12 +5,10 @@ import ( ...@@ -5,12 +5,10 @@ import (
"strings" "strings"
) )
func FromString(path string) *gpb.Path { func FromString(path string) *gpb.Path {
elements := strings.Split(path, delim) elements := strings.Split(path, delim)
elem := make([]*gpb.PathElem, len(elements)) elem := make([]*gpb.PathElem, len(elements))
for i,e := range elements { for i, e := range elements {
elem[i] = &gpb.PathElem{ elem[i] = &gpb.PathElem{
Name: e, Name: e,
Key: nil, Key: nil,
...@@ -31,4 +29,3 @@ func ToStrings(path *gpb.Path) []string { ...@@ -31,4 +29,3 @@ func ToStrings(path *gpb.Path) []string {
} }
return elems return elems
} }
...@@ -28,7 +28,6 @@ func TestMain(m *testing.M) { ...@@ -28,7 +28,6 @@ func TestMain(m *testing.M) {
os.Exit(m.Run()) os.Exit(m.Run())
} }
func testSetupIntegration() { func testSetupIntegration() {
if os.Getenv("GOSDN_LOG") == "nolog" { if os.Getenv("GOSDN_LOG") == "nolog" {
log.SetLevel(log.PanicLevel) log.SetLevel(log.PanicLevel)
......
...@@ -49,9 +49,9 @@ func TestGnmi_SetIntegration(t *testing.T) { ...@@ -49,9 +49,9 @@ func TestGnmi_SetIntegration(t *testing.T) {
name: "valid update", name: "valid update",
fields: fields{opt: opt}, fields: fields{opt: opt},
args: args{ args: args{
ctx: context.Background(), ctx: context.Background(),
params: []string{"/system/config/hostname", "ceos3000"}, params: []string{"/system/config/hostname", "ceos3000"},
}, },
wantErr: false, wantErr: false,
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment