blob: 32dfa6f1c1ed66af781f4298c3bb27583aa7ec5b [file] [log] [blame]
Matteo Scandoloa229eca2017-08-08 13:05:28 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
macauley_cheng420ddce2015-10-26 13:42:23 +080017import logging
18import oftest.base_tests as base_tests
19from oftest import config
20from oftest.testutils import *
21from util import *
22
23
24class features(base_tests.SimpleDataPlane):
25 def runTest(self):
26 delete_all_flows(self.controller)
macauley_cheng0a0a7f62015-11-06 11:36:50 +080027 delete_all_groups(self.controller)
28
29 test_ports = sorted(config["port_map"].keys())
30
macauley_chengdc5eb582015-10-26 14:29:17 +080031 json_result = apply_dpctl_get_cmd(self, config, "features")
macauley_cheng420ddce2015-10-26 13:42:23 +080032 #pprint(json_result)
33 result=json_result["RECEIVED"][1]
macauley_cheng0a0a7f62015-11-06 11:36:50 +080034 #self.assertTrue(result["tabs"]==64, "Table size is not correct")
35 self.assertNotEqual(result["caps"], 0, "Invalid capabilities")
36
macauley_cheng420ddce2015-10-26 13:42:23 +080037class get_config(base_tests.SimpleDataPlane):
38 def runTest(self):
39 delete_all_flows(self.controller)
macauley_cheng0a0a7f62015-11-06 11:36:50 +080040 delete_all_groups(self.controller)
41
42 test_ports = sorted(config["port_map"].keys())
43
macauley_chengdc5eb582015-10-26 14:29:17 +080044 json_result = apply_dpctl_get_cmd(self, config, "get-config")
macauley_cheng420ddce2015-10-26 13:42:23 +080045 #pprint(json_result)
46 result=json_result["RECEIVED"][1]
macauley_cheng0a0a7f62015-11-06 11:36:50 +080047 self.assertNotEqual(result["conf"], {}, "Config reply nothing")
48
49class desc(base_tests.SimpleDataPlane):
50 def runTest(self):
51 delete_all_flows(self.controller)
52 delete_all_groups(self.controller)
53
54 json_result = apply_dpctl_get_cmd(self, config, "stats-desc")
55 #pprint(json_result)
56 result=json_result["RECEIVED"][1]
57 self.assertNotEqual(result["mfr"], {}, "DESC MFR reply nothing")
58
59class port_desc(base_tests.SimpleDataPlane):
60 def runTest(self):
61 json_result = apply_dpctl_get_cmd(self, config, "port-desc")
62 #pprint(json_result)
63 result=json_result["RECEIVED"][1]
64 self.assertNotEqual(result["port"], {}, "Port DESC reply nothing")
65
66class table_features(base_tests.SimpleDataPlane):
67 def runTest(self):
68 json_result = apply_dpctl_get_cmd(self, config, "table-features")
69 #pprint(json_result)
70 result=json_result["RECEIVED"][1]
71 self.assertNotEqual(result["table_features"], {}, "Table features reply nothing")
72
73class group_features(base_tests.SimpleDataPlane):
74 def runTest(self):
75 json_result = apply_dpctl_get_cmd(self, config, "group-features")
76 #pprint(json_result)
77 result=json_result["RECEIVED"][1]
78 self.assertNotEqual(result["types"], 0, "Not support group types")
79
80class meter_features(base_tests.SimpleDataPlane):
81 def runTest(self):
82 json_result = apply_dpctl_get_cmd(self, config, "meter-features")
83 #pprint(json_result)
84 result=json_result["RECEIVED"][1]["features"][0]
85 self.assertNotEqual(result["max_meter"], 0, "Not support meter")
86
87