of1.2: add missing struct ofp_bucket definition

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
test: add more of1.2 unittests

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: make pack_str class variable

So the parser classmethod can use it too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: add common field_parser for MT* classes

Most of MT* classes can use this helper classmethod.

We get value and mask values but don't set them to an instance. It's
done later.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: remove unused parser method in MT* classes

Some MT* classes need the own parser though.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: set value and mask in MT* instance

Set value and mask that the parser gets.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: make MT* class make method take value and mask

- MT* class serialize method doesn't need match argument so we can use
  MT* class for set_field action nicely.

- we can create the common serialize method for most of MT* classes

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: add the common serialize method for MT* classes

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: remove match argument in MT* class serialize method

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

Parse and serialize OXM TLV.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: fix OFAActionCopyTtlOut and OFPActionCopyTtlIn's parsers

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: fix OFPBucket parser and serialize methods

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: Correct pad calculation for OFPMatch

In the case where the match length is a multiple of 8 the pad should be 0.
Previously a pad of 8 was used.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: fix OFPActionSetField

Fix some alignment bugs.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: change IPv6 address representation

8H is more fitter than 4I for IPV6 address string representation.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
app/rest: fix value error exception

This patch fixes value error exception.
The datapath-id is given in hex.

> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 438,
>   in handle_one_response
>     self.run_application()
>   File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 424,
>   in run_application
>     self.result = self.application(self.environ, self.start_response)
>   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
>   130, in __call__
>     resp = self.call_func(req, *args, **self.kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
>   195, in call_func
>     return self.func(req, *args, **kwargs)
>   File "/opt/stack/ryu/ryu/app/wsgi.py", line 81, in __call__
>     return controller(req)
>   File "/opt/stack/ryu/ryu/app/wsgi.py", line 52, in __call__
>     return getattr(self, action)(req, **kwargs)
>   File "/opt/stack/ryu/ryu/app/rest.py", line 104, in create
>     self.nw.create_port(network_id, int(dpid), int(port_id))
> ValueError: invalid literal for int() with base 10: '0000666a9c296241'

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of1.2: fix vlan_vid match

Fix the following error:

  File "/Users/fujita/git/ryu/ryu/ofproto/ofproto_v1_2_parser.py",
  line 1501, in serialize
    self.append_field(header, self.flow.vlan_vid, self.vlan_vid_mask)
AttributeError: 'OFPMatch' object has no attribute 'vlan_vid_mask'

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

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

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

AttributeError: 'MTIPv6NdTarget' object has no attribute 'mask

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