summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorToshiki Tsuboi <t.tsubo2000@gmail.com>2014-08-10 16:50:01 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-08-13 13:02:12 +0900
commitc4abf05e9e03856db9452a9476b653fd31883e04 (patch)
treee59e602af54cb9057ccd73b0fbfda030523a2f68
parent4b07ae47142fc53f1eaa8cb65790de187f1f08bc (diff)
bgp: fix bug of Path(Origin) formatting for show VPNv4 prefix information
The field of 'Path(Origin)' has not displayed in properly ,because Origin codes '2 (incomplete)' is not defined in the latest code . Therfore, I've patched the codes for formatting as follows . INFO:bgpspeaker.api.base:API method operator.show called with args: {'params': ['rib', 'all'], 'format': 'cli'} Status codes: * valid, > best Origin codes: i - IGP, e - EGP, ? - incomplete Network Labels Next Hop Reason Metric LocPrf Path Family: rtfilter *> 64512:64511:101 None 0.0.0.0 Only Path ? Family: vpnv6 Family: vpnv4 *> 64511:101:10.10.0.1/32 [17] 192.168.100.100 Only Path 0 64511 ? *> 64511:101:10.20.2.0/24 [100] 0.0.0.0 Only Path ? *> 64511:101:10.20.1.0/24 [100] 0.0.0.0 Only Path ? *> 64511:101:10.20.3.0/24 [100] 0.0.0.0 Only Path ? Family: ipv4 Family: ipv6 Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py3
-rw-r--r--ryu/services/protocols/bgp/operator/internal_api.py3
2 files changed, 5 insertions, 1 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 7f2c4fe4..b40b1994 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
@@ -10,8 +10,9 @@ class RouteFormatterMixin(object):
def _format_family_header(cls):
ret = ''
ret += ('Status codes: * valid, > best\n')
+ ret += ('Origin codes: i - IGP, e - EGP, ? - incomplete\n')
ret += cls.fmtstr.format('', 'Network', 'Labels', 'Next Hop', 'Reason',
- 'Metric', 'LocPrf', 'Path/Origin')
+ 'Metric', 'LocPrf', 'Path')
return ret
@classmethod
diff --git a/ryu/services/protocols/bgp/operator/internal_api.py b/ryu/services/protocols/bgp/operator/internal_api.py
index a8c76677..524cdd26 100644
--- a/ryu/services/protocols/bgp/operator/internal_api.py
+++ b/ryu/services/protocols/bgp/operator/internal_api.py
@@ -13,6 +13,7 @@ from ryu.lib.packet.bgp import BGP_ATTR_TYPE_MULTI_EXIT_DISC
from ryu.lib.packet.bgp import BGP_ATTR_TYPE_LOCAL_PREF
from ryu.lib.packet.bgp import BGP_ATTR_ORIGIN_IGP
from ryu.lib.packet.bgp import BGP_ATTR_ORIGIN_EGP
+from ryu.lib.packet.bgp import BGP_ATTR_ORIGIN_INCOMPLETE
from ryu.services.protocols.bgp.base import add_bgp_error_metadata
from ryu.services.protocols.bgp.base import BGPSException
@@ -118,6 +119,8 @@ class InternalApi(object):
origin = 'i'
elif origin == BGP_ATTR_ORIGIN_EGP:
origin = 'e'
+ elif origin == BGP_ATTR_ORIGIN_INCOMPLETE:
+ origin = '?'
nexthop = path.nexthop
# Get the MED path attribute