In normally, when RyuBGPSpeaker originates some prefixes, it sends BGP Update 
messages as [ASpath: None] to peering iBGP router.
But, In use of ASPathFilter 'policy=TOP', RyuBGPSpeaker has failed to send 
Update messages as bellow.

$ sudo python sampleBGP_for_InterAS-MPLS-VPN-in-RyuBGP1.py
INFO:bgpspeaker.api.base:API method core.start called with args: {'router_id': 
'10.0.1.1', 'label_range': (1000, 1999), 'waiter': <ryu.lib.hub.Event object at 
0x7f6ba91de890>, 'local_as': 65011, 'bgp_server_port': 179, 
'refresh_max_eor_time': 0, 'refresh_stalepath_time': 0}
INFO:bgpspeaker.api.base:API method neighbor.create called with args: 
{'remote_as': 65010, 'cap_mbgp_vpnv6': False, 'cap_mbgp_vpnv4': True, 
'cap_mbgp_ipv6': False, 'is_next_hop_self': False, 'cap_mbgp_ipv4': True, 
'multi_exit_disc': 100, 'is_route_server_client': False, 'peer_next_hop': None, 
'password': None, 'ip_address': '192.168.101.101'}
INFO:bgpspeaker.api.base:API method neighbor.create called with args: 
{'remote_as': 65011, 'local_port': 50001, 'cap_mbgp_vpnv6': False, 
'cap_mbgp_vpnv4': True, 'cap_mbgp_ipv6': False, 'is_next_hop_self': True, 
'cap_mbgp_ipv4': True, 'is_route_server_client': False, 'peer_next_hop': None, 
'local_address': '10.0.1.1', 'password': None, 'ip_address': '10.0.1.2'}
INFO:bgpspeaker.api.base:API method neighbor.create called with args: 
{'remote_as': 65011, 'local_port': 50002, 'cap_mbgp_vpnv6': False, 
'cap_mbgp_vpnv4': True, 'cap_mbgp_ipv6': False, 'is_next_hop_self': True, 
'cap_mbgp_ipv4': True, 'is_route_server_client': False, 'peer_next_hop': None, 
'local_address': '10.0.1.1', 'password': None, 'ip_address': '10.0.1.3'}
INFO:bgpspeaker.api.base:API method vrf.create called with args: {'import_rts': 
['65010:101'], 'route_family': 'ipv4', 'site_of_origins': None, 'route_dist': 
'65010:101', 'export_rts': ['65010:101']}
INFO:bgpspeaker.api.base:API method prefix.add_local called with args: 
{'prefix': '192.168.4.0/30', 'next_hop': '0.0.0.0', 'route_dist': '65010:101', 
'route_family': 'ipv4'}
INFO:bgpspeaker.api.base:API method prefix.add_local called with args: 
{'prefix': '10.10.10.4/32', 'next_hop': '192.168.4.2', 'route_dist': 
'65010:101', 'route_family': 'ipv4'}
INFO:bgpspeaker.api.base:API method prefix.add_local called with args: 
{'prefix': '192.168.204.0/30', 'next_hop': '192.168.4.2', 'route_dist': 
'65010:101', 'route_family': 'ipv4'}
INFO:bgpspeaker.api.base:API method neighbor.attribute_map.set called with 
args: {'ip_address': '10.0.1.3', 'route_family': 'ipv4', 'route_dist': 
'65010:101', 'attribute_map': 
[AttributeMap(filters=[ASPathFilter(as_number=65010,policy=TOP)],attribute_type=LOCAL_PREF,attribute_value=200)]}
INFO:bgpspeaker.cli:starting ssh server at localhost:4990
INFO:bgpspeaker.peer:Connection to peer: 192.168.101.101 established
INFO:bgpspeaker.peer:Connection to peer: 10.0.1.2 established
INFO:bgpspeaker.peer:Connection to peer: 10.0.1.3 established
ERROR:ryu.lib.hub:hub: uncaught exception: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 52, in 
_launch
    func(*args, **kwargs)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/peer.py", 
line 708, in _process_outgoing_msg_list
    self._send_outgoing_route(outgoing_msg)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/peer.py", 
line 667, in _send_outgoing_route
    update_msg = self._construct_update(outgoing_route)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/peer.py", 
line 938, in _construct_update
    result = self._lookup_attribute_map(at_maps, attr_type, path)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/peer.py", 
line 2004, in _lookup_attribute_map
    cause, result = m.evaluate(path)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/info_base/base.py",
 line 1171, in evaluate
    cause, result = f.evaluate(path)
  File 
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/info_base/base.py",
 line 1074, in evaluate
    path_seg = path_seg_list[0]
IndexError: list index out of range

Signed-off-by: Toshiki Tsuboi <[email protected]>
---
 ryu/services/protocols/bgp/info_base/base.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ryu/services/protocols/bgp/info_base/base.py 
b/ryu/services/protocols/bgp/info_base/base.py
index 0e56bd0..d3bc445 100644
--- a/ryu/services/protocols/bgp/info_base/base.py
+++ b/ryu/services/protocols/bgp/info_base/base.py
@@ -1000,9 +1000,9 @@ class ASPathFilter(Filter):
     Attribute        Description
     ================ ==================================================
     as_number        A AS number used for this filter
-    policy           ASPathFilter.POLICY_TOP and PrefixFilter.POLICY_END,
+    policy           ASPathFilter.POLICY_TOP and ASPathFilter.POLICY_END,
                      ASPathFilter.POLICY_INCLUDE and
-                     PrefixFilter.POLICY_NOT_INCLUDE are available.
+                     ASPathFilter.POLICY_NOT_INCLUDE are available.
     ================ ==================================================
 
     Meaning of each policy is as follows;
@@ -1011,7 +1011,7 @@ class ASPathFilter(Filter):
         Filter checks if the specified AS number is at the top of
         AS_PATH attribute.
 
-    * POLICY_TOP :
+    * POLICY_END :
         Filter checks is the specified AS number
         is at the last of AS_PATH attribute.
 
@@ -1071,7 +1071,10 @@ class ASPathFilter(Filter):
 
         path_aspath = path.pathattr_map.get(BGP_ATTR_TYPE_AS_PATH)
         path_seg_list = path_aspath.path_seg_list
-        path_seg = path_seg_list[0]
+        if path_seg_list:
+            path_seg = path_seg_list[0]
+        else:
+            path_seg = []
         result = False
 
         LOG.debug("path_seg : %s", path_seg)
-- 
1.9.1
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to