Test ipmi driver with bmclib functions

This commit is contained in:
David J. Allen 2023-08-31 08:48:33 -06:00
parent 118c12fa14
commit de07b119b5
10 changed files with 213 additions and 168 deletions

View file

@ -1,7 +1,6 @@
package cmd
import (
"davidallendj/magellan/api/smd"
magellan "davidallendj/magellan/internal"
"github.com/bombsimon/logrusr/v2"
@ -76,21 +75,26 @@ var collectCmd = &cobra.Command{
if err != nil {
l.Errorf("could not query bios: %v\n", err)
}
}
// add all endpoints to smd
for _, inventory := range inventories {
err := smd.AddRedfishEndpoint(inventory)
_, err = magellan.QueryPowerState(client, &logger, &q)
if err != nil {
logrus.Errorf("could not add redfish endpoint: %v", err)
l.Errorf("could not query power state: %v\n", err)
}
}
// add all endpoints to smd
// for _, inventory := range inventories {
// err := smd.AddRedfishEndpoint(inventory)
// if err != nil {
// logrus.Errorf("could not add redfish endpoint: %v", err)
// }
// }
// confirm the inventories were added
err = smd.GetRedfishEndpoints()
if err != nil {
logrus.Errorf("could not get redfish endpoints: %v\n", err)
}
// err = smd.GetRedfishEndpoints()
// if err != nil {
// logrus.Errorf("could not get redfish endpoints: %v\n", err)
// }
},
}

View file

@ -19,6 +19,7 @@ var (
pass string
dbpath string
drivers []string
preferredDriver string
ipmitoolPath string
)
@ -53,9 +54,10 @@ func init() {
rootCmd.PersistentFlags().IntVar(&threads, "threads", -1, "set the number of threads")
rootCmd.PersistentFlags().IntVar(&timeout, "timeout", 10, "set the timeout")
rootCmd.PersistentFlags().IntSliceVar(&ports, "port", []int{}, "set the ports to scan")
rootCmd.PersistentFlags().StringSliceVar(&drivers, "driver", []string{"redfish"}, "set the BMC driver to use")
rootCmd.PersistentFlags().StringSliceVar(&drivers, "driver", []string{"redfish"}, "set the driver(s) and fallback drivers to use")
rootCmd.PersistentFlags().StringVar(&preferredDriver, "preferred-driver", "ipmi", "set the preferred driver to use")
rootCmd.PersistentFlags().StringVar(&dbpath, "dbpath", ":memory:", "set the probe storage path")
rootCmd.PersistentFlags().StringVar(&ipmitoolPath, "ipmitool", "/usr/bin/ipmitool", "set the path for ipmitool")
rootCmd.PersistentFlags().BoolVar(&withSecureTLS, "secure-tls", false, "enable secure TLS")
rootCmd.PersistentFlags().StringVar(&certPoolFile, "cert-pool", "", "path to an file containing x509 CAs. An empty string uses the system CAs. Only takes effect when --secure-tls=true")
rootCmd.PersistentFlags().StringVar(&certPoolFile, "cert-pool", "", "path to CA cert. (defaults to system CAs; used with --secure-tls=true)")
}