oxm_fields: generate OFPXMT_OFB_ and OXM_OF_ from a single source

also, implement text <-> binary convertions for field values.  this will
be used for later ofproto api refinement.  (and probably stringify stuff)

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
oxm_fields: accept [value, mask] as well as (value, mask)

this will be used for OFPMatch from_jsondict implementation.
as json has no notion of tuples, we will use a list instead.

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

a new api to compose matches.  it looks like:

    match = OFPMatch(in_port=1,
                     eth_type=0x86dd,
                     ipv6_src=('2001:db8:bd05:1d2:288a:1fc0:1:10ee',
                               'ffff:ffff:ffff:ffff::'),
                     ipv6_dst = '2001:db8:bd05:1d2:288a:1fc0:1:10ee')

the old match.set_foo and match.append_field methods are kept for now
but will be removed later.

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

add a new match field parser which fills OFPMatch attributes used
by the new api.

the old parser which fills match.fields is kept for now but will be
removed later.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: new OFPMatch field query api

an example:

    if 'ipv6_src' in match:
        print match['ipv6_src']

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: add OFPMatch.iteritems for convenience

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: add OFPMatch.get for convenience

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: OFPMatch from_json/to_json for new api

this breaks from_json/to_json for old api

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

make old query api work on OFPMatch instances created with from_jsondict.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12 OFPMatchField: make this safe to serialize multiple times

this will be used by OFPMatch old api compat code.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: make OFPMatch.to_jsondict work on instances composed with old api

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12: OFPMatch more old api compat

enough to pass test_parser_v12.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of12 OFPMatch: remove now unused code

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

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

a new api to compose matches.  it looks like:

    match = OFPMatch(in_port=1,
                     eth_type=0x86dd,
                     ipv6_src=('2001:db8:bd05:1d2:288a:1fc0:1:10ee',
                               'ffff:ffff:ffff:ffff::'),
                     ipv6_dst = '2001:db8:bd05:1d2:288a:1fc0:1:10ee')

the old match.set_foo and match.append_field methods are kept for now
but will be removed later.

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

add a new match field parser which fills OFPMatch attributes used
by the new api.

the old parser which fills match.fields is kept for now but will be
removed later.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of13: new OFPMatch field query api

an example:

    if 'ipv6_src' in match:
        print match['ipv6_src']

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of13: add OFPMatch.iteritems for convenience

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of13: add OFPMatch.get for convenience

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
of13: OFPMatch from_json/to_json for new api

this breaks from_json/to_json for old api

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