although 'band_types' of MeterFeatures were bitmaps of supported band types, it was expressed numerically. this patch makes 'band_types' human-readable.
e.g.) curl http://localhost:8080/stats/meterfeatures/8796750050962 { "8796750050962": [ { "max_meter": 16777216, "max_color": 0, "max_band": 255, "band_types": ["DROP", "DSCP_REMARK"] } ] } Signed-off-by: Yuichi Ito <[email protected]> --- ryu/lib/ofctl_v1_3.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 99b55d6..9f99680 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -550,6 +550,11 @@ def get_meter_stats(dp, waiters): def get_meter_features(dp, waiters): + + ofp = dp.ofproto + type_convert = {ofp.OFPMBT_DROP: 'DROP', + ofp.OFPMBT_DSCP_REMARK: 'DSCP_REMARK'} + stats = dp.ofproto_parser.OFPMeterFeaturesStatsRequest(dp, 0) msgs = [] send_stats_request(dp, stats, waiters, msgs) @@ -557,8 +562,12 @@ def get_meter_features(dp, waiters): features = [] for msg in msgs: for feature in msg.body: + band_types = [] + for k, v in type_convert.items(): + if (1 << k) & feature.band_types: + band_types.append(v) f = {'max_meter': feature.max_meter, - 'band_types': feature.band_types, + 'band_types': band_types, 'max_band': feature.max_band, 'max_color': feature.max_color} features.append(f) -- 1.7.10.4 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
