Newer
Older
package cli
import (
"code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi"
"code.fbi.h-da.de/cocsn/gosdn/nucleus"
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"os"
)
func Set() error {
a := os.Getenv("GOSDN_TEST_ENDPOINT")
if a == "" {
a = "portainer.danet.fbi.h-da.de:6030"
}
opts := &nucleus.GnmiTransportOptions{
Config: gnmi.Config{
Addr: a,
Username: "admin",
Password: "arista",
},
}
t, err := nucleus.NewGnmiTransport(opts)
if err != nil {
return err
}
reqs := []interface{}{
&gnmi.Operation{
Type: "update",
Origin: "",
Target: "",
Path: []string{
"system",
"config",
"hostname",
},
Val: "ceos3000",
},
}
resp, err := t.Set(context.Background(), reqs...)
if err != nil {
return err
}
if err := proto.Write(resp.(pb.Message), "resp-set-system-config-hostname"); err != nil {