32 Commits

Author SHA1 Message Date
Jason Kölker
b88adadec4 lib/ofctl_v1_0: Flake8 Fixes
Signed-off-by: Jason Kölker <jason@koelker.net>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-30 08:07:23 +09:00
Minoru TAKAHASHI
3484e6e573 lib/ofctl_v1_0: Fix a small bug in get_desc_stats() and get_aggregate_flow_stats()
If there is an empty value in the reply msg, there are cases where those methods cause an error.
This patch fixes this problem.

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-27 22:29:18 +09:00
Shinpei Muraoka
32f5c622b3 ofctl_rest: Support port number and queue id in get_queue_stats()
This patch enables to specify the port number and the queue id to get the queue stats.

Usage)
  $ curl -X GET http://localhost:8080/stats/queue/<dpid>[/<port>[/<queue_id>]]
  Note: Specification of port number and queue id are optional.
        If you want to omitting the port number and setting the queue id,
        please specify the keyword "ALL" to the port number.
        e.g. GET /stats/queue/1/ALL/1

Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-23 22:44:01 +09:00
Shinpei Muraoka
294d241830 ofctl_rest: Support port number in get_port_stats()
This patch enables to specify the port number to get the port stats.

Usage)
  $ curl -X GET http://localhost:8080/stats/port/<dpid>[/<port>]
  Note: Specification of port number is optional

Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-23 22:43:40 +09:00
IWASE Yusuke
19e49c861f lib/ofctl: Add utility library for ofctl_v1_*.py
This patch enables ofctl_v1_*.py to use the reserved OpenFlow
numbers (e.g. port numbering such as "OFPP_CONTROLLER") in the
request and reply parameters of ofctl_rest.py.

Example:
  - When adding a flow entry:
    $ curl -X POST -d '{
        "dpid": 1,
        "actions":[
            {
                "type": "OUTPUT",
                "port": "CONTROLLER"
            }
        ]
     }' http://localhost:8080/stats/flowentry/add

  - When getting flows stats:
    $ curl -X GET http://localhost:8080/stats/flow/1
    {
      "1": [
        {
          ...
          "actions": [
            "OUTPUT:CONTROLLER"
          ],
          ...
        }
      ]
    }

Suggested-by: Sergio Andres Rivera Polanco <sergiorivera88@gmail.com>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-01-19 13:38:12 +09:00
IWASE Yusuke
7d626a55b2 lib/ofctl_v1_*: Confirm hw_addr is str in mod_port_behavior
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-01-19 10:51:55 +09:00
Minoru TAKAHASHI
4feded18f3 ofctl_v1/2/3: Some improvements
* modify from "flow" to "meter" the argument of meter_mod
* modify the default argument from {} to None of the following methods
  because default value []/{} as argument is dangerous.
  - get_flow_stats
  - get_aggregate_flow_stats
  - mod_meter_entry
* fix some log messages for better readability

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-12-25 10:03:53 +09:00
IWASE Yusuke
ed6adb6d83 lib/ofctl: Confirm UTF-8 in binary fields
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-12-22 13:50:27 +09:00
Minoru TAKAHASHI
9a534b46a6 ofctl_rest: support OFPTableStats Message
this patch makes ofctl_rest enable use of OFPTableStats message.

Get table stats:

  usage)

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

  e.g.)

    $ curl -X GET http://localhost:8080/stats/table/1

More infomation about this feature is described in the following URL.
http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#get-table-stats

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-10-28 14:44:40 +09:00
Takeshi
79db626806 use idle timeout in ofctl to avoid incomplete querying
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-08-10 11:24:05 +09:00
Minoru TAKAHASHI
10df461c7b ofctl_v1_0: fix output string of ENQUEUE
There is no port information in output string of ENQUEUE in ofctl_v1_0.py
This patch fixes this problem.

Execution example is as follows.

curl -X GET http://localhost:8080/stats/flow/1

{
    "1": [
        {
            "actions": [
                "ENQUEUE:2:3"  # ENQUEUE:<port>:<queue_id>
            ],
            "byte_count": 0,
            "cookie": 0,
            "duration_nsec": 864000000,
            "duration_sec": 107,
            "hard_timeout": 0,
            "idle_timeout": 0,
            "match": {
                "in_port": 5
            },
            "packet_count": 0,
            "priority": 32768,
            "table_id": 0
        }
    ]
}

Reported-by: Weijie Liu <wliu43@illinois.edu>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-07-22 19:12:47 +09:00
Minoru TAKAHASHI
cd46e0685f ofctl_v1_0: fix output of get_flow_stats
After applying this patch,
ofctl_v1_0:get_flow_stats outputs only match fields that no wildcard is set.
Execution example is as follows.

before applying this patch:

$curl http://127.0.0.1:8080/stats/flow/1
{
    "1": [
        {
            "actions": [
                "OUTPUT:1"
            ],
            "byte_count": 238,
            "cookie": 0,
            "duration_nsec": 585000000,
            "duration_sec": 154,
            "hard_timeout": 0,
            "idle_timeout": 0,
            "match": {
                "dl_dst": "00:00:00:00:00:01",
                "dl_src": "00:00:00:00:00:00",
                "dl_type": 0,
                "dl_vlan": 0,
                "dl_vlan_pcp": 0,
                "in_port": 2,
                "nw_dst": "0.0.0.0",
                "nw_proto": 0,
                "nw_src": "0.0.0.0",
                "nw_tos": 0,
                "tp_dst": 0,
                "tp_src": 0
            },
            "packet_count": 3,
            "priority": 32768,
            "table_id": 0
        }
    ]
}

after applying this patch:

$curl http://127.0.0.1:8080/stats/flow/1
{
    "1": [
        {
            "actions": [
                "OUTPUT:1"
            ],
            "byte_count": 238,
            "cookie": 0,
            "duration_nsec": 593000000,
            "duration_sec": 12,
            "hard_timeout": 0,
            "idle_timeout": 0,
            "match": {
                "dl_dst": "00:00:00:00:00:01",
                "in_port": 2
            },
            "packet_count": 3,
            "priority": 32768,
            "table_id": 0
        }
    ]
}

Reported-by:Liu, Weijie <wliu43@illinois.edu>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-14 22:48:30 +09:00
Yusuke Iwase
a4e9abfcbc ofctl_rest: support OFPAggregateStats message
this patch makes ofctl_rest enable use of OFPAggregateStats message.

Get aggregate flow stats:

  usage)

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

  e.g.)

    $ curl -X GET http://localhost:8080/stats/aggregateflow/1
    {
      "1": [
        {
          "packet_count": 18,
          "byte_count": 756,
          "flow_count": 3
        }
      ]
    }

Get aggregate flow stats filtered by fields:

  usage)

    URI:    /stats/aggregateflow/<dpid>
    method: POST

    the message body is as follows.

        table_id     Table ID (int)
        out_port     Require matching entries to include this as an output port (int)
        out_group    Require matching entries to include this as an output group (int)
        cookie       Require matching entries to contain this cookie value (int)
        cookie_mask  Mask used to restrict the cookie bits that must match (int)
        match        Fields to match (dict)

  e.g.)

    $ curl -X POST -d '{
             "table_id": 0,
             "out_port": 2,
             "cookie": 1,
             "cookie_mask": 1,
             "match":{
                 "in_port":1
             }
         }' http://localhost:8080/stats/aggregateflow/1

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-20 13:12:48 +09:00
Yusuke Iwase
fe0d068f86 ofctl_rest: support OFPQueueStats message
this patch makes ofctl_rest enable use of OFPQueueStats message.

usage)

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

e.g.)

  $ curl -X GET http://localhost:8080/stats/queue/1
  {
    "1": [
      {
        "port_no": 1,
        "queue_id": 0,
        "tx_bytes": 0,
        "tx_packets": 0,
        "tx_errors": 0,
        "duration_sec": 4294963425,
        "duration_nsec": 3912967296
      },
      {
        "port_no": 1,
        "queue_id": 1,
        "tx_bytes": 0,
        "tx_packets": 0,
        "tx_errors": 0,
        "duration_sec": 4294963425,
        "duration_nsec": 3912967296
      }
    ]
  }

NOTE: The "duration_sec" and "duration_nsec" fields are for OF1.3(or later).

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-20 13:12:48 +09:00
Minoru TAKAHASHI
5d63bbfbaf ofctl_v1_0/2/3: Fix unsuitable log level
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-13 21:22:49 +09:00
Yusuke Iwase
9ed1681783 ofctl_v1_0: Add remaining actions
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-11-07 22:00:32 +09:00
Charles M.C. Chan
f0ab847f64 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>
2014-10-26 16:21:23 +09:00
Wei-Li Tang
bcc2c13484 ofctl_v1_0/2/3: check lock timeout by lock.is_set().
send_stats_request never catches hub.Timeout exception because it
has been caught by the event wait function itself.

