Dan Talayco | dc88181 | 2010-02-10 22:42:12 -0800 | [diff] [blame] | 1 | import sys |
| 2 | sys.path.append('../../../src/python/oftest/protocol') |
| 3 | from message import * |
| 4 | from action import * |
| 5 | from error import * |
| 6 | from class_maps import * |
| 7 | |
| 8 | ofmsg_class_map_to_parents = { |
| 9 | action_enqueue : [ofp_action_enqueue], |
| 10 | action_output : [ofp_action_output], |
| 11 | action_set_dl_dst : [ofp_action_dl_addr], |
| 12 | action_set_dl_src : [ofp_action_dl_addr], |
| 13 | action_set_nw_dst : [ofp_action_nw_addr], |
| 14 | action_set_nw_src : [ofp_action_nw_addr], |
| 15 | action_set_nw_tos : [ofp_action_nw_tos], |
| 16 | action_set_tp_dst : [ofp_action_tp_port], |
| 17 | action_set_tp_src : [ofp_action_tp_port], |
| 18 | action_set_vlan_pcp : [ofp_action_vlan_pcp], |
| 19 | action_set_vlan_vid : [ofp_action_vlan_vid], |
| 20 | action_strip_vlan : [ofp_action_header], |
| 21 | action_vendor : [ofp_action_vendor_header], |
| 22 | aggregate_stats_entry : [], |
| 23 | aggregate_stats_reply : [ofp_stats_reply], |
| 24 | aggregate_stats_request : [ofp_stats_request, |
| 25 | ofp_aggregate_stats_request], |
| 26 | bad_action_error_msg : [ofp_error_msg], |
| 27 | bad_request_error_msg : [ofp_error_msg], |
| 28 | barrier_reply : [], |
| 29 | barrier_request : [], |
| 30 | desc_stats_entry : [], |
| 31 | desc_stats_reply : [ofp_stats_reply], |
| 32 | desc_stats_request : [ofp_stats_request, |
| 33 | ofp_desc_stats_request], |
| 34 | echo_reply : [], |
| 35 | echo_request : [], |
| 36 | error : [ofp_error_msg], |
| 37 | features_reply : [ofp_switch_features], |
| 38 | features_request : [], |
| 39 | flow_mod : [ofp_flow_mod], |
| 40 | flow_mod_failed_error_msg : [ofp_error_msg], |
| 41 | flow_removed : [ofp_flow_removed], |
| 42 | flow_stats_entry : [ofp_flow_stats], |
| 43 | flow_stats_reply : [ofp_stats_reply], |
| 44 | flow_stats_request : [ofp_stats_request, |
| 45 | ofp_flow_stats_request], |
| 46 | get_config_reply : [ofp_switch_config], |
| 47 | get_config_request : [], |
| 48 | hello : [], |
| 49 | hello_failed_error_msg : [ofp_error_msg], |
| 50 | packet_in : [ofp_packet_in], |
| 51 | packet_out : [ofp_packet_out], |
| 52 | port_mod : [ofp_port_mod], |
| 53 | port_mod_failed_error_msg : [ofp_error_msg], |
| 54 | port_stats_entry : [], |
| 55 | port_stats_reply : [ofp_stats_reply], |
| 56 | port_stats_request : [ofp_stats_request, |
| 57 | ofp_port_stats_request], |
| 58 | port_status : [ofp_port_status], |
| 59 | queue_get_config_reply : [ofp_queue_get_config_reply], |
| 60 | queue_get_config_request : [ofp_queue_get_config_request], |
| 61 | queue_op_failed_error_msg : [ofp_error_msg], |
| 62 | queue_stats_entry : [], |
| 63 | queue_stats_reply : [ofp_stats_reply], |
| 64 | queue_stats_request : [ofp_stats_request, |
| 65 | ofp_queue_stats_request], |
| 66 | set_config : [ofp_switch_config], |
| 67 | stats_reply : [ofp_stats_reply], |
| 68 | stats_request : [ofp_stats_request], |
| 69 | table_stats_entry : [], |
| 70 | table_stats_reply : [ofp_stats_reply], |
| 71 | table_stats_request : [ofp_stats_request, |
| 72 | ofp_table_stats_request], |
| 73 | vendor : [ofp_vendor_header] |
| 74 | } |
| 75 | |
| 76 | ofmsg_names = { |
| 77 | action_enqueue : 'action_enqueue', |
| 78 | action_output : 'action_output', |
| 79 | action_set_dl_dst : 'action_set_dl_dst', |
| 80 | action_set_dl_src : 'action_set_dl_src', |
| 81 | action_set_nw_dst : 'action_set_nw_dst', |
| 82 | action_set_nw_src : 'action_set_nw_src', |
| 83 | action_set_nw_tos : 'action_set_nw_tos', |
| 84 | action_set_tp_dst : 'action_set_tp_dst', |
| 85 | action_set_tp_src : 'action_set_tp_src', |
| 86 | action_set_vlan_pcp : 'action_set_vlan_pcp', |
| 87 | action_set_vlan_vid : 'action_set_vlan_vid', |
| 88 | action_strip_vlan : 'action_strip_vlan', |
| 89 | action_vendor : 'action_vendor', |
| 90 | aggregate_stats_entry : 'aggregate_stats_entry', |
| 91 | aggregate_stats_reply : 'aggregate_stats_reply', |
| 92 | aggregate_stats_request : 'aggregate_stats_request', |
| 93 | bad_action_error_msg : 'bad_action_error_msg', |
| 94 | bad_request_error_msg : 'bad_request_error_msg', |
| 95 | barrier_reply : 'barrier_reply', |
| 96 | barrier_request : 'barrier_request', |
| 97 | desc_stats_entry : 'desc_stats_entry', |
| 98 | desc_stats_reply : 'desc_stats_reply', |
| 99 | desc_stats_request : 'desc_stats_request', |
| 100 | echo_reply : 'echo_reply', |
| 101 | echo_request : 'echo_request', |
| 102 | error : 'error', |
| 103 | features_reply : 'features_reply', |
| 104 | features_request : 'features_request', |
| 105 | flow_mod : 'flow_mod', |
| 106 | flow_mod_failed_error_msg : 'flow_mod_failed_error_msg', |
| 107 | flow_removed : 'flow_removed', |
| 108 | flow_stats_entry : 'flow_stats_entry', |
| 109 | flow_stats_reply : 'flow_stats_reply', |
| 110 | flow_stats_request : 'flow_stats_request', |
| 111 | get_config_reply : 'get_config_reply', |
| 112 | get_config_request : 'get_config_request', |
| 113 | hello : 'hello', |
| 114 | hello_failed_error_msg : 'hello_failed_error_msg', |
| 115 | ofp_desc_stats_request : 'ofp_desc_stats_request', |
| 116 | ofp_table_stats_request : 'ofp_table_stats_request', |
| 117 | packet_in : 'packet_in', |
| 118 | packet_out : 'packet_out', |
| 119 | port_mod : 'port_mod', |
| 120 | port_mod_failed_error_msg : 'port_mod_failed_error_msg', |
| 121 | port_stats_entry : 'port_stats_entry', |
| 122 | port_stats_reply : 'port_stats_reply', |
| 123 | port_stats_request : 'port_stats_request', |
| 124 | port_status : 'port_status', |
| 125 | queue_get_config_reply : 'queue_get_config_reply', |
| 126 | queue_get_config_request : 'queue_get_config_request', |
| 127 | queue_op_failed_error_msg : 'queue_op_failed_error_msg', |
| 128 | queue_stats_entry : 'queue_stats_entry', |
| 129 | queue_stats_reply : 'queue_stats_reply', |
| 130 | queue_stats_request : 'queue_stats_request', |
| 131 | set_config : 'set_config', |
| 132 | stats_reply : 'stats_reply', |
| 133 | stats_request : 'stats_request', |
| 134 | table_stats_entry : 'table_stats_entry', |
| 135 | table_stats_reply : 'table_stats_reply', |
| 136 | table_stats_request : 'table_stats_request', |
| 137 | vendor : 'vendor' |
| 138 | } |
| 139 | |
| 140 | stats_entry_types = [ |
| 141 | aggregate_stats_entry, |
| 142 | desc_stats_entry, |
| 143 | port_stats_entry, |
| 144 | queue_stats_entry, |
| 145 | table_stats_entry |
| 146 | ] |
| 147 | |
| 148 | ##@var A list of all OpenFlow messages including subtyped messages |
| 149 | of_messages = [ |
| 150 | aggregate_stats_reply, |
| 151 | aggregate_stats_request, |
| 152 | bad_action_error_msg, |
| 153 | bad_request_error_msg, |
| 154 | barrier_reply, |
| 155 | barrier_request, |
| 156 | desc_stats_reply, |
| 157 | desc_stats_request, |
| 158 | echo_reply, |
| 159 | echo_request, |
| 160 | features_reply, |
| 161 | features_request, |
| 162 | flow_mod, |
| 163 | flow_mod_failed_error_msg, |
| 164 | flow_removed, |
| 165 | flow_stats_reply, |
| 166 | flow_stats_request, |
| 167 | get_config_reply, |
| 168 | get_config_request, |
| 169 | hello, |
| 170 | hello_failed_error_msg, |
| 171 | packet_in, |
| 172 | packet_out, |
| 173 | port_mod, |
| 174 | port_mod_failed_error_msg, |
| 175 | port_stats_reply, |
| 176 | port_stats_request, |
| 177 | port_status, |
| 178 | queue_get_config_reply, |
| 179 | queue_get_config_request, |
| 180 | queue_op_failed_error_msg, |
| 181 | queue_stats_reply, |
| 182 | queue_stats_request, |
| 183 | set_config, |
| 184 | table_stats_reply, |
| 185 | table_stats_request, |
| 186 | vendor |
| 187 | ] |
| 188 | |
| 189 | # header_fields = ['version', 'xid'] |
| 190 | # fixed_header_fields = ['type', 'length'] |
| 191 | |
| 192 | all_objs = ofmsg_class_map_to_parents.keys() |
| 193 | all_objs.sort() |