2193 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
e33f5e4d3a README.rst: Replace a reference to ryu-plugin with ofagent
Ryu-plugin is obsolete and has been removed in the development version
of OpenStack/Networking.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-17 12:20:24 +09:00
YAMAMOTO Takashi
bf58a6dcf3 pip-requires: Add comments to say what's required by what
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-17 12:20:23 +09:00
YAMAMOTO Takashi
e7b5e2c1fd UT: Remove unused imports
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-17 12:20:22 +09:00
YAMAMOTO Takashi
7701b4d792 bgp: Remove an unused import
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-17 12:20:20 +09:00
Mark Lentczner
10dcde272d yet more logging call cleanups
Signed-off-by: Jerry Cen <zhiweic@google.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-17 08:16:59 +09:00
YAMAMOTO Takashi
5d993c46ee ryu.app.ofctl: Handle a race with connection close
Report the failure to the client rather than crashing.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-16 21:39:44 +09:00
FUJITA Tomonori
f10f4f7cfd silence pep8 warnings to the previous commit
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-16 21:30:09 +09:00
Mark Lentczner
b636219007 Reduce logging overhead by cleaning up logging calls
Deferred formatting to the logging system:
---------------------------------------------
In general
    logger.debug('xxx %s yyy %d zzz' % (a, b, c))
can be written as:
    logger.debug('xxx %s yyy %d %zzz', a, b, c)
This is faster, as Python logging doesn't bother doing the format
operation (which is slow) if the log message won't be logged.

We measured that a significant amount of CPU time in the BGP service
was attributable to these formatting operations.

Removed unneeded calls to str() and repr()
------------------------------------------
since formatting operations %s and %r will make these calls when
(and if) the formatting is performed.

Signed-off-by: Jerry Cen <zhiweic@google.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-16 21:11:10 +09:00
FUJITA Tomonori
1dd28e459e Ryu 3.19
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
v3.19
2015-03-02 10:59:35 +09:00
Yusuke Iwase
e922a92979 snortlib: Remove disabled flag MSG_WAITALL
Because Ryu is based on Eventlet, GreenSocket is used by default and
blocking flags is disabled. So MSG_WAITALL flag is not available.

This patch removes MSG_WAITALL flag, and fixes snortlib.py to check
received buffer size in _recv_loop_nw_sock().

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-02 10:47:32 +09:00
YAMAMOTO Takashi
305e41f47b ryu.cfg: Use a dedicated ConfigOpt instance
This might be necessary for future vesions of Neutron OVS agent.

1. The agent parses options, including command line options, using
  oslo.config.cfg.CONF ConfigOpt instance.
2. Depending on options, it might lazily import ryu modules.
3. The ryu modules might have import-time register_cli_opts calls
  against ryu.cfg.CONF.
3. As ryu.cfg.CONF is same as oslo.config.cfg.CONF, oslo.config
  raises an exception, complaining register_cli_opts is used after
  parsing command line options.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-26 20:18:27 +09:00
Yusuke Iwase
7fb83c149f snortlib: Fix nw_sock handling
Currently, snortlib cannot receive reconnect request from Snort client
program (e.g. pigrelay.py).
This patch fixes this problem.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-25 22:57:58 +09:00
Akihiro Suda
afccf3954b of: Prevent __str__() methods from raising exceptions
ofproto_parser.MsgBase.__str__(): avoid "TypeError: %x format: a number is required, not NoneType"
2015-02-25 22:56:56 +09:00
Akihiro Suda
665be6e276 bgp: Prevent __str__() methods from raising exceptions
bgp.BadMsg.__str__(): avoid "AttributeError: 'BadMsg' object has no attribute 'msg'"

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-25 22:56:23 +09:00
Minoru TAKAHASHI
d1ff39ebab packet lib: dhcp: Fix to calculate Hardware address length
Reported-by: Sam Russell <sam.h.russell@gmail.com>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-20 21:15:18 +09:00
FUJITA Tomonori
e330e439b8 travis-ci: use container-based infrastructure for faster testings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-16 13:23:39 +09:00
YAMAMOTO Takashi
72a06f6f60 Move msg_pack_into from ofproto to lib
A motivation of this change is a better modularity.
I.e. Make packet lib independent from ofproto.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-16 13:05:32 +09:00
YAMAMOTO Takashi
bbecb6ca56 tox.ini: Disable pep8 W503 for now
Disable pep8 "W503 line break before binary operator" warning for now.
The check was recently introduced by pep8 1.6.2.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-16 13:05:30 +09:00
ISHIDA Wataru
83c5c15cd3 bgp/bmp: bug fix. remove redundant construction of path attributes
BGPPathAttributeNextHop and BGPPathAttributeMpReachNLRI is already in
new_pathattr. so stop construct and append it to new_pathattr list.

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-15 11:38:58 +09:00
YAMAMOTO Takashi
b04e98faa7 Move the definitions of ether types and inet protocols to lib.packet
A motivation of this change is a better modularity.
I.e. Make packet lib independent from ofproto.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-15 09:39:49 +09:00
Shu Shen
4de8c7425e ofproto: Fix invalid error code OFPQCFC_EPERM -> OFPSCFC_EPERM (EXT-208)
Invalid error code OFPQCFC_EPERM should be OFPSCFC_EPERM instead.
This is EXT-208 that was included in Openflow v1.3.1.

