rubbos installation guide
[bottlenecks.git] / vstf / vstf / agent / unittest / perf / test_ethtool.py
1 #!/usr/bin/python
2 # -*- coding: utf8 -*-
3 # author: wly
4 # date: 2015/11/13
5 # see license for license details
6
7 import unittest
8 import logging
9 from vstf.agent.perf import ethtool
10 from vstf.agent.unittest import configuration
11 from vstf.common.log import setup_logging
12
13
14 LOG = logging.getLogger(__name__)
15
16
17 class Testethtool(unittest.TestCase):
18     def setUp(self):
19         LOG.info("start Testethtool unit test.")
20         self._devices = configuration.eth_for_test
21         super(Testethtool, self).setUp()
22
23     def teardown(self):
24         LOG.info("stop Testethtool unit test.")
25
26 #    @unittest.skip('for now')
27     def test_autoneg_on(self):
28         for dev in self._devices:
29             self.assertTrue(ethtool.autoneg_on(dev), True)
30
31     def test_autoneg_off(self):
32         for dev in self._devices:
33             self.assertTrue(ethtool.autoneg_off(dev), True)
34
35     def test_autoneg_query(self):
36         for dev in self._devices:
37             result = ethtool.autoneg_query(dev)
38             LOG.info(result)
39
40 if __name__ == "__main__":
41     setup_logging(level=logging.INFO, log_file="/var/log/vstf/vstf-unit-test.log", clevel=logging.INFO)
42     unittest.main()