diff options
Diffstat (limited to 'ryu/services/protocols/bgp/operator/commands')
-rw-r--r-- | ryu/services/protocols/bgp/operator/commands/show/rib.py | 2 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/ryu/services/protocols/bgp/operator/commands/show/rib.py b/ryu/services/protocols/bgp/operator/commands/show/rib.py index 34d4a18a..94e16574 100644 --- a/ryu/services/protocols/bgp/operator/commands/show/rib.py +++ b/ryu/services/protocols/bgp/operator/commands/show/rib.py @@ -15,7 +15,7 @@ class RibBase(Command, RouteFormatterMixin): class Rib(RibBase): - help_msg = 'show all routes for address family (only vpnv4 supported)' + help_msg = 'show all routes for address family' param_help_msg = '<address-family>' command = 'rib' diff --git a/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py b/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py index 2f58f681..10c56e90 100644 --- a/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py +++ b/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py @@ -3,12 +3,14 @@ import StringIO class RouteFormatterMixin(object): + fmtstr = ' {0:<3s} {1:<32s} {2:<20s} {3:<15s} {4:<6s} {5:<6s} {6:<}\n' + @classmethod def _format_family_header(cls): ret = '' ret += ('Status codes: * valid, > best\n') - ret += ' {0:<3s} {1:<32s} {2:<20s} {3:<10s} {4:<20s} {5:<}\n'.format( - '', 'Network', 'Next Hop', 'Reason', 'Metric', 'Path') + ret += cls.fmtstr.format('', 'Network', 'Next Hop', 'Reason', 'Metric', + 'LocPrf', 'Path') return ret @classmethod @@ -24,6 +26,7 @@ class RouteFormatterMixin(object): bpr = path.get('bpr') next_hop = path.get('nexthop') med = path.get('metric') + localpref = path.get('localpref') # Construct path status string. path_status = '*' if is_best: @@ -35,10 +38,10 @@ class RouteFormatterMixin(object): prefix = path.get('prefix') # Append path info to String buffer. - buff.write( - ' {0:<3s} {1:<32s} {2:<20s} {3:<20s} {4:<10s} {5:<}\n'. - format(path_status, prefix, next_hop, bpr, str(med), - ' '.join(map(str, aspath)))) + buff.write(cls.fmtstr.format(path_status, prefix, + next_hop, bpr, str(med), + str(localpref), + ' '.join(map(str, aspath)))) for dist in dest_list: for idx, path in enumerate(dist.get('paths')): |