of14: add some assertions

This is in keeping with
e08ac471d44db846 ("ofproto_v1_3_parser: put some assertions").

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: set default attributes for OFPMultipartRequest subclasses

This is in keeping with 1368fd6899722a9c ("of13: set default attributes for
OFPMultipartRequest subclasses").

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Fix OFPInstructionWriteMetadata JSON decode

This is in line with 4a394aae2f1a3b82
("Fix OFPInstructionWriteMetadata JSON decode") which fixes
the following for OF1.3:

CLS <class 'ryu.ofproto.ofproto_v1_3_parser.OFPInstructionWriteMetadata'>
ARG {u'metadata_mask': 18446744073709551615L, u'type': 2, u'len': 24, u'metadata': 18446744069414584320L}
KWARG {u'type_': 2, u'metadata_mask': 18446744073709551615L, u'len_': 24, u'metadata': 18446744069414584320L}
Traceback (most recent call last):
  File "a.py", line 19, in <module>
    msg = ofproto_parser.ofp_msg_from_jsondict(dp, m)
  File "/Users/fujita/git/ryu/ryu/ofproto/ofproto_parser.py", line 100, in ofp_msg_from_jsondict
    return cls.from_jsondict(v, datapath=dp)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 291, in from_jsondict
    kwargs = cls._restore_args(_mapdict_kv(decode, dict_))
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 46, in <lambda>
    _mapdict_kv = lambda f, d: dict([(k, f(k, v)) for k, v in d.items()])
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 290, in <lambda>
    decode = lambda k, x: cls._decode_value(k, x, decode_string)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 234, in _decode_value
    return cls._get_decoder(k, decode_string)(json_value)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 242, in _decode
    v = map(_decode, json_value)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 245, in _decode
    v = cls.obj_from_jsondict(json_value)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 223, in obj_from_jsondict
    return obj_cls.from_jsondict(v)
  File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 293, in from_jsondict
    return cls(**dict(kwargs, **additional_args))
TypeError: __init__() got an unexpected keyword argument 'type_'

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add _ordered_fields to .4 OFPMatch

This appears to be necessary for wire tests
to pass if matches are in an order different
from that defined by Ryu.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add table features stats request and reply message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Move OFPMeterBand* to above OFPMeterConfigStats

This is a purely cosmetic change to move some code to
the same location it is found in the of1.3 implementation,
aiding comparison between the two codebases. It also
move the code closer to where it is used.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add OFPMeterBandDscpRemark and OFPMeterBandExperimenter

These will be used my meter mod message support which
is added by a subsequent patch.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add meter mod message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add port status message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Rename OFPPortDescPropUnknown as OFPPortPropUnknown

This corrects what appears to be a typo as
OFPPortDescPropUnknown is never called but
OFPPortPropUnknown, which does not exist, is called.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add generic OFPropBase class

Add generic OFPropBase class and make OFPPortProp a subclass of it.
This is to allow other properties classes to be implemented as subclasses
of OFPPropBase, simplifying their implementation.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add port stats request and reply message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add queue stats request and reply message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add port mod message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of14: Add to ofproto unit tests

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofproto_v1_0_parser: import ofproto_v1_0 as 'ofproto'

as proposed while ago, import ofproto_v1_0 with a version agnostic name
to reduce differences between parser modules.

the name 'ofproto' was chosen to match with ofproto_v1_4_parser.

update tests accordingly.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofproto_v1_2_parser: import ofproto_v1_2 as 'ofproto'

as proposed while ago, import ofproto_v1_2 with a version agnostic name
to reduce differences between parser modules.

the name 'ofproto' was chosen to match with ofproto_v1_4_parser.

update tests accordingly.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofproto_v1_3_parser: import ofproto_v1_3 as 'ofproto'

as proposed while ago, import ofproto_v1_3 with a version agnostic name
to reduce differences between parser modules.

the name 'ofproto' was chosen to match with ofproto_v1_4_parser.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ofproto_protocol: provide a class to describe an openflow version

currently OFP classes takes the Datapath object, which is too complex
for this purpose.  this class, ProtocolDesc, is intended to be
a simpler replacement for that.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Reviewed-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
controller: use ProtocolDesc

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