ofctl_v1_3: Add support for using action experimenter

This patch makes it possible for ofctl_v1_3 to use the action type of experimenter.

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:
Minoru TAKAHASHI 2016-03-10 13:19:18 +09:00 committed by FUJITA Tomonori
parent 801bdacbe3
commit 020eb2b9bf
3 changed files with 23 additions and 1 deletions

View File

@ -81,6 +81,16 @@ def to_action(dp, dic):
result = parser.OFPActionPushPbb(ethertype)
elif action_type == 'POP_PBB':
result = parser.OFPActionPopPbb()
elif action_type == 'EXPERIMENTER':
experimenter = int(dic.get('experimenter'))
data_type = dic.get('data_type', 'ascii')
if data_type not in ['ascii', 'base64']:
LOG.error('Unknown data type: %s', data_type)
return None
data = dic.get('data', '')
if data_type == 'base64':
data = base64.b64decode(data)
result = parser.OFPActionExperimenterUnknown(experimenter, data)
else:
result = None
@ -176,6 +186,10 @@ def action_to_str(act):
buf = 'PUSH_PBB:' + str(act.ethertype)
elif action_type == ofproto_v1_3.OFPAT_POP_PBB:
buf = 'POP_PBB'
elif action_type == ofproto_v1_3.OFPAT_EXPERIMENTER:
data_str = base64.b64encode(act.data)
buf = 'EXPERIMENTER: {experimenter:%s, data:%s}' % \
(act.experimenter, data_str.decode('utf-8'))
else:
buf = 'UNKNOWN'
return buf

View File

@ -74,7 +74,9 @@
"SET_NW_TTL:10",
"SET_QUEUE:3",
"GROUP:99",
"OUTPUT:6"
"OUTPUT:6",
"EXPERIMENTER: {experimenter:98765432, data:ZXhwX2RhdGE=}",
"EXPERIMENTER: {experimenter:8992, data:cF9kYXRh}"
]
},
"SET_FIELD: {eth_src:01:02:03:04:05:06}",

View File

@ -61,6 +61,12 @@
"type": "SET_NW_TTL",
"nw_ttl": 10
},
{
"type": "EXPERIMENTER",
"experimenter": 101,
"data": "AAECAwQFBgc=",
"data_type": "base64"
},
{
"type": "SET_QUEUE",
"queue_id": 3