ofctl_v1_2/3: fix POP_MPLS action and some match fields

The following causes an error at mod_flow_entry command

  - ofctl_v1_2.py
    * match field: metadata, mpls_label

  - ofctl_v1_3.py
    * match field: in_phy_port

and the following causes an error at get_flow_stats command

  - ofctl_v1_2.py
    * action: POP_MPLS
    * match field: metadata, ipv6_nd_target

  - ofctl_v1_3.py
    * action: POP_MPLS
    * match field: ipv6_nd_target

this patch fixes them.

Signed-off-by: TAKAHASHI Minoru <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Correct tcp option values in the test set

"\x11"*4 is an invalid value for TCP option, because it
would be decoded as Kind=17 and Length=17, but actual
size is 4.

If we'd like to set some non-zero value for TCP option
here, Kind=1(NOOP) is better.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ws_topology: fix typo

No spec change. The issue occurs at the time of "one_way=True"

Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_rest: support Port Modification Message

this patch makes ofctl_rest enable use of Port Modification Message.

usage)

  URI:    /stats/portdesc/modify
  method: POST

the message body is as follows:

  dpid
  port_no    (default:0)
  config     (default:0)
  hw_addr    (default:automatic-setting)
  mask       (default:0)
  advertise  (default:automatic-setting)

e.g. )

  curl -X POST -d '{"dpid": 1,
                    "port_no": 1,
                    "mask": 0b0000001,
                    "config": 0b0000001}' http://localhost:8080/stats/portdesc/modify

Signed-off-by: TAKAHASHI Minoru <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_rest: enable getting Description of a port

this patch makes ofctl_rest enable getting Description of a port.

usage)

  URI:    /stats/portdesc/<dpid>
  method: GET

e.g. )

  curl http://localhost:8080/stats/portdesc/1

    {"1": [{"hw_addr": "c6:d8:19:4a:e1:4f", "curr": 0, "supported": 0,
            "max_speed": 0, "advertised": 0, "peer": 0,
            "port_no": 4294967294, "curr_speed": 0, "name": "s1",
            "state": 1, "config": 1},
           {"hw_addr": "8e:96:a1:14:d8:a1", "curr": 2112, "supported": 0,
            "max_speed": 0, "advertised": 0, "peer": 0,
            "port_no": 1, "curr_speed": 10000000, "name": "s1-eth1",
            "state": 0, "config": 0}]}

Signed-off-by: TAKAHASHI Minoru <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add out-filter function

Added out-filter function to Ryu BGPSpeaker. It supports IPv4 and
IPv6.

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix the way of getting RouteFamily object

RouteFamily objects are treated as a singleton object.
However they are created in peer.py, so I added method to
get RouteFamily object in bgp.py and changed codes to use it.

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix logic for checking BGP capability

BGPOpen that is set to sent_open_msg and recv_open_msg doesn't have
caps and BGP capabilities are stored in opt_param as List.
I changed the way of checking BGP capabilities.

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix bug in net_ctrl listen_tcp

due to fdce89a0, _listen_tcp returns tuple.

Reported-by: 坪井俊樹 <t.tsubo2000@gmail.com>
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: shut up runtime warning due to configuration file loading

this patch shut up the warning shown below

/home/wataru/etc/bgpconf01.py:1: RuntimeWarning: Parent module
'bgpspeaker' not found while handling absolute import
  import os

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add med parameter to neighbor_add

Sorry, I changed parameter name for MED to uniform with add_vrf.
I resend patches for neighbor_add method and neighbor_update and
please ignore the patches that I sent before.

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add neighbor_update

added neighbor_update method to BGPSpeaker class.
Currently only MED value can be changed.

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: fix bug when restart neighbor

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

stop showing when stringified because it's noisy

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

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: remove an unused variable from bgpspeaker

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add neighbor_reset method to bgpspeaker

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
unit test for ofctl_v1_2/3

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_v1_2/3: fix tcp_dst/src match fields

when enclosed the value of "ip_proto" in double quotes,
following match fields is not set at mod_flow_stats command:

  * tcp_dst, tcp_src

this patch fixes this problem.

Reported-by: jalee <jalee@inno-tech.com.tw>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_v1_2/3: fix unsuitable log

when using action type below, the log unsuitable is outputted:
Unknown action type: [action type]

  * GOTO_TABLE, WRITE_METADATA, METER(only ofctl_v1_3.py)

this patch fixes this problem.

Reported-by: jalee <jalee@inno-tech.com.tw>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>