mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 13:56:09 +02:00
ofctl_v1_[23]: Add support for OFPIT_[WRITE/CLEAR]_ACTIONS
This patch makes ofctl_rest enable setting instruction type of OFPIT_WRITE/CLEAR_ACTIONS.
e.g.)
$ curl -X POST -d '{
"dpid": 1,
"cookie": 1,
"cookie_mask": 1,
"table_id": 0,
"idle_timeout": 30,
"hard_timeout": 30,
"priority": 11111,
"flags": 1,
"match":{
"in_port":1
},
"actions":[
{
"type":"WRITE_ACTIONS",
"actions":[
{
"type":"POP_VLAN",
},
{
"type":"OUTPUT",
"port": 2
}
]
}
]
}' http://localhost:8080/stats/flowentry/add
$ curl -X POST -d '{
"dpid": 1,
"cookie": 1,
"cookie_mask": 1,
"table_id": 0,
"idle_timeout": 30,
"hard_timeout": 30,
"priority": 11111,
"flags": 1,
"match":{
"in_port":1
},
"actions":[
{
"type":"CLEAR_ACTIONS"
}
]
}' http://localhost:8080/stats/flowentry/add
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
b6e280172a
commit
91af6a5ada
@ -102,7 +102,22 @@ def to_actions(dp, acts):
|
||||
actions.append(action)
|
||||
else:
|
||||
action_type = a.get('type')
|
||||
if action_type == 'GOTO_TABLE':
|
||||
if action_type == 'WRITE_ACTIONS':
|
||||
write_actions = []
|
||||
write_acts = a.get('actions')
|
||||
for a in write_acts:
|
||||
action = to_action(dp, a)
|
||||
if action is not None:
|
||||
write_actions.append(action)
|
||||
else:
|
||||
LOG.error('Unknown action type: %s', action_type)
|
||||
if write_actions:
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_WRITE_ACTIONS,
|
||||
write_actions))
|
||||
elif action_type == 'CLEAR_ACTIONS':
|
||||
inst.append(parser.OFPInstructionActions(
|
||||
ofp.OFPIT_CLEAR_ACTIONS, []))
|
||||
elif action_type == 'GOTO_TABLE':
|
||||
table_id = int(a.get('table_id'))
|
||||
inst.append(parser.OFPInstructionGotoTable(table_id))
|
||||
elif action_type == 'WRITE_METADATA':
|
||||
@ -116,8 +131,9 @@ def to_actions(dp, acts):
|
||||
else:
|
||||
LOG.error('Unknown action type: %s', action_type)
|
||||
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS,
|
||||
actions))
|
||||
if actions:
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS,
|
||||
actions))
|
||||
return inst
|
||||
|
||||
|
||||
|
||||
@ -103,11 +103,27 @@ def to_actions(dp, acts):
|
||||
|
||||
for a in acts:
|
||||
action = to_action(dp, a)
|
||||
|
||||
if action is not None:
|
||||
actions.append(action)
|
||||
else:
|
||||
action_type = a.get('type')
|
||||
if action_type == 'GOTO_TABLE':
|
||||
if action_type == 'WRITE_ACTIONS':
|
||||
write_actions = []
|
||||
write_acts = a.get('actions')
|
||||
for a in write_acts:
|
||||
action = to_action(dp, a)
|
||||
if action is not None:
|
||||
write_actions.append(action)
|
||||
else:
|
||||
LOG.error('Unknown action type: %s', action_type)
|
||||
if write_actions:
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_WRITE_ACTIONS,
|
||||
write_actions))
|
||||
elif action_type == 'CLEAR_ACTIONS':
|
||||
inst.append(parser.OFPInstructionActions(
|
||||
ofp.OFPIT_CLEAR_ACTIONS, []))
|
||||
elif action_type == 'GOTO_TABLE':
|
||||
table_id = int(a.get('table_id'))
|
||||
inst.append(parser.OFPInstructionGotoTable(table_id))
|
||||
elif action_type == 'WRITE_METADATA':
|
||||
@ -124,8 +140,9 @@ def to_actions(dp, acts):
|
||||
else:
|
||||
LOG.error('Unknown action type: %s', action_type)
|
||||
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS,
|
||||
actions))
|
||||
if actions:
|
||||
inst.append(parser.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS,
|
||||
actions))
|
||||
return inst
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user