OFPSCFC_EPERM is backported to ofproto_v1_2 so that any new or updated
application could consistently use OFPSCFC_EPERM to handle all protocol
versions.

OFPQCFC_EPERM is left in ofproto_v1_2 and ofproto_v1_3 definitions for
backward compatibility.

Signed-off-by: Shu Shen <shu.shen@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-15 09:07:15 +09:00
Shu Shen
2889711e46 ofproto: Openflow 1.5 support (work-in-progress)
Work done:
- The baseline is copied over from ofproto_v1_4.py and
  ofproto_v1_4_parser.py and into ofproto_v1_5.py and
  ofproto_v1_5_parser.py respectively.
- Most of structs, enums, and pack strings in ofproto_v1_5.py has been
  updated to spec. Exception is oxs_fields has not been done yet.
- ofproto_v1_5_parser.py has not been updated except those necessary to
  allow run_tests.sh to complete successfully
- ofproto_protocol.py imports ofproto_v1_5 and ofproto_v1_5_parser now
- oxm_fields.py is updated for OFPXMC_PACKET_REGS
- Tests are updated to include Openflow v1.5 when it's obvious. But not
  much work has been done to acutally test v1.5 yet. I also found tests
  for v1.4 are scarce.

TODO:
- Add oxs_fields support. It shall be similar to oxm_fields
- Update and implement ofproto_v1_5_parser.py
- More tests, tests, tests.

Signed-off-by: Shu Shen <shu.shen@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-15 09:06:20 +09:00
FUJITA Tomonori
45e37843b9 ignore some pep8 errors for now
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 12:31:56 +09:00
YAMAMOTO Takashi
b3084c0e45 test_oxm: Add tests for EXT-109 and EXT-233
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:17:40 +09:00
YAMAMOTO Takashi
aef9838a8f ofproto_v1_3: Implement EXT-109 and EXT-233
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:17:40 +09:00
YAMAMOTO Takashi
c938f094f4 oxm_fields: Rename ONFExperimenter to OldONFExperimenter
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:17:40 +09:00
YAMAMOTO Takashi
ee0c84be6a oxm_fields: Update comment for the new version of EXT-256
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:17:40 +09:00
Toshiki Tsuboi
ef0c72c5bf bgp: support of new api for "show neighbor"
You can understand adj-RIB-in information through new api.
 - received-routes : paths received and not withdrawn by given peer
 - sent-routes : paths sent and not withdrawn to given peer

(sample log of show neighbor)
INFO:bgpspeaker.api.base:API method operator.show called with args: {'params': ['neighbor', 'received-routes', '192.168.101.101', 'all'], 'format': 'cli'}
Status codes: x filtered
Origin codes: i - IGP, e - EGP, ? - incomplete
    Timestamp           Network                          Labels   Next Hop             Metric LocPrf Path
    2015/02/06 06:52:04 192.168.1.0/30                   None     192.168.101.101      100    None   [65010] i
    2015/02/06 06:52:04 192.168.2.0/30                   None     192.168.101.101      100    None   [65010] i
    2015/02/06 06:52:04 0.0.0.0/0                        None     192.168.101.101      100    None   [65010, 65001] i

Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:16:57 +09:00
Alan Quillin
973d43f6fb bgp: Fixed error in bgp implementation with single peer
When a single peer is specified for BGPSpeaker the server value was not
being set upon return.

Signed-off-by: Alan Quillin <alanquillin@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:16:41 +09:00
Toshiki Tsuboi
79774a3fe9 bgp: fix bug of Path formatting in "show neighbor"
The field of "Path" has not displayed in properly as bellow.
It looks the raw data of Origin code has displayed instead.

