本文整理匯總了Golang中github.com/HewlettPackard/oneview-golang/ov.OVClient.GetServerHardware方法的典型用法代碼示例。如果您正苦於以下問題:Golang OVClient.GetServerHardware方法的具體用法?Golang OVClient.GetServerHardware怎麽用?Golang OVClient.GetServerHardware使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/HewlettPackard/oneview-golang/ov.OVClient
的用法示例。
在下文中一共展示了OVClient.GetServerHardware方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestGetIloIPAddress
// TestGetIloIPAddress verify get ip address for hardware
func TestGetIloIPAddress(t *testing.T) {
var (
d *OVTest
c *ov.OVClient
testData utils.Nstring
expectsData string
)
if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
d, c = getTestDriverA("dev")
testData = utils.Nstring(d.Tc.GetTestData(d.Env, "ServerHardwareURI").(string))
expectsData = d.Tc.GetExpectsData(d.Env, "IloIPAddress").(string)
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
s, err := c.GetServerHardware(testData)
assert.NoError(t, err, "GetServerHardware threw error -> %s", err)
ip := s.GetIloIPAddress()
log.Debugf("server -> %+v", s)
log.Debugf("ip -> %+v", ip)
assert.Equal(t, expectsData, ip)
}
}
示例2: TestPowerState
// testing power state type
func TestPowerState(t *testing.T) {
var (
d *OVTest
c *ov.OVClient
testData utils.Nstring
expectsData string
)
if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
d, c = getTestDriverA("dev")
testData = utils.Nstring(d.Tc.GetTestData(d.Env, "ServerHardwareURI").(string))
expectsData = d.Tc.GetExpectsData(d.Env, "SerialNumber").(string)
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
// get a blade object
blade, err := c.GetServerHardware(testData)
assert.NoError(t, err, "GetServerHardware threw error -> %s", err)
assert.Equal(t, expectsData, blade.SerialNumber.String())
// get a power state object
var pt *ov.PowerTask
pt = pt.NewPowerTask(blade)
pt.Timeout = 46 // timeout is 20 sec
assert.Equal(t, expectsData, pt.Blade.SerialNumber.String())
// Test the power state executor to off
log.Info("------- Setting Power to Off")
err = pt.PowerExecutor(ov.P_OFF)
assert.NoError(t, err, "PowerExecutor threw no errors -> %s", err)
// Test the power state executor to on
log.Info("------- Setting Power to On")
err = pt.PowerExecutor(ov.P_ON)
assert.NoError(t, err, "PowerExecutor threw no errors -> %s", err)
// Test the power state executor to off and leave off
log.Info("------- Setting Power to Off")
err = pt.PowerExecutor(ov.P_OFF)
assert.NoError(t, err, "PowerExecutor threw no errors -> %s", err)
}
}
示例3: TestServerHardware
// get server hardware test
func TestServerHardware(t *testing.T) {
var (
d *OVTest
c *ov.OVClient
testData utils.Nstring
expectsData string
)
if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
d, c = getTestDriverA("dev")
testData = utils.Nstring(d.Tc.GetTestData(d.Env, "ServerHardwareURI").(string))
expectsData = d.Tc.GetExpectsData(d.Env, "SerialNumber").(string)
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
data, err := c.GetServerHardware(testData)
log.Debugf("%+v", data)
assert.NoError(t, err, "GetServerHardware threw error -> %s", err)
// fmt.Printf("data.Connections -> %+v\n", data)
assert.Equal(t, expectsData, data.SerialNumber.String())
}
}