1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 from vstf.controller.env_build import env_collect
14 from vstf.controller.unittest import model
17 class TestCollect(model.Test):
20 super(TestCollect, self).setUp()
21 self.obj = env_collect.EnvCollectApi(self.conn)
23 def test_collect_host_info(self):
24 ret_str = json.dumps(self.obj.collect_host_info(self.tester_host), indent = 4)
25 for key in ("CPU INFO","MEMORY INFO","HW_INFO","OS INFO"):
26 self.assertTrue(key in ret_str, "collect_host_info failed, ret_str = %s" % ret_str)
28 def test_list_nic_devices(self):
29 ret_str = json.dumps(self.obj.list_nic_devices(self.tester_host), indent = 4)
30 for key in ("device","mac","bdf","desc"):
31 self.assertTrue(key in ret_str, "list_nic_devices failed, ret_str = %s" % ret_str)
34 def test_get_device_detail(self):
36 ret = self.obj.get_device_detail(self.tester_host, "01:00.0")
37 for key in ("device","mac","bdf","desc"):
38 self.assertTrue(key in ret)
39 self.assertTrue(ret['bdf'] == identity)
42 if __name__ == "__main__":
44 logging.basicConfig(level = logging.INFO)