bgpd> show neighbor received-routes 192.168.101.101 all
Status codes: x filtered
Origin codes: i - IGP, e - EGP, ? - incomplete
    Timestamp           Network                          Labels   Next Hop             Metric LocPrf Path
    2015/02/05 07:39:05 192.168.1.0/30                   None     192.168.101.101      100    None   [65010] 2
    2015/02/05 07:39:05 192.168.2.0/30                   None     192.168.101.101      100    None   [65010] 2
    2015/02/05 07:39:05 0.0.0.0/0                        None     192.168.101.101      100    None   [65010, 65001] 2

Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08 10:15:17 +09:00
FUJITA Tomonori
b4c488f807 Ryu 3.18
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
v3.18
2015-02-03 15:05:47 +09:00
Toshiki Tsuboi
32a57971b3 bgp: bug fix of sending Adj-RIB-Out
Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-01 20:57:31 +09:00
Satoshi Kobayashi
00bc1592e1 ryu-manager: add --enable-debugger option
Eventlet's monkey patch overwrite Python standard threading library by default. It affects to Python debugger working. This will be often an issue for the user of Python debugger. Therefore, it's necessary to add the option which doesn't overwrite Python standard threading library.

Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-30 08:00:53 +09:00
ISHIDA Wataru
578327edc9 bgp/cli: fix internel data destruction due to cli show command
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
ISHIDA Wataru
611ffbe5a6 bgp: remove unnecessary bgp update construction
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
ISHIDA Wataru
e3e07209e3 bgp: fix bug of NameError: global name 'sent_route' is not defined
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
ISHIDA Wataru
66da38e3c1 bmpstation: bug fix. stop closing fds which are in use.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
ISHIDA Wataru
b86ab0904e bgp: don't hold withdrawn routes in adj_rib_in
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
ISHIDA Wataru
34465b3ac1 bgp/bmp: send unmodified BGPUpdate to bmp server.
Current implementation of bmp client uses Peer._construct_update()
which modifies original BGPUpdate message for sending to peers.
This function is not appropriate to use for bmp client, because
bmp client must send a BGPUpdate message which contains unmodified path
attributes. Fix this by introducing BMPClient._construct_update().

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26 01:37:17 +09:00
Che-Wei Lin
3736b0c37d Add parsing libpcap and reading/writing PCAP file
Add parsing libpcap and reading/writing PCAP file for debugging.
Now you can easily dump the PCAP file in ryu controller.

Here is the quick example for dumping the data packets:

    from ryu.lib import pcaplib

    class SimpleSwitch13(app_manager.RyuApp):
        OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

        def __init__(self, *args, **kwargs):
            super(SimpleSwitch13, self).__init__(*args, **kwargs)
            self.mac_to_port = {}

            # Creating an instance with a PCAP filename
            self.pcap_pen = Writer(open('mypcap.pcap', 'wb'))

        @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
        def _packet_in_handler(self, ev):
            msg = ev.msg

            # Dump the data packet into PCAP file
            self.pcap_pen.write_pkt(msg.data)

Signed-off-by: Che-Wei Lin <linton.tw@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:51:22 +09:00
YAMAMOTO Takashi
a34eda1fe1 nx_actions: Avoid confusing StringifyMixin
Having class attributes and instance attributes of the same name
confuses StringifyMixin.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
306a500ee6 nx_actions: Implement nx_action_learn
This is planned to be used for upcoming Neutron OVS agent changes.
(https://blueprints.launchpad.net/neutron/+spec/ovs-ofctl-to-python)

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
181d2fa3a2 test_nx_flow_spec: Add UTs for NX flow_mod_spec
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
1d2a30dc57 nx_actions: Implement NX flow_mod_spec
Will be used for NX learn implementation.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
4d06beda4f type_desc: Separate type conversion classes from oxm_fields
Will be used for NX learn implementation.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
820a7cf75c nx_actions: Remove redundant initializations
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-25 21:50:37 +09:00
YAMAMOTO Takashi
cbb387f8eb Implement nx_action_reg_move for OpenFlow 1.3
Also, improve experimenter action related code so that
it can handle unknown actions as unknown.

Only OpenFlow 1.3 for now because this is planned to be used
for Neutron OVS agent and 1.3 is the version to be used there.
(https://blueprints.launchpad.net/neutron/+spec/ovs-ofctl-to-python)

Following the style of oxm_fields, make an OpenFlow version independent
module generate OpenFlow version specific code so that it's easier to
add the functionality to other OpenFlow versions later.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-20 13:12:48 +09:00
Yusuke Iwase
1a03f4c650 doc/app/ofctl_rest: Add description for OFPAggregateStats message
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
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
310e20ee0b doc/app/ofctl_rest: Add description for OFPQueueStats message
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