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

.

parent 4ffc66f4
No related branches found
No related tags found
2 merge requests!221Thesis mk,!173Process response overhaul
Pipeline #74375 passed with warnings
......@@ -9,6 +9,7 @@ import (
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
nbi "code.fbi.h-da.de/cocsn/gosdn/northbound/client"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
......@@ -41,7 +42,7 @@ func Init(addr string) error {
log.Infof("SBI: %v", sbi)
}
}
return nil
return viper.WriteConfig()
}
// GetIds requests all UUID information from the controller
......@@ -184,7 +185,7 @@ func AddDevice(addr, username, password, sbi, pnd, deviceAddress, deviceName str
},
DeviceName: deviceName,
TransportOption: &tpb.TransportOption{
Address: addr,
Address: deviceAddress,
Username: username,
Password: password,
TransportOption: &tpb.TransportOption_GnmiTransportOption{
......@@ -196,7 +197,8 @@ func AddDevice(addr, username, password, sbi, pnd, deviceAddress, deviceName str
Pid: pnd,
}
if sbi == "csbi" {
req.Ond[0].Sbi = nil
req.Ond[0].Sbi.Id = uuid.Nil.String()
req.Ond[0].Sbi.Type = spb.Type_CONTAINERISED
req.Ond[0].TransportOption.Csbi = true
}
ctx := context.Background()
......
......@@ -47,6 +47,9 @@ var addDeviceCmd = &cobra.Command{
Device address and user credentials need to be provided
if they diverge from the default credentials.`,
RunE: func(cmd *cobra.Command, args []string) error {
if csbi {
cliSbi = "csbi"
}
resp, err := cli.AddDevice(
apiEndpoint,
username,
......@@ -65,9 +68,11 @@ if they diverge from the default credentials.`,
}
var deviceName string
var csbi bool
func init() {
cliCmd.AddCommand(addDeviceCmd)
addDeviceCmd.Flags().StringVar(&deviceName, "name", "", "add a device name (optional)")
addDeviceCmd.Flags().BoolVar(&csbi, "csbi", false, "add a csbi device")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment