summaryrefslogtreecommitdiffhomepage
path: root/doc/source
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2014-03-13 15:05:43 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-03-16 20:37:46 +0900
commiteb07d4bf81a72a42b7f9e4aea0356f8ba8023f38 (patch)
treebbeefefdc4369e0dfbfac503af67fe35e88717f9 /doc/source
parent13ec0df56d2f0c5889731b47005e8d22f0a75623 (diff)
library_packet.rst: fix an example code
Reported by Sebastian Gebhard on ryu-devel@. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/library_packet.rst14
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/source/library_packet.rst b/doc/source/library_packet.rst
index b4a5d919..a24b937f 100644
--- a/doc/source/library_packet.rst
+++ b/doc/source/library_packet.rst
@@ -85,12 +85,18 @@ serialize method. You have the raw data to send. The following example
is building an arp packet.
.. code-block:: python
-
- e = ethernet.ethernet(dst, src, ether.ETH_TYPE_8021Q)
+
+ from ryu.ofproto import ether
+ from ryu.lib.packet import ethernet, arp, packet
+
+ e = ethernet.ethernet(dst='ff:ff:ff:ff:ff:ff',
+ src='08:60:6e:7f:74:e7',
+ ethertype=ether.ETH_TYPE_ARP)
a = arp.arp(hwtype=1, proto=0x0800, hlen=6, plen=4, opcode=2,
- src='08:60:6e:7f:74:e7', src_ip='192.0.2.1',
- dst='00:00:00:00:00:00', dst_ip='192.0.2.2')
+ src_mac='08:60:6e:7f:74:e7', src_ip='192.0.2.1',
+ dst_mac='00:00:00:00:00:00', dst_ip='192.0.2.2')
p = packet.Packet()
p.add_protocol(e)
p.add_protocol(a)
p.serialize()
+ print repr(p.data) # the on-wire packet