[Ryu-devel] [PATCH 00/26] OFPMatch api changes
Brought to you by:
nz_gizmoguy
From: YAMAMOTO T. <yam...@va...> - 2013-07-23 07:03:54
|
this set adds a new set of OFPMatch compose/query api for OF1.2/1.3 as proposed on ryu-devel while ago. this is after "addrconv" patches i posted today. the old api is still available but it's supposed to be removed later. i have a plan to apply similar changes for OFPActionSetField as well. a usage example: https://github.com/yamt/LINC-Switch/commit/5ec3d893308469f9cc80b5696a1eefcfcc94191d there are a few examples. old api (compose): o = parser.OFPMatch() o.set_in_port(1) ipv6 = '2001:db8:bd05:1d2:288a:1fc0:1:10ee' mask = 'ffff:ffff:ffff:ffff:0:0:0:0' ipv6 = [int(x, 16) for x in ipv6.split(":")] mask = [int(x, 16) for x in mask.split(":")] o.set_dl_type(0x86dd) o.set_ipv6_src_masked(ipv6, mask) o.set_ipv6_dst(ipv6) new api (compose): o = parser.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') old api (query): for f in in match.fields: if f.header == ofproto.OXM_OF_IPV6_SRC: print f.value # [0x2001, 0xdb8, ...] new api (query): if 'ipv6_src' in match: print match['ipv6_src'] # '2001:db8:...' YAMAMOTO Takashi (26): oxm_fields: generate OFPXMT_OFB_ and OXM_OF_ from a single source oxm_fields: accept [value, mask] as well as (value, mask) of12: new OFPMatch composer api of12: new match field parser of12: new OFPMatch field query api of12: add OFPMatch.iteritems for convenience of12: add OFPMatch.get for convenience of12: OFPMatch from_json/to_json for new api of12: OFPMatch api compat of12 OFPMatchField: make this safe to serialize multiple times of12: make OFPMatch.to_jsondict work on instances composed with old api of12: OFPMatch more old api compat of12 OFPMatch: remove now unused code test_parser: update of12 expected results of13: new OFPMatch composer api of13: new match field parser of13: new OFPMatch field query api of13: add OFPMatch.iteritems for convenience of13: add OFPMatch.get for convenience of13: OFPMatch from_json/to_json for new api of13: OFPMatch api compat of13 OFPMatchField: make this safe to serialize multiple times of13: make OFPMatch.to_jsondict work on instances composed with old api of13: more OFPMatch old api compat of13 OFPMatch: remove now unused code test_parser: update of13 expected results ryu/ofproto/ofproto_v1_2.py | 130 +++++---------- ryu/ofproto/ofproto_v1_2_parser.py | 169 ++++++++++++++++---- ryu/ofproto/ofproto_v1_3.py | 144 ++++++----------- ryu/ofproto/ofproto_v1_3_parser.py | 169 ++++++++++++++++---- ryu/ofproto/oxm_fields.py | 175 +++++++++++++++++++++ .../of12/3-11-ofp_flow_stats_request.packet.json | 8 +- .../of12/3-12-ofp_flow_stats_reply.packet.json | 50 ++---- .../ofproto/json/of12/3-2-ofp_flow_mod.packet.json | 14 +- .../3-25-ofp_aggregate_stats_request.packet.json | 6 +- .../ofproto/json/of12/3-3-ofp_flow_mod.packet.json | 20 +-- .../json/of12/3-4-ofp_packet_in.packet.json | 59 ++----- .../json/of12/3-40-ofp_flow_removed.packet.json | 9 +- .../of13/4-11-ofp_flow_stats_request.packet.json | 6 +- .../of13/4-12-ofp_flow_stats_reply.packet.json | 58 ++----- .../ofproto/json/of13/4-2-ofp_flow_mod.packet.json | 14 +- .../4-25-ofp_aggregate_stats_request.packet.json | 6 +- .../ofproto/json/of13/4-3-ofp_flow_mod.packet.json | 20 +-- .../json/of13/4-4-ofp_packet_in.packet.json | 61 ++----- .../json/of13/4-40-ofp_flow_removed.packet.json | 9 +- .../json/of13/4-46-ofp_flow_mod.packet.json | 14 +- 20 files changed, 629 insertions(+), 512 deletions(-) create mode 100644 ryu/ofproto/oxm_fields.py -- 1.8.1.5 |