packet lib: For convenience, make packet into a sequence type

Protocols can mow be accesed as packet[n].

Signed-off-by: Shaun Crampton <Shaun.Crampton@metaswitch.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: allow packet type to be specified when parsing packet

Signed-off-by: Shaun Crampton <Shaun.Crampton@metaswitch.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add config file for Travis

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
fix travis config file

force to use virtual env.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: fix OFPSetConfig default arguments

If you use initialize like the following way:

OFPSetConfig(dp, miss_send_len=1600)

You get the following assertion when it's serialized:

File "/Users/fujita/git/ryu/ryu/ofproto/ofproto_v1_2_parser.py", line 244, in _serialize_body
  assert self.flags is not None

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: icmp support time exceeded type

Used mainly for traceroute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: ipv4 default args

Make ipv4 more handy by not asking for every args. I prefer to use
more human-readble representation for src and dst but it leads to the
API change so let's do it later with another patch.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: mpls default args

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: vlan default args

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: arp default args

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: packet class accepts protocols list argument

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: add Packet.__contains__

you can do something like:
  if arp.arp in Packet(msg.data):

  a = arp.arp(...)
  if a in Packet(msg.data):

  >>> from ryu.lib.packet import packet
  >>> from ryu.lib.packet import arp
  >>> a = arp.arp_ip(1, 0, 0, 0, 0)
  >>> p = packet.Packet()
  >>> p.protocols = [a]
  >>> arp.arp in p
  True
  >>> a in p
  True

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet lib: packet class supports get_protocol method

returns a list of protocols that matches to the specified protocol.

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.3: Fix parsing of OFP_QUEUE_GET_CONFIG_REPLY

Make parsing similar to that of OpenFlow 1.2 (message has the same format as in 1.3)

Signed-off-by: Oren Spector <oren@oliver-solutions.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
lib/packet: teach packet library to truncate padding octet

The patch teaches packet library to truncate padding octets.
The protocol class that knows its payload length should set its payload
length as payload_length > 0 attributes.
Then, the packet.parser truncates its payload.
If payload_length = 0, do nothing.

Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Cc: Shaun Crampton <Shaun.Crampton@metaswitch.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Changes v1 -> v2:
- typo in ipv4
- s/payload_length_/payload_length/g