summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py10
-rw-r--r--ryu/services/protocols/bgp/operator/internal_api.py6
2 files changed, 12 insertions, 4 deletions
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 10c56e90..7f2c4fe4 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,14 +3,15 @@ import StringIO
class RouteFormatterMixin(object):
- fmtstr = ' {0:<3s} {1:<32s} {2:<20s} {3:<15s} {4:<6s} {5:<6s} {6:<}\n'
+ fmtstr = ' {0:<3s} {1:<32s} {2:<8s} {3:<20s} {4:<15s} '\
+ '{5:<6s} {6:<6s} {7:<}\n'
@classmethod
def _format_family_header(cls):
ret = ''
ret += ('Status codes: * valid, > best\n')
- ret += cls.fmtstr.format('', 'Network', 'Next Hop', 'Reason', 'Metric',
- 'LocPrf', 'Path')
+ ret += cls.fmtstr.format('', 'Network', 'Labels', 'Next Hop', 'Reason',
+ 'Metric', 'LocPrf', 'Path/Origin')
return ret
@classmethod
@@ -26,6 +27,7 @@ class RouteFormatterMixin(object):
bpr = path.get('bpr')
next_hop = path.get('nexthop')
med = path.get('metric')
+ labels = path.get('labels')
localpref = path.get('localpref')
# Construct path status string.
path_status = '*'
@@ -38,7 +40,7 @@ class RouteFormatterMixin(object):
prefix = path.get('prefix')
# Append path info to String buffer.
- buff.write(cls.fmtstr.format(path_status, prefix,
+ buff.write(cls.fmtstr.format(path_status, prefix, labels,
next_hop, bpr, str(med),
str(localpref),
' '.join(map(str, aspath))))
diff --git a/ryu/services/protocols/bgp/operator/internal_api.py b/ryu/services/protocols/bgp/operator/internal_api.py
index d23bdea5..a8c76677 100644
--- a/ryu/services/protocols/bgp/operator/internal_api.py
+++ b/ryu/services/protocols/bgp/operator/internal_api.py
@@ -130,9 +130,15 @@ class InternalApi(object):
localpref = path.get_pattr(BGP_ATTR_TYPE_LOCAL_PREF)
localpref = localpref.value if localpref else ''
+ if hasattr(path.nlri, 'label_list'):
+ labels = path.nlri.label_list
+ else:
+ labels = None
+
return {'best': (path == dst.best_path),
'bpr': bpr,
'prefix': path.nlri.formatted_nlri_str,
+ 'labels': labels,
'nexthop': nexthop,
'metric': med,
'aspath': aspath,