Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 1 | /* |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 3 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 7 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 9 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 16 | |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 17 | #include "stats_collection.h" |
| 18 | |
| 19 | #include <unistd.h> |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 20 | |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 21 | #include "indications.h" |
Nicolas Palpacuer | c09fdb7 | 2018-08-22 10:23:22 -0400 | [diff] [blame] | 22 | #include "core.h" |
Girish Gowdra | ddf9a16 | 2020-01-27 12:56:27 +0530 | [diff] [blame] | 23 | #include "core_data.h" |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 24 | #include "translation.h" |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 25 | |
| 26 | extern "C" |
| 27 | { |
| 28 | #include <bcmos_system.h> |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 29 | #include <bcmolt_api.h> |
| 30 | #include <bcmolt_api_model_api_structs.h> |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 31 | } |
| 32 | |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 33 | //FIXME |
| 34 | #define FLOWS_COUNT 100 |
| 35 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 36 | bcmolt_flow_key* flows_keys = new bcmolt_flow_key[FLOWS_COUNT]; |
| 37 | bcmolt_odid device_id = 0; |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 38 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 39 | void init_stats() { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 40 | memset(flows_keys, 0, FLOWS_COUNT * sizeof(bcmolt_flow_key)); |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | openolt::PortStatistics* get_default_port_statistics() { |
| 44 | openolt::PortStatistics* port_stats = new openolt::PortStatistics; |
| 45 | port_stats->set_intf_id(-1); |
| 46 | port_stats->set_rx_bytes(-1); |
| 47 | port_stats->set_rx_packets(-1); |
| 48 | port_stats->set_rx_ucast_packets(-1); |
| 49 | port_stats->set_rx_mcast_packets(-1); |
| 50 | port_stats->set_rx_bcast_packets(-1); |
| 51 | port_stats->set_rx_error_packets(-1); |
| 52 | port_stats->set_tx_bytes(-1); |
| 53 | port_stats->set_tx_packets(-1); |
| 54 | port_stats->set_tx_ucast_packets(-1); |
| 55 | port_stats->set_tx_mcast_packets(-1); |
| 56 | port_stats->set_tx_bcast_packets(-1); |
| 57 | port_stats->set_tx_error_packets(-1); |
| 58 | port_stats->set_rx_crc_errors(-1); |
| 59 | port_stats->set_bip_errors(-1); |
| 60 | |
| 61 | return port_stats; |
| 62 | } |
| 63 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 64 | #if 0 |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 65 | openolt::FlowStatistics* get_default_flow_statistics() { |
| 66 | openolt::FlowStatistics* flow_stats = new openolt::FlowStatistics; |
| 67 | flow_stats->set_flow_id(-1); |
| 68 | flow_stats->set_rx_bytes(-1); |
| 69 | flow_stats->set_rx_packets(-1); |
| 70 | flow_stats->set_tx_bytes(-1); |
| 71 | flow_stats->set_tx_packets(-1); |
| 72 | |
| 73 | return flow_stats; |
| 74 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 75 | #endif |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 76 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 77 | openolt::PortStatistics* collectPortStatistics(bcmolt_intf_ref intf_ref) { |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 78 | |
| 79 | openolt::PortStatistics* port_stats = get_default_port_statistics(); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 80 | #ifndef TEST_MODE |
| 81 | bcmos_errno err; |
| 82 | bcmolt_stat_flags clear_on_read = BCMOLT_STAT_FLAGS_NONE; |
| 83 | bcmolt_nni_interface_stats nni_stats; |
| 84 | bcmolt_onu_itu_pon_stats pon_stats; |
| 85 | bcmolt_pon_interface_itu_pon_stats itu_pon_stats; |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 86 | |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 87 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 88 | switch (intf_ref.intf_type) { |
| 89 | case BCMOLT_INTERFACE_TYPE_NNI: |
| 90 | { |
| 91 | bcmolt_nni_interface_key nni_intf_key; |
| 92 | nni_intf_key.id = intf_ref.intf_id; |
| 93 | /* init the API struct */ |
| 94 | BCMOLT_STAT_INIT(&nni_stats, nni_interface, stats, nni_intf_key); |
| 95 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_bytes); |
| 96 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_packets); |
| 97 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_ucast_packets); |
| 98 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_mcast_packets); |
| 99 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_bcast_packets); |
| 100 | BCMOLT_MSG_FIELD_GET(&nni_stats, rx_error_packets); |
| 101 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_bytes); |
| 102 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_packets); |
| 103 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_ucast_packets); |
| 104 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_mcast_packets); |
| 105 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_bcast_packets); |
| 106 | BCMOLT_MSG_FIELD_GET(&nni_stats, tx_error_packets); |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 107 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 108 | /* call API */ |
| 109 | err = bcmolt_stat_get((bcmolt_oltid)device_id, &nni_stats.hdr, clear_on_read); |
| 110 | if (err == BCM_ERR_OK) |
| 111 | { |
| 112 | //std::cout << "Interface statistics retrieved" |
| 113 | // << " intf_id:" << intf_id << std::endl; |
| 114 | |
| 115 | port_stats->set_rx_bytes(nni_stats.data.rx_bytes); |
| 116 | port_stats->set_rx_packets(nni_stats.data.rx_packets); |
| 117 | port_stats->set_rx_ucast_packets(nni_stats.data.rx_ucast_packets); |
| 118 | port_stats->set_rx_mcast_packets(nni_stats.data.rx_mcast_packets); |
| 119 | port_stats->set_rx_bcast_packets(nni_stats.data.rx_bcast_packets); |
| 120 | port_stats->set_rx_error_packets(nni_stats.data.rx_error_packets); |
| 121 | port_stats->set_tx_bytes(nni_stats.data.tx_bytes); |
| 122 | port_stats->set_tx_packets(nni_stats.data.tx_packets); |
| 123 | port_stats->set_tx_ucast_packets(nni_stats.data.tx_ucast_packets); |
| 124 | port_stats->set_tx_mcast_packets(nni_stats.data.tx_mcast_packets); |
| 125 | port_stats->set_tx_bcast_packets(nni_stats.data.tx_bcast_packets); |
| 126 | port_stats->set_tx_error_packets(nni_stats.data.tx_error_packets); |
| 127 | |
| 128 | } else { |
Thiyagarajan Subramani | 0890b1f | 2019-11-22 07:52:47 -0500 | [diff] [blame] | 129 | OPENOLT_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d, err = %s\n", |
| 130 | (int)intf_ref.intf_id, (int)intf_ref.intf_type, bcmos_strerror(err)); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 131 | } |
| 132 | break; |
| 133 | } |
| 134 | case BCMOLT_INTERFACE_TYPE_PON: |
| 135 | { |
| 136 | bcmolt_pon_interface_key key; |
| 137 | key.pon_ni = (bcmolt_interface)intf_ref.intf_id; |
| 138 | BCMOLT_STAT_INIT(&itu_pon_stats, pon_interface, itu_pon_stats, key); |
| 139 | BCMOLT_MSG_FIELD_GET(&itu_pon_stats, tx_packets); |
| 140 | BCMOLT_MSG_FIELD_GET(&itu_pon_stats, bip_errors); |
| 141 | BCMOLT_MSG_FIELD_GET(&itu_pon_stats, rx_crc_error); |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 142 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 143 | /* call API */ |
| 144 | err = bcmolt_stat_get((bcmolt_oltid)device_id, &itu_pon_stats.hdr, clear_on_read); |
| 145 | if (err == BCM_ERR_OK) { |
| 146 | port_stats->set_tx_packets(itu_pon_stats.data.tx_packets); |
| 147 | port_stats->set_bip_errors(itu_pon_stats.data.bip_errors); |
| 148 | port_stats->set_rx_crc_errors(itu_pon_stats.data.rx_crc_error); |
| 149 | } else { |
Thiyagarajan Subramani | 0890b1f | 2019-11-22 07:52:47 -0500 | [diff] [blame] | 150 | OPENOLT_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d, err = %s\n", |
| 151 | (int)intf_ref.intf_id, (int)intf_ref.intf_type, bcmos_strerror(err)); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 152 | } |
| 153 | { |
| 154 | bcmolt_onu_key key; |
| 155 | key.pon_ni = (bcmolt_interface)intf_ref.intf_id; |
| 156 | BCMOLT_STAT_INIT(&pon_stats, onu, itu_pon_stats, key); |
| 157 | BCMOLT_MSG_FIELD_GET(&pon_stats, rx_bytes); |
| 158 | BCMOLT_MSG_FIELD_GET(&pon_stats, rx_packets); |
| 159 | BCMOLT_MSG_FIELD_GET(&pon_stats, tx_bytes); |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 160 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 161 | /* call API */ |
| 162 | err = bcmolt_stat_get((bcmolt_oltid)device_id, &pon_stats.hdr, clear_on_read); |
| 163 | if (err == BCM_ERR_OK) { |
| 164 | port_stats->set_rx_bytes(pon_stats.data.rx_bytes); |
| 165 | port_stats->set_rx_packets(pon_stats.data.rx_packets); |
| 166 | port_stats->set_tx_bytes(pon_stats.data.tx_bytes); |
| 167 | } else { |
Thiyagarajan Subramani | 0890b1f | 2019-11-22 07:52:47 -0500 | [diff] [blame] | 168 | OPENOLT_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d, err = %s\n", |
| 169 | (int)intf_ref.intf_id, (int)intf_ref.intf_type, bcmos_strerror(err)); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | break; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | port_stats->set_intf_id(interface_key_to_port_no((bcmolt_interface_id)intf_ref.intf_id, (bcmolt_interface_type)intf_ref.intf_type)); |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 177 | time_t now; |
| 178 | time(&now); |
| 179 | port_stats->set_timestamp((int)now); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 180 | #endif |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 181 | return port_stats; |
| 182 | |
| 183 | } |
| 184 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 185 | #if 0 |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 186 | openolt::FlowStatistics* collectFlowStatistics(bcmbal_flow_id flow_id, bcmbal_flow_type flow_type) { |
| 187 | |
| 188 | bcmos_errno err; |
| 189 | bcmbal_flow_stat stat; /**< declare main API struct */ |
| 190 | bcmbal_flow_key key = { }; /**< declare key */ |
| 191 | bcmos_bool clear_on_read = false; |
| 192 | |
| 193 | openolt::FlowStatistics* flow_stats = get_default_flow_statistics(); |
| 194 | //Key |
| 195 | key.flow_id = flow_id; |
| 196 | key.flow_type = flow_type; |
| 197 | |
| 198 | /* init the API struct */ |
| 199 | BCMBAL_STAT_INIT(&stat, flow, key); |
| 200 | BCMBAL_STAT_PROP_GET(&stat, flow, all_properties); |
| 201 | |
| 202 | err = bcmbal_stat_get(DEFAULT_ATERM_ID, &stat.hdr, clear_on_read); |
| 203 | |
| 204 | if (err == BCM_ERR_OK) |
| 205 | { |
| 206 | std::cout << "Flow statistics retrieved" |
| 207 | << " flow_id:" << flow_id |
| 208 | << " flow_type:" << flow_type << std::endl; |
| 209 | |
| 210 | flow_stats->set_rx_bytes(stat.data.rx_bytes); |
| 211 | flow_stats->set_rx_packets(stat.data.rx_packets); |
| 212 | flow_stats->set_tx_bytes(stat.data.tx_bytes); |
| 213 | flow_stats->set_tx_packets(stat.data.tx_packets); |
| 214 | |
| 215 | } else { |
| 216 | std::cout << "ERROR: Failed to retrieve flow statistics" |
| 217 | << " flow_id:" << flow_id |
| 218 | << " flow_type:" << flow_type << std::endl; |
| 219 | } |
| 220 | |
| 221 | return flow_stats; |
| 222 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 223 | #endif |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 224 | |
| 225 | |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 226 | void stats_collection() { |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 227 | |
Nicolas Palpacuer | c09fdb7 | 2018-08-22 10:23:22 -0400 | [diff] [blame] | 228 | if (!state.is_connected()) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 229 | OPENOLT_LOG(INFO, openolt_log_id, "Voltha is not connected, do not collect stats\n"); |
Nicolas Palpacuer | c09fdb7 | 2018-08-22 10:23:22 -0400 | [diff] [blame] | 230 | return; |
| 231 | } |
| 232 | if (!state.is_activated()) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 233 | OPENOLT_LOG(INFO, openolt_log_id, "The OLT is not up, do not collect stats\n"); |
Nicolas Palpacuer | c09fdb7 | 2018-08-22 10:23:22 -0400 | [diff] [blame] | 234 | return; |
| 235 | } |
| 236 | |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 237 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 238 | OPENOLT_LOG(DEBUG, openolt_log_id, "Collecting statistics\n"); |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 239 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 240 | //Ports statistics |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 241 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 242 | //Uplink ports |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 243 | for (int i = 0; i < NumNniIf_(); i++) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 244 | bcmolt_intf_ref intf_ref; |
| 245 | intf_ref.intf_type = BCMOLT_INTERFACE_TYPE_NNI; |
| 246 | intf_ref.intf_id = i; |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 247 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 248 | openolt::PortStatistics* port_stats = |
| 249 | collectPortStatistics(intf_ref); |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 250 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 251 | openolt::Indication ind; |
| 252 | ind.set_allocated_port_stats(port_stats); |
| 253 | oltIndQ.push(ind); |
| 254 | } |
| 255 | //Pon ports |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 256 | for (int i = 0; i < NumPonIf_(); i++) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 257 | bcmolt_intf_ref intf_ref; |
| 258 | intf_ref.intf_type = BCMOLT_INTERFACE_TYPE_PON; |
| 259 | intf_ref.intf_id = i; |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 260 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 261 | openolt::PortStatistics* port_stats = |
| 262 | collectPortStatistics(intf_ref); |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 263 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 264 | openolt::Indication ind; |
| 265 | ind.set_allocated_port_stats(port_stats); |
| 266 | oltIndQ.push(ind); |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 267 | } |
| 268 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 269 | //Flows statistics |
| 270 | // flow_inst *current_entry = NULL; |
| 271 | // |
| 272 | // TAILQ_FOREACH(current_entry, |
| 273 | // &FLOW_FSM_FLOW_LIST_CTX_PTR->active_flow_list, |
| 274 | // flow_inst_next) { |
| 275 | // int flows_measurements = 0; |
| 276 | // |
| 277 | // for (int i = 0; i < FLOWS_COUNT; i++) { |
| 278 | // |
| 279 | // // bcmbal_flow_id flow_id = current_entry->api_req_flow_info.key.flow_id; |
| 280 | // // bcmbal_flow_type flow_type = current_entry->api_req_flow_info.key.flow_type; |
| 281 | // |
| 282 | // if (flows_keys[i].flow_id != 0) { |
| 283 | // openolt::FlowStatistics* flow_stats = collectFlowStatistics(flows_keys[i].flow_id, flows_keys[i].flow_type); |
| 284 | // if (flow_stats->rx_packets() == -1) { |
| 285 | // //It Failed |
| 286 | // flows_keys[i].flow_id = 0; |
| 287 | // } else { |
| 288 | // flow_stats->set_flow_id(flows_keys[i].flow_id); |
| 289 | // time(&now); |
| 290 | // flow_stats->set_timestamp((int)now); |
| 291 | // openolt::Indication ind; |
| 292 | // ind.set_allocated_flow_stats(flow_stats); |
| 293 | // oltIndQ.push(ind); |
| 294 | // flows_measurements ++; |
| 295 | // } |
| 296 | // } |
| 297 | // |
| 298 | // } |
| 299 | // std::cout << "Stats of " << flows_measurements << " flows retrieved" << std::endl; |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 300 | |
| 301 | } |
| 302 | |
| 303 | /* Storing flow keys, temporary */ |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 304 | // void register_new_flow(bcmbal_flow_key key) { |
| 305 | // for (int i = 0; i < FLOWS_COUNT; i++) { |
| 306 | // if (flows_keys[i].flow_id == 0) { |
| 307 | // flows_keys[i] = key; |
| 308 | // break; |
| 309 | // } |
| 310 | // } |
| 311 | // } |