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