diff options
Diffstat (limited to 'ryu/lib/ofctl_v1_2.py')
-rw-r--r-- | ryu/lib/ofctl_v1_2.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py index 61d35ad5..e179fee4 100644 --- a/ryu/lib/ofctl_v1_2.py +++ b/ryu/lib/ofctl_v1_2.py @@ -768,6 +768,33 @@ def get_group_desc(dp, waiters): return descs +def get_port_desc(dp, waiters): + + stats = dp.ofproto_parser.OFPFeaturesRequest(dp) + msgs = [] + send_stats_request(dp, stats, waiters, msgs) + + descs = [] + + for msg in msgs: + stats = msg.ports + for stat in stats.values(): + d = {'port_no': stat.port_no, + 'hw_addr': stat.hw_addr, + 'name': stat.name, + 'config': stat.config, + 'state': stat.state, + 'curr': stat.curr, + 'advertised': stat.advertised, + 'supported': stat.supported, + 'peer': stat.peer, + 'curr_speed': stat.curr_speed, + 'max_speed': stat.max_speed} + descs.append(d) + descs = {str(dp.id): descs} + return descs + + def mod_flow_entry(dp, flow, cmd): cookie = int(flow.get('cookie', 0)) cookie_mask = int(flow.get('cookie_mask', 0)) |