diff options
author | OHMURA Kei <ohmura.kei@lab.ntt.co.jp> | 2012-11-04 23:13:02 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-11-05 14:51:52 +0900 |
commit | 5ccf13809c61f6a2582e94ff3b210fb376063007 (patch) | |
tree | 59c7b2da3d070c8193842ee780bab6c617434aa1 | |
parent | d347dce3c4050a40a1c36411ab2762c835b348b2 (diff) |
ofctl_v1_0: update get_flow_stats() to dump actions
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ofctl_v1_0.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py index 2ec36c09..37533c89 100644 --- a/ryu/lib/ofctl_v1_0.py +++ b/ryu/lib/ofctl_v1_0.py @@ -53,6 +53,27 @@ def to_actions(dp, acts): return actions +def action_to_str(a): + action_type = a.cls_action_type + + if action_type == ofproto_v1_0.OFPAT_OUTPUT: + buf = 'OUTPUT:' + str(a.port) + elif action_type == ofproto_v1_0.OFPAT_SET_VLAN_VID: + buf = 'SET_VLAN_VID:' + str(a.vlan_vid) + elif action_type == ofproto_v1_0.OFPAT_SET_VLAN_PCP: + buf = 'SET_VLAN_PCP:' + str(a.vlan_pcp) + elif action_type == ofproto_v1_0.OFPAT_STRIP_VLAN: + buf = 'STRIP_VLAN' + elif action_type == ofproto_v1_0.OFPAT_SET_DL_SRC: + buf = 'SET_DL_SRC:' + haddr_to_str(a.dl_addr) + elif action_type == ofproto_v1_0.OFPAT_SET_DL_DST: + buf = 'SET_DL_DST:' + haddr_to_str(a.dl_addr) + else: + buf = 'UNKNOWN' + + return buf + + def to_match(dp, attrs): ofp = dp.ofproto @@ -155,10 +176,15 @@ def get_flow_stats(dp, waiters): flows = [] for msg in msgs: for stats in msg.body: + actions = [] + for a in stats.actions: + actions.append(action_to_str(a)) + s = {'priority': stats.priority, 'cookie': stats.cookie, 'idle_timeout': stats.idle_timeout, 'hard_timeout': stats.hard_timeout, + 'actions': actions, 'match': {'dl_dst': haddr_to_str(stats.match.dl_dst), 'dl_src': haddr_to_str(stats.match.dl_src), 'dl_type': stats.match.dl_type, |