Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2018 Open Networking Foundation |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include "indications.h" |
Shad Ansari | b7b0ced | 2018-05-11 21:53:32 +0000 | [diff] [blame] | 18 | #include "core.h" |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 19 | #include "utils.h" |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 20 | #include "stats_collection.h" |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 21 | #include "translation.h" |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 22 | #include "state.h" |
| 23 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 24 | #include <string> |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 25 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 26 | extern "C" |
| 27 | { |
| 28 | #include <bcmos_system.h> |
| 29 | #include <bal_api.h> |
| 30 | #include <bal_api_end.h> |
| 31 | } |
| 32 | |
| 33 | using grpc::Status; |
| 34 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame^] | 35 | extern Queue<openolt::Indication> oltIndQ; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 36 | //Queue<openolt::Indication*> oltIndQ; |
| 37 | |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 38 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 39 | bool subscribed = false; |
| 40 | |
| 41 | bcmos_errno OmciIndication(bcmbal_obj *obj); |
| 42 | |
| 43 | bcmos_errno OltIndication(bcmbal_obj *obj) { |
| 44 | openolt::Indication ind; |
| 45 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
| 46 | Status status; |
| 47 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 48 | bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj; |
| 49 | if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 50 | olt_ind->set_oper_state("up"); |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 51 | state.activate(); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 52 | } else { |
| 53 | olt_ind->set_oper_state("down"); |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 54 | state.deactivate(); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 55 | } |
| 56 | ind.set_allocated_olt_ind(olt_ind); |
| 57 | std::cout << "olt indication, oper_state:" << ind.olt_ind().oper_state() << std::endl; |
| 58 | oltIndQ.push(ind); |
| 59 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 60 | #define MAX_SUPPORTED_INTF 16 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 61 | // Enable all PON interfaces. |
| 62 | for (int i = 0; i < MAX_SUPPORTED_INTF; i++) { |
| 63 | status = EnablePonIf_(i); |
| 64 | if (!status.ok()) { |
| 65 | // FIXME - raise alarm to report error in enabling PON |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /* register for omci indication */ |
| 70 | { |
| 71 | bcmbal_cb_cfg cb_cfg = {}; |
| 72 | uint16_t ind_subgroup; |
| 73 | |
| 74 | cb_cfg.module = BCMOS_MODULE_ID_NONE; |
| 75 | cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET; |
| 76 | ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx); |
| 77 | cb_cfg.p_object_key_info = NULL; |
| 78 | cb_cfg.p_subgroup = &ind_subgroup; |
| 79 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OmciIndication; |
| 80 | bcmbal_subscribe_ind(0, &cb_cfg); |
| 81 | } |
| 82 | |
| 83 | return BCM_ERR_OK; |
| 84 | } |
| 85 | |
| 86 | bcmos_errno LosIndication(bcmbal_obj *obj) { |
| 87 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 88 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 89 | openolt::LosIndication* los_ind = new openolt::LosIndication; |
| 90 | |
| 91 | bcmbal_interface_los* bcm_los_ind = (bcmbal_interface_los *) obj; |
| 92 | int intf_id = interface_key_to_port_no(bcm_los_ind->key); |
| 93 | std::string status = alarm_status_to_string(bcm_los_ind->data.status); |
| 94 | |
| 95 | std::cout << "LOS indication : " << intf_id << " " << status << std::endl; |
| 96 | |
| 97 | los_ind->set_intf_id(intf_id); |
| 98 | los_ind->set_status(status); |
| 99 | |
| 100 | alarm_ind->set_allocated_los_ind(los_ind); |
| 101 | ind.set_allocated_alarm_ind(alarm_ind); |
| 102 | |
| 103 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 104 | return BCM_ERR_OK; |
| 105 | } |
| 106 | |
| 107 | bcmos_errno IfIndication(bcmbal_obj *obj) { |
| 108 | openolt::Indication ind; |
| 109 | openolt::IntfIndication* intf_ind = new openolt::IntfIndication; |
| 110 | |
| 111 | std::cout << "intf indication, intf_id:" |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 112 | << ((bcmbal_interface_oper_status_change *)obj)->key.intf_id << std::endl; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 113 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 114 | intf_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id); |
| 115 | if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 116 | intf_ind->set_oper_state("up"); |
| 117 | } else { |
| 118 | intf_ind->set_oper_state("down"); |
| 119 | } |
| 120 | ind.set_allocated_intf_ind(intf_ind); |
| 121 | |
| 122 | oltIndQ.push(ind); |
| 123 | |
| 124 | return BCM_ERR_OK; |
| 125 | } |
| 126 | |
| 127 | bcmos_errno IfOperIndication(bcmbal_obj *obj) { |
| 128 | openolt::Indication ind; |
| 129 | openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication; |
| 130 | std::cout << "intf oper state indication, intf_id:" |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 131 | << ((bcmbal_interface_oper_status_change *)obj)->key.intf_id |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 132 | << " type:" << ((bcmbal_interface_oper_status_change *)obj)->key.intf_type |
| 133 | << " oper_state:" << ((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status |
| 134 | << " admin_state:" << ((bcmbal_interface_oper_status_change *)obj)->data.admin_state |
| 135 | << std::endl; |
| 136 | |
| 137 | intf_oper_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id); |
| 138 | |
| 139 | if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_NNI) { |
| 140 | intf_oper_ind->set_type("nni"); |
| 141 | } else if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_PON) { |
| 142 | intf_oper_ind->set_type("pon"); |
| 143 | } else { |
| 144 | intf_oper_ind->set_type("unknown"); |
| 145 | } |
| 146 | |
| 147 | if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) { |
| 148 | intf_oper_ind->set_oper_state("up"); |
| 149 | } else { |
| 150 | intf_oper_ind->set_oper_state("down"); |
| 151 | } |
| 152 | |
| 153 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 154 | |
| 155 | oltIndQ.push(ind); |
| 156 | return BCM_ERR_OK; |
| 157 | } |
| 158 | |
| 159 | bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) { |
| 160 | openolt::Indication ind; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 161 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 162 | openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication; |
| 163 | |
| 164 | bcmbal_subscriber_terminal_key *key = |
| 165 | &((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->key; |
| 166 | |
| 167 | bcmbal_subscriber_terminal_alarms *alarms = |
| 168 | &(((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->data.alarm); |
| 169 | |
| 170 | std::cout << "onu alarm indication intf_id:" << key->intf_id |
| 171 | << ", onu_id:" |
| 172 | << key->sub_term_id |
| 173 | << ", alarm: los " << alarms->los << ", lob " << alarms->lob |
| 174 | << ", lopc_miss " << alarms->lopc_miss << ", lopc_mic_error " |
| 175 | << alarms->lopc_mic_error << std::endl; |
| 176 | |
| 177 | onu_alarm_ind->set_intf_id(key->intf_id); |
| 178 | onu_alarm_ind->set_onu_id(key->sub_term_id); |
| 179 | onu_alarm_ind->set_los_status(alarm_status_to_string(alarms->los)); |
| 180 | onu_alarm_ind->set_lob_status(alarm_status_to_string(alarms->lob)); |
| 181 | onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(alarms->lopc_miss)); |
| 182 | onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(alarms->lopc_mic_error)); |
| 183 | |
| 184 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 185 | ind.set_allocated_alarm_ind(alarm_ind); |
| 186 | |
| 187 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 188 | return BCM_ERR_OK; |
| 189 | } |
| 190 | |
| 191 | bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) { |
| 192 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 193 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 194 | openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 195 | |
| 196 | bcmbal_subscriber_terminal_key *key = |
| 197 | &(((bcmbal_subscriber_terminal_dgi*)obj)->key); |
| 198 | |
| 199 | bcmbal_subscriber_terminal_dgi_data *data = |
| 200 | &(((bcmbal_subscriber_terminal_dgi*)obj)->data); |
| 201 | |
| 202 | |
| 203 | std::cout << "onu dying-gasp indication, intf_id:" |
| 204 | << key->intf_id |
| 205 | << ", onu_id:" |
| 206 | << key->sub_term_id |
| 207 | << ", alarm: " |
| 208 | << data->dgi_status << std::endl; |
| 209 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 210 | dg_ind->set_intf_id(key->intf_id); |
| 211 | dg_ind->set_onu_id(key->sub_term_id); |
| 212 | dg_ind->set_status(alarm_status_to_string(data->dgi_status)); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 213 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 214 | alarm_ind->set_allocated_dying_gasp_ind(dg_ind); |
| 215 | ind.set_allocated_alarm_ind(alarm_ind); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 216 | |
| 217 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 218 | return BCM_ERR_OK; |
| 219 | } |
| 220 | |
| 221 | bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) { |
| 222 | openolt::Indication ind; |
| 223 | openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication; |
| 224 | openolt::SerialNumber* serial_number = new openolt::SerialNumber; |
| 225 | |
| 226 | bcmbal_subscriber_terminal_key *key = |
| 227 | &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key); |
| 228 | |
| 229 | bcmbal_subscriber_terminal_sub_term_disc_data *data = |
| 230 | &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data); |
| 231 | |
| 232 | bcmbal_serial_number *in_serial_number = &(data->serial_number); |
| 233 | |
| 234 | std::cout << "onu discover indication, intf_id:" |
| 235 | << key->intf_id |
| 236 | << " serial_number:" |
| 237 | << serial_number_to_str(in_serial_number) << std::endl; |
| 238 | |
| 239 | onu_disc_ind->set_intf_id(key->intf_id); |
| 240 | serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4); |
| 241 | serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8); |
| 242 | onu_disc_ind->set_allocated_serial_number(serial_number); |
| 243 | ind.set_allocated_onu_disc_ind(onu_disc_ind); |
| 244 | |
| 245 | oltIndQ.push(ind); |
| 246 | |
| 247 | return BCM_ERR_OK; |
| 248 | } |
| 249 | |
| 250 | bcmos_errno OnuIndication(bcmbal_obj *obj) { |
| 251 | openolt::Indication ind; |
| 252 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 253 | |
| 254 | bcmbal_subscriber_terminal_key *key = |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 255 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 256 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 257 | bcmbal_subscriber_terminal_oper_status_change_data *data = |
| 258 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 259 | |
| 260 | std::cout << "onu indication, intf_id:" |
| 261 | << key->intf_id |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 262 | << " oper_state:" << data->new_oper_status |
| 263 | << " admin_state:" << data->admin_state |
| 264 | << " onu_id:" << key->sub_term_id << std::endl; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 265 | |
| 266 | onu_ind->set_intf_id(key->intf_id); |
| 267 | onu_ind->set_onu_id(key->sub_term_id); |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 268 | if (data->new_oper_status == BCMBAL_STATE_UP) { |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 269 | onu_ind->set_oper_state("up"); |
| 270 | } else { |
| 271 | onu_ind->set_oper_state("down"); |
| 272 | } |
| 273 | if (data->admin_state == BCMBAL_STATE_UP) { |
| 274 | onu_ind->set_admin_state("up"); |
| 275 | } else { |
| 276 | onu_ind->set_admin_state("down"); |
| 277 | } |
| 278 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 279 | ind.set_allocated_onu_ind(onu_ind); |
| 280 | |
| 281 | oltIndQ.push(ind); |
| 282 | return BCM_ERR_OK; |
| 283 | } |
| 284 | |
| 285 | bcmos_errno OnuOperIndication(bcmbal_obj *obj) { |
| 286 | openolt::Indication ind; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 287 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 288 | |
| 289 | bcmbal_subscriber_terminal_key *key = |
| 290 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key); |
| 291 | |
| 292 | bcmbal_subscriber_terminal_oper_status_change_data *data = |
| 293 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data); |
| 294 | |
| 295 | |
| 296 | std::cout << "onu oper state indication, intf_id:" |
| 297 | << key->intf_id |
| 298 | << " onu_id: " |
| 299 | << key->sub_term_id |
| 300 | << " old oper state: " |
| 301 | << data->old_oper_status |
| 302 | << " new oper state:" |
| 303 | << data->new_oper_status << std::endl; |
| 304 | |
| 305 | onu_ind->set_intf_id(key->intf_id); |
| 306 | onu_ind->set_onu_id(key->sub_term_id); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 307 | if (data->new_oper_status == BCMBAL_STATE_UP) { |
| 308 | onu_ind->set_oper_state("up"); |
| 309 | } else { |
| 310 | onu_ind->set_oper_state("down"); |
| 311 | } |
| 312 | if (data->admin_state == BCMBAL_STATE_UP) { |
| 313 | onu_ind->set_admin_state("up"); |
| 314 | } else { |
| 315 | onu_ind->set_admin_state("down"); |
| 316 | } |
| 317 | |
| 318 | ind.set_allocated_onu_ind(onu_ind); |
| 319 | |
| 320 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 321 | return BCM_ERR_OK; |
| 322 | } |
| 323 | |
| 324 | bcmos_errno OmciIndication(bcmbal_obj *obj) { |
| 325 | openolt::Indication ind; |
| 326 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 327 | bcmbal_packet_itu_omci_channel_rx *in = |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 328 | (bcmbal_packet_itu_omci_channel_rx *)obj; |
| 329 | |
| 330 | std::cout << "omci indication" << std::endl; |
| 331 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 332 | omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id); |
| 333 | omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id); |
| 334 | omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 335 | |
| 336 | ind.set_allocated_omci_ind(omci_ind); |
| 337 | oltIndQ.push(ind); |
| 338 | |
| 339 | return BCM_ERR_OK; |
| 340 | } |
| 341 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 342 | bcmos_errno PacketIndication(bcmbal_obj *obj) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 343 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 344 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
| 345 | bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj; |
| 346 | |
| 347 | std::cout << "packet indication" |
| 348 | << " intf_id:" << in->data.intf_id |
| 349 | << " svc_port:" << in->data.svc_port |
| 350 | << " flow_id:" << in->data.flow_id |
| 351 | << std::endl; |
| 352 | |
| 353 | pkt_ind->set_intf_id(in->data.intf_id); |
| 354 | pkt_ind->set_gemport_id(in->data.svc_port); |
| 355 | pkt_ind->set_flow_id(in->data.flow_id); |
| 356 | pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len); |
| 357 | |
| 358 | ind.set_allocated_pkt_ind(pkt_ind); |
| 359 | oltIndQ.push(ind); |
| 360 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 361 | return BCM_ERR_OK; |
| 362 | } |
| 363 | |
| 364 | bcmos_errno FlowOperIndication(bcmbal_obj *obj) { |
| 365 | openolt::Indication ind; |
| 366 | std::cout << "flow oper state indication" << std::endl; |
| 367 | return BCM_ERR_OK; |
| 368 | } |
| 369 | |
| 370 | bcmos_errno FlowIndication(bcmbal_obj *obj) { |
| 371 | openolt::Indication ind; |
| 372 | std::cout << "flow indication" << std::endl; |
| 373 | return BCM_ERR_OK; |
| 374 | } |
| 375 | |
| 376 | bcmos_errno TmQIndication(bcmbal_obj *obj) { |
| 377 | openolt::Indication ind; |
| 378 | std::cout << "traffic mgmt queue indication" << std::endl; |
| 379 | return BCM_ERR_OK; |
| 380 | } |
| 381 | |
| 382 | bcmos_errno TmSchedIndication(bcmbal_obj *obj) { |
| 383 | openolt::Indication ind; |
| 384 | std::cout << "traffic mgmt sheduler indication" << std::endl; |
| 385 | return BCM_ERR_OK; |
| 386 | } |
| 387 | |
| 388 | bcmos_errno McastGroupIndication(bcmbal_obj *obj) { |
| 389 | openolt::Indication ind; |
| 390 | std::cout << "mcast group indication" << std::endl; |
| 391 | return BCM_ERR_OK; |
| 392 | } |
| 393 | |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 394 | bcmos_errno OnuStartupFailureIndication(bcmbal_obj *obj) { |
| 395 | openolt::Indication ind; |
| 396 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 397 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 398 | |
| 399 | bcmbal_subscriber_terminal_key *key = |
| 400 | &(((bcmbal_subscriber_terminal_sufi*)obj)->key); |
| 401 | |
| 402 | bcmbal_subscriber_terminal_sufi_data *data = |
| 403 | &(((bcmbal_subscriber_terminal_sufi*)obj)->data); |
| 404 | |
| 405 | std::cout << "onu startup failure indication, intf_id:" |
| 406 | << key->intf_id |
| 407 | << ", onu_id:" |
| 408 | << key->sub_term_id |
| 409 | << ", alarm: " |
| 410 | << data->sufi_status << std::endl; |
| 411 | |
| 412 | sufi_ind->set_intf_id(key->intf_id); |
| 413 | sufi_ind->set_onu_id(key->sub_term_id); |
| 414 | sufi_ind->set_status(alarm_status_to_string(data->sufi_status)); |
| 415 | |
| 416 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
| 417 | ind.set_allocated_alarm_ind(alarm_ind); |
| 418 | |
| 419 | oltIndQ.push(ind); |
| 420 | return BCM_ERR_OK; |
| 421 | } |
| 422 | |
| 423 | bcmos_errno OnuSignalDegradeIndication(bcmbal_obj *obj) { |
| 424 | openolt::Indication ind; |
| 425 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 426 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 427 | |
| 428 | bcmbal_subscriber_terminal_key *key = |
| 429 | &(((bcmbal_subscriber_terminal_sdi*)obj)->key); |
| 430 | |
| 431 | bcmbal_subscriber_terminal_sdi_data *data = |
| 432 | &(((bcmbal_subscriber_terminal_sdi*)obj)->data); |
| 433 | |
| 434 | std::cout << "onu signal degrade indication, intf_id:" |
| 435 | << key->intf_id |
| 436 | << ", onu_id:" |
| 437 | << key->sub_term_id |
| 438 | << ", alarm: " |
| 439 | << data->sdi_status |
| 440 | << ", BER : " << data->ber << std::endl; |
| 441 | |
| 442 | sdi_ind->set_intf_id(key->intf_id); |
| 443 | sdi_ind->set_onu_id(key->sub_term_id); |
| 444 | sdi_ind->set_status(alarm_status_to_string(data->sdi_status)); |
| 445 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 446 | |
| 447 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
| 448 | ind.set_allocated_alarm_ind(alarm_ind); |
| 449 | |
| 450 | oltIndQ.push(ind); |
| 451 | return BCM_ERR_OK; |
| 452 | } |
| 453 | |
| 454 | bcmos_errno OnuDriftOfWindowIndication(bcmbal_obj *obj) { |
| 455 | openolt::Indication ind; |
| 456 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 457 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 458 | |
| 459 | bcmbal_subscriber_terminal_key *key = |
| 460 | &(((bcmbal_subscriber_terminal_dowi*)obj)->key); |
| 461 | |
| 462 | bcmbal_subscriber_terminal_dowi_data *data = |
| 463 | &(((bcmbal_subscriber_terminal_dowi*)obj)->data); |
| 464 | |
| 465 | std::cout << "onu drift of window indication, intf_id:" |
| 466 | << key->intf_id |
| 467 | << ", onu_id:" |
| 468 | << key->sub_term_id |
| 469 | << ", alarm: " |
| 470 | << data->dowi_status |
| 471 | << ", drift : " << data->drift_value |
| 472 | << "new_eqd : " << data->new_eqd << std::endl; |
| 473 | |
| 474 | dowi_ind->set_intf_id(key->intf_id); |
| 475 | dowi_ind->set_onu_id(key->sub_term_id); |
| 476 | dowi_ind->set_status(alarm_status_to_string(data->dowi_status)); |
| 477 | dowi_ind->set_drift(data->drift_value); |
| 478 | dowi_ind->set_new_eqd(data->new_eqd); |
| 479 | |
| 480 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
| 481 | ind.set_allocated_alarm_ind(alarm_ind); |
| 482 | |
| 483 | oltIndQ.push(ind); |
| 484 | return BCM_ERR_OK; |
| 485 | } |
| 486 | |
| 487 | bcmos_errno OnuLossOfOmciChannelIndication(bcmbal_obj *obj) { |
| 488 | openolt::Indication ind; |
| 489 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 490 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 491 | |
| 492 | bcmbal_subscriber_terminal_key *key = |
| 493 | &(((bcmbal_subscriber_terminal_looci*)obj)->key); |
| 494 | |
| 495 | bcmbal_subscriber_terminal_looci_data *data = |
| 496 | &(((bcmbal_subscriber_terminal_looci*)obj)->data); |
| 497 | |
| 498 | std::cout << "onu loss of OMCI channel indication, intf_id:" |
| 499 | << key->intf_id |
| 500 | << ", onu_id:" |
| 501 | << key->sub_term_id |
| 502 | << ", alarm: " |
| 503 | << data->looci_status << std::endl; |
| 504 | |
| 505 | |
| 506 | looci_ind->set_intf_id(key->intf_id); |
| 507 | looci_ind->set_onu_id(key->sub_term_id); |
| 508 | looci_ind->set_status(alarm_status_to_string(data->looci_status)); |
| 509 | |
| 510 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
| 511 | ind.set_allocated_alarm_ind(alarm_ind); |
| 512 | |
| 513 | oltIndQ.push(ind); |
| 514 | return BCM_ERR_OK; |
| 515 | } |
| 516 | |
| 517 | bcmos_errno OnuSignalsFailureIndication(bcmbal_obj *obj) { |
| 518 | openolt::Indication ind; |
| 519 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 520 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 521 | |
| 522 | bcmbal_subscriber_terminal_key *key = |
| 523 | &(((bcmbal_subscriber_terminal_sfi*)obj)->key); |
| 524 | |
| 525 | bcmbal_subscriber_terminal_sfi_data *data = |
| 526 | &(((bcmbal_subscriber_terminal_sfi*)obj)->data); |
| 527 | |
| 528 | std::cout << "onu signals failure indication, intf_id:" |
| 529 | << key->intf_id |
| 530 | << ", onu_id:" |
| 531 | << key->sub_term_id |
| 532 | << ", alarm: " |
| 533 | << data->sfi_status |
| 534 | << ", BER: " << data->ber << std::endl; |
| 535 | |
| 536 | |
| 537 | sfi_ind->set_intf_id(key->intf_id); |
| 538 | sfi_ind->set_onu_id(key->sub_term_id); |
| 539 | sfi_ind->set_status(alarm_status_to_string(data->sfi_status)); |
| 540 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 541 | |
| 542 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
| 543 | ind.set_allocated_alarm_ind(alarm_ind); |
| 544 | |
| 545 | oltIndQ.push(ind); |
| 546 | return BCM_ERR_OK; |
| 547 | } |
| 548 | |
| 549 | bcmos_errno OnuTransmissionInterferenceWarningIndication(bcmbal_obj *obj) { |
| 550 | openolt::Indication ind; |
| 551 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 552 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 553 | |
| 554 | bcmbal_subscriber_terminal_key *key = |
| 555 | &(((bcmbal_subscriber_terminal_tiwi*)obj)->key); |
| 556 | |
| 557 | bcmbal_subscriber_terminal_tiwi_data *data = |
| 558 | &(((bcmbal_subscriber_terminal_tiwi*)obj)->data); |
| 559 | |
| 560 | std::cout << "onu transmission interference warning indication, intf_id:" |
| 561 | << key->intf_id |
| 562 | << ", onu_id:" |
| 563 | << key->sub_term_id |
| 564 | << ", alarm: " |
| 565 | << data->tiwi_status |
| 566 | << ", drift: " << data->drift_value << std::endl; |
| 567 | |
| 568 | tiwi_ind->set_intf_id(key->intf_id); |
| 569 | tiwi_ind->set_onu_id(key->sub_term_id); |
| 570 | tiwi_ind->set_status(alarm_status_to_string(data->tiwi_status)); |
| 571 | tiwi_ind->set_drift(data->drift_value); |
| 572 | |
| 573 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
| 574 | ind.set_allocated_alarm_ind(alarm_ind); |
| 575 | |
| 576 | oltIndQ.push(ind); |
| 577 | return BCM_ERR_OK; |
| 578 | } |
| 579 | |
| 580 | bcmos_errno OnuActivationFailureIndication(bcmbal_obj *obj) { |
| 581 | openolt::Indication ind; |
| 582 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 583 | openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication; |
| 584 | |
| 585 | bcmbal_subscriber_terminal_key *key = |
| 586 | &(((bcmbal_subscriber_terminal_sub_term_act_fail*)obj)->key); |
| 587 | |
| 588 | std::cout << "onu activation failure indication, intf_id:" |
| 589 | << key->intf_id |
| 590 | << ", onu_id:" |
| 591 | << key->sub_term_id << std::endl; |
| 592 | |
| 593 | |
| 594 | activation_fail_ind->set_intf_id(key->intf_id); |
| 595 | activation_fail_ind->set_onu_id(key->sub_term_id); |
| 596 | |
| 597 | alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind); |
| 598 | ind.set_allocated_alarm_ind(alarm_ind); |
| 599 | |
| 600 | oltIndQ.push(ind); |
| 601 | return BCM_ERR_OK; |
| 602 | } |
| 603 | |
| 604 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 605 | openolt::Indication ind; |
| 606 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 607 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 608 | |
| 609 | bcmbal_subscriber_terminal_key *key = |
| 610 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 611 | |
| 612 | std::cout << "onu processing error indication, intf_id:" |
| 613 | << key->intf_id |
| 614 | << ", onu_id:" |
| 615 | << key->sub_term_id << std::endl; |
| 616 | |
| 617 | |
| 618 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 619 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 620 | |
| 621 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 622 | ind.set_allocated_alarm_ind(alarm_ind); |
| 623 | |
| 624 | oltIndQ.push(ind); |
| 625 | return BCM_ERR_OK; |
| 626 | } |
| 627 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 628 | Status SubscribeIndication() { |
| 629 | bcmbal_cb_cfg cb_cfg = {}; |
| 630 | uint16_t ind_subgroup; |
| 631 | |
| 632 | if (subscribed) { |
| 633 | return Status::OK; |
| 634 | } |
| 635 | |
| 636 | cb_cfg.module = BCMOS_MODULE_ID_NONE; |
| 637 | |
| 638 | |
| 639 | /* OLT device indication */ |
| 640 | cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 641 | ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 642 | cb_cfg.p_subgroup = &ind_subgroup; |
| 643 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltIndication; |
| 644 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 645 | return Status(grpc::StatusCode::INTERNAL, "Olt indication subscribe failed"); |
| 646 | } |
| 647 | |
| 648 | /* Interface LOS indication */ |
| 649 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
| 650 | ind_subgroup = bcmbal_interface_auto_id_los; |
| 651 | cb_cfg.p_subgroup = &ind_subgroup; |
| 652 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication; |
| 653 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 654 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
| 655 | } |
| 656 | |
| 657 | /* Interface indication */ |
| 658 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 659 | ind_subgroup = bcmbal_interface_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 660 | cb_cfg.p_subgroup = &ind_subgroup; |
| 661 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication; |
| 662 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 663 | return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed"); |
| 664 | } |
| 665 | |
| 666 | /* Interface operational state change indication */ |
| 667 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
| 668 | ind_subgroup = bcmbal_interface_auto_id_oper_status_change; |
| 669 | cb_cfg.p_subgroup = &ind_subgroup; |
| 670 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication; |
| 671 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 672 | return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed"); |
| 673 | } |
| 674 | |
| 675 | /* onu alarm indication */ |
| 676 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 677 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm; |
| 678 | cb_cfg.p_subgroup = &ind_subgroup; |
| 679 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication; |
| 680 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 681 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 682 | } |
| 683 | |
| 684 | /* onu dying-gasp indication */ |
| 685 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 686 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi; |
| 687 | cb_cfg.p_subgroup = &ind_subgroup; |
| 688 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication; |
| 689 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 690 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
| 691 | } |
| 692 | |
| 693 | /* onu discovery indication */ |
| 694 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 695 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc; |
| 696 | cb_cfg.p_subgroup = &ind_subgroup; |
| 697 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication; |
| 698 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 699 | return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed"); |
| 700 | } |
| 701 | |
| 702 | /* onu indication */ |
| 703 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 704 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 705 | cb_cfg.p_subgroup = &ind_subgroup; |
| 706 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication; |
| 707 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 708 | return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed"); |
| 709 | } |
| 710 | /* onu operational state change indication */ |
| 711 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 712 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change; |
| 713 | cb_cfg.p_subgroup = &ind_subgroup; |
| 714 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication; |
| 715 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 716 | return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed"); |
| 717 | } |
| 718 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 719 | /* Packet (bearer) indication */ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 720 | cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET; |
| 721 | ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx; |
| 722 | cb_cfg.p_subgroup = &ind_subgroup; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 723 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 724 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 725 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | /* Flow Operational State Change */ |
| 729 | cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW; |
| 730 | ind_subgroup = bcmbal_flow_auto_id_oper_status_change; |
| 731 | cb_cfg.p_subgroup = &ind_subgroup; |
| 732 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication; |
| 733 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 734 | return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed"); |
| 735 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 736 | #if 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 737 | /* Flow Indication */ |
| 738 | cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW; |
| 739 | ind_subgroup = bcmbal_flow_auto_id_ind; |
| 740 | cb_cfg.p_subgroup = &ind_subgroup; |
| 741 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication; |
| 742 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 743 | return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed"); |
| 744 | } |
| 745 | |
| 746 | /* TM queue indication */ |
| 747 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE; |
| 748 | ind_subgroup = bcmbal_tm_queue_auto_id_ind; |
| 749 | cb_cfg.p_subgroup = &ind_subgroup; |
| 750 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication; |
| 751 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 752 | return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed"); |
| 753 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 754 | #endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 755 | |
| 756 | /* TM sched indication */ |
| 757 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 758 | ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 759 | cb_cfg.p_subgroup = &ind_subgroup; |
| 760 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication; |
| 761 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 762 | return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed"); |
| 763 | } |
| 764 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 765 | #if 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 766 | /* Multicast group indication */ |
| 767 | cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP; |
| 768 | ind_subgroup = bcmbal_group_auto_id_ind; |
| 769 | cb_cfg.p_subgroup = &ind_subgroup; |
| 770 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication; |
| 771 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 772 | return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed"); |
| 773 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 774 | #endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 775 | |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 776 | |
| 777 | /* ONU startup failure indication */ |
| 778 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 779 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi; |
| 780 | cb_cfg.p_subgroup = &ind_subgroup; |
| 781 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuStartupFailureIndication; |
| 782 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 783 | return Status(grpc::StatusCode::INTERNAL, "onu startup failure indication subscribe failed"); |
| 784 | } |
| 785 | |
| 786 | /* SDI indication */ |
| 787 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 788 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi; |
| 789 | cb_cfg.p_subgroup = &ind_subgroup; |
| 790 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalDegradeIndication; |
| 791 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 792 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
| 793 | } |
| 794 | |
| 795 | /* DOWI indication */ |
| 796 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 797 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi; |
| 798 | cb_cfg.p_subgroup = &ind_subgroup; |
| 799 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDriftOfWindowIndication; |
| 800 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 801 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
| 802 | } |
| 803 | |
| 804 | /* LOOCI indication */ |
| 805 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 806 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci; |
| 807 | cb_cfg.p_subgroup = &ind_subgroup; |
| 808 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuLossOfOmciChannelIndication; |
| 809 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 810 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
| 811 | } |
| 812 | |
| 813 | /* SFI indication */ |
| 814 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 815 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi; |
| 816 | cb_cfg.p_subgroup = &ind_subgroup; |
| 817 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalsFailureIndication; |
| 818 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 819 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
| 820 | } |
| 821 | |
| 822 | /* TIWI indication */ |
| 823 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 824 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi; |
| 825 | cb_cfg.p_subgroup = &ind_subgroup; |
| 826 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuTransmissionInterferenceWarningIndication; |
| 827 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 828 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
| 829 | } |
| 830 | |
| 831 | /* TIWI indication */ |
| 832 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 833 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail; |
| 834 | cb_cfg.p_subgroup = &ind_subgroup; |
| 835 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuActivationFailureIndication; |
| 836 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 837 | return Status(grpc::StatusCode::INTERNAL, "onu activation falaire indication subscribe failed"); |
| 838 | } |
| 839 | |
| 840 | /* ONU processing error indication */ |
| 841 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 842 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error; |
| 843 | cb_cfg.p_subgroup = &ind_subgroup; |
| 844 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuProcessingErrorIndication; |
| 845 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 846 | return Status(grpc::StatusCode::INTERNAL, "onu processing error indication subscribe failed"); |
| 847 | } |
| 848 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 849 | subscribed = true; |
| 850 | |
| 851 | return Status::OK; |
| 852 | } |