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 <[email protected]>
---
 .../protocols/bgp/operator/commands/show/route_formatter_mixin.py      | 3 ++-
 ryu/services/protocols/bgp/operator/internal_api.py                    | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

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 7f2c4fe..b40b199 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 a8c7667..524cdd2 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
-- 
1.9.1
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to