Pier | e130876 | 2016-09-12 15:29:56 -0700 | [diff] [blame] | 1 | """ |
| 2 | Check README file |
| 3 | """ |
| 4 | import Queue |
| 5 | |
| 6 | from oftest import config |
| 7 | import inspect |
| 8 | import logging |
| 9 | import oftest.base_tests as base_tests |
| 10 | import ofp |
| 11 | from oftest.testutils import * |
| 12 | from accton_util import * |
| 13 | from utils import * |
| 14 | |
| 15 | MAX_INTERNAL_VLAN = 4094 |
| 16 | |
| 17 | class L2ForwardingStackedVLAN( base_tests.SimpleDataPlane ): |
| 18 | """ |
| 19 | Verify the proper operation of the pipeline part which includes VLAN table |
| 20 | and VLAN 1 table. This is necessary for classify packets in VPWS |
| 21 | |
| 22 | One rules is necessary in VLAN table (10): |
| 23 | 1) inPort = 12 (Physical) vlanId:mask = 0x1ff2:0x1fff (VLAN 4082) | |
| 24 | GoTo = 11 (VLAN 1) popVlanAction ovid = 8178 | |
| 25 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 26 | |
| 27 | One rules is necessary in VLAN 1 table (11): |
| 28 | 2) inPort = 12 (Physical) vlanId = 0x1f8e (VLAN 3982) ovid = 0x1ff2 (VLAN 4082) | |
| 29 | GoTo = 20 (Termination MAC) newTpid2 = 0x8100 newVlanId2 = 0x1ff2 (VLAN 4082) | |
| 30 | priority = 0 hard_time = 0 idle_time = 0 cookie = 2 |
| 31 | |
| 32 | In this test case outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) and |
| 33 | inner_vlan_id = (MAX_INTERNAL_VLAN - 100 - port_no) |
| 34 | The remaining part of the test is based on the use of the bridging table |
| 35 | """ |
| 36 | |
| 37 | def runTest( self ): |
| 38 | groups = Queue.LifoQueue( ) |
| 39 | try: |
| 40 | if len( config[ "port_map" ] ) < 2: |
| 41 | logging.info( "Port count less than 2, can't run this case" ) |
| 42 | return |
| 43 | |
| 44 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 45 | for in_port in ports: |
| 46 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 47 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 48 | add_one_vlan_table_flow( |
| 49 | self.controller, |
| 50 | in_port, |
| 51 | vlan_id=outer_vlan_id, |
| 52 | flag=VLAN_TABLE_FLAG_ONLY_STACKED |
| 53 | ) |
| 54 | add_one_vlan_1_table_flow( |
| 55 | self.controller, |
| 56 | in_port, |
| 57 | new_outer_vlan_id=-1, |
| 58 | outer_vlan_id=outer_vlan_id, |
| 59 | inner_vlan_id=inner_vlan_id, |
| 60 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 61 | ) |
| 62 | for out_port in ports: |
| 63 | if out_port == in_port: |
| 64 | continue |
| 65 | L2gid, l2msg = add_one_l2_interface_group( |
| 66 | self.controller, |
| 67 | out_port, |
| 68 | outer_vlan_id, |
| 69 | True, |
| 70 | False |
| 71 | ) |
| 72 | groups.put( L2gid ) |
| 73 | add_bridge_flow( |
| 74 | self.controller, |
| 75 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 76 | outer_vlan_id, |
| 77 | L2gid, |
| 78 | True |
| 79 | ) |
| 80 | |
| 81 | do_barrier( self.controller ) |
| 82 | |
| 83 | for in_port in ports: |
| 84 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 85 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 86 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 87 | |
| 88 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 89 | pktlen=108, |
| 90 | out_dl_vlan_enable=True, |
| 91 | out_vlan_vid=outer_vlan_id, |
| 92 | in_dl_vlan_enable=True, |
| 93 | in_vlan_vid=inner_vlan_id, |
| 94 | eth_dst=mac_dst, |
| 95 | ) |
| 96 | pkt = str( parsed_pkt ) |
| 97 | self.dataplane.send( in_port, pkt ) |
| 98 | |
| 99 | # change dest based on port number |
| 100 | for out_port in ports: |
| 101 | if out_port == in_port: |
| 102 | verify_no_packet( self, pkt, in_port ) |
| 103 | continue |
| 104 | verify_packet( self, pkt, out_port ) |
| 105 | verify_no_other_packets( self ) |
| 106 | |
| 107 | finally: |
| 108 | delete_all_flows( self.controller ) |
| 109 | delete_groups( self.controller, groups ) |
| 110 | delete_all_groups( self.controller ) |
| 111 | |
| 112 | class L2ForwardingStackedVLAN2( base_tests.SimpleDataPlane ): |
| 113 | """ |
| 114 | Verify the proper operation of the pipeline part which includes VLAN table |
| 115 | and VLAN 1 table. This is necessary for classify packets in VPWS. In this test |
| 116 | case we verify the change of outer vlan VLAN 1 table. |
| 117 | |
| 118 | One rules is necessary in VLAN table (10): |
| 119 | 1) inPort = 12 (Physical) vlanId:mask = 0x1ff2:0x1fff (VLAN 4082) | |
| 120 | GoTo = 11 (VLAN 1) popVlanAction ovid = 8178 | |
| 121 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 122 | |
| 123 | One rules is necessary in VLAN 1 table (11): |
| 124 | 2) inPort = 12 (Physical) vlanId = 0x1f8e (VLAN 3982) ovid = 0x1ff2 (VLAN 4082) | |
| 125 | GoTo = 20 (Termination MAC) newTpid2 = 0x8100 newVlanId2 = 0x1f2a (VLAN 3882) | |
| 126 | priority = 0 hard_time = 0 idle_time = 0 cookie = 2 |
| 127 | |
| 128 | In this test case: |
| 129 | 1) outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) |
| 130 | 2) inner_vlan_id = (MAX_INTERNAL_VLAN - 100 - port_no) |
| 131 | 3) new_outer_vlan_id = (MAX_INTERNAL_VLAN - 200 - port_no) |
| 132 | |
| 133 | The remaining part of the test is based on the use of the bridging table |
| 134 | """ |
| 135 | |
| 136 | MAX_INTERNAL_VLAN = 4094 |
| 137 | |
| 138 | def runTest( self ): |
| 139 | groups = Queue.LifoQueue( ) |
| 140 | try: |
| 141 | if len( config[ "port_map" ] ) < 2: |
| 142 | logging.info( "Port count less than 2, can't run this case" ) |
| 143 | return |
| 144 | |
| 145 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 146 | for in_port in ports: |
| 147 | new_outer_vlan_id = MAX_INTERNAL_VLAN - 200 - in_port |
| 148 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 149 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 150 | add_one_vlan_table_flow( |
| 151 | self.controller, |
| 152 | in_port, |
| 153 | vlan_id=outer_vlan_id, |
| 154 | flag=VLAN_TABLE_FLAG_ONLY_STACKED |
| 155 | ) |
| 156 | add_one_vlan_1_table_flow( |
| 157 | self.controller, |
| 158 | in_port, |
| 159 | new_outer_vlan_id=new_outer_vlan_id, |
| 160 | outer_vlan_id=outer_vlan_id, |
| 161 | inner_vlan_id=inner_vlan_id, |
| 162 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 163 | ) |
| 164 | for out_port in ports: |
| 165 | if out_port == in_port: |
| 166 | continue |
| 167 | L2gid, l2msg = add_one_l2_interface_group( |
| 168 | self.controller, |
| 169 | out_port, |
| 170 | new_outer_vlan_id, |
| 171 | True, |
| 172 | False |
| 173 | ) |
| 174 | groups.put( L2gid ) |
| 175 | add_bridge_flow( |
| 176 | self.controller, |
| 177 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 178 | new_outer_vlan_id, |
| 179 | L2gid, |
| 180 | True |
| 181 | ) |
| 182 | |
| 183 | do_barrier( self.controller ) |
| 184 | |
| 185 | for in_port in ports: |
| 186 | new_outer_vlan_id = MAX_INTERNAL_VLAN - 200 - in_port |
| 187 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 188 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 189 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 190 | |
| 191 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 192 | pktlen=108, |
| 193 | out_dl_vlan_enable=True, |
| 194 | out_vlan_vid=outer_vlan_id, |
| 195 | in_dl_vlan_enable=True, |
| 196 | in_vlan_vid=inner_vlan_id, |
| 197 | eth_dst=mac_dst, |
| 198 | ) |
| 199 | pkt = str( parsed_pkt ) |
| 200 | self.dataplane.send( in_port, pkt ) |
| 201 | |
| 202 | # change dest based on port number |
| 203 | for out_port in ports: |
| 204 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 205 | pktlen=108, |
| 206 | out_dl_vlan_enable=True, |
| 207 | out_vlan_vid=new_outer_vlan_id, |
| 208 | in_dl_vlan_enable=True, |
| 209 | in_vlan_vid=inner_vlan_id, |
| 210 | eth_dst=mac_dst, |
| 211 | ) |
| 212 | pkt = str( parsed_pkt ) |
| 213 | if out_port == in_port: |
| 214 | verify_no_packet( self, pkt, in_port ) |
| 215 | continue |
| 216 | verify_packet( self, pkt, out_port ) |
| 217 | verify_no_other_packets( self ) |
| 218 | |
| 219 | finally: |
| 220 | delete_all_flows( self.controller ) |
| 221 | delete_groups( self.controller, groups ) |
| 222 | delete_all_groups( self.controller ) |
| 223 | |
| 224 | class L2ForwardingStackedVLAN3( base_tests.SimpleDataPlane ): |
| 225 | """ |
| 226 | Verify the proper operation of the pipeline part which includes VLAN table. |
| 227 | This is necessary for classify packets in VPWS. In this test |
| 228 | case we verify the change of outer vlan pushing another vlan in VLAN table. |
| 229 | |
| 230 | One rules is necessary in VLAN table (10): |
| 231 | 1) inPort = 12 (Physical) vlanId:mask = 0x1f8e:0x1fff (VLAN 3982) | |
| 232 | GoTo = 20 (Termination MAC) newTpid2 = 0x8100 newVlanId2 = 0x1ff2 (VLAN 4082) | |
| 233 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 234 | |
| 235 | In this test case: |
| 236 | 1) outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) |
| 237 | 2) inner_vlan_id = (MAX_INTERNAL_VLAN - 100 - port_no) |
| 238 | |
| 239 | The remaining part of the test is based on the use of the bridging table |
| 240 | """ |
| 241 | |
| 242 | MAX_INTERNAL_VLAN = 4094 |
| 243 | |
| 244 | def runTest( self ): |
| 245 | groups = Queue.LifoQueue( ) |
| 246 | try: |
| 247 | if len( config[ "port_map" ] ) < 2: |
| 248 | logging.info( "Port count less than 2, can't run this case" ) |
| 249 | return |
| 250 | |
| 251 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 252 | for in_port in ports: |
| 253 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 254 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 255 | add_vlan_table_flow_pvid( |
| 256 | self.controller, |
| 257 | in_port, |
| 258 | match_vid=inner_vlan_id, |
| 259 | pvid=outer_vlan_id, |
| 260 | send_barrier=True |
| 261 | ) |
| 262 | for out_port in ports: |
| 263 | if out_port == in_port: |
| 264 | continue |
| 265 | L2gid, l2msg = add_one_l2_interface_group( |
| 266 | self.controller, |
| 267 | out_port, |
| 268 | outer_vlan_id, |
| 269 | True, |
| 270 | False |
| 271 | ) |
| 272 | groups.put( L2gid ) |
| 273 | add_bridge_flow( |
| 274 | self.controller, |
| 275 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 276 | outer_vlan_id, |
| 277 | L2gid, |
| 278 | True |
| 279 | ) |
| 280 | |
| 281 | do_barrier( self.controller ) |
| 282 | |
| 283 | for in_port in ports: |
| 284 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 285 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 286 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 287 | |
| 288 | parsed_pkt = simple_tcp_packet( |
| 289 | pktlen=108, |
| 290 | dl_vlan_enable=True, |
| 291 | vlan_vid=inner_vlan_id, |
| 292 | eth_dst=mac_dst, |
| 293 | ) |
| 294 | pkt = str( parsed_pkt ) |
| 295 | self.dataplane.send( in_port, pkt ) |
| 296 | |
| 297 | # change dest based on port number |
| 298 | for out_port in ports: |
| 299 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 300 | pktlen=112, |
| 301 | out_dl_vlan_enable=True, |
| 302 | out_vlan_vid=outer_vlan_id, |
| 303 | in_dl_vlan_enable=True, |
| 304 | in_vlan_vid=inner_vlan_id, |
| 305 | eth_dst=mac_dst, |
| 306 | ) |
| 307 | pkt = str( parsed_pkt ) |
| 308 | if out_port == in_port: |
| 309 | verify_no_packet( self, pkt, in_port ) |
| 310 | continue |
| 311 | verify_packet( self, pkt, out_port ) |
| 312 | verify_no_other_packets( self ) |
| 313 | |
| 314 | finally: |
| 315 | delete_all_flows( self.controller ) |
| 316 | delete_groups( self.controller, groups ) |
| 317 | delete_all_groups( self.controller ) |
| 318 | |
| 319 | class L2ForwardingStackedVLAN4( base_tests.SimpleDataPlane ): |
| 320 | """ |
| 321 | Verify the proper operation of the pipeline part which includes VLAN table |
| 322 | and VLAN 1 table. This is necessary for classify packets in VPWS. In this test |
| 323 | case we verify the change of outer vlan popping the tag in VLAN 1 table. |
| 324 | |
| 325 | One rules is necessary in VLAN table (10): |
| 326 | 1) inPort = 12 (Physical) vlanId:mask = 0x1ff2:0x1fff (VLAN 4082) | |
| 327 | GoTo = 11 (VLAN 1) popVlanAction ovid = 8178 | |
| 328 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 329 | |
| 330 | One rules is necessary in VLAN table (11): |
| 331 | 1) inPort = 12 (Physical) vlanId = 0x1f8e (VLAN 3982) ovid = 0x1ff2 (VLAN 4082) | |
| 332 | GoTo = 20 (Termination MAC) | |
| 333 | priority = 0 hard_time = 0 idle_time = 0 cookie = 2 |
| 334 | |
| 335 | In this test case: |
| 336 | 1) outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) |
| 337 | 2) inner_vlan_id = (MAX_INTERNAL_VLAN - 100 - port_no) |
| 338 | |
| 339 | The remaining part of the test is based on the use of the bridging table |
| 340 | """ |
| 341 | |
| 342 | MAX_INTERNAL_VLAN = 4094 |
| 343 | |
| 344 | def runTest( self ): |
| 345 | groups = Queue.LifoQueue( ) |
| 346 | try: |
| 347 | if len( config[ "port_map" ] ) < 2: |
| 348 | logging.info( "Port count less than 2, can't run this case" ) |
| 349 | return |
| 350 | |
| 351 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 352 | for in_port in ports: |
| 353 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 354 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 355 | add_one_vlan_table_flow( |
| 356 | self.controller, |
| 357 | in_port, |
| 358 | vlan_id=outer_vlan_id, |
| 359 | flag=VLAN_TABLE_FLAG_ONLY_STACKED |
| 360 | ) |
| 361 | add_one_vlan_1_table_flow( |
| 362 | self.controller, |
| 363 | in_port, |
| 364 | new_outer_vlan_id=-1, |
| 365 | outer_vlan_id=outer_vlan_id, |
| 366 | inner_vlan_id=inner_vlan_id, |
| 367 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 368 | ) |
| 369 | for out_port in ports: |
| 370 | if out_port == in_port: |
| 371 | continue |
| 372 | L2gid, l2msg = add_one_l2_interface_group( |
| 373 | self.controller, |
| 374 | out_port, |
| 375 | inner_vlan_id, |
| 376 | True, |
| 377 | False |
| 378 | ) |
| 379 | groups.put( L2gid ) |
| 380 | add_bridge_flow( |
| 381 | self.controller, |
| 382 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 383 | inner_vlan_id, |
| 384 | L2gid, |
| 385 | True |
| 386 | ) |
| 387 | |
| 388 | do_barrier( self.controller ) |
| 389 | |
| 390 | for in_port in ports: |
| 391 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 392 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 393 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 394 | |
| 395 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 396 | pktlen=112, |
| 397 | out_dl_vlan_enable=True, |
| 398 | out_vlan_vid=outer_vlan_id, |
| 399 | in_dl_vlan_enable=True, |
| 400 | in_vlan_vid=inner_vlan_id, |
| 401 | eth_dst=mac_dst, |
| 402 | ) |
| 403 | pkt = str( parsed_pkt ) |
| 404 | self.dataplane.send( in_port, pkt ) |
| 405 | |
| 406 | # change dest based on port number |
| 407 | for out_port in ports: |
| 408 | parsed_pkt = simple_tcp_packet( |
| 409 | pktlen=108, |
| 410 | dl_vlan_enable=True, |
| 411 | vlan_vid=inner_vlan_id, |
| 412 | eth_dst=mac_dst, |
| 413 | ) |
| 414 | pkt = str( parsed_pkt ) |
| 415 | if out_port == in_port: |
| 416 | verify_no_packet( self, pkt, in_port ) |
| 417 | continue |
| 418 | verify_packet( self, pkt, out_port ) |
| 419 | verify_no_other_packets( self ) |
| 420 | |
| 421 | finally: |
| 422 | delete_all_flows( self.controller ) |
| 423 | delete_groups( self.controller, groups ) |
| 424 | delete_all_groups( self.controller ) |
| 425 | |
| 426 | class L2ForwardingStackedVLAN5( base_tests.SimpleDataPlane ): |
| 427 | """ |
| 428 | Verify the proper operation of the pipeline part which includes VLAN table |
| 429 | and VLAN 1 table. This is necessary for classify packets in VPWS. In this test |
| 430 | case we verify the change of outer vlan in VLAN table. |
| 431 | |
| 432 | One rules is necessary in VLAN table (10): |
| 433 | 1) inPort = 12 (Physical) vlanId:mask = 0x1ff2:0x1fff (VLAN 4082) | |
| 434 | GoTo = 20 (VLAN 1) newVlanId = 0x1f2a (VLAN 3882) | |
| 435 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 436 | |
| 437 | In this test case: |
| 438 | 1) outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) |
| 439 | 3) new_outer_vlan_id = (MAX_INTERNAL_VLAN - 200 - port_no) |
| 440 | |
| 441 | The remaining part of the test is based on the use of the bridging table |
| 442 | """ |
| 443 | |
| 444 | MAX_INTERNAL_VLAN = 4094 |
| 445 | |
| 446 | def runTest( self ): |
| 447 | groups = Queue.LifoQueue( ) |
| 448 | try: |
| 449 | if len( config[ "port_map" ] ) < 2: |
| 450 | logging.info( "Port count less than 2, can't run this case" ) |
| 451 | return |
| 452 | |
| 453 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 454 | for in_port in ports: |
| 455 | new_outer_vlan_id = MAX_INTERNAL_VLAN - 200 - in_port |
| 456 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 457 | add_one_vlan_table_flow_translation( |
| 458 | self.controller, |
| 459 | in_port, |
| 460 | vlan_id=outer_vlan_id, |
| 461 | new_vlan_id=new_outer_vlan_id, |
| 462 | vrf=0, |
| 463 | flag=VLAN_TABLE_FLAG_ONLY_TAG, |
| 464 | send_barrier=False |
| 465 | ) |
| 466 | for out_port in ports: |
| 467 | if out_port == in_port: |
| 468 | continue |
| 469 | L2gid, l2msg = add_one_l2_interface_group( |
| 470 | self.controller, |
| 471 | out_port, |
| 472 | new_outer_vlan_id, |
| 473 | True, |
| 474 | False |
| 475 | ) |
| 476 | groups.put( L2gid ) |
| 477 | add_bridge_flow( |
| 478 | self.controller, |
| 479 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 480 | new_outer_vlan_id, |
| 481 | L2gid, |
| 482 | True |
| 483 | ) |
| 484 | |
| 485 | do_barrier( self.controller ) |
| 486 | |
| 487 | for in_port in ports: |
| 488 | new_outer_vlan_id = MAX_INTERNAL_VLAN - 200 - in_port |
| 489 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 490 | inner_vlan_id =MAX_INTERNAL_VLAN - 100 - in_port |
| 491 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 492 | |
| 493 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 494 | pktlen=112, |
| 495 | out_dl_vlan_enable=True, |
| 496 | out_vlan_vid=outer_vlan_id, |
| 497 | in_dl_vlan_enable=True, |
| 498 | in_vlan_vid=inner_vlan_id, |
| 499 | eth_dst=mac_dst, |
| 500 | ) |
| 501 | pkt = str( parsed_pkt ) |
| 502 | self.dataplane.send( in_port, pkt ) |
| 503 | |
| 504 | # change dest based on port number |
| 505 | for out_port in ports: |
| 506 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 507 | pktlen=112, |
| 508 | out_dl_vlan_enable=True, |
| 509 | out_vlan_vid=new_outer_vlan_id, |
| 510 | in_dl_vlan_enable=True, |
| 511 | in_vlan_vid=inner_vlan_id, |
| 512 | eth_dst=mac_dst, |
| 513 | ) |
| 514 | pkt = str( parsed_pkt ) |
| 515 | if out_port == in_port: |
| 516 | verify_no_packet( self, pkt, in_port ) |
| 517 | continue |
| 518 | verify_packet( self, pkt, out_port ) |
| 519 | verify_no_other_packets( self ) |
| 520 | |
| 521 | finally: |
| 522 | delete_all_flows( self.controller ) |
| 523 | delete_groups( self.controller, groups ) |
| 524 | delete_all_groups( self.controller ) |
| 525 | |
| 526 | class L2ForwardingStackedVLAN6( base_tests.SimpleDataPlane ): |
| 527 | """ |
| 528 | Verify the proper operation of the pipeline part which includes VLAN table. |
| 529 | This is necessary for classify packets priority tagged. In this test |
| 530 | case we verify the change of outer vlan in VLAN table. |
| 531 | |
| 532 | Two rules are necessary in VLAN table (10): |
| 533 | 1) inPort = 12 (Physical) vlanId:mask = 0x1000:0x1fff (VLAN 0) | |
| 534 | GoTo = 20 (Termination MAC) newVlanId = 0x1f8e (VLAN 3982) newTpid2 = 0x8100 newVlanId2 = 0x1ff2 (VLAN 4082) | |
| 535 | priority = 0 hard_time = 0 idle_time = 0 cookie = 3 |
| 536 | 2) inPort = 12 (Physical) vlanId:mask = 0x1ff2:0x1fff (VLAN 4082) | |
| 537 | GoTo = 20 (Termination MAC) | |
| 538 | priority = 0 hard_time = 0 idle_time = 0 cookie = 1 |
| 539 | |
| 540 | |
| 541 | In this test case: |
| 542 | 1) outer_vlan_id = (MAX_INTERNAL_VLAN - port_no) |
| 543 | 3) inner_vlan_id = (MAX_INTERNAL_VLAN - 100 - port_no) |
| 544 | |
| 545 | The remaining part of the test is based on the use of the bridging table |
| 546 | """ |
| 547 | |
| 548 | MAX_INTERNAL_VLAN = 4094 |
| 549 | |
| 550 | def runTest( self ): |
| 551 | groups = Queue.LifoQueue( ) |
| 552 | try: |
| 553 | if len( config[ "port_map" ] ) < 2: |
| 554 | logging.info( "Port count less than 2, can't run this case" ) |
| 555 | return |
| 556 | |
| 557 | ports = sorted( config[ "port_map" ].keys( ) ) |
| 558 | for in_port in ports: |
| 559 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 560 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 561 | add_one_vlan_table_flow( |
| 562 | ctrl=self.controller, |
| 563 | of_port=in_port, |
| 564 | vlan_id=outer_vlan_id, |
| 565 | vrf=0, |
| 566 | flag=VLAN_TABLE_FLAG_ONLY_BOTH, |
| 567 | send_barrier=False |
| 568 | ) |
| 569 | add_one_vlan_table_flow( |
| 570 | ctrl=self.controller, |
| 571 | of_port=in_port, |
| 572 | out_vlan_id=outer_vlan_id, |
| 573 | vlan_id=inner_vlan_id, |
| 574 | vrf=0, |
| 575 | flag=VLAN_TABLE_FLAG_PRIORITY, |
| 576 | send_barrier=False |
| 577 | ) |
| 578 | for out_port in ports: |
| 579 | if out_port == in_port: |
| 580 | continue |
| 581 | L2gid, l2msg = add_one_l2_interface_group( |
| 582 | self.controller, |
| 583 | out_port, |
| 584 | outer_vlan_id, |
| 585 | True, |
| 586 | False |
| 587 | ) |
| 588 | groups.put( L2gid ) |
| 589 | add_bridge_flow( |
| 590 | self.controller, |
| 591 | [ 0x00, 0x12, 0x34, 0x56, 0x78, in_port ], |
| 592 | outer_vlan_id, |
| 593 | L2gid, |
| 594 | True |
| 595 | ) |
| 596 | |
| 597 | do_barrier( self.controller ) |
| 598 | |
| 599 | for in_port in ports: |
| 600 | outer_vlan_id = MAX_INTERNAL_VLAN - in_port |
| 601 | inner_vlan_id = MAX_INTERNAL_VLAN - 100 - in_port |
| 602 | mac_dst = '00:12:34:56:78:%02X' % in_port |
| 603 | |
| 604 | parsed_pkt = simple_tcp_packet( |
| 605 | pktlen=112, |
| 606 | dl_vlan_enable=True, |
| 607 | vlan_vid=0, |
| 608 | eth_dst=mac_dst, |
| 609 | ) |
| 610 | pkt = str( parsed_pkt ) |
| 611 | self.dataplane.send( in_port, pkt ) |
| 612 | |
| 613 | # change dest based on port number |
| 614 | for out_port in ports: |
| 615 | parsed_pkt = simple_tcp_packet_two_vlan( |
| 616 | pktlen=116, |
| 617 | out_dl_vlan_enable=True, |
| 618 | out_vlan_vid=outer_vlan_id, |
| 619 | in_dl_vlan_enable=True, |
| 620 | in_vlan_vid=inner_vlan_id, |
| 621 | eth_dst=mac_dst, |
| 622 | ) |
| 623 | pkt = str( parsed_pkt ) |
| 624 | if out_port == in_port: |
| 625 | verify_no_packet( self, pkt, in_port ) |
| 626 | continue |
| 627 | verify_packet( self, pkt, out_port ) |
| 628 | verify_no_other_packets( self ) |
| 629 | |
| 630 | finally: |
| 631 | delete_all_flows( self.controller ) |
| 632 | delete_groups( self.controller, groups ) |
| 633 | delete_all_groups( self.controller ) |