blob: a35dedb9e11310c8d366819665a323b6d726b4ca [file] [log] [blame]
macauley_cheng420ddce2015-10-26 13:42:23 +08001import logging
2import oftest.base_tests as base_tests
3from oftest import config
4from oftest.testutils import *
5from util import *
6
7
8class features(base_tests.SimpleDataPlane):
9 def runTest(self):
10 delete_all_flows(self.controller)
macauley_cheng0a0a7f62015-11-06 11:36:50 +080011 delete_all_groups(self.controller)
12
13 test_ports = sorted(config["port_map"].keys())
14
macauley_chengdc5eb582015-10-26 14:29:17 +080015 json_result = apply_dpctl_get_cmd(self, config, "features")
macauley_cheng420ddce2015-10-26 13:42:23 +080016 #pprint(json_result)
17 result=json_result["RECEIVED"][1]
macauley_cheng0a0a7f62015-11-06 11:36:50 +080018 #self.assertTrue(result["tabs"]==64, "Table size is not correct")
19 self.assertNotEqual(result["caps"], 0, "Invalid capabilities")
20
macauley_cheng420ddce2015-10-26 13:42:23 +080021class get_config(base_tests.SimpleDataPlane):
22 def runTest(self):
23 delete_all_flows(self.controller)
macauley_cheng0a0a7f62015-11-06 11:36:50 +080024 delete_all_groups(self.controller)
25
26 test_ports = sorted(config["port_map"].keys())
27
macauley_chengdc5eb582015-10-26 14:29:17 +080028 json_result = apply_dpctl_get_cmd(self, config, "get-config")
macauley_cheng420ddce2015-10-26 13:42:23 +080029 #pprint(json_result)
30 result=json_result["RECEIVED"][1]
macauley_cheng0a0a7f62015-11-06 11:36:50 +080031 self.assertNotEqual(result["conf"], {}, "Config reply nothing")
32
33class desc(base_tests.SimpleDataPlane):
34 def runTest(self):
35 delete_all_flows(self.controller)
36 delete_all_groups(self.controller)
37
38 json_result = apply_dpctl_get_cmd(self, config, "stats-desc")
39 #pprint(json_result)
40 result=json_result["RECEIVED"][1]
41 self.assertNotEqual(result["mfr"], {}, "DESC MFR reply nothing")
42
43class port_desc(base_tests.SimpleDataPlane):
44 def runTest(self):
45 json_result = apply_dpctl_get_cmd(self, config, "port-desc")
46 #pprint(json_result)
47 result=json_result["RECEIVED"][1]
48 self.assertNotEqual(result["port"], {}, "Port DESC reply nothing")
49
50class table_features(base_tests.SimpleDataPlane):
51 def runTest(self):
52 json_result = apply_dpctl_get_cmd(self, config, "table-features")
53 #pprint(json_result)
54 result=json_result["RECEIVED"][1]
55 self.assertNotEqual(result["table_features"], {}, "Table features reply nothing")
56
57class group_features(base_tests.SimpleDataPlane):
58 def runTest(self):
59 json_result = apply_dpctl_get_cmd(self, config, "group-features")
60 #pprint(json_result)
61 result=json_result["RECEIVED"][1]
62 self.assertNotEqual(result["types"], 0, "Not support group types")
63
64class meter_features(base_tests.SimpleDataPlane):
65 def runTest(self):
66 json_result = apply_dpctl_get_cmd(self, config, "meter-features")
67 #pprint(json_result)
68 result=json_result["RECEIVED"][1]["features"][0]
69 self.assertNotEqual(result["max_meter"], 0, "Not support meter")
70
71