Step 2: Move test folder to root
[integration/test.git] / tools / Robot_Tool / libraries / StatisticsManager.py
1 """
2 CSIT test tools.
3 Authors: Baohua Yang@IBM, Denghui Huang@IBM
4 Updated: 2013-11-01
5 """
6
7 import sys
8
9 sys.path.append('..')
10 from restlib import *  # noqa
11 from testmodule import TestModule
12
13 sys.path.remove('..')
14
15
16 class StatisticsManager(TestModule):
17     """
18     Test for the statistics manager.
19     Start 2-layer tree topology network. e.g., in Mininet, run
20         'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
21     """
22
23     def __init__(self, restSubContext='/controller/nb/v2/statistics', user=DEFAULT_USER, password=DEFAULT_PWD,
24                  container=DEFAULT_CONTAINER, contentType='json', prefix=DEFAULT_PREFIX):
25         super(self.__class__, self).__init__(restSubContext, user, password, container, contentType, prefix)
26
27     def get_flow_stats(self):
28         """
29         The name is suggested to match the NB API.
30         Show the flow statistics
31         """
32         return super(self.__class__, self).get_entries('flow')
33
34     def get_port_stats(self):
35         """
36         The name is suggested to match the NB API.
37         Show the port statistics
38         """
39         return super(self.__class__, self).get_entries('port')
40
41     def get_table_stats(self):
42         """
43         The name is suggested to match the NB API.
44         Show the table statistics
45         """
46         return super(self.__class__, self).get_entries('table')