ofproto: add Nicira extension ct_clear action

Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
IWAMOTO Toshihiro 2018-03-28 16:48:34 +09:00 committed by FUJITA Tomonori
parent 4e10ba4438
commit b8ebdbe961
6 changed files with 105 additions and 0 deletions

View File

@ -322,3 +322,7 @@ class OfctlActionConverter(object):
'recirc_table': recirc_table,
'alg': alg,
'actions': ct_actions})
@classmethod
def ct_clear(cls, ofproto, action_str):
return dict(NXActionCTClear={})

View File

@ -62,6 +62,7 @@ NXAST_NAT = 36
NXAST_CONTROLLER2 = 37
NXAST_SAMPLE2 = 38
NXAST_OUTPUT_TRUNC = 39
NXAST_CT_CLEAR = 43
NXAST_DEC_NSH_TTL = 48
NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'

View File

@ -2766,6 +2766,43 @@ def generate(ofp_name, ofpp_name):
a.serialize(data, len(data))
return data
class NXActionCTClear(NXAction):
"""
Clear connection tracking state action
This action clears connection tracking state from packets.
And equivalent to the followings action of ovs-ofctl command.
..
ct_clear
..
+--------------+
| **ct_clear** |
+--------------+
Example::
actions += [parser.NXActionCTClear()]
"""
_subtype = nicira_ext.NXAST_CT_CLEAR
_fmt_str = '!6x'
def __init__(self,
type_=None, len_=None, experimenter=None, subtype=None):
super(NXActionCTClear, self).__init__()
@classmethod
def parser(cls, buf):
return cls()
def serialize_body(self):
data = bytearray()
msg_pack_into(self._fmt_str, data, 0)
return data
class NXActionNAT(NXAction):
"""
Network address translation action
@ -3061,6 +3098,7 @@ def generate(ofp_name, ofpp_name):
'NXActionBundle',
'NXActionBundleLoad',
'NXActionCT',
'NXActionCTClear',
'NXActionNAT',
'NXActionOutputTrunc',
'_NXFlowSpec', # exported for testing

View File

@ -131,6 +131,13 @@ MESSAGES = [
'importance=39032'] +
['dl_type=0x86dd'] +
['actions=ct(commit,nat(dst=2001:1::1-2001:1::ffff)'])},
{'name': 'action_ct_clear',
'versions': [4],
'cmd': 'add-flow',
'args': (['table=3,',
'importance=39032'] +
['dl_type=0x0800,ct_state=+trk'] +
['actions=ct_clear'])},
{'name': 'action_note',
'versions': [4],
'cmd': 'add-flow',

View File

@ -0,0 +1,55 @@
{
"OFPFlowMod": {
"buffer_id": 4294967295,
"command": 0,
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"instructions": [
{
"OFPInstructionActions": {
"actions": [
{
"NXActionCTClear": {
"experimenter": 8992,
"len": 16,
"subtype": 43,
"type": 65535
}
}
],
"len": 24,
"type": 4
}
}
],
"match": {
"OFPMatch": {
"length": 22,
"oxm_fields": [
{
"OXMTlv": {
"field": "eth_type",
"mask": null,
"value": 2048
}
},
{
"OXMTlv": {
"field": "ct_state",
"mask": 32,
"value": 32
}
}
],
"type": 1
}
},
"out_group": 4294967295,
"out_port": 4294967295,
"priority": 32768,
"table_id": 3
}
}