Signed-off-by: Wei-Li Tang <alextwl@xinguard.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-10-10 09:38:50 +09:00
Minoru TAKAHASHI
2b202aff8b ofctl_v1_0: correct flow modify message
following fields is not set at mod_flow_stats command:

  * out_port, buffer_id

this patch fixes this problem.

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-09-12 09:04:46 -07:00
Yusuke Iwase
04766aaa93 ofctl_rest: support OFPFlowStats filtered by fields
this patch enables ofctl_rest to get OFPFlowStats messages
filtered by the OFPFlowStatsRequest fields in OpenFlow specification.

usage)

  URI:    /stats/flow/<dpid>
  method: POST

  the message body is as follows:

  table_id     ID of table.
  out_port     Require matching entries to include this as an output port.
  out_group    Require matching entries to include this as an output group.
               (Not supported in of1.0)
  cookie       Require matching entries to contain this cookie value.
               (Not supported in of1.0)
  cookie_mask  Mask used to restrict the cookie bits that must match.
               (Not supported in of1.0)
  match        Fields to match.

e.g.)

  curl -X POST -d '{"table_id": 0,
                    "out_port": 2,
                    "cookie": 1,
                    "cookie_mask": 1,
                    "match":{"in_port":1}}'
  http://localhost:8080/stats/flow/1

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-08-20 05:25:10 -07:00
takahashi.minoru
9d7433e44a 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>
2014-07-17 15:04:38 +09:00
takahashi.minoru
78786a47c6 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>
2014-07-17 15:04:35 +09:00
Yuichi Ito
52540f27da lib: ofctl: support the specified max_len of flow_mod
this patch makes the max_len of flow_mod message more flexible.

before applying this patch:

    ofctl_v1_0: 128 bytes for packet_in (fixed size) and none for others (fixed)
    ofctl_v1_2: 128 bytes for packet_in (fixed size) and 0 for others (fixed size)
    ofctl_v1_3: 0 for all by default (flexible)

    ofctl_v1_3 will send 0 byte length data in a packet_in message if max_len is not specified.

after applying this patch:

    all version: MAX_LEN for all by default (flexible)
    NOTE: MAX_LEN is 65535 for OF1.0, and is OFPCML_MAX for OF1.2/1.3.

    max_len is omissible by every ofctl.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-17 19:51:07 +09:00
watanabe.fumitaka
05cdadc900 ofctl v1.0/v1.2: add miss_send_len for packet in
Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-09-03 17:23:21 +09:00
Satoshi Kobayashi
2ea5431ad3 ofctl lib: Actions is a list
Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Acked-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-08-20 17:52:23 +09:00
YAMAMOTO Takashi
9e6d3053c0 sweep the tree to change from gevent to ryu.lib.hub
mostly mechanical changes.
also, change the requirement from gevent to eventlet.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-05-01 22:18:39 +09:00
watanabe.fumitaka
b4424c92d9 update ofctl_v1_0 library
This patch contains the update for ofctl_v1_0 library.

Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-03-25 06:48:03 +09:00
OHMURA Kei
abd1039801 ofctl_v1_0: fix stats timeout handling
This patch fixes a issue reported by https://github.com/osrg/ryu/issues/7

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-01-25 07:16:50 +09:00
OHMURA Kei
4d2854468a ofctl_{rest, v1_0}: update and clean up
- rename push_flow_entry to mod_flow_entry
- add OFPFC_{MODIFY, DELETE} support
- remove debug message

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-12-20 18:52:26 +09:00
OHMURA Kei
c7d4aa7475 ofctl_v1_0: update and clean up
- add ip match support
- add match_to_str() and actions_to_str() instead of action_to_str()

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-11-26 07:06:54 +09:00
OHMURA Kei
5ccf13809c ofctl_v1_0: update get_flow_stats() to dump actions
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-11-05 14:51:52 +09:00
OHMURA Kei
3e74c789e9 ryu/lib/ofctl_v1_0: introduce OF interface
This patch provides the raw OF interface. We can talk with a switch
by using the OF interface via some protocols such as REST.

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-10-30 11:39:52 +09:00