1 # Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # vim: tabstop=4 shiftwidth=4 softtabstop=4
20 from ryu.ofproto import ofproto_v1_2
21 from ryu.ofproto import ether
22 from ryu.ofproto import inet
23 from ryu.tests.integrated import tester
25 LOG = logging.getLogger(__name__)
28 class RunTest(tester.TestFlowBase):
29 """ Test case for add flows of Matches
31 OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION]
33 def __init__(self, *args, **kwargs):
34 super(RunTest, self).__init__(*args, **kwargs)
38 def add_matches(self, dp, match):
39 m = dp.ofproto_parser.OFPFlowMod(dp, 0, 0, 0,
43 0xffffffff, 0, match, [])
46 def _set_verify(self, headers, value, mask=None,
47 all_bits_masked=False, type_='int'):
49 self._verify['headers'] = headers
50 self._verify['value'] = value
51 self._verify['mask'] = mask
52 self._verify['all_bits_masked'] = all_bits_masked
53 self._verify['type'] = type_
55 def verify_default(self, dp, stats):
56 type_ = self._verify['type']
57 headers = self._verify['headers']
58 value = self._verify['value']
59 mask = self._verify['mask']
60 value_masked = self._masked(type_, value, mask)
61 all_bits_masked = self._verify['all_bits_masked']
65 for f in s.match.fields:
66 if f.header in headers:
71 if self._is_all_zero_bit(type_, mask):
73 return 'Field not found.'
76 if hasattr(field, 'mask'):
81 if (f_value == value) or (f_value == value_masked):
82 if (f_mask == mask) or (all_bits_masked and f_mask is None):
85 return "send: %s/%s, reply: %s/%s" \
86 % (self._cnv_to_str(type_, value, mask, f_value, f_mask))
88 def _masked(self, type_, value, mask):
94 v = self.haddr_masked(value, mask)
96 v = self.ipv4_masked(value, mask)
98 v = self.ipv6_masked(value, mask)
100 raise Exception('Unknown type')
103 def _is_all_zero_bit(self, type_, val):
104 if type_ == 'int' or type_ == 'ipv4':
111 elif type_ == 'ipv6':
117 raise Exception('Unknown type')
119 def _cnv_to_str(self, type_, value, mask, f_value, f_mask):
124 func = self.haddr_to_str
125 elif type_ == 'ipv4':
126 func = self.ipv4_to_str
127 elif type_ == 'ipv6':
128 func = self.ipv6_to_str
130 raise Exception('Unknown type')
134 f_value = func(f_value)
138 f_mask = func(f_mask)
140 return value, mask, f_value, f_mask
142 def test_rule_set_dl_dst(self, dp):
143 dl_dst = 'e2:7a:09:79:0b:0f'
144 dl_dst_bin = self.haddr_to_bin(dl_dst)
146 headers = [dp.ofproto.OXM_OF_ETH_DST, dp.ofproto.OXM_OF_ETH_DST_W]
147 self._set_verify(headers, dl_dst_bin, type_='mac')
149 match = dp.ofproto_parser.OFPMatch()
150 match.set_dl_dst(dl_dst_bin)
151 self.add_matches(dp, match)
153 def test_rule_set_dl_dst_masked_ff(self, dp):
154 dl_dst = 'd0:98:79:b4:75:b5'
155 dl_dst_bin = self.haddr_to_bin(dl_dst)
156 mask = 'ff:ff:ff:ff:ff:ff'
157 mask_bin = self.haddr_to_bin(mask)
159 headers = [dp.ofproto.OXM_OF_ETH_DST, dp.ofproto.OXM_OF_ETH_DST_W]
160 self._set_verify(headers, dl_dst_bin, mask_bin, True, type_='mac')
162 match = dp.ofproto_parser.OFPMatch()
163 match.set_dl_dst_masked(dl_dst_bin, mask_bin)
164 self.add_matches(dp, match)
166 def test_rule_set_dl_dst_masked_f0(self, dp):
167 dl_dst = 'e2:7a:09:79:0b:0f'
168 dl_dst_bin = self.haddr_to_bin(dl_dst)
169 mask = 'ff:ff:ff:ff:ff:00'
170 mask_bin = self.haddr_to_bin(mask)
172 headers = [dp.ofproto.OXM_OF_ETH_DST, dp.ofproto.OXM_OF_ETH_DST_W]
173 self._set_verify(headers, dl_dst_bin, mask_bin, type_='mac')
175 match = dp.ofproto_parser.OFPMatch()
176 match.set_dl_dst_masked(dl_dst_bin, mask_bin)
177 self.add_matches(dp, match)
179 def test_rule_set_dl_dst_masked_00(self, dp):
180 dl_dst = 'e2:7a:09:79:0b:0f'
181 dl_dst_bin = self.haddr_to_bin(dl_dst)
182 mask = '00:00:00:00:00:00'
183 mask_bin = self.haddr_to_bin(mask)
185 headers = [dp.ofproto.OXM_OF_ETH_DST, dp.ofproto.OXM_OF_ETH_DST_W]
186 self._set_verify(headers, dl_dst_bin, mask_bin, type_='mac')
188 match = dp.ofproto_parser.OFPMatch()
189 match.set_dl_dst_masked(dl_dst_bin, mask_bin)
190 self.add_matches(dp, match)
192 def test_rule_set_dl_src(self, dp):
193 dl_src = 'e2:7a:09:79:0b:0f'
194 dl_src_bin = self.haddr_to_bin(dl_src)
196 headers = [dp.ofproto.OXM_OF_ETH_SRC, dp.ofproto.OXM_OF_ETH_SRC_W]
197 self._set_verify(headers, dl_src_bin, type_='mac')
199 match = dp.ofproto_parser.OFPMatch()
200 match.set_dl_src(dl_src_bin)
201 self.add_matches(dp, match)
203 def test_rule_set_dl_src_masked_ff(self, dp):
204 dl_src = 'e2:7a:09:79:0b:0f'
205 dl_src_bin = self.haddr_to_bin(dl_src)
206 mask = 'ff:ff:ff:ff:ff:ff'
207 mask_bin = self.haddr_to_bin(mask)
209 headers = [dp.ofproto.OXM_OF_ETH_SRC, dp.ofproto.OXM_OF_ETH_SRC_W]
210 self._set_verify(headers, dl_src_bin, mask_bin, True, type_='mac')
212 match = dp.ofproto_parser.OFPMatch()
213 match.set_dl_src_masked(dl_src_bin, mask_bin)
214 self.add_matches(dp, match)
216 def test_rule_set_dl_src_masked_f0(self, dp):
217 dl_src = 'e2:7a:09:79:0b:0f'
218 dl_src_bin = self.haddr_to_bin(dl_src)
219 mask = 'ff:ff:ff:ff:ff:00'
220 mask_bin = self.haddr_to_bin(mask)
222 headers = [dp.ofproto.OXM_OF_ETH_SRC, dp.ofproto.OXM_OF_ETH_SRC_W]
223 self._set_verify(headers, dl_src_bin, mask_bin, type_='mac')
225 match = dp.ofproto_parser.OFPMatch()
226 match.set_dl_src_masked(dl_src_bin, mask_bin)
227 self.add_matches(dp, match)
229 def test_rule_set_dl_src_masked_00(self, dp):
230 dl_src = 'e2:7a:09:79:0b:0f'
231 dl_src_bin = self.haddr_to_bin(dl_src)
232 mask = '00:00:00:00:00:00'
233 mask_bin = self.haddr_to_bin(mask)
235 headers = [dp.ofproto.OXM_OF_ETH_SRC, dp.ofproto.OXM_OF_ETH_SRC_W]
236 self._set_verify(headers, dl_src_bin, mask_bin, type_='mac')
238 match = dp.ofproto_parser.OFPMatch()
239 match.set_dl_src_masked(dl_src_bin, mask_bin)
240 self.add_matches(dp, match)
242 def test_rule_set_dl_type_ip(self, dp):
243 dl_type = ether.ETH_TYPE_IP
245 headers = [dp.ofproto.OXM_OF_ETH_TYPE]
246 self._set_verify(headers, dl_type)
248 match = dp.ofproto_parser.OFPMatch()
249 match.set_dl_type(dl_type)
250 self.add_matches(dp, match)
252 def test_rule_set_dl_type_arp(self, dp):
253 dl_type = ether.ETH_TYPE_ARP
255 headers = [dp.ofproto.OXM_OF_ETH_TYPE]
256 self._set_verify(headers, dl_type)
258 match = dp.ofproto_parser.OFPMatch()
259 match.set_dl_type(dl_type)
260 self.add_matches(dp, match)
262 def test_rule_set_dl_type_vlan(self, dp):
263 dl_type = ether.ETH_TYPE_8021Q
265 headers = [dp.ofproto.OXM_OF_ETH_TYPE]
266 self._set_verify(headers, dl_type)
268 match = dp.ofproto_parser.OFPMatch()
269 match.set_dl_type(dl_type)
270 self.add_matches(dp, match)
272 def test_rule_set_dl_type_ipv6(self, dp):
273 dl_type = ether.ETH_TYPE_IPV6
275 headers = [dp.ofproto.OXM_OF_ETH_TYPE]
276 self._set_verify(headers, dl_type)
278 match = dp.ofproto_parser.OFPMatch()
279 match.set_dl_type(dl_type)
280 self.add_matches(dp, match)
282 def test_rule_set_dl_type_lacp(self, dp):
283 dl_type = ether.ETH_TYPE_SLOW
285 headers = [dp.ofproto.OXM_OF_ETH_TYPE]
286 self._set_verify(headers, dl_type)
288 match = dp.ofproto_parser.OFPMatch()
289 match.set_dl_type(dl_type)
290 self.add_matches(dp, match)
292 def test_rule_set_ip_dscp(self, dp):
294 dl_type = ether.ETH_TYPE_IP
296 headers = [dp.ofproto.OXM_OF_IP_DSCP]
297 self._set_verify(headers, ip_dscp)
299 match = dp.ofproto_parser.OFPMatch()
300 match.set_dl_type(dl_type)
301 match.set_ip_dscp(ip_dscp)
302 self.add_matches(dp, match)
304 def test_rule_set_vlan_vid(self, dp):
307 headers = [dp.ofproto.OXM_OF_VLAN_VID, dp.ofproto.OXM_OF_VLAN_VID_W]
308 self._set_verify(headers, vlan_vid)
310 match = dp.ofproto_parser.OFPMatch()
311 match.set_vlan_vid(vlan_vid)
312 self.add_matches(dp, match)
314 def test_rule_set_vlan_vid_masked_ff(self, dp):
318 headers = [dp.ofproto.OXM_OF_VLAN_VID, dp.ofproto.OXM_OF_VLAN_VID_W]
319 self._set_verify(headers, vlan_vid, mask, True)
321 match = dp.ofproto_parser.OFPMatch()
322 match.set_vlan_vid_masked(vlan_vid, mask)
323 self.add_matches(dp, match)
325 def test_rule_set_vlan_vid_masked_f0(self, dp):
329 headers = [dp.ofproto.OXM_OF_VLAN_VID, dp.ofproto.OXM_OF_VLAN_VID_W]
330 self._set_verify(headers, vlan_vid, mask)
332 match = dp.ofproto_parser.OFPMatch()
333 match.set_vlan_vid_masked(vlan_vid, mask)
334 self.add_matches(dp, match)
336 def test_rule_set_vlan_vid_masked_00(self, dp):
340 headers = [dp.ofproto.OXM_OF_VLAN_VID, dp.ofproto.OXM_OF_VLAN_VID_W]
341 self._set_verify(headers, vlan_vid, mask)
343 match = dp.ofproto_parser.OFPMatch()
344 match.set_vlan_vid_masked(vlan_vid, mask)
345 self.add_matches(dp, match)
347 def test_rule_set_vlan_pcp(self, dp):
351 headers = [dp.ofproto.OXM_OF_VLAN_PCP]
352 self._set_verify(headers, vlan_pcp)
354 match = dp.ofproto_parser.OFPMatch()
355 match.set_vlan_vid(vlan_vid)
356 match.set_vlan_pcp(vlan_pcp)
357 self.add_matches(dp, match)
359 def test_rule_set_ip_ecn(self, dp):
360 dl_type = ether.ETH_TYPE_IP
363 headers = [dp.ofproto.OXM_OF_IP_ECN]
364 self._set_verify(headers, ip_ecn)
366 match = dp.ofproto_parser.OFPMatch()
367 match.set_dl_type(dl_type)
368 match.set_ip_ecn(ip_ecn)
369 self.add_matches(dp, match)
371 def test_rule_set_ip_proto_icmp(self, dp):
372 dl_type = ether.ETH_TYPE_IP
373 ip_proto = inet.IPPROTO_ICMP
375 headers = [dp.ofproto.OXM_OF_IP_PROTO]
376 self._set_verify(headers, ip_proto)
378 match = dp.ofproto_parser.OFPMatch()
379 match.set_dl_type(dl_type)
380 match.set_ip_proto(ip_proto)
381 self.add_matches(dp, match)
383 def test_rule_set_ip_proto_tcp(self, dp):
384 dl_type = ether.ETH_TYPE_IP
385 ip_proto = inet.IPPROTO_TCP
387 headers = [dp.ofproto.OXM_OF_IP_PROTO]
388 self._set_verify(headers, ip_proto)
390 match = dp.ofproto_parser.OFPMatch()
391 match.set_dl_type(dl_type)
392 match.set_ip_proto(ip_proto)
393 self.add_matches(dp, match)
395 def test_rule_set_ip_proto_udp(self, dp):
396 dl_type = ether.ETH_TYPE_IP
397 ip_proto = inet.IPPROTO_UDP
399 headers = [dp.ofproto.OXM_OF_IP_PROTO]
400 self._set_verify(headers, ip_proto)
402 match = dp.ofproto_parser.OFPMatch()
403 match.set_dl_type(dl_type)
404 match.set_ip_proto(ip_proto)
405 self.add_matches(dp, match)
407 def test_rule_set_ip_proto_ipv6_route(self, dp):
408 dl_type = ether.ETH_TYPE_IPV6
409 ip_proto = inet.IPPROTO_ROUTING
411 headers = [dp.ofproto.OXM_OF_IP_PROTO]
412 self._set_verify(headers, ip_proto)
414 match = dp.ofproto_parser.OFPMatch()
415 match.set_dl_type(dl_type)
416 match.set_ip_proto(ip_proto)
417 self.add_matches(dp, match)
419 def test_rule_set_ip_proto_ipv6_frag(self, dp):
420 dl_type = ether.ETH_TYPE_IPV6
421 ip_proto = inet.IPPROTO_FRAGMENT
423 headers = [dp.ofproto.OXM_OF_IP_PROTO]
424 self._set_verify(headers, ip_proto)
426 match = dp.ofproto_parser.OFPMatch()
427 match.set_dl_type(dl_type)
428 match.set_ip_proto(ip_proto)
429 self.add_matches(dp, match)
431 def test_rule_set_ip_proto_ipv6_icmp(self, dp):
432 dl_type = ether.ETH_TYPE_IPV6
433 ip_proto = inet.IPPROTO_ICMPV6
435 headers = [dp.ofproto.OXM_OF_IP_PROTO]
436 self._set_verify(headers, ip_proto)
438 match = dp.ofproto_parser.OFPMatch()
439 match.set_dl_type(dl_type)
440 match.set_ip_proto(ip_proto)
441 self.add_matches(dp, match)
443 def test_rule_set_ip_proto_ipv6_none(self, dp):
444 dl_type = ether.ETH_TYPE_IPV6
445 ip_proto = inet.IPPROTO_NONE
447 headers = [dp.ofproto.OXM_OF_IP_PROTO]
448 self._set_verify(headers, ip_proto)
450 match = dp.ofproto_parser.OFPMatch()
451 match.set_dl_type(dl_type)
452 match.set_ip_proto(ip_proto)
453 self.add_matches(dp, match)
455 def test_rule_set_ip_proto_ipv6_dstopts(self, dp):
456 dl_type = ether.ETH_TYPE_IPV6
457 ip_proto = inet.IPPROTO_DSTOPTS
459 headers = [dp.ofproto.OXM_OF_IP_PROTO]
460 self._set_verify(headers, ip_proto)
462 match = dp.ofproto_parser.OFPMatch()
463 match.set_dl_type(dl_type)
464 match.set_ip_proto(ip_proto)
465 self.add_matches(dp, match)
467 def test_rule_set_ipv4_src(self, dp):
468 dl_type = ether.ETH_TYPE_IP
469 src = '192.168.196.250'
470 src_int = self.ipv4_to_int(src)
472 headers = [dp.ofproto.OXM_OF_IPV4_SRC, dp.ofproto.OXM_OF_IPV4_SRC_W]
473 self._set_verify(headers, src_int, type_='ipv4')
475 match = dp.ofproto_parser.OFPMatch()
476 match.set_dl_type(dl_type)
477 match.set_ipv4_src(src_int)
478 self.add_matches(dp, match)
480 def test_rule_set_ipv4_src_masked_32(self, dp):
481 dl_type = ether.ETH_TYPE_IP
482 src = '192.168.196.250'
483 src_int = self.ipv4_to_int(src)
484 mask = '255.255.255.255'
485 mask_int = self.ipv4_to_int(mask)
487 headers = [dp.ofproto.OXM_OF_IPV4_SRC, dp.ofproto.OXM_OF_IPV4_SRC_W]
488 self._set_verify(headers, src_int, mask_int, True, type_='ipv4')
490 match = dp.ofproto_parser.OFPMatch()
491 match.set_dl_type(dl_type)
492 match.set_ipv4_src_masked(src_int, mask_int)
493 self.add_matches(dp, match)
495 def test_rule_set_ipv4_src_masked_24(self, dp):
496 dl_type = ether.ETH_TYPE_IP
497 src = '192.168.196.250'
498 src_int = self.ipv4_to_int(src)
499 mask = '255.255.255.0'
500 mask_int = self.ipv4_to_int(mask)
502 headers = [dp.ofproto.OXM_OF_IPV4_SRC, dp.ofproto.OXM_OF_IPV4_SRC_W]
503 self._set_verify(headers, src_int, mask_int, type_='ipv4')
505 match = dp.ofproto_parser.OFPMatch()
506 match.set_dl_type(dl_type)
507 match.set_ipv4_src_masked(src_int, mask_int)
508 self.add_matches(dp, match)
510 def test_rule_set_ipv4_src_masked_0(self, dp):
511 dl_type = ether.ETH_TYPE_IP
512 src = '192.168.196.250'
513 src_int = self.ipv4_to_int(src)
515 mask_int = self.ipv4_to_int(mask)
517 headers = [dp.ofproto.OXM_OF_IPV4_SRC, dp.ofproto.OXM_OF_IPV4_SRC_W]
518 self._set_verify(headers, src_int, mask_int, type_='ipv4')
520 match = dp.ofproto_parser.OFPMatch()
521 match.set_dl_type(dl_type)
522 match.set_ipv4_src_masked(src_int, mask_int)
523 self.add_matches(dp, match)
525 def test_rule_set_ipv4_dst(self, dp):
526 dl_type = ether.ETH_TYPE_IP
527 dst = '192.168.54.155'
528 dst_int = self.ipv4_to_int(dst)
530 headers = [dp.ofproto.OXM_OF_IPV4_DST, dp.ofproto.OXM_OF_IPV4_DST_W]
531 self._set_verify(headers, dst_int, type_='ipv4')
533 match = dp.ofproto_parser.OFPMatch()
534 match.set_dl_type(dl_type)
535 match.set_ipv4_dst(dst_int)
536 self.add_matches(dp, match)
538 def test_rule_set_ipv4_dst_masked_32(self, dp):
539 dl_type = ether.ETH_TYPE_IP
540 dst = '192.168.54.155'
541 dst_int = self.ipv4_to_int(dst)
542 mask = '255.255.255.255'
543 mask_int = self.ipv4_to_int(mask)
545 headers = [dp.ofproto.OXM_OF_IPV4_DST, dp.ofproto.OXM_OF_IPV4_DST_W]
546 self._set_verify(headers, dst_int, mask_int, True, type_='ipv4')
548 match = dp.ofproto_parser.OFPMatch()
549 match.set_dl_type(dl_type)
550 match.set_ipv4_dst_masked(dst_int, mask_int)
551 self.add_matches(dp, match)
553 def test_rule_set_ipv4_dst_masked_24(self, dp):
554 dl_type = ether.ETH_TYPE_IP
555 dst = '192.168.54.155'
556 dst_int = self.ipv4_to_int(dst)
557 mask = '255.255.255.0'
558 mask_int = self.ipv4_to_int(mask)
560 headers = [dp.ofproto.OXM_OF_IPV4_DST, dp.ofproto.OXM_OF_IPV4_DST_W]
561 self._set_verify(headers, dst_int, mask_int, type_='ipv4')
563 match = dp.ofproto_parser.OFPMatch()
564 match.set_dl_type(dl_type)
565 match.set_ipv4_dst_masked(dst_int, mask_int)
566 self.add_matches(dp, match)
568 def test_rule_set_ipv4_dst_masked_0(self, dp):
569 dl_type = ether.ETH_TYPE_IP
570 dst = '192.168.54.155'
571 dst_int = self.ipv4_to_int(dst)
573 mask_int = self.ipv4_to_int(mask)
575 headers = [dp.ofproto.OXM_OF_IPV4_DST, dp.ofproto.OXM_OF_IPV4_DST_W]
576 self._set_verify(headers, dst_int, mask_int, type_='ipv4')
578 match = dp.ofproto_parser.OFPMatch()
579 match.set_dl_type(dl_type)
580 match.set_ipv4_dst_masked(dst_int, mask_int)
581 self.add_matches(dp, match)
583 def test_rule_set_tcp_src(self, dp):
584 dl_type = ether.ETH_TYPE_IP
585 ip_proto = inet.IPPROTO_TCP
588 headers = [dp.ofproto.OXM_OF_TCP_SRC]
589 self._set_verify(headers, tp_src)
591 match = dp.ofproto_parser.OFPMatch()
592 match.set_dl_type(dl_type)
593 match.set_ip_proto(ip_proto)
594 match.set_tcp_src(tp_src)
595 self.add_matches(dp, match)
597 def test_rule_set_tcp_dst(self, dp):
598 dl_type = ether.ETH_TYPE_IP
599 ip_proto = inet.IPPROTO_TCP
602 headers = [dp.ofproto.OXM_OF_TCP_DST]
603 self._set_verify(headers, tp_dst)
605 match = dp.ofproto_parser.OFPMatch()
606 match.set_dl_type(dl_type)
607 match.set_ip_proto(ip_proto)
608 match.set_tcp_dst(tp_dst)
609 self.add_matches(dp, match)
611 def test_rule_set_udp_src(self, dp):
612 dl_type = ether.ETH_TYPE_IP
613 ip_proto = inet.IPPROTO_UDP
616 headers = [dp.ofproto.OXM_OF_UDP_SRC]
617 self._set_verify(headers, tp_src)
619 match = dp.ofproto_parser.OFPMatch()
620 match.set_dl_type(dl_type)
621 match.set_ip_proto(ip_proto)
622 match.set_udp_src(tp_src)
623 self.add_matches(dp, match)
625 def test_rule_set_udp_dst(self, dp):
626 dl_type = ether.ETH_TYPE_IP
627 ip_proto = inet.IPPROTO_UDP
630 headers = [dp.ofproto.OXM_OF_UDP_DST]
631 self._set_verify(headers, tp_dst)
633 match = dp.ofproto_parser.OFPMatch()
634 match.set_dl_type(dl_type)
635 match.set_ip_proto(ip_proto)
636 match.set_udp_dst(tp_dst)
637 self.add_matches(dp, match)
639 def test_rule_set_icmpv4_type(self, dp):
640 dl_type = ether.ETH_TYPE_IP
641 ip_proto = inet.IPPROTO_ICMP
644 headers = [dp.ofproto.OXM_OF_ICMPV4_TYPE]
645 self._set_verify(headers, icmp_type)
647 match = dp.ofproto_parser.OFPMatch()
648 match.set_dl_type(dl_type)
649 match.set_ip_proto(ip_proto)
650 match.set_icmpv4_type(icmp_type)
651 self.add_matches(dp, match)
653 def test_rule_set_icmpv4_code(self, dp):
654 dl_type = ether.ETH_TYPE_IP
655 ip_proto = inet.IPPROTO_ICMP
659 headers = [dp.ofproto.OXM_OF_ICMPV4_CODE]
660 self._set_verify(headers, icmp_code)
662 match = dp.ofproto_parser.OFPMatch()
663 match.set_dl_type(dl_type)
664 match.set_ip_proto(ip_proto)
665 match.set_icmpv4_type(icmp_type)
666 match.set_icmpv4_code(icmp_code)
667 self.add_matches(dp, match)
669 def test_rule_set_arp_opcode(self, dp):
670 dl_type = ether.ETH_TYPE_ARP
673 headers = [dp.ofproto.OXM_OF_ARP_OP]
674 self._set_verify(headers, arp_op)
676 match = dp.ofproto_parser.OFPMatch()
677 match.set_dl_type(dl_type)
678 match.set_arp_opcode(arp_op)
679 self.add_matches(dp, match)
681 def test_rule_set_arp_spa(self, dp):
682 dl_type = ether.ETH_TYPE_ARP
683 nw_src = '192.168.222.57'
684 nw_src_int = self.ipv4_to_int(nw_src)
686 headers = [dp.ofproto.OXM_OF_ARP_SPA, dp.ofproto.OXM_OF_ARP_SPA_W]
687 self._set_verify(headers, nw_src_int, type_='ipv4')
689 match = dp.ofproto_parser.OFPMatch()
690 match.set_dl_type(dl_type)
691 match.set_arp_spa(nw_src_int)
692 self.add_matches(dp, match)
694 def test_rule_set_arp_spa_masked_32(self, dp):
695 dl_type = ether.ETH_TYPE_ARP
696 nw_src = '192.168.222.57'
697 nw_src_int = self.ipv4_to_int(nw_src)
698 mask = '255.255.255.255'
699 mask_int = self.ipv4_to_int(mask)
701 headers = [dp.ofproto.OXM_OF_ARP_SPA, dp.ofproto.OXM_OF_ARP_SPA_W]
702 self._set_verify(headers, nw_src_int, mask_int, True, type_='ipv4')
704 match = dp.ofproto_parser.OFPMatch()
705 match.set_dl_type(dl_type)
706 match.set_arp_spa_masked(nw_src_int, mask_int)
707 self.add_matches(dp, match)
709 def test_rule_set_arp_spa_masked_24(self, dp):
710 dl_type = ether.ETH_TYPE_ARP
711 nw_src = '192.168.222.57'
712 nw_src_int = self.ipv4_to_int(nw_src)
713 mask = '255.255.255.0'
714 mask_int = self.ipv4_to_int(mask)
716 headers = [dp.ofproto.OXM_OF_ARP_SPA, dp.ofproto.OXM_OF_ARP_SPA_W]
717 self._set_verify(headers, nw_src_int, mask_int, type_='ipv4')
719 match = dp.ofproto_parser.OFPMatch()
720 match.set_dl_type(dl_type)
721 match.set_arp_spa_masked(nw_src_int, mask_int)
722 self.add_matches(dp, match)
724 def test_rule_set_arp_spa_masked_00(self, dp):
725 dl_type = ether.ETH_TYPE_ARP
726 nw_src = '192.168.222.57'
727 nw_src_int = self.ipv4_to_int(nw_src)
729 mask_int = self.ipv4_to_int(mask)
731 headers = [dp.ofproto.OXM_OF_ARP_SPA, dp.ofproto.OXM_OF_ARP_SPA_W]
732 self._set_verify(headers, nw_src_int, mask_int, type_='ipv4')
734 match = dp.ofproto_parser.OFPMatch()
735 match.set_dl_type(dl_type)
736 match.set_arp_spa_masked(nw_src_int, mask_int)
737 self.add_matches(dp, match)
739 def test_rule_set_arp_tpa(self, dp):
740 dl_type = ether.ETH_TYPE_ARP
741 nw_dst = '192.168.198.233'
742 nw_dst_int = self.ipv4_to_int(nw_dst)
744 headers = [dp.ofproto.OXM_OF_ARP_TPA, dp.ofproto.OXM_OF_ARP_TPA_W]
745 self._set_verify(headers, nw_dst_int, type_='ipv4')
747 match = dp.ofproto_parser.OFPMatch()
748 match.set_dl_type(dl_type)
749 match.set_arp_tpa(nw_dst_int)
750 self.add_matches(dp, match)
752 def test_rule_set_arp_tpa_masked_32(self, dp):
753 dl_type = ether.ETH_TYPE_ARP
754 nw_dst = '192.168.198.233'
755 nw_dst_int = self.ipv4_to_int(nw_dst)
756 mask = '255.255.255.255'
757 mask_int = self.ipv4_to_int(mask)
759 headers = [dp.ofproto.OXM_OF_ARP_TPA, dp.ofproto.OXM_OF_ARP_TPA_W]
760 self._set_verify(headers, nw_dst_int, mask_int, True, type_='ipv4')
762 match = dp.ofproto_parser.OFPMatch()
763 match.set_dl_type(dl_type)
764 match.set_arp_tpa_masked(nw_dst_int, mask_int)
765 self.add_matches(dp, match)
767 def test_rule_set_arp_tpa_masked_24(self, dp):
768 dl_type = ether.ETH_TYPE_ARP
769 nw_dst = '192.168.198.233'
770 nw_dst_int = self.ipv4_to_int(nw_dst)
771 mask = '255.255.255.0'
772 mask_int = self.ipv4_to_int(mask)
774 headers = [dp.ofproto.OXM_OF_ARP_TPA, dp.ofproto.OXM_OF_ARP_TPA_W]
775 self._set_verify(headers, nw_dst_int, mask_int, type_='ipv4')
777 match = dp.ofproto_parser.OFPMatch()
778 match.set_dl_type(dl_type)
779 match.set_arp_tpa_masked(nw_dst_int, mask_int)
780 self.add_matches(dp, match)
782 def test_rule_set_arp_tpa_masked_00(self, dp):
783 dl_type = ether.ETH_TYPE_ARP
784 nw_dst = '192.168.198.233'
785 nw_dst_int = self.ipv4_to_int(nw_dst)
787 mask_int = self.ipv4_to_int(mask)
789 headers = [dp.ofproto.OXM_OF_ARP_TPA, dp.ofproto.OXM_OF_ARP_TPA_W]
790 self._set_verify(headers, nw_dst_int, mask_int, type_='ipv4')
792 match = dp.ofproto_parser.OFPMatch()
793 match.set_dl_type(dl_type)
794 match.set_arp_tpa_masked(nw_dst_int, mask_int)
795 self.add_matches(dp, match)
797 def test_rule_set_arp_sha(self, dp):
798 dl_type = ether.ETH_TYPE_ARP
799 arp_sha = '3e:ec:13:9b:f3:0b'
800 arp_sha_bin = self.haddr_to_bin(arp_sha)
802 headers = [dp.ofproto.OXM_OF_ARP_SHA, dp.ofproto.OXM_OF_ARP_SHA_W]
803 self._set_verify(headers, arp_sha_bin, type_='mac')
805 match = dp.ofproto_parser.OFPMatch()
806 match.set_dl_type(dl_type)
807 match.set_arp_sha(arp_sha_bin)
808 self.add_matches(dp, match)
810 def test_rule_set_arp_sha_masked_ff(self, dp):
811 dl_type = ether.ETH_TYPE_ARP
812 arp_sha = '3e:ec:13:9b:f3:0b'
813 arp_sha_bin = self.haddr_to_bin(arp_sha)
814 mask = 'ff:ff:ff:ff:ff:ff'
815 mask_bin = self.haddr_to_bin(mask)
817 headers = [dp.ofproto.OXM_OF_ARP_SHA, dp.ofproto.OXM_OF_ARP_SHA_W]
818 self._set_verify(headers, arp_sha_bin, mask_bin, True, type_='mac')
820 match = dp.ofproto_parser.OFPMatch()
821 match.set_dl_type(dl_type)
822 match.set_arp_sha_masked(arp_sha_bin, mask_bin)
823 self.add_matches(dp, match)
825 def test_rule_set_arp_sha_masked_f0(self, dp):
826 dl_type = ether.ETH_TYPE_ARP
827 arp_sha = '3e:ec:13:9b:f3:0b'
828 arp_sha_bin = self.haddr_to_bin(arp_sha)
829 mask = 'ff:ff:ff:ff:ff:00'
830 mask_bin = self.haddr_to_bin(mask)
832 headers = [dp.ofproto.OXM_OF_ARP_SHA, dp.ofproto.OXM_OF_ARP_SHA_W]
833 self._set_verify(headers, arp_sha_bin, mask_bin, type_='mac')
835 match = dp.ofproto_parser.OFPMatch()
836 match.set_dl_type(dl_type)
837 match.set_arp_sha_masked(arp_sha_bin, mask_bin)
838 self.add_matches(dp, match)
840 def test_rule_set_arp_sha_masked_00(self, dp):
841 dl_type = ether.ETH_TYPE_ARP
842 arp_sha = '3e:ec:13:9b:f3:0b'
843 arp_sha_bin = self.haddr_to_bin(arp_sha)
844 mask = '00:00:00:00:00:00'
845 mask_bin = self.haddr_to_bin(mask)
847 headers = [dp.ofproto.OXM_OF_ARP_SHA, dp.ofproto.OXM_OF_ARP_SHA_W]
848 self._set_verify(headers, arp_sha_bin, mask_bin, type_='mac')
850 match = dp.ofproto_parser.OFPMatch()
851 match.set_dl_type(dl_type)
852 match.set_arp_sha_masked(arp_sha_bin, mask_bin)
853 self.add_matches(dp, match)
855 def test_rule_set_arp_tha(self, dp):
856 dl_type = ether.ETH_TYPE_ARP
857 arp_tha = '83:6c:21:52:49:68'
858 arp_tha_bin = self.haddr_to_bin(arp_tha)
860 headers = [dp.ofproto.OXM_OF_ARP_THA, dp.ofproto.OXM_OF_ARP_THA_W]
861 self._set_verify(headers, arp_tha_bin, type_='mac')
863 match = dp.ofproto_parser.OFPMatch()
864 match.set_dl_type(dl_type)
865 match.set_arp_tha(arp_tha_bin)
866 self.add_matches(dp, match)
868 def test_rule_set_arp_tha_masked_ff(self, dp):
869 dl_type = ether.ETH_TYPE_ARP
870 arp_tha = '83:6c:21:52:49:68'
871 arp_tha_bin = self.haddr_to_bin(arp_tha)
872 mask = 'ff:ff:ff:ff:ff:ff'
873 mask_bin = self.haddr_to_bin(mask)
875 headers = [dp.ofproto.OXM_OF_ARP_THA, dp.ofproto.OXM_OF_ARP_THA_W]
876 self._set_verify(headers, arp_tha_bin, mask_bin, True, type_='mac')
878 match = dp.ofproto_parser.OFPMatch()
879 match.set_dl_type(dl_type)
880 match.set_arp_tha_masked(arp_tha_bin, mask_bin)
881 self.add_matches(dp, match)
883 def test_rule_set_arp_tha_masked_f0(self, dp):
884 dl_type = ether.ETH_TYPE_ARP
885 arp_tha = '83:6c:21:52:49:68'
886 arp_tha_bin = self.haddr_to_bin(arp_tha)
887 mask = 'ff:ff:ff:ff:ff:00'
888 mask_bin = self.haddr_to_bin(mask)
890 headers = [dp.ofproto.OXM_OF_ARP_THA, dp.ofproto.OXM_OF_ARP_THA_W]
891 self._set_verify(headers, arp_tha_bin, mask_bin, type_='mac')
893 match = dp.ofproto_parser.OFPMatch()
894 match.set_dl_type(dl_type)
895 match.set_arp_tha_masked(arp_tha_bin, mask_bin)
896 self.add_matches(dp, match)
898 def test_rule_set_arp_tha_masked_00(self, dp):
899 dl_type = ether.ETH_TYPE_ARP
900 arp_tha = '83:6c:21:52:49:68'
901 arp_tha_bin = self.haddr_to_bin(arp_tha)
902 mask = '00:00:00:00:00:00'
903 mask_bin = self.haddr_to_bin(mask)
905 headers = [dp.ofproto.OXM_OF_ARP_THA, dp.ofproto.OXM_OF_ARP_THA_W]
906 self._set_verify(headers, arp_tha_bin, mask_bin, type_='mac')
908 match = dp.ofproto_parser.OFPMatch()
909 match.set_dl_type(dl_type)
910 match.set_arp_tha_masked(arp_tha_bin, mask_bin)
911 self.add_matches(dp, match)
913 def test_rule_set_ipv6_src(self, dp):
914 dl_type = ether.ETH_TYPE_IPV6
915 ipv6_src = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
916 ipv6_src_int = self.ipv6_to_int(ipv6_src)
918 headers = [dp.ofproto.OXM_OF_IPV6_SRC, dp.ofproto.OXM_OF_IPV6_SRC_W]
919 self._set_verify(headers, ipv6_src_int, type_='ipv6')
921 match = dp.ofproto_parser.OFPMatch()
922 match.set_dl_type(dl_type)
923 match.set_ipv6_src(ipv6_src_int)
924 self.add_matches(dp, match)
926 def test_rule_set_ipv6_src_masked_ff(self, dp):
927 dl_type = ether.ETH_TYPE_IPV6
928 ipv6_src = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
929 ipv6_src_int = self.ipv6_to_int(ipv6_src)
930 mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
931 mask_int = self.ipv6_to_int(mask)
933 headers = [dp.ofproto.OXM_OF_IPV6_SRC, dp.ofproto.OXM_OF_IPV6_SRC_W]
934 self._set_verify(headers, ipv6_src_int, mask_int, True, type_='ipv6')
936 match = dp.ofproto_parser.OFPMatch()
937 match.set_dl_type(dl_type)
938 match.set_ipv6_src_masked(ipv6_src_int, mask_int)
939 self.add_matches(dp, match)
941 def test_rule_set_ipv6_src_masked_f0(self, dp):
942 dl_type = ether.ETH_TYPE_IPV6
943 ipv6_src = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
944 ipv6_src_int = self.ipv6_to_int(ipv6_src)
945 mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:0'
946 mask_int = self.ipv6_to_int(mask)
948 headers = [dp.ofproto.OXM_OF_IPV6_SRC, dp.ofproto.OXM_OF_IPV6_SRC_W]
949 self._set_verify(headers, ipv6_src_int, mask_int, type_='ipv6')
951 match = dp.ofproto_parser.OFPMatch()
952 match.set_dl_type(dl_type)
953 match.set_ipv6_src_masked(ipv6_src_int, mask_int)
954 self.add_matches(dp, match)
956 def test_rule_set_ipv6_src_masked_00(self, dp):
957 dl_type = ether.ETH_TYPE_IPV6
958 ipv6_src = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
959 ipv6_src_int = self.ipv6_to_int(ipv6_src)
960 mask = '0:0:0:0:0:0:0:0'
961 mask_int = self.ipv6_to_int(mask)
963 headers = [dp.ofproto.OXM_OF_IPV6_SRC, dp.ofproto.OXM_OF_IPV6_SRC_W]
964 self._set_verify(headers, ipv6_src_int, mask_int, type_='ipv6')
966 match = dp.ofproto_parser.OFPMatch()
967 match.set_dl_type(dl_type)
968 match.set_ipv6_src_masked(ipv6_src_int, mask_int)
969 self.add_matches(dp, match)
971 def test_rule_set_ipv6_dst(self, dp):
972 dl_type = ether.ETH_TYPE_IPV6
973 ipv6_dst = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
974 ipv6_dst_int = self.ipv6_to_int(ipv6_dst)
976 headers = [dp.ofproto.OXM_OF_IPV6_DST, dp.ofproto.OXM_OF_IPV6_DST_W]
977 self._set_verify(headers, ipv6_dst_int, type_='ipv6')
979 match = dp.ofproto_parser.OFPMatch()
980 match.set_dl_type(dl_type)
981 match.set_ipv6_dst(ipv6_dst_int)
982 self.add_matches(dp, match)
984 def test_rule_set_ipv6_dst_masked_ff(self, dp):
985 dl_type = ether.ETH_TYPE_IPV6
986 ipv6_dst = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
987 ipv6_dst_int = self.ipv6_to_int(ipv6_dst)
988 mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
989 mask_int = self.ipv6_to_int(mask)
991 headers = [dp.ofproto.OXM_OF_IPV6_DST, dp.ofproto.OXM_OF_IPV6_DST_W]
992 self._set_verify(headers, ipv6_dst_int, mask_int, True, type_='ipv6')
994 match = dp.ofproto_parser.OFPMatch()
995 match.set_dl_type(dl_type)
996 match.set_ipv6_dst_masked(ipv6_dst_int, mask_int)
997 self.add_matches(dp, match)
999 def test_rule_set_ipv6_dst_masked_f0(self, dp):
1000 dl_type = ether.ETH_TYPE_IPV6
1001 ipv6_dst = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
1002 ipv6_dst_int = self.ipv6_to_int(ipv6_dst)
1003 mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:0'
1004 mask_int = self.ipv6_to_int(mask)
1006 headers = [dp.ofproto.OXM_OF_IPV6_DST, dp.ofproto.OXM_OF_IPV6_DST_W]
1007 self._set_verify(headers, ipv6_dst_int, mask_int, type_='ipv6')
1009 match = dp.ofproto_parser.OFPMatch()
1010 match.set_dl_type(dl_type)
1011 match.set_ipv6_dst_masked(ipv6_dst_int, mask_int)
1012 self.add_matches(dp, match)
1014 def test_rule_set_ipv6_dst_masked_00(self, dp):
1015 dl_type = ether.ETH_TYPE_IPV6
1016 ipv6_dst = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
1017 ipv6_dst_int = self.ipv6_to_int(ipv6_dst)
1018 mask = '0:0:0:0:0:0:0:0'
1019 mask_int = self.ipv6_to_int(mask)
1021 headers = [dp.ofproto.OXM_OF_IPV6_DST, dp.ofproto.OXM_OF_IPV6_DST_W]
1022 self._set_verify(headers, ipv6_dst_int, mask_int, type_='ipv6')
1024 match = dp.ofproto_parser.OFPMatch()
1025 match.set_dl_type(dl_type)
1026 match.set_ipv6_dst_masked(ipv6_dst_int, mask_int)
1027 self.add_matches(dp, match)
1029 def test_rule_set_ipv6_flabel(self, dp):
1030 dl_type = ether.ETH_TYPE_IPV6
1031 ipv6_label = 0xc5384
1033 headers = [dp.ofproto.OXM_OF_IPV6_FLABEL,
1034 dp.ofproto.OXM_OF_IPV6_FLABEL_W]
1035 self._set_verify(headers, ipv6_label)
1037 match = dp.ofproto_parser.OFPMatch()
1038 match.set_dl_type(dl_type)
1039 match.set_ipv6_flabel(ipv6_label)
1040 self.add_matches(dp, match)
1042 def test_rule_set_ipv6_flabel_masked_ff(self, dp):
1043 dl_type = ether.ETH_TYPE_IPV6
1044 ipv6_label = 0xc5384
1047 headers = [dp.ofproto.OXM_OF_IPV6_FLABEL,
1048 dp.ofproto.OXM_OF_IPV6_FLABEL_W]
1049 self._set_verify(headers, ipv6_label, mask, True)
1051 match = dp.ofproto_parser.OFPMatch()
1052 match.set_dl_type(dl_type)
1053 match.set_ipv6_flabel_masked(ipv6_label, mask)
1054 self.add_matches(dp, match)
1056 def test_rule_set_ipv6_flabel_masked_f0(self, dp):
1057 dl_type = ether.ETH_TYPE_IPV6
1058 ipv6_label = 0xc5384
1061 headers = [dp.ofproto.OXM_OF_IPV6_FLABEL,
1062 dp.ofproto.OXM_OF_IPV6_FLABEL_W]
1063 self._set_verify(headers, ipv6_label, mask)
1065 match = dp.ofproto_parser.OFPMatch()
1066 match.set_dl_type(dl_type)
1067 match.set_ipv6_flabel_masked(ipv6_label, mask)
1068 self.add_matches(dp, match)
1070 def test_rule_set_ipv6_flabel_masked_00(self, dp):
1071 dl_type = ether.ETH_TYPE_IPV6
1072 ipv6_label = 0xc5384
1075 headers = [dp.ofproto.OXM_OF_IPV6_FLABEL,
1076 dp.ofproto.OXM_OF_IPV6_FLABEL_W]
1077 self._set_verify(headers, ipv6_label, mask)
1079 match = dp.ofproto_parser.OFPMatch()
1080 match.set_dl_type(dl_type)
1081 match.set_ipv6_flabel_masked(ipv6_label, mask)
1082 self.add_matches(dp, match)
1084 def test_rule_set_icmpv6_type(self, dp):
1085 dl_type = ether.ETH_TYPE_IPV6
1086 ip_proto = inet.IPPROTO_ICMPV6
1089 headers = [dp.ofproto.OXM_OF_ICMPV6_TYPE]
1090 self._set_verify(headers, icmp_type)
1092 match = dp.ofproto_parser.OFPMatch()
1093 match.set_dl_type(dl_type)
1094 match.set_ip_proto(ip_proto)
1095 match.set_icmpv6_type(icmp_type)
1096 self.add_matches(dp, match)
1098 def test_rule_set_icmpv6_code(self, dp):
1099 dl_type = ether.ETH_TYPE_IPV6
1100 ip_proto = inet.IPPROTO_ICMPV6
1104 headers = [dp.ofproto.OXM_OF_ICMPV6_CODE]
1105 self._set_verify(headers, icmp_code)
1107 match = dp.ofproto_parser.OFPMatch()
1108 match.set_dl_type(dl_type)
1109 match.set_ip_proto(ip_proto)
1110 match.set_icmpv6_type(icmp_type)
1111 match.set_icmpv6_code(icmp_code)
1112 self.add_matches(dp, match)
1114 def test_rule_set_ipv6_nd_target(self, dp):
1115 dl_type = ether.ETH_TYPE_IPV6
1116 ip_proto = inet.IPPROTO_ICMPV6
1118 target = "5420:db3f:921b:3e33:2791:98f:dd7f:2e19"
1119 target_int = self.ipv6_to_int(target)
1121 headers = [dp.ofproto.OXM_OF_IPV6_ND_TARGET]
1122 self._set_verify(headers, target_int, type_='ipv6')
1124 match = dp.ofproto_parser.OFPMatch()
1125 match.set_dl_type(dl_type)
1126 match.set_ip_proto(ip_proto)
1127 match.set_icmpv6_type(icmp_type)
1128 match.set_ipv6_nd_target(target_int)
1129 self.add_matches(dp, match)
1131 def test_rule_set_ipv6_nd_sll(self, dp):
1132 dl_type = ether.ETH_TYPE_IPV6
1133 ip_proto = inet.IPPROTO_ICMPV6
1135 nd_sll = "93:6d:d0:d4:e8:36"
1136 nd_sll_bin = self.haddr_to_bin(nd_sll)
1138 headers = [dp.ofproto.OXM_OF_IPV6_ND_SLL]
1139 self._set_verify(headers, nd_sll_bin, type_='mac')
1141 match = dp.ofproto_parser.OFPMatch()
1142 match.set_dl_type(dl_type)
1143 match.set_ip_proto(ip_proto)
1144 match.set_icmpv6_type(icmp_type)
1145 match.set_ipv6_nd_sll(nd_sll_bin)
1146 self.add_matches(dp, match)
1148 def test_rule_set_ipv6_nd_tll(self, dp):
1149 dl_type = ether.ETH_TYPE_IPV6
1150 ip_proto = inet.IPPROTO_ICMPV6
1152 nd_tll = "18:f6:66:b6:f1:b3"
1153 nd_tll_bin = self.haddr_to_bin(nd_tll)
1155 headers = [dp.ofproto.OXM_OF_IPV6_ND_TLL]
1156 self._set_verify(headers, nd_tll_bin, type_='mac')
1158 match = dp.ofproto_parser.OFPMatch()
1159 match.set_dl_type(dl_type)
1160 match.set_ip_proto(ip_proto)
1161 match.set_icmpv6_type(icmp_type)
1162 match.set_ipv6_nd_tll(nd_tll_bin)
1163 self.add_matches(dp, match)
1165 def test_rule_set_mpls_label(self, dp):
1169 headers = [dp.ofproto.OXM_OF_MPLS_LABEL]
1170 self._set_verify(headers, label)
1172 match = dp.ofproto_parser.OFPMatch()
1173 match.set_dl_type(dl_type)
1174 match.set_mpls_label(label)
1175 self.add_matches(dp, match)
1177 def test_rule_set_mpls_tc(self, dp):
1181 headers = [dp.ofproto.OXM_OF_MPLS_TC]
1182 self._set_verify(headers, tc)
1184 match = dp.ofproto_parser.OFPMatch()
1185 match.set_dl_type(dl_type)
1186 match.set_mpls_tc(tc)
1187 self.add_matches(dp, match)
1189 def is_supported(self, t):
1190 # Open vSwitch 1.10 does not support MPLS yet.
1192 'test_rule_set_mpls_label',
1193 'test_rule_set_mpls_tc',
1195 for u in unsupported: