summaryrefslogtreecommitdiffhomepage
path: root/ryu/lib
AgeCommit message (Collapse)Author
2015-06-26python3: Convert str to six.binary_type where appropriateIWAMOTO Toshihiro
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-26python3: Use six.binary_type instead of str for binary datafumihiko kakuma
Signed-off-by: Fumihiko Kakuma <kakuma@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-25python3: Avoid applying ord() to integersIWAMOTO Toshihiro
In python3, b'abc'[0] isn't a string but a int value and ord() should not be used. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-25python3: Use b'str' for binary literalsIWAMOTO Toshihiro
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-25python3: Remove use of buffer()IWAMOTO Toshihiro
python3 doesn't have buffer(). They are mostly needed by the fact that python2.6's unpack doesn't take bytearray. Replace them with six.binary_type or remove them where not needed. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-25python3: Use six.text_type instead of unicodefumihiko kakuma
This is the partial patch to supporting python 3. unicode was removed in python 3. So we use six.text_type instead of unicode. Signed-off-by: Fumihiko Kakuma <kakuma@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-23eventlet has already supported WebSocket(RFC6455) in stable releases (>= 0.15)FUJITA Tomonori
Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-23python3: Use integer division where appropriateIWAMOTO Toshihiro
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-20python3: Use bytes type for binary dataIWAMOTO Toshihiro
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-20python3: Adapt to new iterator namesIWAMOTO Toshihiro
This patch is generated by "2to3 -f dict" and irrevant parts were hand-removed. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-18oxs_fields: Add OXS class supportYusuke Iwase
This patch adds OXS class parser for Extensible Flow Entry Statistics in OpenFlow Spec 1.5. And this implementation introduces oxx_fields.py to share the logic functions with oxm_fields.py. note: This pacth has no implementation for specific OXS Experimenter classes as oxm_fields.py has. (eg. ONF Experimenter, Nicira Experimenter) Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-14ofctl_v1_0: fix output of get_flow_statsMinoru TAKAHASHI
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-05-27Add missing ryu.contrib.update_module_path callsYAMAMOTO Takashi
Found by investigating readthedocs logs. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-05-19_NXFlowSpec: Add type annotation for stringify stuffYAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-22disable padding check for llc packetsRom
the llc padding check causes an exception when android or iOS devices are used (dhcp). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-18ryu.contrib: Be explicit about sys.path modificationYAMAMOTO Takashi
Avoid the automatic modification of sys.path because it hurts ryu-as-a-library use cases. An example is the recent versions of neutron OVS-agent, which optionally imports OVS python bindings, and ends up to use a wrong copy in ryu.contrib.ovs. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-17Integers between '/' operation become float in Python 3Satoshi Kobayashi
Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-17'map' returns iterator like object with Python 3Satoshi Kobayashi
Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-17'reduce' has been renamed to 'functools.reduce' in Python 3Satoshi Kobayashi
Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-14'itertools.izip()' has been deprecated in Python 3Satoshi Kobayashi
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-14'__div__' is renamed to '__truediv__' in Python 3Satoshi Kobayashi
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-14Fix ImportError(s) with Python3Satoshi Kobayashi
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-14Use range() instead of xrange()Satoshi Kobayashi
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-14'+' operator can't combine no-string objectSatoshi Kobayashi
I don't know what it is not a really a string but use '%' for safety. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-08Syntax level compatibility with Python 3Satoshi Kobayashi
We use syntaxes which can be used only in Python2 at many locations. But we should reduce the use of the syntaxes. This patch serves syntax level compatibility with Python3. However, for full compatibility is required still a lot of work because many API changes are made between 2 to 3. Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-04-03ofctl_v1_[23]: Ignore unkown match fieldsYusuke Iwase
Currently, ofctl_v1_[23].py adds non-existing match fields when getting unknown match fields, then parser returns KeyError. This patch fixes ofctl_v1_[23].py to ignore unkown match fields and output error messages. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-22lib.ovs.vsctl: Fix a crashYAMAMOTO Takashi
Fix some typos in the code. This fixes a crash reported on ryu-devel@. http://sourceforge.net/p/ryu/mailman/message/33607025/ Reported-by: Jason Syu <newdongfong@gmail.com> Tested-by: Jason Syu <newdongfong@gmail.com> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-18ofctl_rest: Reduce pylint warningsYusuke Iwase
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-18ofctl_v1_3: Support masked ipv6_exthdr match fieldYusuke Iwase
In OpenFlow Spec 1.3.4, ipv6_exthdr is maskable match field, but ofctl_v1_3 does not support mask. This patch makes ofctl_v1_3 enable to set masked ipv6_exthdr. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-16Reduce logging overhead by cleaning up logging callsMark Lentczner
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-02snortlib: Remove disabled flag MSG_WAITALLYusuke Iwase
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-02-25snortlib: Fix nw_sock handlingYusuke Iwase
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-25bgp: Prevent __str__() methods from raising exceptionsAkihiro Suda
bgp.BadMsg.__str__(): avoid "AttributeError: 'BadMsg' object has no attribute 'msg'" Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-20packet lib: dhcp: Fix to calculate Hardware address lengthMinoru TAKAHASHI
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-16Move msg_pack_into from ofproto to libYAMAMOTO Takashi
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-15Move the definitions of ether types and inet protocols to lib.packetYAMAMOTO Takashi
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-01-25Add parsing libpcap and reading/writing PCAP fileChe-Wei Lin
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-25type_desc: Separate type conversion classes from oxm_fieldsYAMAMOTO Takashi
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-20ofctl_rest: support OFPAggregateStats messageYusuke Iwase
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-20ofctl_rest: support OFPQueueStats messageYusuke Iwase
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-19Cleanup isinstance(foo, (int, long))YAMAMOTO Takashi
Use numbers where appropriate. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-13ospf: fix wrong OSPF LSA typeISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-13ofctl_v1_0/2/3: Fix unsuitable log levelMinoru TAKAHASHI
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-31ospf: add SummaryLSA classISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-28ofctl_v1_2, 3: Fix regression of IP arbitrary bitmask supportFUJITA Tomonori
Reported-by: Wei-Li Tang <alextwl@xinguard.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: Wei-Li Tang <alextwl@xinguard.com>
2014-12-05ofctl_v1_3: Fix to parse capabilities field in OPFMeterFeaturesYusuke Iwase
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-11-30packet lib: don't crash with bogus ospf packetFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-11-29ofctl_v1_2/3: Fully support the match combinations for VLAN IDMinoru TAKAHASHI
Currently, when VLAN ID match field is specified, ofctl_v1_[23] is compatible with only match combination 1) of the following three match combinations. This patch makes it possible to set the all three combinations. Match combinations for VLAN ID : 1) To match only packets with VLAN tag and VID equal value 2) To match only packets without a VLAN tag 3) To match only packets with a VLAN tag regardless of its value In order to set the match combinations 2) or 3), please describe "dl_vlan" field as hexadecimal string value like as follows. Before applying this patch: {"dl_vlan": 3 } # int After applying this patch: {"dl_vlan": 3 } # int (same as before applying) {"dl_vlan": "0x0000"} # hexadecimal string without mask {"dl_vlan": "0x1000/0x1000"} # hexadecimal string with mask NOTE: When "dl_vlan" field is described as decimal int value, OFPVID_PRESENT(0x1000) bit is automatically applied. OTOH, OFPVID_PRESENT(0x1000) bit is NOT automatically applied to hexadecimal string value. For curl command examples, please refer to the following page in Ryu-documentation. http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#example-of-vlan-id-match-field Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-11-25ofctl_v1_/2/3: Modify to_match() to use new match apiYusuke Iwase
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-11-25ofctl_v1_/2/3: Modify match_to_str() to use new match field parserYusuke Iwase
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>