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