Matteo Scandolo | a229eca | 2017-08-08 13:05:28 -0700 | [diff] [blame] | 1 | |
| 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_cheng | 420ddce | 2015-10-26 13:42:23 +0800 | [diff] [blame] | 17 | import logging
|
| 18 | import oftest.base_tests as base_tests
|
| 19 | from oftest import config
|
| 20 | from oftest.testutils import *
|
| 21 | from util import *
|
| 22 |
|
| 23 |
|
| 24 | class features(base_tests.SimpleDataPlane):
|
| 25 | def runTest(self):
|
| 26 | delete_all_flows(self.controller)
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 27 | delete_all_groups(self.controller)
|
| 28 |
|
| 29 | test_ports = sorted(config["port_map"].keys())
|
| 30 |
|
macauley_cheng | dc5eb58 | 2015-10-26 14:29:17 +0800 | [diff] [blame] | 31 | json_result = apply_dpctl_get_cmd(self, config, "features")
|
macauley_cheng | 420ddce | 2015-10-26 13:42:23 +0800 | [diff] [blame] | 32 | #pprint(json_result)
|
| 33 | result=json_result["RECEIVED"][1]
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 34 | #self.assertTrue(result["tabs"]==64, "Table size is not correct")
|
| 35 | self.assertNotEqual(result["caps"], 0, "Invalid capabilities")
|
| 36 |
|
macauley_cheng | 420ddce | 2015-10-26 13:42:23 +0800 | [diff] [blame] | 37 | class get_config(base_tests.SimpleDataPlane):
|
| 38 | def runTest(self):
|
| 39 | delete_all_flows(self.controller)
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 40 | delete_all_groups(self.controller)
|
| 41 |
|
| 42 | test_ports = sorted(config["port_map"].keys())
|
| 43 |
|
macauley_cheng | dc5eb58 | 2015-10-26 14:29:17 +0800 | [diff] [blame] | 44 | json_result = apply_dpctl_get_cmd(self, config, "get-config")
|
macauley_cheng | 420ddce | 2015-10-26 13:42:23 +0800 | [diff] [blame] | 45 | #pprint(json_result)
|
| 46 | result=json_result["RECEIVED"][1]
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 47 | self.assertNotEqual(result["conf"], {}, "Config reply nothing")
|
| 48 |
|
| 49 | class 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 |
|
| 59 | class 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 |
|
| 66 | class 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 |
|
| 73 | class 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 |
|
| 80 | class 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 |
|