Step 2: Move test folder to root
[integration/test.git] / tools / CSIT_Test / base / modules / statistics_manager.py
diff --git a/tools/CSIT_Test/base/modules/statistics_manager.py b/tools/CSIT_Test/base/modules/statistics_manager.py
new file mode 100644 (file)
index 0000000..e247216
--- /dev/null
@@ -0,0 +1,46 @@
+"""
+CSIT test tools.
+Authors: Baohua Yang@IBM, Denghui Huang@IBM
+Updated: 2013-11-01
+"""
+
+import sys
+
+sys.path.append('..')
+from restlib import *  # noqa
+from testmodule import TestModule
+
+sys.path.remove('..')
+
+
+class StatisticsManager(TestModule):
+    """
+    Test for the statistics manager.
+    Start 2-layer tree topology network. e.g., in Mininet, run
+        'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
+    """
+
+    def __init__(self, restSubContext='/controller/nb/v2/statistics', user=DEFAULT_USER, password=DEFAULT_PWD,
+                 container=DEFAULT_CONTAINER, contentType='json', prefix=DEFAULT_PREFIX):
+        super(self.__class__, self).__init__(restSubContext, user, password, container, contentType, prefix)
+
+    def get_flow_stats(self):
+        """
+        The name is suggested to match the NB API.
+        Show the flow statistics
+        """
+        return super(self.__class__, self).get_entries('flow')
+
+    def get_port_stats(self):
+        """
+        The name is suggested to match the NB API.
+        Show the port statistics
+        """
+        return super(self.__class__, self).get_entries('port')
+
+    def get_table_stats(self):
+        """
+        The name is suggested to match the NB API.
+        Show the table statistics
+        """
+        return super(self.__class__, self).get_entries('table')