Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 1 | """ |
Flavio Castro | c36621e | 2015-12-08 12:57:07 -0500 | [diff] [blame] | 2 | The following tests are being done here |
Flavio Castro | 3aec890 | 2015-11-20 10:51:38 -0500 | [diff] [blame] | 3 | 1) PacketInSrcMacMiss |
castroflavio | 9e715f3 | 2015-12-08 14:04:12 -0500 | [diff] [blame] | 4 | 2) VlanSupport |
| 5 | 3) L2FloodQinQ |
| 6 | 4) L2FloodTagged |
| 7 | 5) L2Flood Tagged Unknown Src |
| 8 | 6) L2 Unicast Tagged |
| 9 | 7) MTU 1500 |
| 10 | 8) MTU 4100 |
| 11 | 9) MTU 4500 |
| 12 | 10) L3UnicastTagged |
| 13 | 11) L3VPNMPLS |
| 14 | 12) MPLS Termination |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 15 | """ |
| 16 | |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 17 | from oftest import config |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 18 | import logging |
| 19 | import oftest.base_tests as base_tests |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 20 | import ofp |
| 21 | from oftest.testutils import * |
| 22 | from accton_util import * |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 23 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 24 | class PacketInSrcMacMiss(base_tests.SimpleDataPlane): |
| 25 | """ |
| 26 | Test packet in function on a src-mac miss |
| 27 | Send a packet to each dataplane port and verify that a packet |
| 28 | in message is received from the controller for each |
| 29 | #todo verify you stop receiving after adding rule |
| 30 | """ |
| 31 | |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 32 | def runTest(self): |
| 33 | delete_all_flows(self.controller) |
| 34 | delete_all_groups(self.controller) |
| 35 | |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 36 | ports = sorted(config["port_map"].keys()) |
| 37 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 38 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 39 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 40 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 41 | parsed_vlan_pkt = simple_tcp_packet(pktlen=104, |
| 42 | vlan_vid=0x1001, dl_vlan_enable=True) |
| 43 | vlan_pkt = str(parsed_vlan_pkt) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 44 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 45 | for of_port in config["port_map"].keys(): |
| 46 | logging.info("PacketInMiss test, port %d", of_port) |
| 47 | self.dataplane.send(of_port, vlan_pkt) |
| 48 | |
| 49 | verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_NO_MATCH) |
| 50 | |
| 51 | verify_no_other_packets(self) |
| 52 | |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 53 | class PacketInUDP(base_tests.SimpleDataPlane): |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 54 | """ |
| 55 | Test packet in function for a table-miss flow |
| 56 | Send a packet to each dataplane port and verify that a packet |
| 57 | in message is received from the controller for each |
| 58 | |
| 59 | NOTE: Verify This case the oft option shall not use --switch-ip |
| 60 | """ |
| 61 | |
| 62 | def runTest(self): |
| 63 | delete_all_flows(self.controller) |
| 64 | delete_all_groups(self.controller) |
| 65 | |
| 66 | parsed_vlan_pkt = simple_udp_packet(pktlen=104, |
| 67 | vlan_vid=0x1001, dl_vlan_enable=True) |
| 68 | vlan_pkt = str(parsed_vlan_pkt) |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 69 | # create match |
| 70 | match = ofp.match() |
| 71 | match.oxm_list.append(ofp.oxm.eth_type(0x0800)) |
castroflavio | 4a09c96 | 2016-01-05 13:13:41 -0800 | [diff] [blame] | 72 | match.oxm_list.append(ofp.oxm.ip_proto(17)) |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 73 | request = ofp.message.flow_add( |
| 74 | table_id=60, |
| 75 | cookie=42, |
| 76 | match=match, |
| 77 | instructions=[ |
| 78 | ofp.instruction.apply_actions( |
| 79 | actions=[ |
| 80 | ofp.action.output( |
| 81 | port=ofp.OFPP_CONTROLLER, |
| 82 | max_len=ofp.OFPCML_NO_BUFFER)]), |
| 83 | ], |
| 84 | buffer_id=ofp.OFP_NO_BUFFER, |
| 85 | priority=1) |
| 86 | |
| 87 | logging.info("Inserting packet in flow to controller") |
| 88 | self.controller.message_send(request) |
| 89 | do_barrier(self.controller) |
| 90 | |
| 91 | for of_port in config["port_map"].keys(): |
| 92 | logging.info("PacketInMiss test, port %d", of_port) |
| 93 | self.dataplane.send(of_port, vlan_pkt) |
| 94 | |
| 95 | verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION) |
| 96 | |
| 97 | verify_no_other_packets(self) |
| 98 | |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 99 | class ArpNL2(base_tests.SimpleDataPlane): |
| 100 | def runTest(self): |
| 101 | delete_all_flows(self.controller) |
| 102 | delete_all_groups(self.controller) |
| 103 | |
| 104 | ports = sorted(config["port_map"].keys()) |
| 105 | match = ofp.match() |
| 106 | match.oxm_list.append(ofp.oxm.eth_type(0x0806)) |
| 107 | request = ofp.message.flow_add( |
| 108 | table_id=60, |
| 109 | cookie=42, |
| 110 | match=match, |
| 111 | instructions=[ |
| 112 | ofp.instruction.apply_actions( |
| 113 | actions=[ |
| 114 | ofp.action.output( |
| 115 | port=ofp.OFPP_CONTROLLER, |
| 116 | max_len=ofp.OFPCML_NO_BUFFER)]), |
| 117 | ], |
| 118 | buffer_id=ofp.OFP_NO_BUFFER, |
| 119 | priority=40000) |
| 120 | self.controller.message_send(request) |
| 121 | for port in ports: |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 122 | add_one_l2_interface_group(self.controller, port, 1, False, False) |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 123 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_BOTH) |
| 124 | group_id = encode_l2_interface_group_id(1, port) |
| 125 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
| 126 | do_barrier(self.controller) |
| 127 | parsed_arp_pkt = simple_arp_packet() |
| 128 | arp_pkt = str(parsed_arp_pkt) |
| 129 | |
| 130 | for out_port in ports: |
| 131 | self.dataplane.send(out_port, arp_pkt) |
| 132 | verify_packet_in(self, arp_pkt, out_port, ofp.OFPR_ACTION) |
| 133 | # change dest based on port number |
| 134 | mac_dst= '00:12:34:56:78:%02X' % out_port |
| 135 | for in_port in ports: |
| 136 | if in_port == out_port: |
| 137 | continue |
| 138 | # change source based on port number to avoid packet-ins from learning |
| 139 | mac_src= '00:12:34:56:78:%02X' % in_port |
| 140 | parsed_pkt = simple_tcp_packet(eth_dst=mac_dst, eth_src=mac_src) |
| 141 | pkt = str(parsed_pkt) |
| 142 | self.dataplane.send(in_port, pkt) |
| 143 | |
| 144 | for ofport in ports: |
| 145 | if ofport in [out_port]: |
| 146 | verify_packet(self, pkt, ofport) |
| 147 | else: |
| 148 | verify_no_packet(self, pkt, ofport) |
| 149 | |
| 150 | verify_no_other_packets(self) |
| 151 | |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 152 | class PacketInArp(base_tests.SimpleDataPlane): |
| 153 | """ |
| 154 | Test packet in function for a table-miss flow |
| 155 | Send a packet to each dataplane port and verify that a packet |
| 156 | in message is received from the controller for each |
| 157 | |
| 158 | NOTE: Verify This case the oft option shall not use --switch-ip |
| 159 | """ |
| 160 | |
| 161 | def runTest(self): |
| 162 | delete_all_flows(self.controller) |
| 163 | delete_all_groups(self.controller) |
| 164 | |
| 165 | parsed_arp_pkt = simple_arp_packet() |
| 166 | arp_pkt = str(parsed_arp_pkt) |
| 167 | ports = sorted(config["port_map"].keys()) |
| 168 | #for port in ports: |
| 169 | # add_one_l2_interface_group(self.controller, port, 1, True, False) |
| 170 | # add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 171 | |
| 172 | # create match |
| 173 | match = ofp.match() |
| 174 | match.oxm_list.append(ofp.oxm.eth_type(0x0806)) |
| 175 | request = ofp.message.flow_add( |
| 176 | table_id=60, |
| 177 | cookie=42, |
| 178 | match=match, |
| 179 | instructions=[ |
| 180 | ofp.instruction.apply_actions( |
| 181 | actions=[ |
| 182 | ofp.action.output( |
| 183 | port=ofp.OFPP_CONTROLLER, |
| 184 | max_len=ofp.OFPCML_NO_BUFFER)]), |
| 185 | ], |
| 186 | buffer_id=ofp.OFP_NO_BUFFER, |
| 187 | priority=1) |
| 188 | |
| 189 | logging.info("Inserting packet in flow to controller") |
| 190 | self.controller.message_send(request) |
| 191 | do_barrier(self.controller) |
| 192 | |
| 193 | for of_port in config["port_map"].keys(): |
| 194 | logging.info("PacketInMiss test, port %d", of_port) |
| 195 | self.dataplane.send(of_port, arp_pkt) |
| 196 | |
| 197 | verify_packet_in(self, arp_pkt, of_port, ofp.OFPR_ACTION) |
| 198 | |
| 199 | verify_no_other_packets(self) |
| 200 | |
Flavio Castro | 1b5c21d | 2015-12-08 12:41:56 -0500 | [diff] [blame] | 201 | class L2FloodQinQ(base_tests.SimpleDataPlane): |
| 202 | """ |
Flavio Castro | c36621e | 2015-12-08 12:57:07 -0500 | [diff] [blame] | 203 | Test L2 flood of double tagged vlan packets (802.1Q) |
| 204 | Sends a double tagged packet and verifies flooding behavior according to outer vlan |
Flavio Castro | 1b5c21d | 2015-12-08 12:41:56 -0500 | [diff] [blame] | 205 | """ |
| 206 | def runTest(self): |
| 207 | ports = sorted(config["port_map"].keys()) |
| 208 | |
| 209 | delete_all_flows(self.controller) |
| 210 | delete_all_groups(self.controller) |
| 211 | |
| 212 | # Installing flows to avoid packet-in |
| 213 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 214 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 1b5c21d | 2015-12-08 12:41:56 -0500 | [diff] [blame] | 215 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 216 | |
| 217 | group_id = encode_l2_interface_group_id(1, port) |
| 218 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
| 219 | msg=add_l2_flood_group(self.controller, ports, 1, 1) |
| 220 | add_bridge_flow(self.controller, None, 1, msg.group_id, True) |
| 221 | do_barrier(self.controller) |
| 222 | |
| 223 | #verify flood |
| 224 | for ofport in ports: |
| 225 | # change dest based on port number |
| 226 | mac_src= '00:12:34:56:78:%02X' % ofport |
| 227 | parsed_pkt = simple_tcp_packet_two_vlan(pktlen=108, out_dl_vlan_enable=True, out_vlan_vid=1, |
| 228 | in_dl_vlan_enable=True, in_vlan_vid=10, eth_dst='00:12:34:56:78:9a', eth_src=mac_src) |
| 229 | pkt = str(parsed_pkt) |
| 230 | self.dataplane.send(ofport, pkt) |
| 231 | #self won't rx packet |
| 232 | verify_no_packet(self, pkt, ofport) |
| 233 | #others will rx packet |
| 234 | tmp_ports=list(ports) |
| 235 | tmp_ports.remove(ofport) |
| 236 | verify_packets(self, pkt, tmp_ports) |
| 237 | |
| 238 | verify_no_other_packets(self) |
| 239 | |
Flavio Castro | 184cefe | 2015-11-19 20:52:49 -0500 | [diff] [blame] | 240 | class L2FloodTagged(base_tests.SimpleDataPlane): |
| 241 | """ |
| 242 | Test L2 flood to a vlan |
| 243 | Send a packet with unknown dst_mac and check if the packet is flooded to all ports except inport |
| 244 | #todo take in account unknown src |
| 245 | """ |
| 246 | def runTest(self): |
| 247 | ports = sorted(config["port_map"].keys()) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 248 | |
Flavio Castro | 184cefe | 2015-11-19 20:52:49 -0500 | [diff] [blame] | 249 | delete_all_flows(self.controller) |
| 250 | delete_all_groups(self.controller) |
| 251 | |
Flavio Castro | 184cefe | 2015-11-19 20:52:49 -0500 | [diff] [blame] | 252 | # Installing flows to avoid packet-in |
| 253 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 254 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 255 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 256 | |
Flavio Castro | 184cefe | 2015-11-19 20:52:49 -0500 | [diff] [blame] | 257 | group_id = encode_l2_interface_group_id(1, port) |
| 258 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 259 | msg=add_l2_flood_group(self.controller, ports, 1, 1) |
| 260 | add_bridge_flow(self.controller, None, 1, msg.group_id, True) |
Flavio Castro | 184cefe | 2015-11-19 20:52:49 -0500 | [diff] [blame] | 261 | do_barrier(self.controller) |
| 262 | |
| 263 | #verify flood |
| 264 | for ofport in ports: |
| 265 | # change dest based on port number |
| 266 | mac_src= '00:12:34:56:78:%02X' % ofport |
| 267 | parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst='00:12:34:56:78:9a', eth_src=mac_src) |
| 268 | pkt = str(parsed_pkt) |
| 269 | self.dataplane.send(ofport, pkt) |
| 270 | #self won't rx packet |
| 271 | verify_no_packet(self, pkt, ofport) |
| 272 | #others will rx packet |
| 273 | tmp_ports=list(ports) |
| 274 | tmp_ports.remove(ofport) |
| 275 | verify_packets(self, pkt, tmp_ports) |
| 276 | |
| 277 | verify_no_other_packets(self) |
| 278 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 279 | class L2FloodTaggedUnknownSrc(base_tests.SimpleDataPlane): |
| 280 | """ |
| 281 | Test L2 flood to a vlan |
| 282 | Send a packet with unknown dst_mac and check if the packet is flooded to all ports except inport |
| 283 | #todo take in account unknown src |
| 284 | """ |
| 285 | def runTest(self): |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 286 | delete_all_flows(self.controller) |
| 287 | delete_all_groups(self.controller) |
| 288 | |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 289 | ports = sorted(config["port_map"].keys()) |
| 290 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 291 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 292 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 293 | |
| 294 | msg=add_l2_flood_group(self.controller, ports, 1, 1) |
| 295 | add_bridge_flow(self.controller, None, 1, msg.group_id, True) |
| 296 | |
| 297 | parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst='00:12:34:56:78:9a') |
| 298 | pkt = str(parsed_pkt) |
| 299 | #verify flood |
| 300 | for ofport in ports: |
| 301 | self.dataplane.send(ofport, pkt) |
| 302 | #self won't rx packet |
| 303 | verify_no_packet(self, pkt, ofport) |
| 304 | #others will rx packet |
| 305 | tmp_ports=list(ports) |
| 306 | tmp_ports.remove(ofport) |
| 307 | verify_packets(self, pkt, tmp_ports) |
| 308 | |
| 309 | verify_no_other_packets(self) |
| 310 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 311 | class L2UnicastTagged(base_tests.SimpleDataPlane): |
| 312 | """ |
| 313 | Test output function for an exact-match flow |
| 314 | |
| 315 | For each port A, adds a flow directing matching packets to that port. |
| 316 | Then, for all other ports B != A, verifies that sending a matching packet |
| 317 | to B results in an output to A. |
| 318 | """ |
| 319 | def runTest(self): |
| 320 | ports = sorted(config["port_map"].keys()) |
| 321 | |
| 322 | delete_all_flows(self.controller) |
| 323 | delete_all_groups(self.controller) |
| 324 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 325 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 326 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 327 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 328 | group_id = encode_l2_interface_group_id(1, port) |
| 329 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 330 | do_barrier(self.controller) |
| 331 | |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 332 | for out_port in ports: |
| 333 | # change dest based on port number |
| 334 | mac_dst= '00:12:34:56:78:%02X' % out_port |
| 335 | for in_port in ports: |
| 336 | if in_port == out_port: |
| 337 | continue |
| 338 | # change source based on port number to avoid packet-ins from learning |
| 339 | mac_src= '00:12:34:56:78:%02X' % in_port |
| 340 | parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src) |
| 341 | pkt = str(parsed_pkt) |
| 342 | self.dataplane.send(in_port, pkt) |
| 343 | |
| 344 | for ofport in ports: |
| 345 | if ofport in [out_port]: |
| 346 | verify_packet(self, pkt, ofport) |
| 347 | else: |
| 348 | verify_no_packet(self, pkt, ofport) |
| 349 | |
| 350 | verify_no_other_packets(self) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 351 | |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 352 | class Mtu1500(base_tests.SimpleDataPlane): |
| 353 | |
| 354 | def runTest(self): |
| 355 | ports = sorted(config["port_map"].keys()) |
| 356 | |
| 357 | delete_all_flows(self.controller) |
| 358 | delete_all_groups(self.controller) |
| 359 | |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 360 | # set up tag groups for each port |
Flavio Castro | d4c44d1 | 2015-12-08 14:44:18 -0500 | [diff] [blame] | 361 | add_l2_interface_group(self.controller, ports, 1, True, 1) |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 362 | |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 363 | add_vlan_table_flow(self.controller, ports) |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 364 | |
| 365 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 366 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 367 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 368 | group_id = encode_l2_interface_group_id(1, port) |
| 369 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
| 370 | do_barrier(self.controller) |
| 371 | |
| 372 | for out_port in ports: |
| 373 | # change dest based on port number |
| 374 | mac_dst= '00:12:34:56:78:%02X' % out_port |
| 375 | for in_port in ports: |
| 376 | if in_port == out_port: |
| 377 | continue |
| 378 | # change source based on port number to avoid packet-ins from learning |
| 379 | mac_src= '00:12:34:56:78:%02X' % in_port |
| 380 | parsed_pkt = simple_tcp_packet(pktlen=1500,dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src) |
| 381 | pkt = str(parsed_pkt) |
| 382 | self.dataplane.send(in_port, pkt) |
| 383 | |
| 384 | for ofport in ports: |
| 385 | if ofport in [out_port]: |
| 386 | verify_packet(self, pkt, ofport) |
| 387 | else: |
| 388 | verify_no_packet(self, pkt, ofport) |
| 389 | |
| 390 | verify_no_other_packets(self) |
| 391 | |
| 392 | |
| 393 | class Mtu4000(base_tests.SimpleDataPlane): |
| 394 | """ |
| 395 | Test output function for an exact-match flow |
| 396 | For each port A, adds a flow directing matching packets to that port. |
| 397 | Then, for all other ports B != A, verifies that sending a matching packet |
| 398 | to B results in an output to A. |
| 399 | """ |
| 400 | def runTest(self): |
| 401 | ports = sorted(config["port_map"].keys()) |
| 402 | |
| 403 | delete_all_flows(self.controller) |
| 404 | delete_all_groups(self.controller) |
| 405 | |
| 406 | add_vlan_table_flow(self.controller, config["port_map"].keys()) |
| 407 | |
| 408 | # set up tag groups for each port |
Flavio Castro | d4c44d1 | 2015-12-08 14:44:18 -0500 | [diff] [blame] | 409 | add_l2_interface_group(self.controller, config["port_map"].keys(), 1, True, 1) |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 410 | |
| 411 | for port in ports: |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 412 | add_one_l2_interface_group(self.controller, port, 1, True, False) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 413 | add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | b677303 | 2015-11-19 22:49:24 -0500 | [diff] [blame] | 414 | group_id = encode_l2_interface_group_id(1, port) |
| 415 | add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True) |
| 416 | do_barrier(self.controller) |
| 417 | |
| 418 | for out_port in ports: |
| 419 | # change dest based on port number |
| 420 | mac_dst= '00:12:34:56:78:%02X' % out_port |
| 421 | for in_port in ports: |
| 422 | if in_port == out_port: |
| 423 | continue |
| 424 | # change source based on port number to avoid packet-ins from learning |
| 425 | mac_src= '00:12:34:56:78:%02X' % in_port |
| 426 | parsed_pkt = simple_tcp_packet(pktlen=4000,dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src) |
| 427 | pkt = str(parsed_pkt) |
| 428 | self.dataplane.send(in_port, pkt) |
| 429 | |
| 430 | for ofport in ports: |
| 431 | if ofport in [out_port]: |
| 432 | verify_packet(self, pkt, ofport) |
| 433 | else: |
| 434 | verify_no_packet(self, pkt, ofport) |
| 435 | |
| 436 | verify_no_other_packets(self) |
Flavio Castro | aabb579 | 2015-11-18 19:03:50 -0500 | [diff] [blame] | 437 | |
| 438 | class L3UcastTagged(base_tests.SimpleDataPlane): |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 439 | """ |
Flavio Castro | 35e6439 | 2015-12-02 16:53:14 -0500 | [diff] [blame] | 440 | Port1(vid=in_port, src=00:00:00:22:22:in_port, 192.168.outport.1) , |
| 441 | Port2(vid=outport, dst=00:00:00:22:22:outport, 192.168.outport.1) |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 442 | """ |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 443 | def runTest(self): |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 444 | delete_all_flows(self.controller) |
| 445 | delete_all_groups(self.controller) |
| 446 | |
| 447 | if len(config["port_map"]) <2: |
| 448 | logging.info("Port count less than 2, can't run this case") |
| 449 | return |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 450 | |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 451 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 452 | dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00] |
| 453 | dip=0xc0a80001 |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 454 | ports = config["port_map"].keys() |
| 455 | for port in ports: |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 456 | #add l2 interface group |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 457 | vlan_id=port |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 458 | add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False) |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 459 | dst_mac[5]=vlan_id |
| 460 | l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac) |
| 461 | #add vlan flow table |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 462 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 463 | #add termination flow |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 464 | add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id) |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 465 | #add unicast routing flow |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 466 | dst_ip = dip + (vlan_id<<8) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 467 | add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 468 | #add entries in the Bridging table to avoid packet-in from mac learning |
| 469 | group_id = encode_l2_interface_group_id(vlan_id, port) |
| 470 | add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 471 | |
| 472 | do_barrier(self.controller) |
| 473 | |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 474 | switch_mac = ':'.join(['%02X' % x for x in intf_src_mac]) |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 475 | for in_port in ports: |
| 476 | mac_src='00:00:00:22:22:%02X' % in_port |
| 477 | ip_src='192.168.%02d.1' % in_port |
| 478 | for out_port in ports: |
| 479 | if in_port == out_port: |
| 480 | continue |
| 481 | ip_dst='192.168.%02d.1' % out_port |
| 482 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port, |
| 483 | eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 484 | ip_dst=ip_dst) |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 485 | pkt=str(parsed_pkt) |
| 486 | self.dataplane.send(in_port, pkt) |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 487 | #build expected packet |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 488 | mac_dst='00:00:00:22:22:%02X' % out_port |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 489 | exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port, |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 490 | eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=63, |
| 491 | ip_src=ip_src, ip_dst=ip_dst) |
| 492 | pkt=str(exp_pkt) |
| 493 | verify_packet(self, pkt, out_port) |
| 494 | verify_no_other_packets(self) |
Flavio Castro | 05d20bc | 2015-11-16 15:06:14 -0500 | [diff] [blame] | 495 | |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 496 | class L3VPNMPLS(base_tests.SimpleDataPlane): |
| 497 | """ |
| 498 | Insert IP packet |
| 499 | Receive MPLS packet |
| 500 | """ |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 501 | def runTest(self): |
| 502 | delete_all_flows(self.controller) |
| 503 | delete_all_groups(self.controller) |
| 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 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 510 | dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00] |
| 511 | dip=0xc0a80001 |
| 512 | index=1 |
| 513 | ports = config["port_map"].keys() |
| 514 | for port in ports: |
| 515 | #add l2 interface group |
| 516 | vlan_id=port |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 517 | l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, True) |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 518 | dst_mac[5]=vlan_id |
Flavio Castro | 35e6439 | 2015-12-02 16:53:14 -0500 | [diff] [blame] | 519 | #add MPLS interface group |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 520 | mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, vlan_id, port) |
Flavio Castro | 35e6439 | 2015-12-02 16:53:14 -0500 | [diff] [blame] | 521 | #add MPLS L3 VPN group |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 522 | mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 523 | index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=port, set_bos=1, set_ttl=32) |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 524 | #ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid]) |
| 525 | do_barrier(self.controller) |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 526 | #add vlan flow table |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 527 | add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=2, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 528 | #add termination flow |
| 529 | add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id) |
Flavio Castro | 35e6439 | 2015-12-02 16:53:14 -0500 | [diff] [blame] | 530 | #add routing flow |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 531 | dst_ip = dip + (vlan_id<<8) |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 532 | add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, mpls_label_gid, vrf=2) |
| 533 | #add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id, vrf=2) |
| 534 | #add entries in the Bridging table to avoid packet-in from mac learning |
| 535 | group_id = encode_l2_interface_group_id(vlan_id, port) |
| 536 | add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True) |
castroflavio | ee29484 | 2016-01-06 15:54:28 -0800 | [diff] [blame^] | 537 | port = ports[0] |
| 538 | #add l2 interface group |
| 539 | vlan_id=port |
| 540 | l2_gid = encode_l2_interface_group_id(vlan_id, port) |
| 541 | dst_mac[5]=vlan_id |
| 542 | #add MPLS interface group |
| 543 | mpls_gid = encode_mpls_interface_group_id(0, port) |
| 544 | #add MPLS L3 VPN group |
| 545 | mpls_label_gid = encode_mpls_label_group_id(OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, index=port) |
| 546 | #ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid]) |
| 547 | do_barrier(self.controller) |
| 548 | #add routing flow |
| 549 | dst_ip = 0x0 |
| 550 | add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0x0, mpls_label_gid, vrf=2) |
| 551 | #add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id, vrf=2) |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 552 | |
| 553 | do_barrier(self.controller) |
| 554 | |
| 555 | switch_mac = ':'.join(['%02X' % x for x in intf_src_mac]) |
| 556 | for in_port in ports: |
| 557 | mac_src='00:00:00:22:22:%02X' % in_port |
| 558 | ip_src='192.168.%02d.1' % in_port |
| 559 | for out_port in ports: |
| 560 | if in_port == out_port: |
| 561 | continue |
| 562 | ip_dst='192.168.%02d.1' % out_port |
| 563 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port, |
| 564 | eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, |
| 565 | ip_dst=ip_dst) |
| 566 | pkt=str(parsed_pkt) |
| 567 | self.dataplane.send(in_port, pkt) |
| 568 | #build expect packet |
| 569 | mac_dst='00:00:00:22:22:%02X' % out_port |
| 570 | label = (out_port, 0, 1, 32) |
| 571 | exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src, |
| 572 | ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label]) |
| 573 | pkt=str(exp_pkt) |
| 574 | verify_packet(self, pkt, out_port) |
| 575 | verify_no_other_packets(self) |
castroflavio | ee29484 | 2016-01-06 15:54:28 -0800 | [diff] [blame^] | 576 | ip_dst='1.168.%02d.1' % out_port |
| 577 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port, |
| 578 | eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, ip_dst=ip_dst) |
| 579 | pkt=str(parsed_pkt) |
| 580 | self.dataplane.send(in_port, pkt) |
| 581 | #build expect packet |
| 582 | mac_dst='00:00:00:22:22:%02X' % out_port |
| 583 | label = (out_port, 0, 1, 32) |
| 584 | exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src, |
| 585 | ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label]) |
| 586 | pkt=str(exp_pkt) |
| 587 | verify_packet(self, pkt, out_port) |
| 588 | verify_no_other_packets(self) |
| 589 | |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 590 | |
| 591 | class L3VPN_32(base_tests.SimpleDataPlane): |
| 592 | """ |
| 593 | Insert IP packet |
| 594 | Receive MPLS packet |
| 595 | """ |
| 596 | def runTest(self): |
| 597 | delete_all_flows(self.controller) |
| 598 | delete_all_groups(self.controller) |
| 599 | |
| 600 | if len(config["port_map"]) <2: |
| 601 | logging.info("Port count less than 2, can't run this case") |
| 602 | return |
| 603 | |
| 604 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 605 | dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00] |
| 606 | dip=0xc0a80001 |
| 607 | index=1 |
| 608 | ports = config["port_map"].keys() |
| 609 | for port in ports: |
| 610 | #add l2 interface group |
| 611 | vlan_id=port |
| 612 | l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, True) |
| 613 | dst_mac[5]=vlan_id |
| 614 | #add MPLS interface group |
| 615 | mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, vlan_id, port) |
| 616 | #add MPLS L3 VPN group |
| 617 | mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
| 618 | index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=port, set_bos=1, set_ttl=32) |
| 619 | #ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid]) |
| 620 | do_barrier(self.controller) |
| 621 | #add vlan flow table |
| 622 | add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=2, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 623 | #add termination flow |
| 624 | add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id) |
| 625 | #add routing flow |
| 626 | dst_ip = dip + (vlan_id<<8) |
| 627 | add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, mpls_gid, vrf=2) |
| 628 | #ecmp_msg.group_id, vrf=2) |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 629 | #add entries in the Bridging table to avoid packet-in from mac learning |
| 630 | group_id = encode_l2_interface_group_id(vlan_id, port) |
| 631 | add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True) |
| 632 | |
| 633 | do_barrier(self.controller) |
| 634 | |
| 635 | switch_mac = ':'.join(['%02X' % x for x in intf_src_mac]) |
| 636 | for in_port in ports: |
| 637 | mac_src='00:00:00:22:22:%02X' % in_port |
| 638 | ip_src='192.168.%02d.1' % in_port |
| 639 | for out_port in ports: |
| 640 | if in_port == out_port: |
| 641 | continue |
| 642 | ip_dst='192.168.%02d.1' % out_port |
| 643 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port, |
| 644 | eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, |
| 645 | ip_dst=ip_dst) |
| 646 | pkt=str(parsed_pkt) |
| 647 | self.dataplane.send(in_port, pkt) |
| 648 | #build expect packet |
| 649 | mac_dst='00:00:00:22:22:%02X' % out_port |
| 650 | label = (out_port, 0, 1, 32) |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 651 | exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src, |
Flavio Castro | 72a45d5 | 2015-12-02 16:37:05 -0500 | [diff] [blame] | 652 | ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label]) |
| 653 | pkt=str(exp_pkt) |
| 654 | verify_packet(self, pkt, out_port) |
| 655 | verify_no_other_packets(self) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 656 | |
| 657 | class MplsTermination(base_tests.SimpleDataPlane): |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 658 | """ |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 659 | Insert IP packet |
| 660 | Receive MPLS packet |
Flavio Castro | 34352e7 | 2015-12-07 20:01:51 -0500 | [diff] [blame] | 661 | """ |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 662 | def runTest(self): |
| 663 | delete_all_flows(self.controller) |
| 664 | delete_all_groups(self.controller) |
| 665 | |
| 666 | if len(config["port_map"]) <2: |
| 667 | logging.info("Port count less than 2, can't run this case") |
| 668 | return |
| 669 | |
| 670 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 671 | dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00] |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 672 | mcast_mac = [0x01, 0x00, 0x5e, 0x00, 0x00, 0x01] |
| 673 | |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 674 | dip=0xc0a80001 |
| 675 | index=1 |
| 676 | ports = config["port_map"].keys() |
| 677 | for port in ports: |
| 678 | #add l2 interface group |
| 679 | vlan_id=port |
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 680 | l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, False) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 681 | dst_mac[5]=vlan_id |
| 682 | #add L3 Unicast group |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 683 | l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac) |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 684 | #add L3 ecmp group |
| 685 | ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id]) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 686 | #add vlan flow table |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 687 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 688 | #add termination flow |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 689 | add_termination_flow(self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 690 | #add routing flow |
| 691 | dst_ip = dip + (vlan_id<<8) |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 692 | add_mpls_flow(self.controller, ecmp_msg.group_id, port) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 693 | #add entries in the Bridging table to avoid packet-in from mac learning |
| 694 | group_id = encode_l2_interface_group_id(vlan_id, port) |
| 695 | add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True) |
| 696 | |
| 697 | do_barrier(self.controller) |
| 698 | |
| 699 | switch_mac = ':'.join(['%02X' % x for x in intf_src_mac]) |
| 700 | for in_port in ports: |
| 701 | mac_src='00:00:00:22:22:%02X' % in_port |
| 702 | ip_src='192.168.%02d.1' % in_port |
| 703 | for out_port in ports: |
| 704 | if in_port == out_port: |
| 705 | continue |
| 706 | ip_dst='192.168.%02d.1' % out_port |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 707 | |
| 708 | label = (out_port, 0, 1, 32) |
| 709 | parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=in_port, ip_src=ip_src, |
| 710 | ip_dst=ip_dst, eth_dst=switch_mac, eth_src=mac_src, label=[label]) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 711 | pkt=str(parsed_pkt) |
| 712 | self.dataplane.send(in_port, pkt) |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 713 | |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 714 | #build expect packet |
| 715 | mac_dst='00:00:00:22:22:%02X' % out_port |
Flavio Castro | 7fb6ca9 | 2015-12-16 15:50:14 -0500 | [diff] [blame] | 716 | mcast='01:00:5e:00:00:01' |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 717 | exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port, |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 718 | eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst) |
Flavio Castro | d8f8af2 | 2015-12-02 18:19:26 -0500 | [diff] [blame] | 719 | pkt=str(exp_pkt) |
| 720 | verify_packet(self, pkt, out_port) |
Flavio Castro | 167f5bd | 2015-12-02 19:33:53 -0500 | [diff] [blame] | 721 | verify_no_other_packets(self) |
| 722 | |
Flavio Castro | 8073082 | 2015-12-11 15:38:47 -0500 | [diff] [blame] | 723 | class MPLSBUG(base_tests.SimpleDataPlane): |
| 724 | |
| 725 | def runTest(self): |
| 726 | delete_all_flows(self.controller) |
| 727 | delete_all_groups(self.controller) |
| 728 | |
| 729 | if len(config["port_map"]) <2: |
| 730 | logging.info("Port count less than 2, can't run this case") |
| 731 | return |
| 732 | |
| 733 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 734 | dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00] |
| 735 | dip=0xc0a80001 |
| 736 | index=1 |
| 737 | ports = config["port_map"].keys() |
| 738 | for port in ports: |
| 739 | #add l2 interface group |
| 740 | vlan_id=port |
| 741 | l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, False) |
| 742 | dst_mac[5]=vlan_id |
| 743 | #add L3 Unicast group |
| 744 | l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac) |
| 745 | #add vlan flow table |
| 746 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH) |
| 747 | #add termination flow |
| 748 | add_termination_flow(self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24) |
| 749 | #add mpls flow |
| 750 | add_mpls_flow(self.controller, l3_msg.group_id, port) |
| 751 | #add termination flow |
| 752 | add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id) |
| 753 | #add unicast routing flow |
| 754 | dst_ip = dip + (vlan_id<<8) |
| 755 | add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id) |
| 756 | |
| 757 | #add entries in the Bridging table to avoid packet-in from mac learning |
| 758 | group_id = encode_l2_interface_group_id(vlan_id, port) |
| 759 | add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True) |
| 760 | |
| 761 | do_barrier(self.controller) |
| 762 | |
| 763 | switch_mac = ':'.join(['%02X' % x for x in intf_src_mac]) |
| 764 | for in_port in ports: |
| 765 | mac_src='00:00:00:22:22:%02X' % in_port |
| 766 | ip_src='192.168.%02d.1' % in_port |
| 767 | for out_port in ports: |
| 768 | if in_port == out_port: |
| 769 | continue |
| 770 | ip_dst='192.168.%02d.1' % out_port |
| 771 | switch_mac = "00:00:00:cc:cc:cc" |
| 772 | label = (out_port, 0, 1, 32) |
| 773 | parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=in_port, ip_src=ip_src, |
| 774 | ip_dst=ip_dst, eth_dst=switch_mac, eth_src=mac_src, label=[label]) |
| 775 | pkt=str(parsed_pkt) |
| 776 | self.dataplane.send(in_port, pkt) |
| 777 | |
| 778 | #build expect packet |
| 779 | mac_dst='00:00:00:22:22:%02X' % out_port |
| 780 | exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port, |
| 781 | eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst) |
| 782 | pkt=str(exp_pkt) |
| 783 | verify_packet(self, pkt, out_port) |
| 784 | verify_no_other_packets(self) |
| 785 | |
| 786 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port, |
| 787 | eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, |
| 788 | ip_dst=ip_dst) |
| 789 | pkt=str(parsed_pkt) |
| 790 | self.dataplane.send(in_port, pkt) |
| 791 | #build expected packet |
| 792 | mac_dst='00:00:00:22:22:%02X' % out_port |
| 793 | exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port, |
| 794 | eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=63, |
| 795 | ip_src=ip_src, ip_dst=ip_dst) |
| 796 | pkt=str(exp_pkt) |
| 797 | verify_packet(self, pkt, out_port) |
| 798 | verify_no_other_packets(self) |
| 799 | |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 800 | class L3McastToL2(base_tests.SimpleDataPlane): |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 801 | """ |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 802 | Mcast routing to L2 |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 803 | """ |
| 804 | def runTest(self): |
| 805 | """ |
| 806 | port1 (vlan 300)-> All Ports (vlan 300) |
| 807 | """ |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 808 | #delete_all_flows(self.controller) |
| 809 | #delete_all_groups(self.controller) |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 810 | |
castroflavio | 4a09c96 | 2016-01-05 13:13:41 -0800 | [diff] [blame] | 811 | if len(config["port_map"]) <3: |
| 812 | logging.info("Port count less than 3, can't run this case") |
| 813 | assert(False) |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 814 | return |
| 815 | |
| 816 | vlan_id =300 |
| 817 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 818 | intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac]) |
| 819 | dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01] |
| 820 | dst_mac_str=':'.join(['%02X' % x for x in dst_mac]) |
| 821 | port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11] |
| 822 | port1_mac_str=':'.join(['%02X' % x for x in port1_mac]) |
| 823 | src_ip=0xc0a80101 |
| 824 | src_ip_str="192.168.1.1" |
| 825 | dst_ip=0xe0010101 |
| 826 | dst_ip_str="224.1.1.1" |
| 827 | |
| 828 | port1=config["port_map"].keys()[0] |
| 829 | port2=config["port_map"].keys()[1] |
| 830 | |
| 831 | switch_mac = [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00] |
| 832 | |
| 833 | |
| 834 | #add l2 interface group |
| 835 | l2_intf_group_list=[] |
| 836 | for port in config["port_map"].keys(): |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 837 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=4) |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 838 | if port == port2: |
| 839 | continue |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 840 | l2_intf_gid, msg=add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False) |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 841 | l2_intf_group_list.append(l2_intf_gid) |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 842 | |
| 843 | #add termination flow |
| 844 | add_termination_flow(self.controller, port1, 0x0800, switch_mac, vlan_id) |
| 845 | |
| 846 | #add l3 interface group |
| 847 | mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id, 2, l2_intf_group_list) |
| 848 | add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id) |
| 849 | |
Flavio Castro | 932014b | 2016-01-05 18:29:15 -0500 | [diff] [blame] | 850 | parsed_pkt = simple_udp_packet(pktlen=100, |
| 851 | dl_vlan_enable=True, |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 852 | eth_dst=dst_mac_str, |
| 853 | eth_src=port1_mac_str, |
| 854 | ip_ttl=64, |
| 855 | ip_src=src_ip_str, |
| 856 | ip_dst=dst_ip_str) |
| 857 | pkt=str(parsed_pkt) |
| 858 | self.dataplane.send(port1, pkt) |
| 859 | for port in config["port_map"].keys(): |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 860 | if port == port2 or port == port1: |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 861 | verify_no_packet(self, pkt, port) |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 862 | continue |
castroflavio | cc403a9 | 2015-12-15 14:04:19 -0500 | [diff] [blame] | 863 | verify_packet(self, pkt, port) |
| 864 | verify_no_other_packets(self) |
| 865 | |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 866 | class L3McastToL3(base_tests.SimpleDataPlane): |
| 867 | """ |
| 868 | Mcast routing |
| 869 | """ |
| 870 | def runTest(self): |
| 871 | """ |
| 872 | port1 (vlan 1)-> port 2 (vlan 2) |
| 873 | """ |
| 874 | delete_all_flows(self.controller) |
| 875 | delete_all_groups(self.controller) |
| 876 | |
| 877 | if len(config["port_map"]) <3: |
castroflavio | 4a09c96 | 2016-01-05 13:13:41 -0800 | [diff] [blame] | 878 | logging.info("Port count less than 3, can't run this case") |
| 879 | assert(False) |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 880 | return |
| 881 | |
| 882 | vlan_id =1 |
| 883 | port2_out_vlan=2 |
| 884 | port3_out_vlan=3 |
| 885 | in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan |
| 886 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 887 | intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac]) |
| 888 | dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01] |
| 889 | dst_mac_str=':'.join(['%02X' % x for x in dst_mac]) |
| 890 | port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11] |
| 891 | port1_mac_str=':'.join(['%02X' % x for x in port1_mac]) |
| 892 | src_ip=0xc0a80101 |
| 893 | src_ip_str="192.168.1.1" |
| 894 | dst_ip=0xe0010101 |
| 895 | dst_ip_str="224.1.1.1" |
| 896 | |
| 897 | port1=config["port_map"].keys()[0] |
| 898 | port2=config["port_map"].keys()[1] |
| 899 | port3=config["port_map"].keys()[2] |
| 900 | |
| 901 | #add l2 interface group |
| 902 | for port in config["port_map"].keys(): |
| 903 | add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False) |
| 904 | #add vlan flow table |
| 905 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 906 | vlan_id +=1 |
| 907 | |
| 908 | #add termination flow |
| 909 | add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id) |
| 910 | |
| 911 | #add l3 interface group |
| 912 | port2_ucast_msg=add_l3_interface_group(self.controller, port2, port2_out_vlan, 2, intf_src_mac) |
| 913 | port3_ucast_msg=add_l3_interface_group(self.controller, port3, port3_out_vlan, 3, intf_src_mac) |
| 914 | mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [port2_ucast_msg.group_id, port3_ucast_msg.group_id]) |
| 915 | add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id) |
| 916 | |
| 917 | parsed_pkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=1, |
| 918 | eth_dst=dst_mac_str, |
| 919 | eth_src=port1_mac_str, |
| 920 | ip_ttl=64, |
| 921 | ip_src=src_ip_str, |
| 922 | ip_dst=dst_ip_str) |
| 923 | pkt=str(parsed_pkt) |
| 924 | self.dataplane.send(port1, pkt) |
| 925 | parsed_pkt = simple_udp_packet(pktlen=96, |
| 926 | eth_dst=dst_mac_str, |
| 927 | eth_src=intf_src_mac_str, |
| 928 | ip_ttl=63, |
| 929 | ip_src=src_ip_str, |
| 930 | ip_dst=dst_ip_str) |
| 931 | pkt=str(parsed_pkt) |
| 932 | verify_packet(self, pkt, port2) |
| 933 | verify_packet(self, pkt, port3) |
| 934 | verify_no_other_packets(self) |
| 935 | |
| 936 | class L3McastToVPN(base_tests.SimpleDataPlane): |
| 937 | """ |
| 938 | Mcast routing |
| 939 | """ |
| 940 | def runTest(self): |
| 941 | """ |
| 942 | port1 (vlan 1)-> port 2 (vlan 2) |
| 943 | """ |
| 944 | #delete_all_flows(self.controller) |
| 945 | #delete_all_groups(self.controller) |
| 946 | |
| 947 | if len(config["port_map"]) <3: |
castroflavio | 4a09c96 | 2016-01-05 13:13:41 -0800 | [diff] [blame] | 948 | logging.info("Port count less than 3, can't run this case") |
| 949 | assert(False) |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 950 | return |
| 951 | |
| 952 | vlan_id =1 |
| 953 | port2_out_vlan=2 |
| 954 | port3_out_vlan=3 |
| 955 | in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan |
| 956 | intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc] |
| 957 | intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac]) |
| 958 | dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01] |
| 959 | dst_mac_str=':'.join(['%02X' % x for x in dst_mac]) |
| 960 | port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11] |
| 961 | port1_mac_str=':'.join(['%02X' % x for x in port1_mac]) |
| 962 | src_ip=0xc0a80101 |
| 963 | src_ip_str="192.168.1.1" |
| 964 | dst_ip=0xe0010101 |
| 965 | dst_ip_str="224.1.1.1" |
| 966 | |
| 967 | port1=config["port_map"].keys()[0] |
| 968 | port2=config["port_map"].keys()[1] |
| 969 | port3=config["port_map"].keys()[2] |
| 970 | |
| 971 | #add l2 interface group |
| 972 | for port in config["port_map"].keys(): |
| 973 | add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False) |
| 974 | #add vlan flow table |
| 975 | add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG) |
| 976 | vlan_id +=1 |
| 977 | |
| 978 | #add termination flow |
| 979 | add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id) |
| 980 | |
| 981 | #add MPLS interface group |
| 982 | l2_gid = encode_l2_interface_group_id(port2_out_vlan, port2) |
| 983 | mpls_gid2, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, port2_out_vlan, port2) |
| 984 | l2_gid3 = encode_l2_interface_group_id(port3_out_vlan, port3) |
| 985 | mpls_gid3, mpls_msg = add_mpls_intf_group(self.controller, l2_gid3, dst_mac, intf_src_mac, port3_out_vlan, port3) |
| 986 | #add L3VPN groups |
| 987 | mpls_label_gid2, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
| 988 | index=(0x20000+port2), ref_gid= mpls_gid2, push_mpls_header=True, set_mpls_label=port2, set_bos=1, cpy_ttl_outward=True) |
| 989 | mpls_label_gid3, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL, |
| 990 | index=(0x10000+port3), ref_gid= mpls_gid3, push_mpls_header=True, set_mpls_label=port3, set_bos=1, cpy_ttl_outward=True) |
| 991 | |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame] | 992 | mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [0x92020022 , 0x92010023]) |
| 993 | add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id) |
| 994 | |
| 995 | parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=1, |
| 996 | eth_dst=dst_mac_str, |
| 997 | eth_src=port1_mac_str, |
| 998 | ip_ttl=64, |
| 999 | ip_src=src_ip_str, |
| 1000 | ip_dst=dst_ip_str) |
| 1001 | pkt=str(parsed_pkt) |
| 1002 | self.dataplane.send(port1, pkt) |
| 1003 | label = (in_vlan, 0, 1, 63) |
| 1004 | parsed_pkt = mpls_packet(pktlen=100, |
| 1005 | eth_dst=dst_mac_str, |
| 1006 | eth_src=intf_src_mac_str, |
| 1007 | ip_ttl=63, |
| 1008 | ip_src=src_ip_str, label= [label], |
| 1009 | ip_dst=dst_ip_str) |
| 1010 | pkt=str(parsed_pkt) |
| 1011 | verify_packet(self, pkt, port2) |
| 1012 | verify_packet(self, pkt, port3) |
| 1013 | verify_no_other_packets(self) |