diff options
-rw-r--r-- | ryu/lib/ofctl_v1_3.py | 14 | ||||
-rw-r--r-- | ryu/tests/unit/lib/ofctl_json/of13/4-12-ofp_flow_stats_reply.packet.json | 4 | ||||
-rw-r--r-- | ryu/tests/unit/lib/ofctl_json/of13/4-2-ofp_flow_mod.packet.json | 6 |
3 files changed, 23 insertions, 1 deletions
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 3f8ee8f5..ad2760bb 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -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 diff --git a/ryu/tests/unit/lib/ofctl_json/of13/4-12-ofp_flow_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/4-12-ofp_flow_stats_reply.packet.json index 763586f9..a9cdfa92 100644 --- a/ryu/tests/unit/lib/ofctl_json/of13/4-12-ofp_flow_stats_reply.packet.json +++ b/ryu/tests/unit/lib/ofctl_json/of13/4-12-ofp_flow_stats_reply.packet.json @@ -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}", diff --git a/ryu/tests/unit/lib/ofctl_json/of13/4-2-ofp_flow_mod.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/4-2-ofp_flow_mod.packet.json index 636bfb8c..fbd5c214 100644 --- a/ryu/tests/unit/lib/ofctl_json/of13/4-2-ofp_flow_mod.packet.json +++ b/ryu/tests/unit/lib/ofctl_json/of13/4-2-ofp_flow_mod.packet.json @@ -62,6 +62,12 @@ "nw_ttl": 10 }, { + "type": "EXPERIMENTER", + "experimenter": 101, + "data": "AAECAwQFBgc=", + "data_type": "base64" + }, + { "type": "SET_QUEUE", "queue_id": 3 }, |