コード例 #1
0
// 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
0
// 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
0
// 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())

	}
}