blob: 32dfa6f1c1ed66af781f4298c3bb27583aa7ec5b [file] [log] [blame]
Sreeju Sreedhare3fefd92019-04-02 15:57:15 -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
17import 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)
27 delete_all_groups(self.controller)
28
29 test_ports = sorted(config["port_map"].keys())
30
31 json_result = apply_dpctl_get_cmd(self, config, "features")
32 #pprint(json_result)
33 result=json_result["RECEIVED"][1]
34 #self.assertTrue(result["tabs"]==64, "Table size is not correct")
35 self.assertNotEqual(result["caps"], 0, "Invalid capabilities")
36
37class get_config(base_tests.SimpleDataPlane):
38 def runTest(self):
39 delete_all_flows(self.controller)
40 delete_all_groups(self.controller)
41
42 test_ports = sorted(config["port_map"].keys())
43
44 json_result = apply_dpctl_get_cmd(self, config, "get-config")
45 #pprint(json_result)
46 result=json_result["RECEIVED"][1]
47 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