library_bgp_speaker.rst: make an example more complete

also, while i'm here, remove trailing whitespaces in the example.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix a crash in path comparison

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 <oda@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix some leftover of transition to packet lib bgp

fix some leftover of commit 9d5e66fa4e49ce66103dbc9640a33bd9c22fab3f.
("bgp: use ryu bgp packet library instead of original one")

Tested-by: Itsuro ODA <oda@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix another crash (recv_open -> recv_open_msg)

Tested-by: Itsuro ODA <oda@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix example code

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix best_path_change_handler for best_path_lost

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix ipv6 peering regression

Workaround. Needs to clean up get_peername and get_sockname usage.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple rest application

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>