A happy new year 2014

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tests: add some tests for ryu.lib.of_config.classes

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
lib.of_config: import ryu.contrib

import ryu.contrib by ourself for the benefit of programs
which doesn't use other ryu.contrib stuffs like oslo.config.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_rest: support group-related messages

this patch makes ofctl_rest possible to:

  - support the GROUP action in the FlowMod message
  - support the GroupMod message
  - support the GroupStats message
  - support the GroupFeatures message
  - support the GroupDesc message

see following examples.

FlowMod with the group action:

  e.g.)

    curl -X POST -d '{"dpid": 1,
                      "match": {},
                      "actions": [{"type": "GROUP,
                                   "group_id": 1}]}' http://localhost:8080/stats/flowentry/add

GroupMod:

  usage)

    URI:    /stats/groupentry/{cmd}
    METHOD: POST

      NOTE: the value of 'cmd' is one of follows: 'add', 'modify', or 'delete'.

    the message body is as follows:

      type      Group types. 'ALL', 'SELECT', 'INDIRECT', or 'FF'.
      group_id  Group Identifier. (default: 0)
      buckets   a list of buckets.

    where each bucket has the following members:

      weight       Relative weight of bucket. (default: 0)
      watch_port   Port whose state affects whether this bucket is live. (default: OFPP_ANY)
      watch_group  Group whose state affects whether this bucket is live. (default: OFPG_ANY)
      actions      a list of actions. the format is the same as that of FlowMod.

  e.g.)

    curl -X POST -d '{"dpid": 1,
                      "type": "FF",
                      "group_id": 1,
                      "buckets": [{"watch_port": 2,
                                   "actions": [{"type": "OUTPUT",
                                                "port": 3}]}]}' http://localhost:8080/stats/groupentry/add

GroupStats:

  usage)

    URI:    /stats/group/{dpid}
    METHOD: GET

  e.g.)

    curl http://localhost:8080/stats/group/1
    {
      "1": [
        {
          "bucket_stats": [
            {
              "packet_count": 0,
              "byte_count": 0
            }
          ],
          "byte_count": 0,
          "ref_count": 0,
          "duration_nsec": 231000000,
          "packet_count": 0,
          "duration_sec": 11238,
          "group_id": 1
        }
      ]
    }

GroupFeatures:

  usage)

    URI:    /stats/groupfeatures/{dpid}
    METHOD: GET

  e.g.)

    curl http://localhost:8080/stats/groupfeatures/1
    {
      "1": [
        {
          "actions": [
            {"ALL": ["OUTPUT", "COPY_TTL_OUT", "COPY_TTL_IN", "SET_MPLS_TTL", "DEC_MPLS_TTL", "PUSH_VLAN", "POP_VLAN", "PUSH_MPLS", "POP_MPLS", "SET_QUEUE", "GROUP", "SET_NW_TTL", "DEC_NW_TTL", "SET_FIELD"]},
            {"SELECT": []},
            {"INDIRECT": []},
            {"FF": []}
          ],
          "max_groups": [
            {"ALL": 4294967040},
            {"SELECT": 4294967040},
            {"INDIRECT": 4294967040},
            {"FF": 4294967040}
          ],
          "capabilities": ["SELECT_WEIGHT", "SELECT_LIVENESS", "CHAINING"],
          "types": []
        }
      ]
    }

GroupDesc:

  usage)

    URI:    /stats/groupdesc/{dpid}
    METHOD: GET

  e.g.)

    curl http://localhost:8080/stats/groupdesc/1
    {
      "1": [
        {
          "buckets": [
            {
              "actions": ["OUTPUT:2"],
              "watch_group": 4294967295,
              "weight": 0,
              "watch_port": 3
            }
          ],
          "group_id": 1,
          "type": "FF"
        }
      ]
    }

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_rest: improve readability of the result of MeterFeatures

although 'band_types' of MeterFeatures were bitmaps of supported band types, it was expressed numerically.
this patch makes 'band_types' human-readable.

e.g.)

  curl http://localhost:8080/stats/meterfeatures/8796750050962
  {
    "8796750050962": [
      {
        "max_meter": 16777216,
        "max_color": 0,
        "max_band": 255,
        "band_types": ["DROP", "DSCP_REMARK"]
      }
    ]
  }

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bpdu: handling based on version and type

In bpdu.py only one version was permitted with one type, before.
This patch improves parser so that it may be based on multiple versions and types.

Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka1@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
test_bpdu: add unit test

Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka1@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet_data_generator: update of_protocol upstream

merely a clean up for a pullup request.  no functionality changes.

also, update comments.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
enable OpenFlow 1.4

Adds the very basic features for L2 switch. Kinda simple_switch_14.py
successfully works with LINC switch.

- HELLO
- FEATURES_REQUEST_REQUEST/REPLY
- GET_CONFIG_REQUEST/REPLY
- SET_CONFIG
- PACKET_IN
- MULTIPART_REQUEST/REPLY (only flow_stats)
- PACKET_OUT
- FLOW_MOD

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofctl_v1_2/3: fix match conditions about ARP

ofctl_v1_0 has changed nw_src/dst into ipv4_src/dst or arp_spa/tpa automatically like ovs-ofctl.
since ofctl_v1_2/3 change nw_src/dst only into ipv4_src/dst, it cannot create the match conditions which use arp_spa/tpa.
this patch fixes this problem.

before applying this patch (using ofctl_rest):

  curl -X POST -d '{"dpid": 1,
                    "match": {"dl_type": 2048,
                              "nw_src": "192.168.0.0/24"},
                    "actions": [{"type": "OUTPUT",
                                 "port": 2}]}' http://localhost:8080/stats/flowentry/add

  OFPST_FLOW reply (OF1.3) (xid=0x2):
   cookie=0x0, duration=3.602s, table=0, n_packets=0, n_bytes=0, priority=0,ip,nw_src=192.168.0.0/24 actions=output:2

  curl -X POST -d '{"dpid": 1,
                    "match": {"dl_type": 2054,
                              "nw_src": "192.168.0.0/24"},
                    "actions": [{"type": "OUTPUT",
                                 "port": 2}]}' http://localhost:8080/stats/flowentry/add

  no flow entry was installed.

after applying this patch (using ofctl_rest):

  curl -X POST -d '{"dpid": 1,
                    "match": {"dl_type": 2048,
                              "nw_src": "192.168.0.0/24"},
                    "actions": [{"type": "OUTPUT",
                                 "port": 2}]}' http://localhost:8080/stats/flowentry/add

  OFPST_FLOW reply (OF1.3) (xid=0x2):
   cookie=0x0, duration=3.602s, table=0, n_packets=0, n_bytes=0, priority=0,ip,nw_src=192.168.0.0/24 actions=output:2

  curl -X POST -d '{"dpid": 1,
                    "match": {"dl_type": 2054,
                              "nw_src": "192.168.0.0/24"},
                    "actions": [{"type": "OUTPUT",
                                 "port": 2}]}' http://localhost:8080/stats/flowentry/add

  OFPST_FLOW reply (OF1.3) (xid=0x2):
   cookie=0x0, duration=2.555s, table=0, n_packets=0, n_bytes=0, priority=0,arp,arp_spa=192.168.0.0/24 actions=output:2

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
rest_firewall: support IPv6 match conditions

this patch gets rest_firewall to support IPv6 match conditions.

'ipv6_src' and 'ipv6_dst' are allowed as key.
'ICMPv6' is allowed as the value of 'nw_proto'.

e.g.)

  curl -X POST -d '{"ipv6_src": "10::/64"}' http://localhost:8080/firewall/rules/0000000000000001

  curl http://localhost:8080/firewall/rules/0000000000000001

  [
    {
      "access_control_list": [
        {
          "rules": [
            {
              "priority": 1,
              "dl_type": "IPv6",
              "ipv6_src": "10::/64",
              "rule_id": 1,
              "actions": "ALLOW"
            }
          ]
        }
      ],
      "switch_id": "0000000000000001"
    }
  ]

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
safi: add a constant for route target constrain

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add a constant for enhanced route refresh

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: implement BGPOptParamCapabilityCarryingLabelInfo

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: implement the rest of RFC 3107

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
test tool: run_mininet: support CPqD Software Switch

this patch gets run_mininet.py to support CPqD Software Switch.

usage)

  to use CPqD Software Switch:
    sudo ryu/tests/switch/run_mininet.py --switch cpqd

  to use Open vSwitch:
    sudo ryu/tests/switch/run_mininet.py --switch ovs
      or
    sudo ryu/tests/switch/run_mininet.py

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ryu.app.ofctl: Add a proxy application to send OF messages

This application provides functionality similar to ofctl_rest
but via Ryu synchronous events instead of REST API.

This is intended to be used by a feature version of ryu neutron agent.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: a comment

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: constants for NOTIFICATION code/subcode

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: RFC 4486

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>