Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 01 11 # version/type |
| 3 | 00 e4 # length |
| 4 | 00 00 00 06 # xid |
| 5 | 00 01 # stats_type |
| 6 | 00 00 # flags |
| 7 | 00 68 # entries[0].length |
| 8 | 03 # entries[0].table_id |
| 9 | 00 # entries[0].pad |
| 10 | 00 3f ff ff # entries[0].match.wildcards |
| 11 | 00 00 00 00 # remaining match fields |
| 12 | 00 00 00 00 00 00 00 00 # ... |
| 13 | 00 00 00 00 00 00 00 00 # ... |
| 14 | 00 00 00 00 00 00 00 00 # ... |
| 15 | 00 00 00 00 00 00 00 00 # ... |
| 16 | 00 00 00 01 # entries[0].duration_sec |
| 17 | 00 00 00 02 # entries[0].duration_nsec |
| 18 | 00 64 # entries[0].priority |
| 19 | 00 05 # entries[0].idle_timeout |
| 20 | 00 0a # entries[0].hard_timeout |
| 21 | 00 00 00 00 00 00 # pad |
| 22 | 01 23 45 67 89 ab cd ef # entries[0].cookie |
| 23 | 00 00 00 00 00 00 00 0a # entries[0].packet_count |
| 24 | 00 00 00 00 00 00 03 e8 # entries[0].byte_count |
| 25 | 00 00 # entries[0].actions[0].type |
| 26 | 00 08 # entries[0].actions[0].len |
| 27 | 00 01 # entries[0].actions[0].port |
| 28 | 00 00 # entries[0].actions[0].max_len |
| 29 | 00 00 # entries[0].actions[1].type |
| 30 | 00 08 # entries[0].actions[1].len |
| 31 | 00 02 # entries[0].actions[1].port |
| 32 | 00 00 # entries[0].actions[1].max_len |
| 33 | 00 70 # entries[1].length |
| 34 | 04 # entries[1].table_id |
| 35 | 00 # entries[1].pad |
| 36 | 00 3f ff ff # entries[1].match.wildcards |
| 37 | 00 00 00 00 # remaining match fields |
| 38 | 00 00 00 00 00 00 00 00 # ... |
| 39 | 00 00 00 00 00 00 00 00 # ... |
| 40 | 00 00 00 00 00 00 00 00 # ... |
| 41 | 00 00 00 00 00 00 00 00 # ... |
| 42 | 00 00 00 01 # entries[1].duration_sec |
| 43 | 00 00 00 02 # entries[1].duration_nsec |
| 44 | 00 64 # entries[1].priority |
| 45 | 00 05 # entries[1].idle_timeout |
| 46 | 00 0a # entries[1].hard_timeout |
| 47 | 00 00 00 00 00 00 # pad |
| 48 | 01 23 45 67 89 ab cd ef # entries[1].cookie |
| 49 | 00 00 00 00 00 00 00 0a # entries[1].packet_count |
| 50 | 00 00 00 00 00 00 03 e8 # entries[1].byte_count |
| 51 | 00 00 # entries[1].actions[0].type |
| 52 | 00 08 # entries[1].actions[0].len |
| 53 | 00 01 # entries[1].actions[0].port |
| 54 | 00 00 # entries[1].actions[0].max_len |
| 55 | 00 00 # entries[1].actions[1].type |
| 56 | 00 08 # entries[1].actions[1].len |
| 57 | 00 02 # entries[1].actions[1].port |
| 58 | 00 00 # entries[1].actions[1].max_len |
| 59 | 00 00 # entries[1].actions[2].type |
| 60 | 00 08 # entries[1].actions[2].len |
| 61 | 00 03 # entries[1].actions[2].port |
| 62 | 00 00 # entries[1].actions[2].max_len |
| 63 | -- python |
| 64 | ofp.message.flow_stats_reply( |
| 65 | xid=6, |
| 66 | flags=0, |
| 67 | entries=[ |
| 68 | ofp.flow_stats_entry(table_id=3, |
| 69 | match=ofp.match(), |
| 70 | duration_sec=1, |
| 71 | duration_nsec=2, |
| 72 | priority=100, |
| 73 | idle_timeout=5, |
| 74 | hard_timeout=10, |
| 75 | cookie=0x0123456789abcdef, |
| 76 | packet_count=10, |
| 77 | byte_count=1000, |
| 78 | actions=[ofp.action.output(port=1), |
| 79 | ofp.action.output(port=2)]), |
| 80 | ofp.flow_stats_entry(table_id=4, |
| 81 | match=ofp.match(), |
| 82 | duration_sec=1, |
| 83 | duration_nsec=2, |
| 84 | priority=100, |
| 85 | idle_timeout=5, |
| 86 | hard_timeout=10, |
| 87 | cookie=0x0123456789abcdef, |
| 88 | packet_count=10, |
| 89 | byte_count=1000, |
| 90 | actions=[ofp.action.output(port=1), |
| 91 | ofp.action.output(port=2), |
| 92 | ofp.action.output(port=3)])]) |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 93 | -- c |
| 94 | obj = of_flow_stats_reply_new(OF_VERSION_1_0); |
| 95 | of_flow_stats_reply_flags_set(obj, 0); |
| 96 | of_flow_stats_reply_xid_set(obj, 6); |
| 97 | { |
| 98 | of_object_t *entries = of_list_flow_stats_entry_new(OF_VERSION_1_0); |
| 99 | { |
| 100 | of_object_t *elem = of_flow_stats_entry_new(OF_VERSION_1_0); |
| 101 | of_flow_stats_entry_byte_count_set(elem, 1000); |
| 102 | of_flow_stats_entry_cookie_set(elem, 81985529216486895); |
| 103 | of_flow_stats_entry_duration_nsec_set(elem, 2); |
| 104 | of_flow_stats_entry_duration_sec_set(elem, 1); |
| 105 | of_flow_stats_entry_hard_timeout_set(elem, 10); |
| 106 | of_flow_stats_entry_idle_timeout_set(elem, 5); |
| 107 | of_flow_stats_entry_packet_count_set(elem, 10); |
| 108 | of_flow_stats_entry_priority_set(elem, 100); |
| 109 | of_flow_stats_entry_table_id_set(elem, 3); |
| 110 | { |
| 111 | of_match_t match = { OF_VERSION_1_0 }; |
| 112 | of_flow_stats_entry_match_set(elem, &match); |
| 113 | } |
| 114 | { |
| 115 | of_object_t *actions = of_list_action_new(OF_VERSION_1_0); |
| 116 | { |
| 117 | of_object_t *elem = of_action_output_new(OF_VERSION_1_0); |
| 118 | of_action_output_max_len_set(elem, 0); |
| 119 | of_action_output_port_set(elem, 1); |
| 120 | of_list_append(actions, elem); |
| 121 | of_object_delete(elem); |
| 122 | } |
| 123 | { |
| 124 | of_object_t *elem = of_action_output_new(OF_VERSION_1_0); |
| 125 | of_action_output_max_len_set(elem, 0); |
| 126 | of_action_output_port_set(elem, 2); |
| 127 | of_list_append(actions, elem); |
| 128 | of_object_delete(elem); |
| 129 | } |
| 130 | of_flow_stats_entry_actions_set(elem, actions); |
| 131 | of_object_delete(actions); |
| 132 | } |
| 133 | of_list_append(entries, elem); |
| 134 | of_object_delete(elem); |
| 135 | } |
| 136 | { |
| 137 | of_object_t *elem = of_flow_stats_entry_new(OF_VERSION_1_0); |
| 138 | of_flow_stats_entry_byte_count_set(elem, 1000); |
| 139 | of_flow_stats_entry_cookie_set(elem, 81985529216486895); |
| 140 | of_flow_stats_entry_duration_nsec_set(elem, 2); |
| 141 | of_flow_stats_entry_duration_sec_set(elem, 1); |
| 142 | of_flow_stats_entry_hard_timeout_set(elem, 10); |
| 143 | of_flow_stats_entry_idle_timeout_set(elem, 5); |
| 144 | of_flow_stats_entry_packet_count_set(elem, 10); |
| 145 | of_flow_stats_entry_priority_set(elem, 100); |
| 146 | of_flow_stats_entry_table_id_set(elem, 4); |
| 147 | { |
| 148 | of_match_t match = { OF_VERSION_1_0 }; |
| 149 | of_flow_stats_entry_match_set(elem, &match); |
| 150 | } |
| 151 | { |
| 152 | of_object_t *actions = of_list_action_new(OF_VERSION_1_0); |
| 153 | { |
| 154 | of_object_t *elem = of_action_output_new(OF_VERSION_1_0); |
| 155 | of_action_output_max_len_set(elem, 0); |
| 156 | of_action_output_port_set(elem, 1); |
| 157 | of_list_append(actions, elem); |
| 158 | of_object_delete(elem); |
| 159 | } |
| 160 | { |
| 161 | of_object_t *elem = of_action_output_new(OF_VERSION_1_0); |
| 162 | of_action_output_max_len_set(elem, 0); |
| 163 | of_action_output_port_set(elem, 2); |
| 164 | of_list_append(actions, elem); |
| 165 | of_object_delete(elem); |
| 166 | } |
| 167 | { |
| 168 | of_object_t *elem = of_action_output_new(OF_VERSION_1_0); |
| 169 | of_action_output_max_len_set(elem, 0); |
| 170 | of_action_output_port_set(elem, 3); |
| 171 | of_list_append(actions, elem); |
| 172 | of_object_delete(elem); |
| 173 | } |
| 174 | of_flow_stats_entry_actions_set(elem, actions); |
| 175 | of_object_delete(actions); |
| 176 | } |
| 177 | of_list_append(entries, elem); |
| 178 | of_object_delete(elem); |
| 179 | } |
| 180 | of_flow_stats_reply_entries_set(obj, entries); |
| 181 | of_object_delete(entries); |
| 182 | } |