The field of "Path" has not displayed in properly as bellow.
It looks the raw data of Origin code has displayed instead.

bgpd> show neighbor received-routes 192.168.101.101 all
Status codes: x filtered
Origin codes: i - IGP, e - EGP, ? - incomplete
    Timestamp           Network                          Labels   Next Hop      
       Metric LocPrf Path
    2015/02/05 07:39:05 192.168.1.0/30                   None     
192.168.101.101      100    None   [65010] 2
    2015/02/05 07:39:05 192.168.2.0/30                   None     
192.168.101.101      100    None   [65010] 2
    2015/02/05 07:39:05 0.0.0.0/0                        None     
192.168.101.101      100    None   [65010, 65001] 2

Signed-off-by: Toshiki Tsuboi <[email protected]>
---
 ryu/services/protocols/bgp/operator/commands/show/neighbor.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ryu/services/protocols/bgp/operator/commands/show/neighbor.py 
b/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
index fa9614c..4f9199e 100644
--- a/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
+++ b/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
@@ -12,6 +12,9 @@ from ryu.lib.packet.bgp import RF_IPv4_UC
 from ryu.lib.packet.bgp import RF_IPv6_UC
 from ryu.lib.packet.bgp import RF_IPv4_VPN
 from ryu.lib.packet.bgp import RF_IPv6_VPN
+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
 
 LOG = logging.getLogger('bgpspeaker.operator.commands.show.neighbor')
 
@@ -101,6 +104,14 @@ class SentRoutes(Command):
             path = v.get('path')
             aspath = path.get('as_path')
             origin = path.get('origin')
+
+            if origin == BGP_ATTR_ORIGIN_IGP:
+                origin = 'i'
+            elif origin == BGP_ATTR_ORIGIN_EGP:
+                origin = 'e'
+            elif origin == BGP_ATTR_ORIGIN_INCOMPLETE:
+                origin = '?'
+
             if origin:
                 aspath = aspath + [origin]
 
-- 
1.9.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to