blob: f18248e92c391ac682477c7f64fe723833ad8b75 [file] [log] [blame]
Rich Lane64585d92013-10-02 16:01:37 -07001# Copyright 2013, Big Switch Networks, Inc.
2#
3# LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
4# the following special exception:
5#
6# LOXI Exception
7#
8# As a special exception to the terms of the EPL, you may distribute libraries
9# generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
10# that copyright and licensing notices generated by LoxiGen are not altered or removed
11# from the LoxiGen Libraries and the notice provided below is (i) included in
12# the LoxiGen Libraries, if distributed in source code form and (ii) included in any
13# documentation for the LoxiGen Libraries, if distributed in binary form.
14#
15# Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
16#
17# You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
18# a copy of the EPL at:
19#
20# http://www.eclipse.org/legal/epl-v10.html
21#
22# Unless required by applicable law or agreed to in writing, software
23# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
25# EPL for the specific language governing permissions and limitations
26# under the EPL.
27
28# Map from LOXI types to Wireshark types
29oftype_to_wireshark_type = {
Rich Lane4df40f32013-10-08 15:40:39 -070030 "char": "int8",
31 "uint8_t": "uint8",
32 "uint16_t": "uint16",
33 "uint32_t": "uint32",
34 "uint64_t": "uint64",
35 "of_mac_addr_t": "ether",
36 "of_ipv4_t": "ipv4",
37 "of_ipv6_t": "ipv6",
38 "of_port_name_t": "stringz",
39 "of_table_name_t": "stringz",
40 "of_desc_str_t": "stringz",
41 "of_serial_num_t": "stringz",
Rich Lanef8a3d002014-03-19 13:33:52 -070042 "of_str64_t": "stringz",
Brian O'Connor58a73e32015-05-28 11:51:27 -070043 "of_str32_t": "stringz",
44 "of_str6_t": "stringz",
Rich Lane4df40f32013-10-08 15:40:39 -070045 "of_octets_t": "bytes",
46 "of_port_no_t": "uint32",
47 "of_port_desc_t": "stringz",
Murat Parlakisik34863382016-12-05 00:53:17 -080048 "of_table_desc_t": "stringz",
Rich Lane4df40f32013-10-08 15:40:39 -070049 "of_bsn_vport_t": "bytes",
50 "of_bsn_vport_q_in_q_t": "bytes",
51 "of_fm_cmd_t": "uint16",
52 "of_wc_bmap_t": "uint64",
53 "of_match_bmap_t": "uint64",
54 "of_match_t": "bytes",
Murat Parlakisik34863382016-12-05 00:53:17 -080055 "of_stat_t": "bytes",
Rich Lane4df40f32013-10-08 15:40:39 -070056 "of_oxm_t": "bytes",
Murat Parlakisik34863382016-12-05 00:53:17 -080057 "of_oxs_t": "bytes",
Rich Lane4df40f32013-10-08 15:40:39 -070058 "of_meter_features_t": "bytes",
Rich Lane9d25b082013-10-08 15:53:33 -070059 "of_bitmap_128_t": "bytes",
Brian O'Connor81fca3a2015-12-15 00:04:22 -080060 "of_bitmap_512_t": "bytes",
61 "of_checksum_128_t": "bytes",
Murat Parlakisik34863382016-12-05 00:53:17 -080062 "of_controller_uri_t":"stringz",
Rich Lane64585d92013-10-02 16:01:37 -070063}
64
65# Map from LOXI type to Wireshark base
66oftype_to_base = {
67 "char": "DEC",
68 "uint8_t": "DEC",
69 "uint16_t": "DEC",
70 "uint32_t": "DEC",
71 "uint64_t": "DEC",
72 "of_mac_addr_t": "NONE",
73 "of_ipv4_t": "NONE",
74 "of_ipv6_t": "NONE",
75 "of_port_name_t": "NONE",
76 "of_table_name_t": "NONE",
77 "of_desc_str_t": "NONE",
78 "of_serial_num_t": "NONE",
Rich Lanef8a3d002014-03-19 13:33:52 -070079 "of_str64_t": "NONE",
Brian O'Connor58a73e32015-05-28 11:51:27 -070080 "of_str32_t": "NONE",
81 "of_str6_t": "NONE",
Rich Lane64585d92013-10-02 16:01:37 -070082 "of_octets_t": "NONE",
83 "of_port_no_t": "DEC",
84 "of_port_desc_t": "NONE",
85 "of_bsn_vport_t": "NONE",
86 "of_bsn_vport_q_in_q_t": "NONE",
87 "of_fm_cmd_t": "DEC",
88 "of_wc_bmap_t": "HEX",
89 "of_match_bmap_t": "HEX",
90 "of_match_t": "NONE",
Murat Parlakisik34863382016-12-05 00:53:17 -080091 "of_stat_t":"NONE",
Rich Lane64585d92013-10-02 16:01:37 -070092 "of_oxm_t": "NONE",
Murat Parlakisik34863382016-12-05 00:53:17 -080093 "of_oxs_t" : "NONE",
Rich Lane64585d92013-10-02 16:01:37 -070094 "of_meter_features_t": "NONE",
Rich Lane9d25b082013-10-08 15:53:33 -070095 "of_bitmap_128_t": "NONE",
Brian O'Connor81fca3a2015-12-15 00:04:22 -080096 "of_bitmap_512_t": "NONE",
97 "of_checksum_128_t": "NONE",
Rich Lane64585d92013-10-02 16:01:37 -070098}
99
Rich Lane52452662013-10-25 13:34:42 -0700100# Use enums for certain fields where it isn't specified in the LOXI input
101class_field_to_enum = {
102 ('of_flow_mod', 'type'): 'ofp_type',
103 ('of_error_msg', 'type'): 'ofp_type',
104 ('of_stats_request', 'type'): 'ofp_type',
105 ('of_stats_request', 'stats_type'): 'ofp_stats_type',
106 ('of_stats_request', 'flags'): 'ofp_stats_request_flags',
107 ('of_stats_reply', 'type'): 'ofp_type',
108 ('of_stats_reply', 'stats_type'): 'ofp_stats_type',
109 ('of_stats_reply', 'flags'): 'ofp_stats_reply_flags',
110 ('of_flow_mod', 'table_id'): 'ofp_table',
111 ('of_flow_mod', '_command'): 'ofp_flow_mod_command',
112 ('of_flow_mod', 'out_port'): 'ofp_port',
113 ('of_flow_mod', 'out_group'): 'ofp_group',
114 ('of_error_msg', 'err_type'): 'ofp_error_type',
115 ('of_port_mod', 'type'): 'ofp_type',
116 ('of_hello', 'type'): 'ofp_type',
117 ('of_features_request', 'type'): 'ofp_type',
118 ('of_features_reply', 'type'): 'ofp_type',
119 ('of_barrier_request', 'type'): 'ofp_type',
120 ('of_barrier_reply', 'type'): 'ofp_type',
121 ('of_echo_request', 'type'): 'ofp_type',
122 ('of_echo_reply', 'type'): 'ofp_type',
Tomasz4bc08ae2013-12-16 21:21:23 -0800123 ('of_flow_delete', 'type'): 'ofp_type',
124 ('of_flow_add', 'type'): 'ofp_type',
Tomasz359147c2013-12-17 18:34:20 -0800125 ('of_port_status', 'type'): 'ofp_type',
Tomaszdb2045d2013-10-25 02:29:23 -0700126 ('of_match_v3', 'type'): 'ofp_match_type',
Murat Parlakisik34863382016-12-05 00:53:17 -0800127 ('of_stat_v6' , 'type'): 'ofp_stat_type',
Tomaszdb2045d2013-10-25 02:29:23 -0700128 ('of_action_set_nw_ttl', 'type'): 'ofp_action_type',
Tomaszc1b0ad32013-12-08 11:18:59 -0800129 ('of_action_set_field', 'type'): 'ofp_action_type',
Tomaszdb2045d2013-10-25 02:29:23 -0700130 ('of_action_output', 'type'): 'ofp_action_type',
131 ('of_action_group', 'type'): 'ofp_action_type',
132 ('of_action_id', 'type'): 'ofp_action_type',
133 ('of_instruction_apply_actions', 'type'): 'ofp_instruction_type',
134 ('of_instruction_write_actions', 'type'): 'ofp_instruction_type',
Tomasza17a6692013-10-30 17:34:18 -0700135 ('of_group_mod', 'group_type'): 'ofp_group_type',
136 ('of_group_mod', 'type'): 'ofp_type',
Tomasz5e7ffbf2013-11-02 15:09:02 -0700137 ('of_group_mod', 'command'): 'ofp_group_mod_command',
Tomasza17a6692013-10-30 17:34:18 -0700138 ('of_group_mod', 'group_id'): 'ofp_group',
Tomasz5e7ffbf2013-11-02 15:09:02 -0700139 ('of_packet_out', 'type'): 'ofp_type',
140 ('of_packet_in', 'type'): 'ofp_type',
141 ('of_packet_in', 'reason'): 'ofp_packet_in_reason',
142 ('of_flow_stats_request', 'type'): 'ofp_type',
143 ('of_flow_stats_request', 'stats_type'): 'ofp_stats_type',
144 ('of_desc_stats_request', 'type'): 'ofp_type',
145 ('of_desc_stats_request', 'stats_type'): 'ofp_stats_type',
146 ('of_queue_stats_request', 'type'): 'ofp_type',
147 ('of_queue_stats_request', 'stats_type'): 'ofp_stats_type',
148 ('of_port_stats_request', 'type'): 'ofp_type',
149 ('of_port_stats_request', 'stats_type'): 'ofp_stats_type',
150 ('of_table_stats_request', 'type'): 'ofp_type',
151 ('of_table_stats_request', 'stats_type'): 'ofp_stats_type',
152 ('of_port_desc_stats_request', 'type'): 'ofp_type',
153 ('of_port_desc_stats_request', 'stats_type'): 'ofp_stats_type',
154 ('of_meter_stats_request', 'type'): 'ofp_type',
155 ('of_meter_stats_request', 'stats_type'): 'ofp_stats_type',
156 ('of_meter_features_stats_request', 'type'): 'ofp_type',
157 ('of_meter_features_stats_request', 'stats_type'): 'ofp_stats_type',
158 ('of_meter_config_stats_request', 'type'): 'ofp_type',
159 ('of_meter_config_stats_request', 'stats_type'): 'ofp_stats_type',
160 ('of_group_stats_request', 'type'): 'ofp_type',
161 ('of_group_stats_request', 'stats_type'): 'ofp_stats_type',
162 ('of_group_features_stats_request', 'type'): 'ofp_type',
163 ('of_group_features_stats_request', 'stats_type'): 'ofp_stats_type',
164 ('of_group_desc_stats_request', 'type'): 'ofp_type',
165 ('of_group_desc_stats_request', 'stats_type'): 'ofp_stats_type',
166 ('of_aggregate_stats_request', 'type'): 'ofp_type',
167 ('of_aggregate_stats_request', 'stats_type'): 'ofp_stats_type',
168 ('of_async_get_request', 'type'): 'ofp_type',
169 ('of_flow_stats_reply', 'type'): 'ofp_type',
170 ('of_flow_stats_reply', 'stats_type'): 'ofp_stats_type',
171 ('of_desc_stats_reply', 'type'): 'ofp_type',
172 ('of_desc_stats_reply', 'stats_type'): 'ofp_stats_type',
173 ('of_queue_stats_reply', 'type'): 'ofp_type',
174 ('of_queue_stats_reply', 'stats_type'): 'ofp_stats_type',
175 ('of_port_stats_reply', 'type'): 'ofp_type',
176 ('of_port_stats_reply', 'stats_type'): 'ofp_stats_type',
177 ('of_table_stats_reply', 'type'): 'ofp_type',
178 ('of_table_stats_reply', 'stats_type'): 'ofp_stats_type',
179 ('of_port_desc_stats_reply', 'type'): 'ofp_type',
180 ('of_port_desc_stats_reply', 'stats_type'): 'ofp_stats_type',
181 ('of_aggregate_stats_reply', 'type'): 'ofp_type',
182 ('of_aggregate_stats_reply', 'stats_type'): 'ofp_stats_type',
Rich Lane52452662013-10-25 13:34:42 -0700183}
184
Rich Lane64585d92013-10-02 16:01:37 -0700185# Override oftype_to_base for certain field names
186field_to_base = {
187 "eth_type": "HEX",
188 "cookie": "HEX",
189 "datapath_id": "HEX",
190}
tomaszklimczyk8d18d722014-01-19 23:17:05 -0800191
192reader_overrides = {
193 ("of_packet_in", "data"): "read_ethernet",
tomaszklimczyk4f78cef2014-01-29 10:39:58 -0800194 ("of_packet_out", "data"): "read_ethernet",
195 ("of_bsn_pdu_tx_request", "data"): "read_ethernet",
196 ("of_bsn_pdu_rx_request", "data"): "read_ethernet",
Rich Lane88fe6c22014-07-17 10:25:10 -0700197 ("of_error_msg", "data"): "read_openflow",
198 ("of_hello_failed_error_msg", "data"): "read_openflow",
199 ("of_bad_request_error_msg", "data"): "read_openflow",
200 ("of_bad_action_error_msg", "data"): "read_openflow",
201 ("of_bad_instruction_error_msg", "data"): "read_openflow",
202 ("of_bad_match_error_msg", "data"): "read_openflow",
203 ("of_flow_mod_failed_error_msg", "data"): "read_openflow",
204 ("of_group_mod_failed_error_msg", "data"): "read_openflow",
205 ("of_port_mod_failed_error_msg", "data"): "read_openflow",
206 ("of_table_mod_failed_error_msg", "data"): "read_openflow",
207 ("of_queue_op_failed_error_msg", "data"): "read_openflow",
208 ("of_switch_config_failed_error_msg", "data"): "read_openflow",
209 ("of_role_request_failed_error_msg", "data"): "read_openflow",
210 ("of_meter_mod_failed_error_msg", "data"): "read_openflow",
211 ("of_table_features_failed_error_msg", "data"): "read_openflow",
Rich Laned2726bf2015-01-23 13:15:12 -0800212 ("of_bundle_add_msg", "data"): "read_openflow",
tomaszklimczyk8d18d722014-01-19 23:17:05 -0800213}