ofproto_v1_4: Add tun_ipv4_src and tun_ipv4_dst NXMs

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sw test tool: Fix typos

Reported by Ian Y. Choi on ryu-devel.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add a simple switch for Openflow 1.4, an easy adaption of SimpleSwitch13

Signed-off-by: Shu Shen <shu.shen@radisys.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch_13: Update a comment about OVS bug

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch_14: Update a comment about OVS bug

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
stplib.py: Should wildcard non-relevant bits in the mask field of port mod message for OpenFlow 1.2+.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix bug of ASPathFilter in case of iBGP peering

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 <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_v1_0: match_to_str() does not convert nw_tos correctly

The match_to_str() function in ryu/lib/ofctl_v1_0.py does not convert
nw_tos correctly.  As a result, we cannot obtain nw_tos value of any
flow entry by invoking get_flow_stats()

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: don't crash with corrupted lldp packet

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: Benjamin Eggerstedt <benjamin.eggerstedt@gmail.com>
packet lib: don't crash with truncated dhcp packet

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
rest_router: fix security problem

Signed-off-by: Takeshi <a86487817@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: supporting best_path_change_handler for Vpnv4/6 prefix in BGPSpeaker

BGPSpeaker is aware of "best_path_change_handler" in MPLS-VPN topology.
This feature is available in calculating Best Path Selection of VPNv4/6 prefixes.

Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch_13: Added a logging when running in --verbose for truncated packets

Added a logging when running in --verbose as truncated packets in packet_in
have caused some confusion and this would hopefully help others

Signed-off-by: Benjamin Eggerstedt <benjamin.eggerstedt@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch_13.py: Added ability to use buffer_id in FlowMod

This avoids to send two packets (FlowMod & PacketOut).

OF v1.3.1 (the specification most switch vendors implemented) mentions
in A.3.4.1 on page 65 that this is a valid way to avoid two packets.

Signed-off-by: Benny Eggerstedt <benjamin.eggerstedt@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch: handle non-buffering switch

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
simple_switch_12: handle non-buffering switch

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Ryu 3.15

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix _OptParamCapability parser

It could include multiple Capabilities.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: remove uncommon open msg check

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
doc: Add tables about match and actions structures

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>