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); |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 57 | BCM_LOG(INFO, openolt_log_id, "Olt indication, oper_state: %s\n", ind.olt_ind().oper_state().c_str()); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 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 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 95 | BCM_LOG(INFO, openolt_log_id, "LOS indication : %d status %s\n", intf_id, status.c_str()); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 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 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 111 | BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n", |
| 112 | ((bcmbal_interface_oper_status_change *)obj)->key.intf_id ); |
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; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 130 | BCM_LOG(INFO, openolt_log_id, "intf oper state indication, intf_id %d, type %d, oper_state %d, admin_state %d\n", |
| 131 | ((bcmbal_interface_oper_status_change *)obj)->key.intf_id, |
| 132 | ((bcmbal_interface_oper_status_change *)obj)->key.intf_type, |
| 133 | ((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status, |
| 134 | ((bcmbal_interface_oper_status_change *)obj)->data.admin_state); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 135 | |
| 136 | intf_oper_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id); |
| 137 | |
| 138 | if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_NNI) { |
| 139 | intf_oper_ind->set_type("nni"); |
| 140 | } else if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_PON) { |
| 141 | intf_oper_ind->set_type("pon"); |
| 142 | } else { |
| 143 | intf_oper_ind->set_type("unknown"); |
| 144 | } |
| 145 | |
| 146 | if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) { |
| 147 | intf_oper_ind->set_oper_state("up"); |
| 148 | } else { |
| 149 | intf_oper_ind->set_oper_state("down"); |
| 150 | } |
| 151 | |
| 152 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 153 | |
| 154 | oltIndQ.push(ind); |
| 155 | return BCM_ERR_OK; |
| 156 | } |
| 157 | |
| 158 | bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) { |
| 159 | openolt::Indication ind; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 160 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 161 | openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication; |
| 162 | |
| 163 | bcmbal_subscriber_terminal_key *key = |
| 164 | &((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->key; |
| 165 | |
| 166 | bcmbal_subscriber_terminal_alarms *alarms = |
| 167 | &(((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->data.alarm); |
| 168 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 169 | BCM_LOG(WARNING, openolt_log_id, "onu alarm indication intf_id %d, onu_id %d, alarm: los %d, lob %d, lopc_miss %d, lopc_mic_error %d\n", |
| 170 | key->intf_id, key->sub_term_id, alarms->los, alarms->lob, alarms->lopc_miss, alarms->lopc_mic_error); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 171 | |
| 172 | onu_alarm_ind->set_intf_id(key->intf_id); |
| 173 | onu_alarm_ind->set_onu_id(key->sub_term_id); |
| 174 | onu_alarm_ind->set_los_status(alarm_status_to_string(alarms->los)); |
| 175 | onu_alarm_ind->set_lob_status(alarm_status_to_string(alarms->lob)); |
| 176 | onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(alarms->lopc_miss)); |
| 177 | onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(alarms->lopc_mic_error)); |
| 178 | |
| 179 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 180 | ind.set_allocated_alarm_ind(alarm_ind); |
| 181 | |
| 182 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 183 | return BCM_ERR_OK; |
| 184 | } |
| 185 | |
| 186 | bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) { |
| 187 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 188 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 189 | openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 190 | |
| 191 | bcmbal_subscriber_terminal_key *key = |
| 192 | &(((bcmbal_subscriber_terminal_dgi*)obj)->key); |
| 193 | |
| 194 | bcmbal_subscriber_terminal_dgi_data *data = |
| 195 | &(((bcmbal_subscriber_terminal_dgi*)obj)->data); |
| 196 | |
| 197 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 198 | BCM_LOG(WARNING, openolt_log_id, "onu dying-gasp indication, intf_id %d, onu_id %d, alarm %d\n", |
| 199 | key->intf_id, key->sub_term_id, data->dgi_status); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 200 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 201 | dg_ind->set_intf_id(key->intf_id); |
| 202 | dg_ind->set_onu_id(key->sub_term_id); |
| 203 | dg_ind->set_status(alarm_status_to_string(data->dgi_status)); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 204 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 205 | alarm_ind->set_allocated_dying_gasp_ind(dg_ind); |
| 206 | ind.set_allocated_alarm_ind(alarm_ind); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 207 | |
| 208 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 209 | return BCM_ERR_OK; |
| 210 | } |
| 211 | |
| 212 | bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) { |
| 213 | openolt::Indication ind; |
| 214 | openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication; |
| 215 | openolt::SerialNumber* serial_number = new openolt::SerialNumber; |
| 216 | |
| 217 | bcmbal_subscriber_terminal_key *key = |
| 218 | &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key); |
| 219 | |
| 220 | bcmbal_subscriber_terminal_sub_term_disc_data *data = |
| 221 | &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data); |
| 222 | |
| 223 | bcmbal_serial_number *in_serial_number = &(data->serial_number); |
| 224 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 225 | BCM_LOG(INFO, openolt_log_id, "onu discover indication, intf_id %d, serial_number %s\n", |
| 226 | key->intf_id, serial_number_to_str(in_serial_number)); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 227 | |
| 228 | onu_disc_ind->set_intf_id(key->intf_id); |
| 229 | serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4); |
| 230 | serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8); |
| 231 | onu_disc_ind->set_allocated_serial_number(serial_number); |
| 232 | ind.set_allocated_onu_disc_ind(onu_disc_ind); |
| 233 | |
| 234 | oltIndQ.push(ind); |
| 235 | |
| 236 | return BCM_ERR_OK; |
| 237 | } |
| 238 | |
| 239 | bcmos_errno OnuIndication(bcmbal_obj *obj) { |
| 240 | openolt::Indication ind; |
| 241 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 242 | |
| 243 | bcmbal_subscriber_terminal_key *key = |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 244 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 245 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 246 | bcmbal_subscriber_terminal_oper_status_change_data *data = |
| 247 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 248 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 249 | BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper_state %d, admin_state %d\n", |
| 250 | key->intf_id, key->sub_term_id, data->new_oper_status, data->admin_state); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 251 | |
| 252 | onu_ind->set_intf_id(key->intf_id); |
| 253 | onu_ind->set_onu_id(key->sub_term_id); |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 254 | if (data->new_oper_status == BCMBAL_STATE_UP) { |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 255 | onu_ind->set_oper_state("up"); |
| 256 | } else { |
| 257 | onu_ind->set_oper_state("down"); |
| 258 | } |
| 259 | if (data->admin_state == BCMBAL_STATE_UP) { |
| 260 | onu_ind->set_admin_state("up"); |
| 261 | } else { |
| 262 | onu_ind->set_admin_state("down"); |
| 263 | } |
| 264 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 265 | ind.set_allocated_onu_ind(onu_ind); |
| 266 | |
| 267 | oltIndQ.push(ind); |
| 268 | return BCM_ERR_OK; |
| 269 | } |
| 270 | |
| 271 | bcmos_errno OnuOperIndication(bcmbal_obj *obj) { |
| 272 | openolt::Indication ind; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 273 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 274 | |
| 275 | bcmbal_subscriber_terminal_key *key = |
| 276 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key); |
| 277 | |
| 278 | bcmbal_subscriber_terminal_oper_status_change_data *data = |
| 279 | &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data); |
| 280 | |
| 281 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 282 | BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %d\n", |
| 283 | key->intf_id, key->sub_term_id, data->old_oper_status, data->new_oper_status); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 284 | |
| 285 | onu_ind->set_intf_id(key->intf_id); |
| 286 | onu_ind->set_onu_id(key->sub_term_id); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 287 | if (data->new_oper_status == BCMBAL_STATE_UP) { |
| 288 | onu_ind->set_oper_state("up"); |
| 289 | } else { |
| 290 | onu_ind->set_oper_state("down"); |
| 291 | } |
| 292 | if (data->admin_state == BCMBAL_STATE_UP) { |
| 293 | onu_ind->set_admin_state("up"); |
| 294 | } else { |
| 295 | onu_ind->set_admin_state("down"); |
| 296 | } |
| 297 | |
| 298 | ind.set_allocated_onu_ind(onu_ind); |
| 299 | |
| 300 | oltIndQ.push(ind); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 301 | return BCM_ERR_OK; |
| 302 | } |
| 303 | |
| 304 | bcmos_errno OmciIndication(bcmbal_obj *obj) { |
| 305 | openolt::Indication ind; |
| 306 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 307 | bcmbal_packet_itu_omci_channel_rx *in = |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 308 | (bcmbal_packet_itu_omci_channel_rx *)obj; |
| 309 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 310 | BCM_LOG(DEBUG, omci_log_id, "OMCI indication: intf_id %d, onu_id %d\n", |
| 311 | in->key.packet_send_dest.u.itu_omci_channel.intf_id, |
| 312 | in->key.packet_send_dest.u.itu_omci_channel.sub_term_id); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 313 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 314 | omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id); |
| 315 | omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id); |
| 316 | omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 317 | |
| 318 | ind.set_allocated_omci_ind(omci_ind); |
| 319 | oltIndQ.push(ind); |
| 320 | |
| 321 | return BCM_ERR_OK; |
| 322 | } |
| 323 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 324 | bcmos_errno PacketIndication(bcmbal_obj *obj) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 325 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 326 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
| 327 | bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj; |
| 328 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 329 | BCM_LOG(INFO, openolt_log_id, "packet indication, intf_id %d, svc_port %d, flow_id %d\n", |
| 330 | in->data.intf_id, in->data.svc_port, in->data.flow_id); |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 331 | |
| 332 | pkt_ind->set_intf_id(in->data.intf_id); |
| 333 | pkt_ind->set_gemport_id(in->data.svc_port); |
| 334 | pkt_ind->set_flow_id(in->data.flow_id); |
| 335 | pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len); |
| 336 | |
| 337 | ind.set_allocated_pkt_ind(pkt_ind); |
| 338 | oltIndQ.push(ind); |
| 339 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 340 | return BCM_ERR_OK; |
| 341 | } |
| 342 | |
| 343 | bcmos_errno FlowOperIndication(bcmbal_obj *obj) { |
| 344 | openolt::Indication ind; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 345 | BCM_LOG(DEBUG, openolt_log_id, "flow oper state indication\n"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 346 | return BCM_ERR_OK; |
| 347 | } |
| 348 | |
| 349 | bcmos_errno FlowIndication(bcmbal_obj *obj) { |
| 350 | openolt::Indication ind; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 351 | BCM_LOG(DEBUG, openolt_log_id, "flow indication\n"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 352 | return BCM_ERR_OK; |
| 353 | } |
| 354 | |
| 355 | bcmos_errno TmQIndication(bcmbal_obj *obj) { |
| 356 | openolt::Indication ind; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 357 | BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 358 | return BCM_ERR_OK; |
| 359 | } |
| 360 | |
| 361 | bcmos_errno TmSchedIndication(bcmbal_obj *obj) { |
| 362 | openolt::Indication ind; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 363 | BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 364 | return BCM_ERR_OK; |
| 365 | } |
| 366 | |
| 367 | bcmos_errno McastGroupIndication(bcmbal_obj *obj) { |
| 368 | openolt::Indication ind; |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 369 | BCM_LOG(DEBUG, openolt_log_id, "mcast group indication\n"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 370 | return BCM_ERR_OK; |
| 371 | } |
| 372 | |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 373 | bcmos_errno OnuStartupFailureIndication(bcmbal_obj *obj) { |
| 374 | openolt::Indication ind; |
| 375 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 376 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 377 | |
| 378 | bcmbal_subscriber_terminal_key *key = |
| 379 | &(((bcmbal_subscriber_terminal_sufi*)obj)->key); |
| 380 | |
| 381 | bcmbal_subscriber_terminal_sufi_data *data = |
| 382 | &(((bcmbal_subscriber_terminal_sufi*)obj)->data); |
| 383 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 384 | BCM_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n", |
| 385 | key->intf_id, key->sub_term_id, data->sufi_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 386 | |
| 387 | sufi_ind->set_intf_id(key->intf_id); |
| 388 | sufi_ind->set_onu_id(key->sub_term_id); |
| 389 | sufi_ind->set_status(alarm_status_to_string(data->sufi_status)); |
| 390 | |
| 391 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
| 392 | ind.set_allocated_alarm_ind(alarm_ind); |
| 393 | |
| 394 | oltIndQ.push(ind); |
| 395 | return BCM_ERR_OK; |
| 396 | } |
| 397 | |
| 398 | bcmos_errno OnuSignalDegradeIndication(bcmbal_obj *obj) { |
| 399 | openolt::Indication ind; |
| 400 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 401 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 402 | |
| 403 | bcmbal_subscriber_terminal_key *key = |
| 404 | &(((bcmbal_subscriber_terminal_sdi*)obj)->key); |
| 405 | |
| 406 | bcmbal_subscriber_terminal_sdi_data *data = |
| 407 | &(((bcmbal_subscriber_terminal_sdi*)obj)->data); |
| 408 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 409 | BCM_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 410 | key->intf_id, key->sub_term_id, data->sdi_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 411 | |
| 412 | sdi_ind->set_intf_id(key->intf_id); |
| 413 | sdi_ind->set_onu_id(key->sub_term_id); |
| 414 | sdi_ind->set_status(alarm_status_to_string(data->sdi_status)); |
| 415 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 416 | |
| 417 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
| 418 | ind.set_allocated_alarm_ind(alarm_ind); |
| 419 | |
| 420 | oltIndQ.push(ind); |
| 421 | return BCM_ERR_OK; |
| 422 | } |
| 423 | |
| 424 | bcmos_errno OnuDriftOfWindowIndication(bcmbal_obj *obj) { |
| 425 | openolt::Indication ind; |
| 426 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 427 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 428 | |
| 429 | bcmbal_subscriber_terminal_key *key = |
| 430 | &(((bcmbal_subscriber_terminal_dowi*)obj)->key); |
| 431 | |
| 432 | bcmbal_subscriber_terminal_dowi_data *data = |
| 433 | &(((bcmbal_subscriber_terminal_dowi*)obj)->data); |
| 434 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 435 | BCM_LOG(WARNING, openolt_log_id, "onu drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n", |
| 436 | key->intf_id, key->sub_term_id, data->dowi_status, data->drift_value, data->new_eqd); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 437 | |
| 438 | dowi_ind->set_intf_id(key->intf_id); |
| 439 | dowi_ind->set_onu_id(key->sub_term_id); |
| 440 | dowi_ind->set_status(alarm_status_to_string(data->dowi_status)); |
| 441 | dowi_ind->set_drift(data->drift_value); |
| 442 | dowi_ind->set_new_eqd(data->new_eqd); |
| 443 | |
| 444 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
| 445 | ind.set_allocated_alarm_ind(alarm_ind); |
| 446 | |
| 447 | oltIndQ.push(ind); |
| 448 | return BCM_ERR_OK; |
| 449 | } |
| 450 | |
| 451 | bcmos_errno OnuLossOfOmciChannelIndication(bcmbal_obj *obj) { |
| 452 | openolt::Indication ind; |
| 453 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 454 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 455 | |
| 456 | bcmbal_subscriber_terminal_key *key = |
| 457 | &(((bcmbal_subscriber_terminal_looci*)obj)->key); |
| 458 | |
| 459 | bcmbal_subscriber_terminal_looci_data *data = |
| 460 | &(((bcmbal_subscriber_terminal_looci*)obj)->data); |
| 461 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 462 | BCM_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n", |
| 463 | key->intf_id, key->sub_term_id, data->looci_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 464 | |
| 465 | looci_ind->set_intf_id(key->intf_id); |
| 466 | looci_ind->set_onu_id(key->sub_term_id); |
| 467 | looci_ind->set_status(alarm_status_to_string(data->looci_status)); |
| 468 | |
| 469 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
| 470 | ind.set_allocated_alarm_ind(alarm_ind); |
| 471 | |
| 472 | oltIndQ.push(ind); |
| 473 | return BCM_ERR_OK; |
| 474 | } |
| 475 | |
| 476 | bcmos_errno OnuSignalsFailureIndication(bcmbal_obj *obj) { |
| 477 | openolt::Indication ind; |
| 478 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 479 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 480 | |
| 481 | bcmbal_subscriber_terminal_key *key = |
| 482 | &(((bcmbal_subscriber_terminal_sfi*)obj)->key); |
| 483 | |
| 484 | bcmbal_subscriber_terminal_sfi_data *data = |
| 485 | &(((bcmbal_subscriber_terminal_sfi*)obj)->data); |
| 486 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 487 | BCM_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 488 | key->intf_id, key->sub_term_id, data->sfi_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 489 | |
| 490 | |
| 491 | sfi_ind->set_intf_id(key->intf_id); |
| 492 | sfi_ind->set_onu_id(key->sub_term_id); |
| 493 | sfi_ind->set_status(alarm_status_to_string(data->sfi_status)); |
| 494 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 495 | |
| 496 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
| 497 | ind.set_allocated_alarm_ind(alarm_ind); |
| 498 | |
| 499 | oltIndQ.push(ind); |
| 500 | return BCM_ERR_OK; |
| 501 | } |
| 502 | |
| 503 | bcmos_errno OnuTransmissionInterferenceWarningIndication(bcmbal_obj *obj) { |
| 504 | openolt::Indication ind; |
| 505 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 506 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 507 | |
| 508 | bcmbal_subscriber_terminal_key *key = |
| 509 | &(((bcmbal_subscriber_terminal_tiwi*)obj)->key); |
| 510 | |
| 511 | bcmbal_subscriber_terminal_tiwi_data *data = |
| 512 | &(((bcmbal_subscriber_terminal_tiwi*)obj)->data); |
| 513 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 514 | BCM_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n", |
| 515 | key->intf_id, key->sub_term_id, data->tiwi_status, data->drift_value); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 516 | |
| 517 | tiwi_ind->set_intf_id(key->intf_id); |
| 518 | tiwi_ind->set_onu_id(key->sub_term_id); |
| 519 | tiwi_ind->set_status(alarm_status_to_string(data->tiwi_status)); |
| 520 | tiwi_ind->set_drift(data->drift_value); |
| 521 | |
| 522 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
| 523 | ind.set_allocated_alarm_ind(alarm_ind); |
| 524 | |
| 525 | oltIndQ.push(ind); |
| 526 | return BCM_ERR_OK; |
| 527 | } |
| 528 | |
| 529 | bcmos_errno OnuActivationFailureIndication(bcmbal_obj *obj) { |
| 530 | openolt::Indication ind; |
| 531 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 532 | openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication; |
| 533 | |
| 534 | bcmbal_subscriber_terminal_key *key = |
| 535 | &(((bcmbal_subscriber_terminal_sub_term_act_fail*)obj)->key); |
| 536 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 537 | BCM_LOG(WARNING, openolt_log_id, "onu activation failure indication, intf_id %d, onu_id %d\n", |
| 538 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 539 | |
| 540 | |
| 541 | activation_fail_ind->set_intf_id(key->intf_id); |
| 542 | activation_fail_ind->set_onu_id(key->sub_term_id); |
| 543 | |
| 544 | alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind); |
| 545 | ind.set_allocated_alarm_ind(alarm_ind); |
| 546 | |
| 547 | oltIndQ.push(ind); |
| 548 | return BCM_ERR_OK; |
| 549 | } |
| 550 | |
| 551 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 552 | openolt::Indication ind; |
| 553 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 554 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 555 | |
| 556 | bcmbal_subscriber_terminal_key *key = |
| 557 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 558 | |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 559 | BCM_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n", |
| 560 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 561 | |
| 562 | |
| 563 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 564 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 565 | |
| 566 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 567 | ind.set_allocated_alarm_ind(alarm_ind); |
| 568 | |
| 569 | oltIndQ.push(ind); |
| 570 | return BCM_ERR_OK; |
| 571 | } |
| 572 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 573 | Status SubscribeIndication() { |
| 574 | bcmbal_cb_cfg cb_cfg = {}; |
| 575 | uint16_t ind_subgroup; |
| 576 | |
| 577 | if (subscribed) { |
| 578 | return Status::OK; |
| 579 | } |
| 580 | |
| 581 | cb_cfg.module = BCMOS_MODULE_ID_NONE; |
| 582 | |
| 583 | |
| 584 | /* OLT device indication */ |
| 585 | cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 586 | ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 587 | cb_cfg.p_subgroup = &ind_subgroup; |
| 588 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltIndication; |
| 589 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 590 | return Status(grpc::StatusCode::INTERNAL, "Olt indication subscribe failed"); |
| 591 | } |
| 592 | |
| 593 | /* Interface LOS indication */ |
| 594 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
| 595 | ind_subgroup = bcmbal_interface_auto_id_los; |
| 596 | cb_cfg.p_subgroup = &ind_subgroup; |
| 597 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication; |
| 598 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 599 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
| 600 | } |
| 601 | |
| 602 | /* Interface indication */ |
| 603 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 604 | ind_subgroup = bcmbal_interface_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 605 | cb_cfg.p_subgroup = &ind_subgroup; |
| 606 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication; |
| 607 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 608 | return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed"); |
| 609 | } |
| 610 | |
| 611 | /* Interface operational state change indication */ |
| 612 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
| 613 | ind_subgroup = bcmbal_interface_auto_id_oper_status_change; |
| 614 | cb_cfg.p_subgroup = &ind_subgroup; |
| 615 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication; |
| 616 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 617 | return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed"); |
| 618 | } |
| 619 | |
| 620 | /* onu alarm indication */ |
| 621 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 622 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm; |
| 623 | cb_cfg.p_subgroup = &ind_subgroup; |
| 624 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication; |
| 625 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 626 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 627 | } |
| 628 | |
| 629 | /* onu dying-gasp indication */ |
| 630 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 631 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi; |
| 632 | cb_cfg.p_subgroup = &ind_subgroup; |
| 633 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication; |
| 634 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 635 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
| 636 | } |
| 637 | |
| 638 | /* onu discovery indication */ |
| 639 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 640 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc; |
| 641 | cb_cfg.p_subgroup = &ind_subgroup; |
| 642 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication; |
| 643 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 644 | return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed"); |
| 645 | } |
| 646 | |
| 647 | /* onu indication */ |
| 648 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 649 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 650 | cb_cfg.p_subgroup = &ind_subgroup; |
| 651 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication; |
| 652 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 653 | return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed"); |
| 654 | } |
| 655 | /* onu operational state change indication */ |
| 656 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 657 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change; |
| 658 | cb_cfg.p_subgroup = &ind_subgroup; |
| 659 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication; |
| 660 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 661 | return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed"); |
| 662 | } |
| 663 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 664 | /* Packet (bearer) indication */ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 665 | cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET; |
| 666 | ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx; |
| 667 | cb_cfg.p_subgroup = &ind_subgroup; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 668 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 669 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 670 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 671 | } |
| 672 | |
| 673 | /* Flow Operational State Change */ |
| 674 | cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW; |
| 675 | ind_subgroup = bcmbal_flow_auto_id_oper_status_change; |
| 676 | cb_cfg.p_subgroup = &ind_subgroup; |
| 677 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication; |
| 678 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 679 | return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed"); |
| 680 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 681 | #if 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 682 | /* Flow Indication */ |
| 683 | cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW; |
| 684 | ind_subgroup = bcmbal_flow_auto_id_ind; |
| 685 | cb_cfg.p_subgroup = &ind_subgroup; |
| 686 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication; |
| 687 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 688 | return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed"); |
| 689 | } |
| 690 | |
| 691 | /* TM queue indication */ |
| 692 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE; |
| 693 | ind_subgroup = bcmbal_tm_queue_auto_id_ind; |
| 694 | cb_cfg.p_subgroup = &ind_subgroup; |
| 695 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication; |
| 696 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 697 | return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed"); |
| 698 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 699 | #endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 700 | |
| 701 | /* TM sched indication */ |
| 702 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED; |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 703 | ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 704 | cb_cfg.p_subgroup = &ind_subgroup; |
| 705 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication; |
| 706 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 707 | return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed"); |
| 708 | } |
| 709 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 710 | #if 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 711 | /* Multicast group indication */ |
| 712 | cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP; |
| 713 | ind_subgroup = bcmbal_group_auto_id_ind; |
| 714 | cb_cfg.p_subgroup = &ind_subgroup; |
| 715 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication; |
| 716 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 717 | return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed"); |
| 718 | } |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 719 | #endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 720 | |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 721 | |
| 722 | /* ONU startup failure indication */ |
| 723 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 724 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi; |
| 725 | cb_cfg.p_subgroup = &ind_subgroup; |
| 726 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuStartupFailureIndication; |
| 727 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 728 | return Status(grpc::StatusCode::INTERNAL, "onu startup failure indication subscribe failed"); |
| 729 | } |
| 730 | |
| 731 | /* SDI indication */ |
| 732 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 733 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi; |
| 734 | cb_cfg.p_subgroup = &ind_subgroup; |
| 735 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalDegradeIndication; |
| 736 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 737 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
| 738 | } |
| 739 | |
| 740 | /* DOWI indication */ |
| 741 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 742 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi; |
| 743 | cb_cfg.p_subgroup = &ind_subgroup; |
| 744 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDriftOfWindowIndication; |
| 745 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 746 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
| 747 | } |
| 748 | |
| 749 | /* LOOCI indication */ |
| 750 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 751 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci; |
| 752 | cb_cfg.p_subgroup = &ind_subgroup; |
| 753 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuLossOfOmciChannelIndication; |
| 754 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 755 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
| 756 | } |
| 757 | |
| 758 | /* SFI indication */ |
| 759 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 760 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi; |
| 761 | cb_cfg.p_subgroup = &ind_subgroup; |
| 762 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalsFailureIndication; |
| 763 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 764 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
| 765 | } |
| 766 | |
| 767 | /* TIWI indication */ |
| 768 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 769 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi; |
| 770 | cb_cfg.p_subgroup = &ind_subgroup; |
| 771 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuTransmissionInterferenceWarningIndication; |
| 772 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 773 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
| 774 | } |
| 775 | |
| 776 | /* TIWI indication */ |
| 777 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 778 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail; |
| 779 | cb_cfg.p_subgroup = &ind_subgroup; |
| 780 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuActivationFailureIndication; |
| 781 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 782 | return Status(grpc::StatusCode::INTERNAL, "onu activation falaire indication subscribe failed"); |
| 783 | } |
| 784 | |
| 785 | /* ONU processing error indication */ |
| 786 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 787 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error; |
| 788 | cb_cfg.p_subgroup = &ind_subgroup; |
| 789 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuProcessingErrorIndication; |
| 790 | if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) { |
| 791 | return Status(grpc::StatusCode::INTERNAL, "onu processing error indication subscribe failed"); |
| 792 | } |
| 793 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 794 | subscribed = true; |
| 795 | |
| 796 | return Status::OK; |
| 797 | } |