Pier | 1e4e98e | 2016-10-26 14:36:05 -0700 | [diff] [blame^] | 1 | """ |
| 2 | Check README file |
| 3 | """ |
| 4 | import Queue |
| 5 | |
| 6 | import itertools |
| 7 | from oftest import config |
| 8 | import inspect |
| 9 | import logging |
| 10 | import oftest.base_tests as base_tests |
| 11 | import ofp |
| 12 | from oftest.testutils import * |
| 13 | from accton_util import * |
| 14 | from utils import * |
| 15 | import time |
| 16 | |
| 17 | class PacketInICMPv6( base_tests.SimpleDataPlane ): |
| 18 | """ |
| 19 | Verify ACL rule for ICMPv6 packet. The expected behavior is |
| 20 | Packet-In message in the control plane. |
| 21 | """ |
| 22 | |
| 23 | def runTest( self ): |
| 24 | try: |
| 25 | # We insert an ACL rule for ICMPv6 |
| 26 | add_acl_rule( |
| 27 | self.controller, |
| 28 | eth_type=0x86dd, |
| 29 | ip_proto=0x3A, |
| 30 | send_barrier=False |
| 31 | ) |
| 32 | |
| 33 | ports = config[ "port_map" ].keys( ) |
| 34 | for in_port in ports: |
| 35 | # Neighbor solicitation |
| 36 | parsed_icmpv6_pkt = simple_icmpv6_packet(icmp_type=135) |
| 37 | icmpv6_pkt = str( parsed_icmpv6_pkt ) |
| 38 | self.dataplane.send(in_port, icmpv6_pkt) |
| 39 | verify_packet_in(self, icmpv6_pkt, in_port, ofp.OFPR_ACTION) |
| 40 | verify_no_other_packets( self ) |
| 41 | # Neighbor advertisement |
| 42 | parsed_icmpv6_pkt = simple_icmpv6_packet(icmp_type=136) |
| 43 | icmpv6_pkt = str( parsed_icmpv6_pkt ) |
| 44 | self.dataplane.send(in_port, icmpv6_pkt) |
| 45 | verify_packet_in(self, icmpv6_pkt, in_port, ofp.OFPR_ACTION) |
| 46 | verify_no_other_packets( self ) |
| 47 | |
| 48 | finally: |
| 49 | delete_all_flows( self.controller ) |
| 50 | delete_all_groups( self.controller ) |
| 51 | |
| 52 | class PacketInIPv6Table( base_tests.SimpleDataPlane ): |
| 53 | """ |
| 54 | Verify Packet-in message from IP table when controller action is used |
| 55 | Send a packet to each dataplane port and verify that a packet |
| 56 | in message is received from the controller for each |
| 57 | #todo verify you stop receiving after adding rule |
| 58 | """ |
| 59 | |
| 60 | def runTest( self ): |
| 61 | try: |
| 62 | |
| 63 | if len( config[ "port_map" ] ) < 2: |
| 64 | logging.info( "Port count less than 2, can't run this case" ) |
| 65 | return |
| 66 | |
| 67 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0x22, 0x00 ] |
| 68 | # We are assuming that the port number are xx" |
| 69 | dip = "2000::%s" |
| 70 | sip = "2000::1" |
| 71 | ports = config[ "port_map" ].keys( ) |
| 72 | |
| 73 | for pair in itertools.product(ports, ports): |
| 74 | # we generate all possible products |
| 75 | in_port = pair[0] |
| 76 | out_port = pair[1] |
| 77 | vlan_id = in_port |
| 78 | dst_mac[ 5 ] = vlan_id |
| 79 | dst_ip = dip % in_port |
| 80 | # We fill the unicast_table |
| 81 | add_unicast_v6_routing_flow( |
| 82 | ctrl=self.controller, |
| 83 | eth_type=0x86dd, |
| 84 | dst_ip=dst_ip, |
| 85 | mask="ffff:ffff:ffff:ffff::", |
| 86 | action_group_id=None, |
| 87 | vrf=0, |
| 88 | send_ctrl=True, |
| 89 | send_barrier=False |
| 90 | ) |
| 91 | # add termination flow |
| 92 | add_termination_flow( |
| 93 | ctrl=self.controller, |
| 94 | in_port=in_port, |
| 95 | eth_type=0x86dd, |
| 96 | dst_mac=dst_mac, |
| 97 | vlanid=vlan_id |
| 98 | ) |
| 99 | # add vlan table flow |
| 100 | add_one_vlan_table_flow( |
| 101 | ctrl=self.controller, |
| 102 | of_port=in_port, |
| 103 | vlan_id=vlan_id, |
| 104 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 105 | ) |
| 106 | |
| 107 | for port in ports: |
| 108 | vlan_id = port |
| 109 | dst_mac[ 5 ] = vlan_id |
| 110 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 111 | dip_str = dip % port |
| 112 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 113 | pktlen=100, |
| 114 | eth_dst=dst_mac_str, |
| 115 | dl_vlan_enable=True, |
| 116 | vlan_vid=vlan_id, |
| 117 | ipv6_dst=dip_str, |
| 118 | ipv6_src=sip |
| 119 | ) |
| 120 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 121 | self.dataplane.send(port, tcpv6_pkt) |
| 122 | verify_packet_in(self, tcpv6_pkt, port, ofp.OFPR_ACTION) |
| 123 | verify_no_other_packets( self ) |
| 124 | |
| 125 | finally: |
| 126 | delete_all_flows( self.controller ) |
| 127 | delete_all_groups( self.controller ) |
| 128 | |
| 129 | class _128UcastUnTagged( base_tests.SimpleDataPlane ): |
| 130 | """ Verify /128 IP forwarding to L3 Interface""" |
| 131 | |
| 132 | def runTest( self ): |
| 133 | try: |
| 134 | |
| 135 | if len( config[ "port_map" ] ) < 2: |
| 136 | logging.info( "Port count less than 2, can't run this case" ) |
| 137 | return |
| 138 | |
| 139 | Groups = Queue.LifoQueue( ) |
| 140 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 141 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 142 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 143 | # We are assuming that the port number are xx" |
| 144 | dip = "2000::%s" |
| 145 | sip = "2000::1" |
| 146 | ports = config[ "port_map" ].keys( ) |
| 147 | vlan_id = 4094 |
| 148 | |
| 149 | in_port = ports[0] |
| 150 | out_port = ports[1] |
| 151 | r_dst_mac[5] = in_port |
| 152 | intf_src_mac[5] = out_port |
| 153 | dst_mac[5] = out_port |
| 154 | dst_ip = dip % in_port |
| 155 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 156 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 157 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 158 | # We create the L2 group |
| 159 | l2gid, msg = add_one_l2_interface_group( |
| 160 | ctrl=self.controller, |
| 161 | port=out_port, |
| 162 | vlan_id=vlan_id, |
| 163 | is_tagged=False, |
| 164 | send_barrier=True |
| 165 | ) |
| 166 | Groups._put(l2gid) |
| 167 | # We create the L3 group |
| 168 | l3_msg = add_l3_unicast_group( |
| 169 | ctrl=self.controller, |
| 170 | port=out_port, |
| 171 | vlanid=vlan_id, |
| 172 | id=vlan_id, |
| 173 | src_mac=intf_src_mac, |
| 174 | dst_mac=dst_mac, |
| 175 | send_barrier=True |
| 176 | ) |
| 177 | Groups._put( l3_msg.group_id ) |
| 178 | # We fill the unicast_table |
| 179 | add_unicast_v6_routing_flow( |
| 180 | ctrl=self.controller, |
| 181 | eth_type=0x86dd, |
| 182 | dst_ip=dst_ip, |
| 183 | mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", |
| 184 | action_group_id=l3_msg.group_id, |
| 185 | vrf=0, |
| 186 | send_ctrl=False, |
| 187 | send_barrier=True |
| 188 | ) |
| 189 | # add termination flow |
| 190 | add_termination_flow( |
| 191 | ctrl=self.controller, |
| 192 | in_port=in_port, |
| 193 | eth_type=0x86dd, |
| 194 | dst_mac=r_dst_mac, |
| 195 | vlanid=vlan_id, |
| 196 | ) |
| 197 | # add filtering flow |
| 198 | add_one_vlan_table_flow( |
| 199 | ctrl=self.controller, |
| 200 | of_port=in_port, |
| 201 | vlan_id=vlan_id, |
| 202 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 203 | ) |
| 204 | # add assignment flow |
| 205 | add_one_vlan_table_flow( |
| 206 | ctrl=self.controller, |
| 207 | of_port=in_port, |
| 208 | vlan_id=vlan_id, |
| 209 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 210 | ) |
| 211 | |
| 212 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 213 | pktlen=100, |
| 214 | eth_dst=r_dst_mac_str, |
| 215 | ipv6_dst=dst_ip, |
| 216 | ipv6_src=sip |
| 217 | ) |
| 218 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 219 | self.dataplane.send(in_port, tcpv6_pkt) |
| 220 | print_port_stats(self, in_port) |
| 221 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 222 | pktlen=100, |
| 223 | eth_dst=dst_mac_str, |
| 224 | eth_src=intf_src_mac_str, |
| 225 | ipv6_dst=dst_ip, |
| 226 | ipv6_src=sip, |
| 227 | ipv6_hlim=63 |
| 228 | ) |
| 229 | time.sleep(2) |
| 230 | print_port_stats(self, in_port) |
| 231 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 232 | verify_packet(self, tcpv6_pkt, out_port ) |
| 233 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 234 | verify_no_other_packets(self) |
| 235 | |
| 236 | |
| 237 | finally: |
| 238 | delete_all_flows( self.controller ) |
| 239 | delete_groups( self.controller, Groups ) |
| 240 | delete_all_groups( self.controller ) |
| 241 | |
| 242 | class _128ECMPVpn( base_tests.SimpleDataPlane ): |
| 243 | """ Verify MPLS IP VPN Initiation from /128 rule using ECMP """ |
| 244 | |
| 245 | def runTest( self ): |
| 246 | try: |
| 247 | |
| 248 | if len( config[ "port_map" ] ) < 2: |
| 249 | logging.info( "Port count less than 2, can't run this case" ) |
| 250 | return |
| 251 | |
| 252 | Groups = Queue.LifoQueue( ) |
| 253 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 254 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 255 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 256 | # We are assuming that the port number are xx" |
| 257 | dip = "2000::%s" |
| 258 | sip = "2000::1" |
| 259 | ports = config[ "port_map" ].keys( ) |
| 260 | vlan_id = 4094 |
| 261 | mpls_label = 255 |
| 262 | label = (mpls_label, 0, 1, 63) |
| 263 | |
| 264 | in_port = ports[0] |
| 265 | out_port = ports[1] |
| 266 | r_dst_mac[5] = in_port |
| 267 | intf_src_mac[5] = out_port |
| 268 | dst_mac[5] = out_port |
| 269 | dst_ip = dip % in_port |
| 270 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 271 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 272 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 273 | # We create the L2 group |
| 274 | l2gid, msg = add_one_l2_interface_group( |
| 275 | ctrl=self.controller, |
| 276 | port=out_port, |
| 277 | vlan_id=vlan_id, |
| 278 | is_tagged=False, |
| 279 | send_barrier=True |
| 280 | ) |
| 281 | Groups.put(l2gid) |
| 282 | mpls_gid, mpls_msg = add_mpls_intf_group( |
| 283 | ctrl=self.controller, |
| 284 | ref_gid=l2gid, |
| 285 | dst_mac=dst_mac, |
| 286 | src_mac=intf_src_mac, |
| 287 | vid=vlan_id, |
| 288 | index=out_port, |
| 289 | send_barrier=True |
| 290 | ) |
| 291 | Groups.put( mpls_gid ) |
| 292 | # add MPLS L3 VPN group |
| 293 | mpls_label_gid, mpls_label_msg = add_mpls_label_group( |
| 294 | ctrl=self.controller, |
| 295 | subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
| 296 | index=out_port, |
| 297 | ref_gid=mpls_gid, |
| 298 | push_mpls_header=True, |
| 299 | set_mpls_label=mpls_label, |
| 300 | set_bos=1, |
| 301 | cpy_ttl_outward=True, |
| 302 | send_barrier=True |
| 303 | ) |
| 304 | Groups.put( mpls_label_gid ) |
| 305 | # Add ECMP group |
| 306 | ecmp_msg = add_l3_ecmp_group( |
| 307 | ctrl=self.controller, |
| 308 | id=vlan_id, |
| 309 | l3_ucast_groups=[ mpls_label_gid ], |
| 310 | send_barrier=True |
| 311 | ) |
| 312 | Groups.put( ecmp_msg.group_id ) |
| 313 | # We fill the unicast_table |
| 314 | add_unicast_v6_routing_flow( |
| 315 | ctrl=self.controller, |
| 316 | eth_type=0x86dd, |
| 317 | dst_ip=dst_ip, |
| 318 | mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", |
| 319 | action_group_id=ecmp_msg.group_id, |
| 320 | vrf=0, |
| 321 | send_ctrl=False, |
| 322 | send_barrier=True |
| 323 | ) |
| 324 | # add termination flow |
| 325 | add_termination_flow( |
| 326 | ctrl=self.controller, |
| 327 | in_port=in_port, |
| 328 | eth_type=0x86dd, |
| 329 | dst_mac=r_dst_mac, |
| 330 | vlanid=vlan_id |
| 331 | ) |
| 332 | # add filtering flow |
| 333 | add_one_vlan_table_flow( |
| 334 | ctrl=self.controller, |
| 335 | of_port=in_port, |
| 336 | vlan_id=vlan_id, |
| 337 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 338 | ) |
| 339 | # add assignment flow |
| 340 | add_one_vlan_table_flow( |
| 341 | ctrl=self.controller, |
| 342 | of_port=in_port, |
| 343 | vlan_id=vlan_id, |
| 344 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 345 | ) |
| 346 | |
| 347 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 348 | pktlen=100, |
| 349 | eth_dst=r_dst_mac_str, |
| 350 | ipv6_dst=dst_ip, |
| 351 | ipv6_src=sip |
| 352 | ) |
| 353 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 354 | self.dataplane.send(in_port, tcpv6_pkt) |
| 355 | print_port_stats(self, in_port) |
| 356 | parsed_mplsv6_pkt = mplsv6_packet( |
| 357 | pktlen=104, |
| 358 | eth_dst=dst_mac_str, |
| 359 | eth_src=intf_src_mac_str, |
| 360 | ipv6_dst=dst_ip, |
| 361 | ipv6_src=sip, |
| 362 | ipv6_hlim=63, |
| 363 | label=[ label ] |
| 364 | ) |
| 365 | mplsv6_pkt = str( parsed_mplsv6_pkt ) |
| 366 | time.sleep(2) |
| 367 | print_port_stats(self, in_port) |
| 368 | verify_packet(self, mplsv6_pkt, out_port ) |
| 369 | verify_no_packet(self, mplsv6_pkt, in_port ) |
| 370 | verify_no_other_packets(self) |
| 371 | |
| 372 | finally: |
| 373 | delete_all_flows( self.controller ) |
| 374 | delete_groups( self.controller, Groups ) |
| 375 | delete_all_groups( self.controller ) |
| 376 | |
| 377 | class _128ECMPL3( base_tests.SimpleDataPlane ): |
| 378 | """ Verifies /128 IP routing and ECMP """ |
| 379 | |
| 380 | |
| 381 | def runTest( self ): |
| 382 | try: |
| 383 | |
| 384 | if len( config[ "port_map" ] ) < 2: |
| 385 | logging.info( "Port count less than 2, can't run this case" ) |
| 386 | return |
| 387 | |
| 388 | Groups = Queue.LifoQueue( ) |
| 389 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 390 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 391 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 392 | # We are assuming that the port number are xx" |
| 393 | dip = "2000::%s" |
| 394 | sip = "2000::1" |
| 395 | ports = config[ "port_map" ].keys( ) |
| 396 | vlan_id = 4094 |
| 397 | |
| 398 | in_port = ports[0] |
| 399 | out_port = ports[1] |
| 400 | r_dst_mac[5] = in_port |
| 401 | intf_src_mac[5] = out_port |
| 402 | dst_mac[5] = out_port |
| 403 | dst_ip = dip % in_port |
| 404 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 405 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 406 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 407 | # We create the L2 group |
| 408 | l2gid, msg = add_one_l2_interface_group( |
| 409 | ctrl=self.controller, |
| 410 | port=out_port, |
| 411 | vlan_id=vlan_id, |
| 412 | is_tagged=False, |
| 413 | send_barrier=True |
| 414 | ) |
| 415 | Groups.put(l2gid) |
| 416 | # We create the L3 group |
| 417 | l3_msg = add_l3_unicast_group( |
| 418 | ctrl=self.controller, |
| 419 | port=out_port, |
| 420 | vlanid=vlan_id, |
| 421 | id=vlan_id, |
| 422 | src_mac=intf_src_mac, |
| 423 | dst_mac=dst_mac, |
| 424 | send_barrier=True |
| 425 | ) |
| 426 | Groups.put( l3_msg.group_id ) |
| 427 | # Add ECMP group |
| 428 | ecmp_msg = add_l3_ecmp_group( |
| 429 | ctrl=self.controller, |
| 430 | id=vlan_id, |
| 431 | l3_ucast_groups=[ l3_msg.group_id ], |
| 432 | send_barrier=True |
| 433 | ) |
| 434 | Groups.put( ecmp_msg.group_id ) |
| 435 | # We fill the unicast_table |
| 436 | add_unicast_v6_routing_flow( |
| 437 | ctrl=self.controller, |
| 438 | eth_type=0x86dd, |
| 439 | dst_ip=dst_ip, |
| 440 | mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", |
| 441 | action_group_id=ecmp_msg.group_id, |
| 442 | vrf=0, |
| 443 | send_ctrl=False, |
| 444 | send_barrier=True |
| 445 | ) |
| 446 | # add termination flow |
| 447 | add_termination_flow( |
| 448 | ctrl=self.controller, |
| 449 | in_port=in_port, |
| 450 | eth_type=0x86dd, |
| 451 | dst_mac=r_dst_mac, |
| 452 | vlanid=vlan_id |
| 453 | ) |
| 454 | # add filtering flow |
| 455 | add_one_vlan_table_flow( |
| 456 | ctrl=self.controller, |
| 457 | of_port=in_port, |
| 458 | vlan_id=vlan_id, |
| 459 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 460 | ) |
| 461 | # add assignment flow |
| 462 | add_one_vlan_table_flow( |
| 463 | ctrl=self.controller, |
| 464 | of_port=in_port, |
| 465 | vlan_id=vlan_id, |
| 466 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 467 | ) |
| 468 | |
| 469 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 470 | pktlen=100, |
| 471 | eth_dst=r_dst_mac_str, |
| 472 | ipv6_dst=dst_ip, |
| 473 | ipv6_src=sip |
| 474 | ) |
| 475 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 476 | self.dataplane.send(in_port, tcpv6_pkt) |
| 477 | print_port_stats(self, in_port) |
| 478 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 479 | pktlen=100, |
| 480 | eth_dst=dst_mac_str, |
| 481 | eth_src=intf_src_mac_str, |
| 482 | ipv6_dst=dst_ip, |
| 483 | ipv6_src=sip, |
| 484 | ipv6_hlim=63 |
| 485 | ) |
| 486 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 487 | time.sleep(2) |
| 488 | print_port_stats(self, in_port) |
| 489 | verify_packet(self, tcpv6_pkt, out_port ) |
| 490 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 491 | verify_no_other_packets(self) |
| 492 | |
| 493 | finally: |
| 494 | print "END" |
| 495 | #delete_all_flows( self.controller ) |
| 496 | #delete_groups( self.controller, Groups ) |
| 497 | #delete_all_groups( self.controller ) |
| 498 | |
| 499 | class _64UcastUntagged( base_tests.SimpleDataPlane ): |
| 500 | """ Verify /64 IP forwarding to L3 Interface""" |
| 501 | |
| 502 | def runTest( self ): |
| 503 | try: |
| 504 | |
| 505 | if len( config[ "port_map" ] ) < 2: |
| 506 | logging.info( "Port count less than 2, can't run this case" ) |
| 507 | return |
| 508 | |
| 509 | Groups = Queue.LifoQueue( ) |
| 510 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 511 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 512 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 513 | # We are assuming that the port number are xx" |
| 514 | dip = "2000::%s" |
| 515 | sip = "2000::1" |
| 516 | ports = config[ "port_map" ].keys( ) |
| 517 | vlan_id = 4094 |
| 518 | |
| 519 | in_port = ports[0] |
| 520 | out_port = ports[1] |
| 521 | r_dst_mac[5] = in_port |
| 522 | intf_src_mac[5] = out_port |
| 523 | dst_mac[5] = out_port |
| 524 | dst_ip = dip % in_port |
| 525 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 526 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 527 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 528 | # We create the L2 group |
| 529 | l2gid, msg = add_one_l2_interface_group( |
| 530 | ctrl=self.controller, |
| 531 | port=out_port, |
| 532 | vlan_id=vlan_id, |
| 533 | is_tagged=False, |
| 534 | send_barrier=True |
| 535 | ) |
| 536 | Groups._put(l2gid) |
| 537 | # We create the L3 group |
| 538 | l3_msg = add_l3_unicast_group( |
| 539 | ctrl=self.controller, |
| 540 | port=out_port, |
| 541 | vlanid=vlan_id, |
| 542 | id=vlan_id, |
| 543 | src_mac=intf_src_mac, |
| 544 | dst_mac=dst_mac, |
| 545 | send_barrier=True |
| 546 | ) |
| 547 | Groups._put( l3_msg.group_id ) |
| 548 | # We fill the unicast_table |
| 549 | add_unicast_v6_routing_flow( |
| 550 | ctrl=self.controller, |
| 551 | eth_type=0x86dd, |
| 552 | dst_ip=dst_ip, |
| 553 | mask="ffff:ffff:ffff:ffff::", |
| 554 | action_group_id=l3_msg.group_id, |
| 555 | vrf=0, |
| 556 | send_ctrl=False, |
| 557 | send_barrier=True |
| 558 | ) |
| 559 | # add termination flow |
| 560 | add_termination_flow( |
| 561 | ctrl=self.controller, |
| 562 | in_port=in_port, |
| 563 | eth_type=0x86dd, |
| 564 | dst_mac=r_dst_mac, |
| 565 | vlanid=vlan_id, |
| 566 | ) |
| 567 | # add filtering flow |
| 568 | add_one_vlan_table_flow( |
| 569 | ctrl=self.controller, |
| 570 | of_port=in_port, |
| 571 | vlan_id=vlan_id, |
| 572 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 573 | ) |
| 574 | # add assignment flow |
| 575 | add_one_vlan_table_flow( |
| 576 | ctrl=self.controller, |
| 577 | of_port=in_port, |
| 578 | vlan_id=vlan_id, |
| 579 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 580 | ) |
| 581 | |
| 582 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 583 | pktlen=100, |
| 584 | eth_dst=r_dst_mac_str, |
| 585 | ipv6_dst=dst_ip, |
| 586 | ipv6_src=sip |
| 587 | ) |
| 588 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 589 | self.dataplane.send(in_port, tcpv6_pkt) |
| 590 | print_port_stats(self, in_port) |
| 591 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 592 | pktlen=100, |
| 593 | eth_dst=dst_mac_str, |
| 594 | eth_src=intf_src_mac_str, |
| 595 | ipv6_dst=dst_ip, |
| 596 | ipv6_src=sip, |
| 597 | ipv6_hlim=63 |
| 598 | ) |
| 599 | time.sleep(2) |
| 600 | print_port_stats(self, in_port) |
| 601 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 602 | verify_packet(self, tcpv6_pkt, out_port ) |
| 603 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 604 | verify_no_other_packets(self) |
| 605 | |
| 606 | finally: |
| 607 | delete_all_flows( self.controller ) |
| 608 | delete_groups( self.controller, Groups ) |
| 609 | delete_all_groups( self.controller ) |
| 610 | |
| 611 | class _64ECMPVpn( base_tests.SimpleDataPlane ): |
| 612 | """ Verify MPLS IP VPN Initiation from /64 rule using ECMP """ |
| 613 | |
| 614 | def runTest( self ): |
| 615 | try: |
| 616 | |
| 617 | if len( config[ "port_map" ] ) < 2: |
| 618 | logging.info( "Port count less than 2, can't run this case" ) |
| 619 | return |
| 620 | |
| 621 | Groups = Queue.LifoQueue( ) |
| 622 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 623 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 624 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 625 | # We are assuming that the port number are xx" |
| 626 | dip = "2000::%s" |
| 627 | sip = "2000::1" |
| 628 | ports = config[ "port_map" ].keys( ) |
| 629 | vlan_id = 4094 |
| 630 | mpls_label = 255 |
| 631 | label = (mpls_label, 0, 1, 63) |
| 632 | |
| 633 | in_port = ports[0] |
| 634 | out_port = ports[1] |
| 635 | r_dst_mac[5] = in_port |
| 636 | intf_src_mac[5] = out_port |
| 637 | dst_mac[5] = out_port |
| 638 | dst_ip = dip % in_port |
| 639 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 640 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 641 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 642 | # We create the L2 group |
| 643 | l2gid, msg = add_one_l2_interface_group( |
| 644 | ctrl=self.controller, |
| 645 | port=out_port, |
| 646 | vlan_id=vlan_id, |
| 647 | is_tagged=False, |
| 648 | send_barrier=True |
| 649 | ) |
| 650 | Groups.put(l2gid) |
| 651 | mpls_gid, mpls_msg = add_mpls_intf_group( |
| 652 | ctrl=self.controller, |
| 653 | ref_gid=l2gid, |
| 654 | dst_mac=dst_mac, |
| 655 | src_mac=intf_src_mac, |
| 656 | vid=vlan_id, |
| 657 | index=out_port, |
| 658 | send_barrier=True |
| 659 | ) |
| 660 | Groups.put( mpls_gid ) |
| 661 | # add MPLS L3 VPN group |
| 662 | mpls_label_gid, mpls_label_msg = add_mpls_label_group( |
| 663 | ctrl=self.controller, |
| 664 | subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
| 665 | index=out_port, |
| 666 | ref_gid=mpls_gid, |
| 667 | push_mpls_header=True, |
| 668 | set_mpls_label=mpls_label, |
| 669 | set_bos=1, |
| 670 | cpy_ttl_outward=True, |
| 671 | send_barrier=True |
| 672 | ) |
| 673 | Groups.put( mpls_label_gid ) |
| 674 | # Add ECMP group |
| 675 | ecmp_msg = add_l3_ecmp_group( |
| 676 | ctrl=self.controller, |
| 677 | id=vlan_id, |
| 678 | l3_ucast_groups=[ mpls_label_gid ], |
| 679 | send_barrier=True |
| 680 | ) |
| 681 | Groups.put( ecmp_msg.group_id ) |
| 682 | # We fill the unicast_table |
| 683 | add_unicast_v6_routing_flow( |
| 684 | ctrl=self.controller, |
| 685 | eth_type=0x86dd, |
| 686 | dst_ip=dst_ip, |
| 687 | mask="ffff:ffff:ffff:ffff::", |
| 688 | action_group_id=ecmp_msg.group_id, |
| 689 | vrf=0, |
| 690 | send_ctrl=False, |
| 691 | send_barrier=True |
| 692 | ) |
| 693 | # add termination flow |
| 694 | add_termination_flow( |
| 695 | ctrl=self.controller, |
| 696 | in_port=in_port, |
| 697 | eth_type=0x86dd, |
| 698 | dst_mac=r_dst_mac, |
| 699 | vlanid=vlan_id |
| 700 | ) |
| 701 | # add filtering flow |
| 702 | add_one_vlan_table_flow( |
| 703 | ctrl=self.controller, |
| 704 | of_port=in_port, |
| 705 | vlan_id=vlan_id, |
| 706 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 707 | ) |
| 708 | # add assignment flow |
| 709 | add_one_vlan_table_flow( |
| 710 | ctrl=self.controller, |
| 711 | of_port=in_port, |
| 712 | vlan_id=vlan_id, |
| 713 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 714 | ) |
| 715 | |
| 716 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 717 | pktlen=100, |
| 718 | eth_dst=r_dst_mac_str, |
| 719 | ipv6_dst=dst_ip, |
| 720 | ipv6_src=sip |
| 721 | ) |
| 722 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 723 | self.dataplane.send(in_port, tcpv6_pkt) |
| 724 | print_port_stats(self, in_port) |
| 725 | parsed_mplsv6_pkt = mplsv6_packet( |
| 726 | pktlen=104, |
| 727 | eth_dst=dst_mac_str, |
| 728 | eth_src=intf_src_mac_str, |
| 729 | ipv6_dst=dst_ip, |
| 730 | ipv6_src=sip, |
| 731 | ipv6_hlim=63, |
| 732 | label=[ label ] |
| 733 | ) |
| 734 | mplsv6_pkt = str( parsed_mplsv6_pkt ) |
| 735 | time.sleep(2) |
| 736 | print_port_stats(self, in_port) |
| 737 | verify_packet(self, mplsv6_pkt, out_port ) |
| 738 | verify_no_packet(self, mplsv6_pkt, in_port ) |
| 739 | verify_no_other_packets(self) |
| 740 | |
| 741 | finally: |
| 742 | delete_all_flows( self.controller ) |
| 743 | delete_groups( self.controller, Groups ) |
| 744 | delete_all_groups( self.controller ) |
| 745 | |
| 746 | class _64ECMPL3( base_tests.SimpleDataPlane ): |
| 747 | """ Verifies /64 IP routing and ECMP """ |
| 748 | |
| 749 | |
| 750 | def runTest( self ): |
| 751 | try: |
| 752 | |
| 753 | if len( config[ "port_map" ] ) < 2: |
| 754 | logging.info( "Port count less than 2, can't run this case" ) |
| 755 | return |
| 756 | |
| 757 | Groups = Queue.LifoQueue( ) |
| 758 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 759 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 760 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 761 | # We are assuming that the port number are xx" |
| 762 | dip = "2000::%s" |
| 763 | sip = "2000::1" |
| 764 | ports = config[ "port_map" ].keys( ) |
| 765 | vlan_id = 4094 |
| 766 | |
| 767 | in_port = ports[0] |
| 768 | out_port = ports[1] |
| 769 | r_dst_mac[5] = in_port |
| 770 | intf_src_mac[5] = out_port |
| 771 | dst_mac[5] = out_port |
| 772 | dst_ip = dip % in_port |
| 773 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 774 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 775 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 776 | # We create the L2 group |
| 777 | l2gid, msg = add_one_l2_interface_group( |
| 778 | ctrl=self.controller, |
| 779 | port=out_port, |
| 780 | vlan_id=vlan_id, |
| 781 | is_tagged=False, |
| 782 | send_barrier=True |
| 783 | ) |
| 784 | Groups.put(l2gid) |
| 785 | # We create the L3 group |
| 786 | l3_msg = add_l3_unicast_group( |
| 787 | ctrl=self.controller, |
| 788 | port=out_port, |
| 789 | vlanid=vlan_id, |
| 790 | id=vlan_id, |
| 791 | src_mac=intf_src_mac, |
| 792 | dst_mac=dst_mac, |
| 793 | send_barrier=True |
| 794 | ) |
| 795 | Groups.put( l3_msg.group_id ) |
| 796 | # Add ECMP group |
| 797 | ecmp_msg = add_l3_ecmp_group( |
| 798 | ctrl=self.controller, |
| 799 | id=vlan_id, |
| 800 | l3_ucast_groups=[ l3_msg.group_id ], |
| 801 | send_barrier=True |
| 802 | ) |
| 803 | Groups.put( ecmp_msg.group_id ) |
| 804 | # We fill the unicast_table |
| 805 | add_unicast_v6_routing_flow( |
| 806 | ctrl=self.controller, |
| 807 | eth_type=0x86dd, |
| 808 | dst_ip=dst_ip, |
| 809 | mask="ffff:ffff:ffff:ffff::", |
| 810 | action_group_id=ecmp_msg.group_id, |
| 811 | vrf=0, |
| 812 | send_ctrl=False, |
| 813 | send_barrier=True |
| 814 | ) |
| 815 | # add termination flow |
| 816 | add_termination_flow( |
| 817 | ctrl=self.controller, |
| 818 | in_port=in_port, |
| 819 | eth_type=0x86dd, |
| 820 | dst_mac=r_dst_mac, |
| 821 | vlanid=vlan_id |
| 822 | ) |
| 823 | # add filtering flow |
| 824 | add_one_vlan_table_flow( |
| 825 | ctrl=self.controller, |
| 826 | of_port=in_port, |
| 827 | vlan_id=vlan_id, |
| 828 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 829 | ) |
| 830 | # add assignment flow |
| 831 | add_one_vlan_table_flow( |
| 832 | ctrl=self.controller, |
| 833 | of_port=in_port, |
| 834 | vlan_id=vlan_id, |
| 835 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 836 | ) |
| 837 | |
| 838 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 839 | pktlen=100, |
| 840 | eth_dst=r_dst_mac_str, |
| 841 | ipv6_dst=dst_ip, |
| 842 | ipv6_src=sip |
| 843 | ) |
| 844 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 845 | self.dataplane.send(in_port, tcpv6_pkt) |
| 846 | print_port_stats(self, in_port) |
| 847 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 848 | pktlen=100, |
| 849 | eth_dst=dst_mac_str, |
| 850 | eth_src=intf_src_mac_str, |
| 851 | ipv6_dst=dst_ip, |
| 852 | ipv6_src=sip, |
| 853 | ipv6_hlim=63 |
| 854 | ) |
| 855 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 856 | time.sleep(2) |
| 857 | print_port_stats(self, in_port) |
| 858 | verify_packet(self, tcpv6_pkt, out_port ) |
| 859 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 860 | verify_no_other_packets(self) |
| 861 | |
| 862 | finally: |
| 863 | delete_all_flows( self.controller ) |
| 864 | delete_groups( self.controller, Groups ) |
| 865 | delete_all_groups( self.controller ) |
| 866 | |
| 867 | class _0UcastV6( base_tests.SimpleDataPlane ): |
| 868 | """ Verify default gateway IP forwarding to L3 Interface ( /0 rule ) """ |
| 869 | |
| 870 | def runTest( self ): |
| 871 | try: |
| 872 | |
| 873 | if len( config[ "port_map" ] ) < 2: |
| 874 | logging.info( "Port count less than 2, can't run this case" ) |
| 875 | return |
| 876 | |
| 877 | Groups = Queue.LifoQueue( ) |
| 878 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 879 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 880 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 881 | # We are assuming that the port number are xx" |
| 882 | dip = "2000::%s" |
| 883 | sip = "2000::1" |
| 884 | ports = config[ "port_map" ].keys( ) |
| 885 | vlan_id = 4094 |
| 886 | |
| 887 | in_port = ports[0] |
| 888 | out_port = ports[1] |
| 889 | r_dst_mac[5] = in_port |
| 890 | intf_src_mac[5] = out_port |
| 891 | dst_mac[5] = out_port |
| 892 | dst_ip = dip % in_port |
| 893 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 894 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 895 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 896 | # We create the L2 group |
| 897 | l2gid, msg = add_one_l2_interface_group( |
| 898 | ctrl=self.controller, |
| 899 | port=out_port, |
| 900 | vlan_id=vlan_id, |
| 901 | is_tagged=False, |
| 902 | send_barrier=True |
| 903 | ) |
| 904 | Groups._put(l2gid) |
| 905 | # We create the L3 group |
| 906 | l3_msg = add_l3_unicast_group( |
| 907 | ctrl=self.controller, |
| 908 | port=out_port, |
| 909 | vlanid=vlan_id, |
| 910 | id=vlan_id, |
| 911 | src_mac=intf_src_mac, |
| 912 | dst_mac=dst_mac, |
| 913 | send_barrier=True |
| 914 | ) |
| 915 | Groups._put( l3_msg.group_id ) |
| 916 | # We fill the unicast_table |
| 917 | add_unicast_v6_routing_flow( |
| 918 | ctrl=self.controller, |
| 919 | eth_type=0x86dd, |
| 920 | dst_ip="::", |
| 921 | mask="::", |
| 922 | action_group_id=l3_msg.group_id, |
| 923 | vrf=0, |
| 924 | send_ctrl=False, |
| 925 | send_barrier=True |
| 926 | ) |
| 927 | # add termination flow |
| 928 | add_termination_flow( |
| 929 | ctrl=self.controller, |
| 930 | in_port=in_port, |
| 931 | eth_type=0x86dd, |
| 932 | dst_mac=r_dst_mac, |
| 933 | vlanid=vlan_id, |
| 934 | ) |
| 935 | # add filtering flow |
| 936 | add_one_vlan_table_flow( |
| 937 | ctrl=self.controller, |
| 938 | of_port=in_port, |
| 939 | vlan_id=vlan_id, |
| 940 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 941 | ) |
| 942 | # add assignment flow |
| 943 | add_one_vlan_table_flow( |
| 944 | ctrl=self.controller, |
| 945 | of_port=in_port, |
| 946 | vlan_id=vlan_id, |
| 947 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 948 | ) |
| 949 | |
| 950 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 951 | pktlen=100, |
| 952 | eth_dst=r_dst_mac_str, |
| 953 | ipv6_dst=dst_ip, |
| 954 | ipv6_src=sip |
| 955 | ) |
| 956 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 957 | self.dataplane.send(in_port, tcpv6_pkt) |
| 958 | print_port_stats(self, in_port) |
| 959 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 960 | pktlen=100, |
| 961 | eth_dst=dst_mac_str, |
| 962 | eth_src=intf_src_mac_str, |
| 963 | ipv6_dst=dst_ip, |
| 964 | ipv6_src=sip, |
| 965 | ipv6_hlim=63 |
| 966 | ) |
| 967 | time.sleep(2) |
| 968 | print_port_stats(self, in_port) |
| 969 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 970 | verify_packet(self, tcpv6_pkt, out_port ) |
| 971 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 972 | verify_no_other_packets(self) |
| 973 | |
| 974 | finally: |
| 975 | delete_all_flows( self.controller ) |
| 976 | delete_groups( self.controller, Groups ) |
| 977 | delete_all_groups( self.controller ) |
| 978 | |
| 979 | class _MPLSTerminationV6( base_tests.SimpleDataPlane ): |
| 980 | """ Verify MPLS termination with IPv6 traffic """ |
| 981 | |
| 982 | def runTest( self ): |
| 983 | try: |
| 984 | |
| 985 | if len( config[ "port_map" ] ) < 2: |
| 986 | logging.info( "Port count less than 2, can't run this case" ) |
| 987 | return |
| 988 | |
| 989 | Groups = Queue.LifoQueue( ) |
| 990 | r_dst_mac = [ 0x00, 0x00, 0x00, 0xa2, 0x22, 0x00 ] |
| 991 | dst_mac = [ 0x00, 0x00, 0x00, 0x22, 0xa2, 0x00 ] |
| 992 | intf_src_mac = [ 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00 ] |
| 993 | # We are assuming that the port number are xx" |
| 994 | dip = "2000::%s" |
| 995 | sip = "2000::1" |
| 996 | ports = config[ "port_map" ].keys( ) |
| 997 | vlan_id = 4094 |
| 998 | mpls_label = 255 |
| 999 | label = (mpls_label, 0, 1, 64) |
| 1000 | |
| 1001 | in_port = ports[0] |
| 1002 | out_port = ports[1] |
| 1003 | r_dst_mac[5] = in_port |
| 1004 | intf_src_mac[5] = out_port |
| 1005 | dst_mac[5] = out_port |
| 1006 | dst_ip = dip % in_port |
| 1007 | dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] ) |
| 1008 | r_dst_mac_str = ':'.join( [ '%02X' % x for x in r_dst_mac ] ) |
| 1009 | intf_src_mac_str = ':'.join( [ '%02X' % x for x in intf_src_mac ] ) |
| 1010 | # We create the L2 group |
| 1011 | l2gid, msg = add_one_l2_interface_group( |
| 1012 | ctrl=self.controller, |
| 1013 | port=out_port, |
| 1014 | vlan_id=vlan_id, |
| 1015 | is_tagged=False, |
| 1016 | send_barrier=True |
| 1017 | ) |
| 1018 | Groups.put(l2gid) |
| 1019 | # We create the L3 group |
| 1020 | l3_msg = add_l3_unicast_group( |
| 1021 | ctrl=self.controller, |
| 1022 | port=out_port, |
| 1023 | vlanid=vlan_id, |
| 1024 | id=vlan_id, |
| 1025 | src_mac=intf_src_mac, |
| 1026 | dst_mac=dst_mac, |
| 1027 | send_barrier=True |
| 1028 | ) |
| 1029 | Groups.put( l3_msg.group_id ) |
| 1030 | # Add ECMP group |
| 1031 | ecmp_msg = add_l3_ecmp_group( |
| 1032 | ctrl=self.controller, |
| 1033 | id=vlan_id, |
| 1034 | l3_ucast_groups=[ l3_msg.group_id ], |
| 1035 | send_barrier=True |
| 1036 | ) |
| 1037 | Groups.put( ecmp_msg.group_id ) |
| 1038 | # add filtering flow |
| 1039 | add_one_vlan_table_flow( |
| 1040 | ctrl=self.controller, |
| 1041 | of_port=in_port, |
| 1042 | vlan_id=vlan_id, |
| 1043 | flag=VLAN_TABLE_FLAG_ONLY_TAG |
| 1044 | ) |
| 1045 | # add assignment flow |
| 1046 | add_one_vlan_table_flow( |
| 1047 | ctrl=self.controller, |
| 1048 | of_port=in_port, |
| 1049 | vlan_id=vlan_id, |
| 1050 | flag=VLAN_TABLE_FLAG_ONLY_UNTAG |
| 1051 | ) |
| 1052 | # add termination flow |
| 1053 | add_termination_flow( |
| 1054 | ctrl=self.controller, |
| 1055 | in_port=in_port, |
| 1056 | eth_type=0x8847, |
| 1057 | dst_mac=r_dst_mac, |
| 1058 | vlanid=vlan_id, |
| 1059 | goto_table=24 |
| 1060 | ) |
| 1061 | # We fill the mpls flow table 1 |
| 1062 | add_mpls_flow( |
| 1063 | ctrl=self.controller, |
| 1064 | action_group_id=ecmp_msg.group_id, |
| 1065 | label=mpls_label, |
| 1066 | send_barrier=True |
| 1067 | ) |
| 1068 | |
| 1069 | parsed_mplsv6_pkt = mplsv6_packet( |
| 1070 | pktlen=104, |
| 1071 | eth_dst=r_dst_mac_str, |
| 1072 | ipv6_dst=dst_ip, |
| 1073 | ipv6_src=sip, |
| 1074 | label=[ label ] |
| 1075 | ) |
| 1076 | mplsv6_pkt = str( parsed_mplsv6_pkt ) |
| 1077 | self.dataplane.send(in_port, mplsv6_pkt) |
| 1078 | print_port_stats(self, in_port) |
| 1079 | parsed_tcpv6_pkt = simple_tcpv6_packet( |
| 1080 | pktlen=100, |
| 1081 | eth_dst=dst_mac_str, |
| 1082 | eth_src=intf_src_mac_str, |
| 1083 | ipv6_dst=dst_ip, |
| 1084 | ipv6_src=sip, |
| 1085 | ipv6_hlim=63 |
| 1086 | ) |
| 1087 | tcpv6_pkt = str( parsed_tcpv6_pkt ) |
| 1088 | time.sleep(2) |
| 1089 | print_port_stats(self, in_port) |
| 1090 | verify_packet(self, tcpv6_pkt, out_port ) |
| 1091 | verify_no_packet(self, tcpv6_pkt, in_port ) |
| 1092 | verify_no_other_packets(self) |
| 1093 | |
| 1094 | finally: |
| 1095 | delete_all_flows( self.controller ) |
| 1096 | delete_groups( self.controller, Groups ) |
| 1097 | delete_all_groups( self.controller ) |