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