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