bgp: fix NameError bug

variable 'nlri_str' was not defined in peer.py

bgpspeaker.speaker l.566  |    DEBUG | Traceback (most recent call last):
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
560, in _recv_loop
    self.data_received(next_bytes)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
275, in data_received
    self._data_received(next_bytes)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
355, in _data_received
    self._handle_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
508, in _handle_msg
    self._peer.handle_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1564,
in handle_msg
    self._handle_update_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1230,
in _handle_update_msg
    self._extract_and_handle_mpbgp_new_paths(update_msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1445,
in _extract_and_handle_mpbgp_new_paths
    self._adj_rib_in[nlri_str] = received_route
NameError: global name 'nlri_str' is not defined

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix AttributeError bug

for BGPPathAttributeMpUnreachNLRI, use 'withdrawn_routes' instead of
'nlri_list'

bgpspeaker.speaker l.566  |    DEBUG | Traceback (most recent
call last):
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
560, in _recv_loop
    self.data_received(next_bytes)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
275, in data_received
    self._data_received(next_bytes)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
355, in _data_received
    self._handle_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/speaker.py", line
508, in _handle_msg
    self._peer.handle_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1567,
in handle_msg
    self._handle_update_msg(msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1234,
in _handle_update_msg
    self._extract_and_handle_mpbgp_withdraws(mp_unreach_attr)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 1496,
in _extract_and_handle_mpbgp_withdraws
    w_nlris = mp_unreach_attr.nlri_list
AttributeError: 'BGPPathAttributeMpUnreachNLRI' object has no attribute
'nlri_list'

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix bugs related to filter

previous implementation apply all filters to all paths regardless of
its route family. this implementation cause error like one shown below.

ryu.lib.hub l.60   |    ERROR | hub: uncaught exception:
Traceback (most recent call last):
  File "/home/wataru/ryu/ryu/lib/hub.py", line 52, in _launch
    func(*args, **kwargs)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 650,
in _process_outgoing_msg_list
    self._send_outgoing_route(outgoing_msg)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 599,
in _send_outgoing_route
    block, blocked_cause = self._apply_out_filter(path)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 505,
in _apply_out_filter
    return self._apply_filter(self._out_filters, path)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/peer.py", line 490,
in _apply_filter
    policy, is_matched = filter_.evaluate(path)
  File "/home/wataru/ryu/ryu/services/protocols/bgp/info_base/base.py",
line 953, in evaluate
    net = netaddr.IPNetwork(prefix.formatted_nlri_str)
  File "/usr/local/lib/python2.7/dist-packages/netaddr/ip/__init__.py",
line 941, in __init__
    raise AddrFormatError('invalid IPNetwork %s' % addr)
AddrFormatError: invalid IPNetwork 100:100:20.0.0.0/24

To fix this bug, this patch introduce the Ipv4PrefixFilter and Ipv6PrefixFilter
class which is only applied to the ipv4 path and ipv6 path.

other condition bug related to applying filter is also fixed.

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>