bgp: add bgpspaker module for non Ryu application usage

This enables you to use Ryu BGP feature as 'bgp speaker' python
library, that is, without ryu-manager, RPC API, REST API, or other Ryu
stuff, you can use Ryu BGP feature in your python application (just
import bgpspeaker.py). The sample code and the API reference docs are
included too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
sw test tool: Modify conditions of ofp_packet_in_reason

OF 1.4.0 spec (B.14.2 More descriptive reasons for packet-in) says:

    The main change is that the the "output action" reason OFPR_ACTION is effectively split into four reasons,
    "apply-action", "action-set", "group bucket" and "packet-out", representing the four distinct context
    where this action is used.

A set of reason values for ofp_packet_in message in OF 1.3.3 is:

    enum ofp_packet_in_reason {
        OFPR_NO_MATCH    = 0, /* No matching flow (table-miss flow entry). */
        OFPR_ACTION      = 1, /* Action explicitly output to controller. */
        OFPR_INVALID_TTL = 2, /* Packet has invalid TTL */
    };

And a new set of reason values for ofp_packet_in message in OF 1.4.0 is:

    enum ofp_packet_in_reason {
        OFPR_TABLE_MISS   = 0, /* No matching flow (table-miss flow entry). */
        OFPR_APPLY_ACTION = 1, /* Output to controller in apply-actions. */
        OFPR_INVALID_TTL  = 2, /* Packet has invalid TTL */
        OFPR_ACTION_SET   = 3, /* Output to controller in action set. */
        OFPR_GROUP        = 4, /* Output to controller in group bucket. */
        OFPR_PACKET_OUT   = 5, /* Output to controller in packet-out. */
    };

Therefore, "reason != OFPR_ACTION" means "reason == OFPR_NOMATCH or reason == OFPR_INVALID_TTL".

NOTE: OFPR_TABLE_MISS is defined as OFPR_NO_MATCH in ryu.ofproto.ofproto_v1_4.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add mask length of ipv6_flabel

OF 1.3.3 spec (B.14.1 Changes) says:

    Clarify that IPv6 flow label is not maskable by default

Since OF 1.4.0 was defined as the next of OF 1.3.2, IPv6 flow label is maskable in OF 1.4.0.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add support for OpenFlow 1.4

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Enable using connected switches to parse

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Enable getting switches from outside of OfTester

This patch is for using connected switches to parse.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Enable waiting for switches to connect before parsing

This patch is for using connected switches to parse.
The switch test tool starts to parse test files after switches connected.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Enable using connected switches to compare

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Modify OFPMatch to normalize

This patch is for avoiding the following issues when using ofproto_v1_4_parser:

  - OFPMatch that is created from JSON keeps unicode strings, instead of usual strings.
  - In OFPMatch that is created from JSON, IPv6 formats like 'ff::0' or '00ff:0000:0000:0000:0000:0000:0000:0000' are not normalized to 'ff::'.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Modify OFPActionSetField to normalize

This patch is for avoiding the following issues when using ofproto_v1_4_parser:

  - OFPActionSetField that is created from JSON keeps unicode strings, instead of usual strings.
  - In OFPActionSetField that is created from JSON, IPv6 formats like 'ff::0' or '00ff:0000:0000:0000:0000:0000:0000:0000' are not normalized to 'ff::'.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add default test files (of14: action without set-field)

These test files aim to examine 'action' excluding 'set-field' of FlowMod message.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add default test files (of14: action with set-field only)

These test files aim to examine 'set-field action' of FlowMod message.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add default test files (of14: match)

These test files aim to examine 'match' of FlowMod message.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add default test files (of14: meter)

These test files aim to examine 'meter instruction' of FlowMod message.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: Add default test files (of14: group:all/select)

These test files aim to examine 'group action' of FlowMod message.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
sw test tool: using difflib

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