@@ -384,6 +384,10 @@ def is_set_field(action):
384
384
return isinstance (action , parser .OFPActionSetField )
385
385
386
386
387
+ def is_ct (action ):
388
+ return isinstance (action , parser .NXActionCT )
389
+
390
+
387
391
def apply_meter (meter_id ):
388
392
"""Return instruction to apply a meter."""
389
393
return parser .OFPInstructionMeter (meter_id , ofp .OFPIT_METER )
@@ -513,6 +517,39 @@ def pop_vlan():
513
517
return parser .OFPActionPopVlan ()
514
518
515
519
520
+ def ct (** kwds ): # pylint: disable=invalid-name
521
+ """Return connection tracker action.
522
+
523
+ Args:
524
+ kwds (dict): exactly one connection tracker action.
525
+ Returns:
526
+ ryu.ofproto.nx_actions.NXActionCT: connection tracker action.
527
+ """
528
+ return parser .NXActionCT (** kwds ) # pylint: disable=no-member
529
+
530
+
531
+ def ct_clear ():
532
+ """Return clear connection tracker state action.
533
+
534
+ Args:
535
+ kwds (dict): exactly one clear connection tracker state action.
536
+ Returns:
537
+ ryu.ofproto.nx_actions.NXActionCTClear: clear connection tracker state action.
538
+ """
539
+ return parser .NXActionCTClear () # pylint: disable=no-member
540
+
541
+
542
+ def ct_nat (** kwds ):
543
+ """Return network address translation connection tracker action.
544
+
545
+ Args:
546
+ kwds (dict): exactly one network address translation connection tracker action.
547
+ Returns:
548
+ ryu.ofproto.nx_actions.NXActionNAT: network address translation connection tracker action.
549
+ """
550
+ return parser .NXActionNAT (** kwds ) # pylint: disable=no-member
551
+
552
+
516
553
@functools .lru_cache (maxsize = 1024 )
517
554
def output_port (port_num , max_len = 0 ):
518
555
"""Return OpenFlow action to output to a port.
@@ -662,8 +699,8 @@ def valve_match_vid(value):
662
699
return to_match_vid (value , ofp .OFPVID_PRESENT )
663
700
664
701
665
- # See 7.2.3.7 Flow Match Fields (OF 1.3.5)
666
702
MATCH_FIELDS = {
703
+ # See 7.2.3.7 Flow Match Fields (OF 1.3.5)
667
704
'in_port' : OFCtlUtil (ofp ).ofp_port_from_user ,
668
705
'in_phy_port' : str_to_int ,
669
706
'metadata' : to_match_masked_int ,
@@ -703,7 +740,13 @@ def valve_match_vid(value):
703
740
'mpls_bos' : str_to_int ,
704
741
'pbb_isid' : to_match_masked_int ,
705
742
'tunnel_id' : to_match_masked_int ,
706
- 'ipv6_exthdr' : to_match_masked_int
743
+ 'ipv6_exthdr' : to_match_masked_int ,
744
+
745
+ # Nicira extensions, see ovs-fields(7)
746
+ 'ct_state' : to_match_masked_int ,
747
+ 'ct_zone' : str_to_int ,
748
+ 'ct_mark' : to_match_masked_int ,
749
+ 'ct_label' : to_match_masked_int
707
750
}
708
751
709
752
0 commit comments