this fixes the following crash.

API method core.start called with args: {'router_id': '172.17.190.2', 'waiter':<
<ryu.lib.hub.Event object at 0x7f903ed084d0>, 'bgp_server_port': 179, 'local_as:
: 64512, 'refresh_max_eor_time': 0, 'refresh_stalepath_time': 0}
API method neighbor.create called with args: {'cap_mbgp_vpnv6': False, 'ip_addrs
ss': '172.17.190.3', 'cap_mbgp_vpnv4': False, 'remote_as': 64512, 'cap_mbgp_ipv'
': True}
API method neighbor.create called with args: {'cap_mbgp_vpnv6': False, 'ip_addrs
ss': '172.17.190.4', 'cap_mbgp_vpnv4': False, 'remote_as': 64512, 'cap_mbgp_ipv'
': True}
Connection to peer: 172.17.190.3 established
Connection to peer: 172.17.190.4 established
the best path changed: 64512 0.0.0.0/0 172.17.190.3 False
hub: uncaught exception: Traceback (most recent call last):
  File "/opt/ryu/ryu/lib/hub.py", line 52, in _launch
    func(*args, **kwargs)
  File "/opt/ryu/ryu/services/protocols/bgp/base.py", line 241, in start
    self._run(*args, **kwargs)
  File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 97, in _run
    self._process_dest()
  File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 114, in _proces_
_dest
    next_dest.process()
  File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 396, in prc
cess
    self._process()
  File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 366, in _po
ocess
    new_best_path, reason = self._process_paths()
  File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 485, in _po
ocess_paths
    current_best_path, reason = self._compute_best_known_path()
  File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 588, in _cm
mpute_best_known_path
    next_path)
  File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 252, in computeb
best_path
    best_path = _cmp_by_router_id(local_asn, path1, path2)
  File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 495, in _cmp_byr
router_id
    local_bgp_id = path_source1.protocol.sent_open.bgpid
AttributeError: 'Peer' object has no attribute 'protocol'

Tested-by: Itsuro ODA <[email protected]>
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/services/protocols/bgp/peer.py      | 4 ++++
 ryu/services/protocols/bgp/processor.py | 9 ++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index c56b294..d92e0d3 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -336,6 +336,10 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
         return self._neigh_conf.ip_address
 
     @property
+    def protocol(self):
+        return self._protocol
+
+    @property
     def host_bind_ip(self):
         return self._host_bind_ip
 
diff --git a/ryu/services/protocols/bgp/processor.py 
b/ryu/services/protocols/bgp/processor.py
index a5fcbcc..05b766a 100644
--- a/ryu/services/protocols/bgp/processor.py
+++ b/ryu/services/protocols/bgp/processor.py
@@ -492,9 +492,9 @@ def _cmp_by_router_id(local_asn, path1, path2):
 
     # At least one path is not coming from NC, so we get local bgp id.
     if path_source1 is not None:
-        local_bgp_id = path_source1.protocol.sent_open.bgpid
+        local_bgp_id = path_source1.protocol.sent_open_msg.bgpid
     else:
-        local_bgp_id = path_source2.protocol.sent_open.bgpid
+        local_bgp_id = path_source2.protocol.sent_open_msg.bgpid
 
     # Get router ids.
     router_id1 = get_router_id(path_source1, local_bgp_id)
@@ -506,9 +506,8 @@ def _cmp_by_router_id(local_asn, path1, path2):
         return None
 
     # Select the path with lowest router Id.
-    from ryu.services.protocols.bgp.ker.utils.bgp import from_inet_ptoi
-    if (from_inet_ptoi(router_id1) <
-            from_inet_ptoi(router_id2)):
+    from ryu.services.protocols.bgp.utils.bgp import from_inet_ptoi
+    if (from_inet_ptoi(router_id1) < from_inet_ptoi(router_id2)):
         return path1
     else:
         return path2
-- 
1.8.3.1


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to