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 | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 17 | """
|
| 18 | Group table test
|
| 19 | Verify each group table can created correctly
|
| 20 | """
|
| 21 | from oftest import config
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 22 |
|
| 23 | import logging
|
| 24 | import random
|
| 25 |
|
| 26 | from oftest import config
|
| 27 | import oftest
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 28 | import oftest.base_tests as base_tests
|
| 29 | import ofp
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 30 |
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 31 | from oftest.testutils import *
|
| 32 | from accton_util import *
|
| 33 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 34 | def getkey(type):
|
| 35 | def byGroupId(stats_entry):
|
| 36 | return stats_entry.group_id
|
| 37 |
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 38 | def byGroupType(stats_entry):
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 39 | return stats_entry.group_type
|
| 40 |
|
| 41 |
|
| 42 | if type == "group_id":
|
| 43 | return byGroupId
|
| 44 | elif type == "group_type":
|
| 45 | return byGroupType
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 46 | else:
|
| 47 | assert(0)
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 48 | return byGroupId
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 49 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 50 | class L2InterfaceGroupOne(base_tests.SimpleDataPlane):
|
| 51 | def runTest(self):
|
| 52 | delete_all_flows(self.controller)
|
| 53 | delete_all_groups(self.controller)
|
| 54 |
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 55 | group_list1, msg1 = add_one_l2_interface_group(self.controller, config["port_map"].keys()[0], 1, False, False)
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 56 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 57 |
|
| 58 | verify_group_stats=[ofp.group_desc_stats_entry(
|
| 59 | group_type=msg1.group_type,
|
| 60 | group_id=msg1.group_id,
|
| 61 | buckets=msg1.buckets)]
|
| 62 |
|
| 63 | self.maxDiff=None
|
| 64 |
|
| 65 | self.assertEquals(stats, verify_group_stats)
|
| 66 |
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 67 | class L2InterfaceGroup(base_tests.SimpleDataPlane):
|
| 68 | def runTest(self):
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 69 | delete_all_flows(self.controller)
|
| 70 | delete_all_groups(self.controller)
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 71 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 72 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 73 | group_list2, msg2 =add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 74 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 75 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 76 |
|
| 77 | verify_group_stats=[]
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 78 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 79 | for msg in msg1:
|
| 80 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 81 | group_type=msg.group_type,
|
| 82 | group_id=msg.group_id,
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 83 | buckets=msg.buckets))
|
| 84 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 85 | for msg in msg2:
|
| 86 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 87 | group_type=msg.group_type,
|
| 88 | group_id=msg.group_id,
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 89 | buckets=msg.buckets))
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 90 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 91 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 92 | stats=sorted(stats, key=getkey("group_id"))
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 93 | #self.maxDiff=None
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 94 | self.assertEquals(stats, verify_group_stats)
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 95 |
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 96 | class L2McastGroup(base_tests.SimpleDataPlane):
|
| 97 | def runTest(self):
|
| 98 | delete_all_flows(self.controller)
|
| 99 | delete_all_groups(self.controller)
|
| 100 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 101 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 102 | msg2=add_l2_mcast_group(self.controller, config["port_map"].keys(), 1, 1)
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 103 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 104 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 105 | msg4=add_l2_mcast_group(self.controller, config["port_map"].keys(), 2, 2)
|
macauley | e7df640 | 2015-07-16 17:38:20 +0800 | [diff] [blame] | 106 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 107 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 108 |
|
| 109 | verify_group_stats=[]
|
| 110 | for msg in msg1:
|
| 111 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 112 | group_type=msg.group_type,
|
| 113 | group_id=msg.group_id,
|
| 114 | buckets=msg.buckets)
|
| 115 | )
|
| 116 |
|
| 117 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 118 | group_type=msg2.group_type,
|
| 119 | group_id=msg2.group_id,
|
| 120 | buckets=msg2.buckets)
|
| 121 | )
|
| 122 |
|
| 123 | for msg in msg3:
|
| 124 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 125 | group_type=msg.group_type,
|
| 126 | group_id=msg.group_id,
|
| 127 | buckets=msg.buckets)
|
| 128 | )
|
| 129 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 130 | group_type=msg4.group_type,
|
| 131 | group_id=msg4.group_id,
|
| 132 | buckets=msg4.buckets)
|
| 133 | )
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 134 |
|
| 135 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 136 | stats=sorted(stats, key=getkey("group_id"))
|
| 137 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 138 | self.assertEquals(stats, verify_group_stats)
|
| 139 |
|
| 140 |
|
| 141 | class L2FloodGroup(base_tests.SimpleDataPlane):
|
| 142 | def runTest(self):
|
| 143 | delete_all_flows(self.controller)
|
| 144 | delete_all_groups(self.controller)
|
| 145 |
|
| 146 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 147 | msg2=add_l2_flood_group(self.controller, config["port_map"].keys(), 1, 1)
|
| 148 |
|
| 149 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 150 | msg4=add_l2_flood_group(self.controller, config["port_map"].keys(), 2, 2)
|
| 151 |
|
| 152 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 153 |
|
| 154 | verify_group_stats=[]
|
| 155 | for msg in msg1:
|
| 156 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 157 | group_type=msg.group_type,
|
| 158 | group_id=msg.group_id,
|
| 159 | buckets=msg.buckets)
|
| 160 | )
|
| 161 |
|
| 162 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 163 | group_type=msg2.group_type,
|
| 164 | group_id=msg2.group_id,
|
| 165 | buckets=msg2.buckets)
|
| 166 | )
|
| 167 |
|
| 168 | for msg in msg3:
|
| 169 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 170 | group_type=msg.group_type,
|
| 171 | group_id=msg.group_id,
|
| 172 | buckets=msg.buckets)
|
| 173 | )
|
| 174 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 175 | group_type=msg4.group_type,
|
| 176 | group_id=msg4.group_id,
|
| 177 | buckets=msg4.buckets)
|
| 178 | )
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 179 |
|
| 180 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 181 | stats=sorted(stats, key=getkey("group_id"))
|
| 182 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 183 | self.assertEquals(stats, verify_group_stats)
|
| 184 |
|
| 185 |
|
| 186 | class L2RewriteGroup(base_tests.SimpleDataPlane):
|
| 187 | def runTest(self):
|
| 188 | delete_all_flows(self.controller)
|
| 189 | delete_all_groups(self.controller)
|
| 190 |
|
| 191 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 192 | msg2=add_l2_rewrite_group(self.controller, config["port_map"].keys()[0], 1, 1, [00,11,22,33,44,55], [00,22,22,22,22,22])
|
| 193 |
|
| 194 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 195 | msg4=add_l2_rewrite_group(self.controller, config["port_map"].keys()[0], 2, 2, [00,11,22,33,44,55], [00,33,33,33,33,33])
|
| 196 |
|
| 197 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 198 |
|
| 199 | verify_group_stats=[]
|
| 200 | for msg in msg1:
|
| 201 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 202 | group_type=msg.group_type,
|
| 203 | group_id=msg.group_id,
|
| 204 | buckets=msg.buckets)
|
| 205 | )
|
| 206 |
|
| 207 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 208 | group_type=msg2.group_type,
|
| 209 | group_id=msg2.group_id,
|
| 210 | buckets=msg2.buckets)
|
| 211 | )
|
| 212 |
|
| 213 | for msg in msg3:
|
| 214 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 215 | group_type=msg.group_type,
|
| 216 | group_id=msg.group_id,
|
| 217 | buckets=msg.buckets)
|
| 218 | )
|
| 219 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 220 | group_type=msg4.group_type,
|
| 221 | group_id=msg4.group_id,
|
| 222 | buckets=msg4.buckets)
|
| 223 | )
|
| 224 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 225 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 226 | stats=sorted(stats, key=getkey("group_id"))
|
| 227 |
|
| 228 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 229 | self.assertEquals(stats, verify_group_stats)
|
| 230 |
|
| 231 |
|
| 232 | class L3UnicastGroup(base_tests.SimpleDataPlane):
|
| 233 | def runTest(self):
|
| 234 | delete_all_flows(self.controller)
|
| 235 | delete_all_groups(self.controller)
|
| 236 |
|
| 237 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 238 | msg2=add_l3_unicast_group(self.controller, config["port_map"].keys()[0], 1, 1, [0x00,0x11,0x22,0x33,0x44,0x55], [00,0x22,0x22,0x22,0x22,0x22])
|
| 239 |
|
| 240 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 241 | msg4=add_l3_unicast_group(self.controller, config["port_map"].keys()[0], 2, 2, [0x00,0x11,0x22,0x33,0x44,0x55], [00,0x33,0x33,0x33,0x33,0x33])
|
| 242 |
|
| 243 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 244 |
|
| 245 | verify_group_stats=[]
|
| 246 | for msg in msg1:
|
| 247 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 248 | group_type=msg.group_type,
|
| 249 | group_id=msg.group_id,
|
| 250 | buckets=msg.buckets)
|
| 251 | )
|
| 252 |
|
| 253 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 254 | group_type=msg2.group_type,
|
| 255 | group_id=msg2.group_id,
|
| 256 | buckets=msg2.buckets)
|
| 257 | )
|
| 258 |
|
| 259 | for msg in msg3:
|
| 260 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 261 | group_type=msg.group_type,
|
| 262 | group_id=msg.group_id,
|
| 263 | buckets=msg.buckets)
|
| 264 | )
|
| 265 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 266 | group_type=msg4.group_type,
|
| 267 | group_id=msg4.group_id,
|
| 268 | buckets=msg4.buckets)
|
| 269 | )
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 270 |
|
| 271 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 272 | stats=sorted(stats, key=getkey("group_id"))
|
| 273 |
|
| 274 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 275 | self.assertEquals(stats, verify_group_stats)
|
| 276 |
|
| 277 |
|
| 278 | class L3ECMPGroup(base_tests.SimpleDataPlane):
|
| 279 | def runTest(self):
|
| 280 | delete_all_flows(self.controller)
|
| 281 | delete_all_groups(self.controller)
|
| 282 |
|
| 283 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 284 | msg2=add_l3_unicast_group(self.controller, config["port_map"].keys()[0], 1, 1, [0x00,0x11,0x22,0x33,0x44,0x55], [00,0x22,0x22,0x22,0x22,0x22])
|
| 285 |
|
| 286 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 287 | msg4=add_l3_unicast_group(self.controller, config["port_map"].keys()[0], 2, 2, [0x00,0x11,0x22,0x33,0x44,0x55], [00,0x33,0x33,0x33,0x33,0x33])
|
| 288 |
|
| 289 | group_ids=[msg2.group_id, msg4.group_id]
|
| 290 |
|
| 291 | msg5=add_l3_ecmp_group(self.controller, 1, group_ids)
|
| 292 |
|
| 293 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 294 |
|
| 295 | verify_group_stats=[]
|
| 296 | for msg in msg1:
|
| 297 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 298 | group_type=msg.group_type,
|
| 299 | group_id=msg.group_id,
|
| 300 | buckets=msg.buckets)
|
| 301 | )
|
| 302 |
|
| 303 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 304 | group_type=msg2.group_type,
|
| 305 | group_id=msg2.group_id,
|
| 306 | buckets=msg2.buckets)
|
| 307 | )
|
| 308 |
|
| 309 | for msg in msg3:
|
| 310 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 311 | group_type=msg.group_type,
|
| 312 | group_id=msg.group_id,
|
| 313 | buckets=msg.buckets)
|
| 314 | )
|
| 315 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 316 | group_type=msg4.group_type,
|
| 317 | group_id=msg4.group_id,
|
| 318 | buckets=msg4.buckets)
|
| 319 | )
|
| 320 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 321 | group_type=msg5.group_type,
|
| 322 | group_id=msg5.group_id,
|
| 323 | buckets=msg5.buckets)
|
| 324 | )
|
| 325 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 326 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 327 | stats=sorted(stats, key=getkey("group_id"))
|
| 328 |
|
| 329 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 330 | self.assertEquals(stats, verify_group_stats)
|
| 331 |
|
| 332 |
|
| 333 | class L3InterfaceGroup(base_tests.SimpleDataPlane):
|
| 334 | def runTest(self):
|
| 335 | delete_all_flows(self.controller)
|
| 336 | delete_all_groups(self.controller)
|
| 337 |
|
| 338 | group_list1, msg1 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
|
| 339 | msg2=add_l3_interface_group(self.controller, config["port_map"].keys()[0], 1, 1, [0x00,0x11,0x22,0x33,0x44,0x55])
|
| 340 | group_list1, msg3 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 2, False, False)
|
| 341 | msg4=add_l3_interface_group(self.controller, config["port_map"].keys()[0], 2, 2, [0x00,0x11,0x22,0x33,0x44,0x66])
|
| 342 |
|
| 343 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 344 |
|
| 345 | verify_group_stats=[]
|
| 346 | for msg in msg1:
|
| 347 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 348 | group_type=msg.group_type,
|
| 349 | group_id=msg.group_id,
|
| 350 | buckets=msg.buckets)
|
| 351 | )
|
| 352 |
|
| 353 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 354 | group_type=msg2.group_type,
|
| 355 | group_id=msg2.group_id,
|
| 356 | buckets=msg2.buckets)
|
| 357 | )
|
| 358 |
|
| 359 | for msg in msg3:
|
| 360 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 361 | group_type=msg.group_type,
|
| 362 | group_id=msg.group_id,
|
| 363 | buckets=msg.buckets)
|
| 364 | )
|
| 365 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 366 | group_type=msg4.group_type,
|
| 367 | group_id=msg4.group_id,
|
| 368 | buckets=msg4.buckets)
|
| 369 | )
|
| 370 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 371 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 372 | stats=sorted(stats, key=getkey("group_id"))
|
| 373 |
|
| 374 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 375 | self.assertEquals(stats, verify_group_stats)
|
| 376 |
|
| 377 |
|
| 378 | class L3McastGroup(base_tests.SimpleDataPlane):
|
| 379 | def runTest(self):
|
| 380 | delete_all_flows(self.controller)
|
| 381 | delete_all_groups(self.controller)
|
| 382 |
|
| 383 | # Vlan 3 forward to vlan 3 port 1 and 2
|
| 384 | # Vlan 3 foward to vlan 1 port 1
|
| 385 | # Vlan 3 foward to vlan 2 port 1
|
| 386 | # Vlan 3 foward to vlan 2 port 2
|
| 387 | group_list1_1, msg1 = add_l2_interface_grouop(self.controller, [config["port_map"].keys()[0]], 1, False, False)
|
| 388 | msg2=add_l3_interface_group(self.controller, config["port_map"].keys()[0], 1, 1, [0x00,0x11,0x22,0x33,0x44,0x11])
|
| 389 | group_list1_2, msg3 = add_l2_interface_grouop(self.controller, [config["port_map"].keys()[0]], 2, False, False)
|
| 390 | msg4=add_l3_interface_group(self.controller, config["port_map"].keys()[0], 2, 2, [0x00,0x11,0x22,0x33,0x44,0x22])
|
| 391 | group_list2_1, msg5 = add_l2_interface_grouop(self.controller, [config["port_map"].keys()[1]], 2, False, False)
|
| 392 | msg6=add_l3_interface_group(self.controller, config["port_map"].keys()[1], 2, 3, [0x00,0x11,0x22,0x33,0x44,0x33])
|
| 393 | group_list3, msg7 = add_l2_interface_grouop(self.controller, config["port_map"].keys(), 3, False, False)
|
| 394 |
|
| 395 | group_actions=[msg2.group_id, msg4.group_id, msg6.group_id]
|
| 396 | group_actions.extend(group_list3)
|
| 397 |
|
| 398 | msg8=add_l3_mcast_group(self.controller, 3, 1, group_actions)
|
| 399 |
|
| 400 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 401 |
|
| 402 | verify_group_stats=[]
|
| 403 | for msg in msg1:
|
| 404 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 405 | group_type=msg.group_type,
|
| 406 | group_id=msg.group_id,
|
| 407 | buckets=msg.buckets)
|
| 408 | )
|
| 409 |
|
| 410 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 411 | group_type=msg2.group_type,
|
| 412 | group_id=msg2.group_id,
|
| 413 | buckets=msg2.buckets)
|
| 414 | )
|
| 415 |
|
| 416 | for msg in msg3:
|
| 417 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 418 | group_type=msg.group_type,
|
| 419 | group_id=msg.group_id,
|
| 420 | buckets=msg.buckets)
|
| 421 | )
|
| 422 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 423 | group_type=msg4.group_type,
|
| 424 | group_id=msg4.group_id,
|
| 425 | buckets=msg4.buckets)
|
| 426 | )
|
| 427 | for msg in msg5:
|
| 428 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 429 | group_type=msg.group_type,
|
| 430 | group_id=msg.group_id,
|
| 431 | buckets=msg.buckets)
|
| 432 | )
|
| 433 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 434 | group_type=msg6.group_type,
|
| 435 | group_id=msg6.group_id,
|
| 436 | buckets=msg6.buckets)
|
| 437 | )
|
| 438 | for msg in msg7:
|
| 439 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 440 | group_type=msg.group_type,
|
| 441 | group_id=msg.group_id,
|
| 442 | buckets=msg.buckets)
|
| 443 | )
|
| 444 |
|
| 445 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 446 | group_type=msg8.group_type,
|
| 447 | group_id=msg8.group_id,
|
| 448 | buckets=msg8.buckets)
|
| 449 | )
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 450 |
|
| 451 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 452 | stats=sorted(stats, key=getkey("group_id"))
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 453 |
|
macauley | 68bd768 | 2015-08-03 09:20:32 +0800 | [diff] [blame] | 454 | self.maxDiff=None
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 455 | self.assertEquals(stats, verify_group_stats)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 456 |
|
| 457 |
|
| 458 | class mpls_intf_group(base_tests.SimpleDataPlane):
|
| 459 | """
|
| 460 | create mpls intf group
|
| 461 | 1. ref l2_intf_group
|
| 462 | 2. ref l2_flood_group
|
| 463 | """
|
| 464 | def runTest(self):
|
| 465 | delete_all_flows(self.controller)
|
| 466 | delete_all_groups(self.controller)
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 467 |
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 468 | test_vid=1
|
| 469 |
|
| 470 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 471 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, config["port_map"].keys()[0], test_vid, False, False)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 472 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 473 |
|
| 474 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 475 |
|
| 476 | verify_group_stats=[]
|
| 477 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 478 | group_type=l2_intf_msg.group_type,
|
| 479 | group_id=l2_intf_msg.group_id,
|
| 480 | buckets=l2_intf_msg.buckets)
|
| 481 | )
|
| 482 |
|
| 483 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 484 | group_type=mpls_intf_msg.group_type,
|
| 485 | group_id=mpls_intf_msg.group_id,
|
| 486 | buckets=mpls_intf_msg.buckets)
|
| 487 | )
|
| 488 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 489 | stats=sorted(stats, key=getkey("group_id"))
|
| 490 | self.assertEquals(stats, verify_group_stats)
|
| 491 |
|
macauley | fd08eda | 2015-07-17 15:59:04 +0800 | [diff] [blame] | 492 |
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 493 | class mpls_l2_vpn_group(base_tests.SimpleDataPlane):
|
| 494 | """
|
| 495 | create mpls intf group
|
| 496 | 1. ref l2_intf_group
|
| 497 |
|
| 498 | """
|
| 499 | def runTest(self):
|
| 500 | delete_all_flows(self.controller)
|
| 501 | delete_all_groups(self.controller)
|
| 502 |
|
| 503 | test_vid=1
|
| 504 | test_port=config["port_map"].keys()[0]
|
| 505 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 506 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 507 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 508 | mpls_label_gid, mpls_label_msg=add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L2_VPN_LABEL,
|
| 509 | index=1,
|
| 510 | ref_gid=mpls_intf_gid,
|
| 511 | push_l2_header=True,
|
| 512 | push_vlan=True,
|
| 513 | push_mpls_header=True,
|
| 514 | push_cw=False,
|
| 515 | set_mpls_label=10,
|
| 516 | set_bos=0,
|
| 517 | set_tc=7,
|
| 518 | set_tc_from_table=False,
|
| 519 | cpy_tc_outward=False,
|
| 520 | set_ttl=250,
|
| 521 | cpy_ttl_outward=False,
|
| 522 | oam_lm_tx_count=False,
|
| 523 | set_pri_from_table=False
|
| 524 | )
|
| 525 |
|
| 526 | verify_group_stats=[]
|
| 527 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 528 | group_type=l2_intf_msg.group_type,
|
| 529 | group_id=l2_intf_msg.group_id,
|
| 530 | buckets=l2_intf_msg.buckets)
|
| 531 | )
|
| 532 |
|
| 533 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 534 | group_type=mpls_intf_msg.group_type,
|
| 535 | group_id=mpls_intf_msg.group_id,
|
| 536 | buckets=mpls_intf_msg.buckets)
|
| 537 | )
|
| 538 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 539 | group_type=mpls_label_msg.group_type,
|
| 540 | group_id=mpls_label_msg.group_id,
|
| 541 | buckets=mpls_label_msg.buckets)
|
| 542 | )
|
| 543 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 544 | stats= get_stats(self, ofp.message.group_desc_stats_request())
|
| 545 | stats=sorted(stats, key=getkey("group_id"))
|
| 546 | #DumpGroup(stats, verify_group_stats)
|
| 547 | #AssertGroup(self, stats, verify_group_stats)
|
| 548 | self.assertEquals(stats, verify_group_stats)
|
| 549 |
|
| 550 |
|
| 551 | class mpls_tunnel_lable1_group(base_tests.SimpleDataPlane):
|
| 552 | """
|
| 553 | create mpls intf group
|
| 554 | 1. ref l2_intf_group
|
| 555 |
|
| 556 | """
|
| 557 | def runTest(self):
|
| 558 | delete_all_flows(self.controller)
|
| 559 | delete_all_groups(self.controller)
|
| 560 |
|
| 561 | test_vid=1
|
| 562 | test_port=config["port_map"].keys()[0]
|
| 563 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 564 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 565 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 566 | mpls_label_gid, mpls_label_msg=add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_TUNNEL_LABEL1,
|
| 567 | index=1,
|
| 568 | ref_gid=mpls_intf_gid,
|
| 569 | push_l2_header=True,
|
| 570 | push_vlan=True,
|
| 571 | push_mpls_header=True,
|
| 572 | push_cw=True,
|
| 573 | set_mpls_label=10,
|
| 574 | set_bos=0,
|
| 575 | set_tc=7,
|
| 576 | set_tc_from_table=False,
|
| 577 | cpy_tc_outward=False,
|
| 578 | set_ttl=250,
|
| 579 | cpy_ttl_outward=False,
|
| 580 | oam_lm_tx_count=False,
|
| 581 | set_pri_from_table=False
|
| 582 | )
|
| 583 |
|
| 584 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 585 |
|
| 586 | verify_group_stats=[]
|
| 587 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 588 | group_type=l2_intf_msg.group_type,
|
| 589 | group_id=l2_intf_msg.group_id,
|
| 590 | buckets=l2_intf_msg.buckets)
|
| 591 | )
|
| 592 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 593 | group_type=mpls_intf_msg.group_type,
|
| 594 | group_id=mpls_intf_msg.group_id,
|
| 595 | buckets=mpls_intf_msg.buckets)
|
| 596 | )
|
| 597 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 598 | group_type=mpls_label_msg.group_type,
|
| 599 | group_id=mpls_label_msg.group_id,
|
| 600 | buckets=mpls_label_msg.buckets)
|
| 601 | )
|
| 602 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 603 | stats=sorted(stats, key=getkey("group_id"))
|
| 604 | self.assertEquals(stats, verify_group_stats)
|
| 605 |
|
| 606 |
|
| 607 | class mpls_tunnel_lable2_group(base_tests.SimpleDataPlane):
|
| 608 | """
|
| 609 | create mpls intf group
|
| 610 | 1. ref l2_intf_group
|
| 611 |
|
| 612 | """
|
| 613 | def runTest(self):
|
| 614 | delete_all_flows(self.controller)
|
| 615 | delete_all_groups(self.controller)
|
| 616 |
|
| 617 | test_vid=1
|
| 618 | test_port=config["port_map"].keys()[0]
|
| 619 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 620 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 621 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 622 | mpls_label_gid, mpls_label_msg=add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_TUNNEL_LABEL2,
|
| 623 | index=1,
|
| 624 | ref_gid=mpls_intf_gid,
|
| 625 | push_l2_header=True,
|
| 626 | push_vlan=True,
|
| 627 | push_mpls_header=True,
|
| 628 | push_cw=True,
|
| 629 | set_mpls_label=10,
|
| 630 | set_bos=0,
|
| 631 | set_tc=7,
|
| 632 | set_tc_from_table=False,
|
| 633 | cpy_tc_outward=False,
|
| 634 | set_ttl=250,
|
| 635 | cpy_ttl_outward=False,
|
| 636 | oam_lm_tx_count=False,
|
| 637 | set_pri_from_table=False
|
| 638 | )
|
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 639 |
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 640 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 641 |
|
| 642 | verify_group_stats=[]
|
| 643 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 644 | group_type=l2_intf_msg.group_type,
|
| 645 | group_id=l2_intf_msg.group_id,
|
| 646 | buckets=l2_intf_msg.buckets)
|
| 647 | )
|
| 648 |
|
| 649 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 650 | group_type=mpls_intf_msg.group_type,
|
| 651 | group_id=mpls_intf_msg.group_id,
|
| 652 | buckets=mpls_intf_msg.buckets)
|
| 653 | )
|
| 654 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 655 | group_type=mpls_label_msg.group_type,
|
| 656 | group_id=mpls_label_msg.group_id,
|
| 657 | buckets=mpls_label_msg.buckets)
|
| 658 | )
|
| 659 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 660 | stats=sorted(stats, key=getkey("group_id"))
|
| 661 | self.assertEquals(stats, verify_group_stats)
|
| 662 |
|
| 663 | class mpls_swap_label_group(base_tests.SimpleDataPlane):
|
| 664 | """
|
| 665 | create mpls intf group
|
| 666 | 1. ref l2_intf_group
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 667 | """
|
| 668 | def runTest(self):
|
| 669 | delete_all_flows(self.controller)
|
| 670 | delete_all_groups(self.controller)
|
| 671 |
|
| 672 | test_vid=1
|
| 673 | test_port=config["port_map"].keys()[0]
|
| 674 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 675 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1be9d38 | 2015-08-31 15:18:48 +0800 | [diff] [blame] | 676 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 677 | mpls_label_gid, mpls_label_msg=add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_SWAP_LABEL,
|
| 678 | index=1,
|
| 679 | ref_gid=mpls_intf_gid,
|
| 680 | push_l2_header=True,
|
| 681 | push_vlan=True,
|
| 682 | push_mpls_header=True,
|
| 683 | push_cw=True,
|
| 684 | set_mpls_label=10,
|
| 685 | set_bos=0,
|
| 686 | set_tc=7,
|
| 687 | set_tc_from_table=False,
|
| 688 | cpy_tc_outward=False,
|
| 689 | set_ttl=250,
|
| 690 | cpy_ttl_outward=False,
|
| 691 | oam_lm_tx_count=False,
|
| 692 | set_pri_from_table=False
|
| 693 | )
|
| 694 |
|
| 695 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 696 |
|
| 697 | verify_group_stats=[]
|
| 698 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 699 | group_type=l2_intf_msg.group_type,
|
| 700 | group_id=l2_intf_msg.group_id,
|
| 701 | buckets=l2_intf_msg.buckets)
|
| 702 | )
|
| 703 |
|
| 704 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 705 | group_type=mpls_intf_msg.group_type,
|
| 706 | group_id=mpls_intf_msg.group_id,
|
| 707 | buckets=mpls_intf_msg.buckets)
|
| 708 | )
|
| 709 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 710 | group_type=mpls_label_msg.group_type,
|
| 711 | group_id=mpls_label_msg.group_id,
|
| 712 | buckets=mpls_label_msg.buckets)
|
| 713 | )
|
| 714 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 715 | stats=sorted(stats, key=getkey("group_id"))
|
| 716 | self.assertEquals(stats, verify_group_stats)
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 717 |
|
| 718 |
|
| 719 | class mpls_forwarding_group_fastfailover(base_tests.SimpleDataPlane):
|
| 720 | def runTest(self):
|
| 721 | delete_all_flows(self.controller)
|
| 722 | delete_all_groups(self.controller)
|
| 723 |
|
| 724 | test_vid=1
|
| 725 | test_port=config["port_map"].keys()[0]
|
| 726 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 727 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 728 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=1)
|
| 729 | mpls_label_gid, mpls_label_msg=add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_SWAP_LABEL,
|
| 730 | index=1,
|
| 731 | ref_gid=mpls_intf_gid,
|
| 732 | push_l2_header=True,
|
| 733 | push_vlan=True,
|
| 734 | push_mpls_header=True,
|
| 735 | push_cw=True,
|
| 736 | set_mpls_label=10,
|
| 737 | set_bos=0,
|
| 738 | set_tc=7,
|
| 739 | set_tc_from_table=False,
|
| 740 | cpy_tc_outward=False,
|
| 741 | set_ttl=250,
|
| 742 | cpy_ttl_outward=False,
|
| 743 | oam_lm_tx_count=False,
|
| 744 | set_pri_from_table=False
|
| 745 | )
|
| 746 | mpls_fwd_gid, mpls_fwd_msg=add_mpls_forwarding_group(self.controller,
|
| 747 | subtype=OFDPA_MPLS_GROUP_SUBTYPE_FAST_FAILOVER_GROUP,
|
| 748 | index=1,
|
| 749 | ref_gids=[mpls_label_gid],
|
| 750 | watch_port=test_port,
|
| 751 | watch_group=ofp.OFPP_ANY,
|
| 752 | push_vlan=None,
|
macauley_cheng | ddcd934 | 2015-11-10 11:49:35 +0800 | [diff] [blame] | 753 | pop_vlan=None,
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 754 | set_vid=None)
|
| 755 |
|
| 756 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 757 |
|
| 758 | verify_group_stats=[]
|
| 759 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 760 | group_type=l2_intf_msg.group_type,
|
| 761 | group_id=l2_intf_msg.group_id,
|
| 762 | buckets=l2_intf_msg.buckets)
|
| 763 | )
|
| 764 |
|
| 765 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 766 | group_type=mpls_intf_msg.group_type,
|
| 767 | group_id=mpls_intf_msg.group_id,
|
| 768 | buckets=mpls_intf_msg.buckets)
|
| 769 | )
|
| 770 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 771 | group_type=mpls_label_msg.group_type,
|
| 772 | group_id=mpls_label_msg.group_id,
|
| 773 | buckets=mpls_label_msg.buckets)
|
| 774 | )
|
| 775 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 776 | group_type=mpls_fwd_msg.group_type,
|
| 777 | group_id=mpls_fwd_msg.group_id,
|
| 778 | buckets=mpls_fwd_msg.buckets)
|
| 779 | )
|
| 780 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 781 | stats=sorted(stats, key=getkey("group_id"))
|
| 782 | self.assertEquals(stats, verify_group_stats)
|
| 783 |
|
| 784 |
|
| 785 | class mpls_forwarding_group_ecmp(base_tests.SimpleDataPlane):
|
| 786 | """chip not support to bind flow on trident2
|
| 787 | """
|
| 788 | def runTest(self):
|
| 789 | delete_all_flows(self.controller)
|
| 790 | delete_all_groups(self.controller)
|
| 791 |
|
| 792 | test_vid=1
|
| 793 | mpls_intf_msgs=[]
|
| 794 | mpls_intf_gids=[]
|
| 795 | l2_intf_msgs=[]
|
| 796 | index=1
|
| 797 | #ref l2_intf_group
|
| 798 | for port in config["port_map"].keys():
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 799 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, port, test_vid, False, False)
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 800 | l2_intf_msgs.append(l2_intf_msg)
|
| 801 | mpls_intf_gid, mpls_intf_msg=add_mpls_intf_group(self.controller, l2_intf_gid, [0x00,0x11,0x11,0x11,0x11,0x11], [0x00,0x22,0x22,0x22,0x22,0x22], vid=test_vid, index=index)
|
| 802 | index=index+1
|
| 803 | mpls_intf_msgs.append(mpls_intf_msg)
|
| 804 | mpls_intf_gids.append(mpls_intf_gid)
|
| 805 |
|
| 806 | mpls_fwd_gid, mpls_fwd_msg=add_mpls_forwarding_group(self.controller,
|
| 807 | subtype=OFDPA_MPLS_GROUP_SUBTYPE_ECMP,
|
| 808 | index=1,
|
| 809 | ref_gids=mpls_intf_gids,
|
| 810 | watch_port=None,
|
| 811 | watch_group=None,
|
| 812 | push_vlan=None,
|
macauley_cheng | ddcd934 | 2015-11-10 11:49:35 +0800 | [diff] [blame] | 813 | pop_vlan=None,
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 814 | set_vid=None)
|
| 815 |
|
| 816 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 817 |
|
| 818 | verify_group_stats=[]
|
| 819 | for msg in l2_intf_msgs:
|
| 820 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 821 | group_type=msg.group_type,
|
| 822 | group_id=msg.group_id,
|
| 823 | buckets=msg.buckets)
|
| 824 | )
|
| 825 |
|
| 826 | for msg in mpls_intf_msgs:
|
| 827 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 828 | group_type=msg.group_type,
|
| 829 | group_id=msg.group_id,
|
| 830 | buckets=msg.buckets)
|
| 831 | )
|
| 832 |
|
| 833 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 834 | group_type=mpls_fwd_msg.group_type,
|
| 835 | group_id=mpls_fwd_msg.group_id,
|
| 836 | buckets=mpls_fwd_msg.buckets)
|
| 837 | )
|
| 838 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 839 | stats=sorted(stats, key=getkey("group_id"))
|
| 840 | self.assertEquals(stats, verify_group_stats)
|
| 841 |
|
| 842 |
|
| 843 | class mpls_forwarding_group_l2tag(base_tests.SimpleDataPlane):
|
| 844 | """chip not support
|
| 845 | """
|
| 846 | def runTest(self):
|
| 847 | delete_all_flows(self.controller)
|
| 848 | delete_all_groups(self.controller)
|
| 849 |
|
| 850 | test_vid=1
|
| 851 | test_port=config["port_map"].keys()[0]
|
| 852 | index=1
|
| 853 | #ref l2_intf_group
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 854 | l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(self.controller, test_port, test_vid, False, False)
|
macauley_cheng | 1dba79f | 2015-08-31 17:45:56 +0800 | [diff] [blame] | 855 |
|
| 856 | mpls_fwd_gid, mpls_fwd_msg=add_mpls_forwarding_group(self.controller,
|
| 857 | subtype=OFDPA_MPLS_GROUP_SUBTYPE_L2_TAG,
|
| 858 | index=1,
|
| 859 | ref_gids=l2_intf_gid,
|
| 860 | watch_port=None,
|
| 861 | watch_group=None,
|
| 862 | push_vlan=None,
|
| 863 | pop_vlan=None,
|
| 864 | set_vid=1)
|
| 865 |
|
| 866 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 867 |
|
| 868 | verify_group_stats=[]
|
| 869 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 870 | group_type=l2_intf_msg.group_type,
|
| 871 | group_id=l2_intf_msg.group_id,
|
| 872 | buckets=l2_intf_msg.buckets)
|
| 873 | )
|
| 874 |
|
| 875 | verify_group_stats.append(ofp.group_desc_stats_entry(
|
| 876 | group_type=mpls_fwd_msg.group_type,
|
| 877 | group_id=mpls_fwd_msg.group_id,
|
| 878 | buckets=mpls_fwd_msg.buckets)
|
| 879 | )
|
| 880 | verify_group_stats=sorted(verify_group_stats, key=getkey("group_id"))
|
| 881 | stats=sorted(stats, key=getkey("group_id"))
|
| 882 |
|
| 883 | self.assertEquals(stats, verify_group_stats) |