bgp: fix non configured peer exception

peer is None if the connection comes from non configured bgp peer.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: set bgp-config-file default None

allowing not use a config file.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add JSON RPC API

Adds JSON RPC API on web socket to dynamically configure bgp. This is
the initial support (there are still tons of APIs that are not
exported via JSON RPC API).

$ sudo PYTHONPATH=.:$PYTHONPATH ryu-manager ryu/services/protocols/bgp/api/jsonrpc.py ryu/services/protocols/bgp/application.py

then you can configure on another terminal:

~ fujita$ wsdump.py ws://127.0.0.1:8080/bgp/ws
Press Ctrl+C to quit
> {"jsonrpc": "2.0", "id": 1, "method": "core.start", "params" : {"as_number":64512, "router_id":"10.0.0.2"}}
< {"jsonrpc": "2.0", "id": 1, "result": {}}
> {"jsonrpc": "2.0", "id": 1, "method": "neighbor.create", "params" : {"ip_address":"192.168.177.32", "remote_as":64513}}
< {"jsonrpc": "2.0", "id": 1, "result": {}}
> {"jsonrpc": "2.0", "id": 1, "method": "network.add", "params" : {"prefix":"10.20.0.0/24"}}
< {"jsonrpc": "2.0", "id": 1, "result": {}}

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add 'neighbors.get' and 'show.rib' JSON RPC API

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
stringify: Enable using the following operators: '==', '!='

StringifyMixin and its inherited classes are now able to compare each other using '==' and '!='.

ex)
  >>> from ryu.lib.packet.ipv4 import ipv4
  >>> a = ipv4(version=4,src='127.0.0.1')
  >>> a
  ipv4(csum=0,dst='0.0.0.0',flags=0,header_length=5,identification=0,offset=0,option=None,proto=0,src='127.0.0.1',tos=0,total_length=0,ttl=255,version=4)
  >>> b = ipv4(src='127.0.0.1')
  >>> b
  ipv4(csum=0,dst='0.0.0.0',flags=0,header_length=5,identification=0,offset=0,option=None,proto=0,src='127.0.0.1',tos=0,total_length=0,ttl=255,version=4)
  >>> a == b
  True

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
of12/of13/of14: OFPMatch: Enable comparison methods to consider masks

When using operators '==' and '!=', comparison methods consider masks that are all-one-bits or are all-zero-bits or without byte boundary.

ex)
  >>> from ryu.ofproto.ofproto_v1_2_parser import OFPMatch
  >>> a = OFPMatch(vlan_vid=(0x0400,0x1ff0),eth_type=0x0800,ipv4_src=('127.0.0.1','0.0.0.0'),ipv4_dst=('224.0.0.1','255.255.255.255'))
  >>> a
  OFPMatch(oxm_fields={'eth_type': 2048, 'ipv4_dst': ('224.0.0.1', '255.255.255.255'), 'ipv4_src': ('0.0.0.0', '0.0.0.0'), 'vlan_vid': (1024, 8176)})
  >>> b = OFPMatch(vlan_vid=(0x0400,0xfff0),eth_type=0x0800,ipv4_dst='224.0.0.1')
  >>> b
  OFPMatch(oxm_fields={'eth_type': 2048, 'ipv4_dst': '224.0.0.1', 'vlan_vid': (1024, 65520)})
  >>> a == b
  True

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Remove OFPMatch comparison method

These codes are moved to ryu.ofproto.ofproto_parser.

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