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