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