blob: 789702f55503b015217c47b91f37b4862ff13dd1 [file] [log] [blame]
Shad Ansari01b0e652018-04-05 21:02:53 +00001/*
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 Ansarib7b0ced2018-05-11 21:53:32 +000018#include "core.h"
Shad Ansari01b0e652018-04-05 21:02:53 +000019#include "utils.h"
Nicolas Palpacuer0f19b1a2018-06-07 17:29:31 -040020#include "stats_collection.h"
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -040021#include "translation.h"
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040022#include "state.h"
23
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -040024#include <string>
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040025
Shad Ansari01b0e652018-04-05 21:02:53 +000026extern "C"
27{
28#include <bcmos_system.h>
29#include <bal_api.h>
30#include <bal_api_end.h>
31}
32
33using grpc::Status;
34
Shad Ansari627b5782018-08-13 22:49:32 +000035extern Queue<openolt::Indication> oltIndQ;
Shad Ansari01b0e652018-04-05 21:02:53 +000036//Queue<openolt::Indication*> oltIndQ;
37
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040038
Shad Ansari01b0e652018-04-05 21:02:53 +000039bool subscribed = false;
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080040uint32_t nni_intf_id = 0;
Shad Ansari01b0e652018-04-05 21:02:53 +000041
42bcmos_errno OmciIndication(bcmbal_obj *obj);
43
Craig Lutgen88a22ad2018-10-04 12:30:46 -050044std::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
Girish Gowdru376b33c2019-05-06 21:46:31 -070054std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){
55 bcmbal_subscriber_terminal_key key;
56 bcmbal_subscriber_terminal_cfg sub_term_obj = {};
57 uint8_t *list_mem;// to fetch config details for ONU
58 bcmos_errno err = BCM_ERR_OK;
59
60 key.sub_term_id =onu_id;
61 key.intf_id = intf_id;
62 BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id);
63
64 BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key);
65
66 BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties);
67 char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH);
68 memset(reg_id, '\0', MAX_REGID_LENGTH);
69
70 //set memory to use for variable-sized lists
71 list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE);
72
73 if (list_mem == NULL)
74 {
75 BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \
76 cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id);
77 return reg_id;
78 }
79
80 memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE);
81 BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE);
82
83 //call API
84 err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr);
85
86 if (err != BCM_ERR_OK)
87 {
88 BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)",
89 key.sub_term_id, key.intf_id);
90 free(list_mem);
91 return reg_id;
92 }
93
94 BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)",
95 key.sub_term_id, key.intf_id);
96
97 for (int i=0; i<MAX_REGID_LENGTH ; i++){
98 reg_id[i]=sub_term_obj.data.registration_id.arr[i];
99 }
100
101 free(list_mem);
102 return reg_id;
103}
104
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500105bcmos_errno OltOperIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000106 openolt::Indication ind;
107 openolt::OltIndication* olt_ind = new openolt::OltIndication;
108 Status status;
109
Shad Ansaricb004c52018-05-30 18:07:23 +0000110 bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500111 std::string admin_state;
112 if (acc_term_ind->data.admin_state == BCMBAL_STATE_UP) {
113 admin_state = "up";
114 } else {
115 admin_state = "down";
116 }
117
Shad Ansaricb004c52018-05-30 18:07:23 +0000118 if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500119 // Determine device capabilities before transitionto acive state
120 ProbeDeviceCapabilities_();
Shad Ansari01b0e652018-04-05 21:02:53 +0000121 olt_ind->set_oper_state("up");
122 } else {
123 olt_ind->set_oper_state("down");
124 }
125 ind.set_allocated_olt_ind(olt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500126
127 BCM_LOG(INFO, openolt_log_id, "Olt oper status indication, admin_state: %s oper_state: %s\n",
128 admin_state.c_str(),
129 olt_ind->oper_state().c_str());
130
Shad Ansari01b0e652018-04-05 21:02:53 +0000131 oltIndQ.push(ind);
132
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500133 // Enable all PON interfaces.
134 //
135 for (int i = 0; i < NumPonIf_(); i++) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000136 status = EnablePonIf_(i);
137 if (!status.ok()) {
138 // FIXME - raise alarm to report error in enabling PON
139 }
140 }
141
Craig Lutgend0bae9b2018-10-18 18:02:07 -0500142 // Enable all NNI interfaces.
143 //
144 for (int i = 0; i < NumNniIf_(); i++) {
145 status = EnableUplinkIf_(i);
146 if (!status.ok()) {
147 // FIXME - raise alarm to report error in enabling PON
148 }
149 }
150
Shad Ansari01b0e652018-04-05 21:02:53 +0000151 /* register for omci indication */
152 {
153 bcmbal_cb_cfg cb_cfg = {};
154 uint16_t ind_subgroup;
155
156 cb_cfg.module = BCMOS_MODULE_ID_NONE;
157 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
158 ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx);
159 cb_cfg.p_object_key_info = NULL;
160 cb_cfg.p_subgroup = &ind_subgroup;
161 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OmciIndication;
162 bcmbal_subscribe_ind(0, &cb_cfg);
163 }
164
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500165 if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
166 ProbePonIfTechnology_();
167 state.activate();
168 }
169 else {
170 state.deactivate();
171 }
172
Shad Ansari01b0e652018-04-05 21:02:53 +0000173 return BCM_ERR_OK;
174}
175
176bcmos_errno LosIndication(bcmbal_obj *obj) {
177 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400178 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
179 openolt::LosIndication* los_ind = new openolt::LosIndication;
180
181 bcmbal_interface_los* bcm_los_ind = (bcmbal_interface_los *) obj;
182 int intf_id = interface_key_to_port_no(bcm_los_ind->key);
183 std::string status = alarm_status_to_string(bcm_los_ind->data.status);
184
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500185 BCM_LOG(INFO, openolt_log_id, "LOS indication : intf_type: %d intf_id: %d port: %d status %s\n",
186 bcm_los_ind->key.intf_type, bcm_los_ind->key.intf_id, intf_id, status.c_str());
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400187
188 los_ind->set_intf_id(intf_id);
189 los_ind->set_status(status);
190
191 alarm_ind->set_allocated_los_ind(los_ind);
192 ind.set_allocated_alarm_ind(alarm_ind);
193
194 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000195 return BCM_ERR_OK;
196}
197
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700198bcmos_errno IfIndication(bcmbal_obj *obj) {
199 openolt::Indication ind;
200 openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
201
202 BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
203 ((bcmbal_interface_oper_status_change *)obj)->key.intf_id );
204
205 intf_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id);
206 if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) {
207 intf_ind->set_oper_state("up");
208 } else {
209 intf_ind->set_oper_state("down");
210 }
211 ind.set_allocated_intf_ind(intf_ind);
212
213 oltIndQ.push(ind);
214
215 return BCM_ERR_OK;
216}
217
Shad Ansari01b0e652018-04-05 21:02:53 +0000218bcmos_errno IfOperIndication(bcmbal_obj *obj) {
219 openolt::Indication ind;
220 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500221 bcmbal_interface_oper_status_change* bcm_if_oper_ind = (bcmbal_interface_oper_status_change *) obj;
Shad Ansari01b0e652018-04-05 21:02:53 +0000222
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500223 intf_oper_ind->set_type(bcmbal_to_grpc_intf_type(bcm_if_oper_ind->key.intf_type));
224 intf_oper_ind->set_intf_id(bcm_if_oper_ind->key.intf_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000225
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500226 if (bcm_if_oper_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000227 intf_oper_ind->set_oper_state("up");
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -0800228 if (bcm_if_oper_ind->key.intf_type == BCMBAL_INTF_TYPE_NNI) {
229 nni_intf_id = bcm_if_oper_ind->key.intf_id;
230 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000231 } else {
232 intf_oper_ind->set_oper_state("down");
233 }
234
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700235 BCM_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s, admin_state %d\n",
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500236 intf_oper_ind->type().c_str(),
237 bcm_if_oper_ind->key.intf_id,
238 intf_oper_ind->oper_state().c_str(),
239 bcm_if_oper_ind->data.admin_state);
240
Shad Ansari01b0e652018-04-05 21:02:53 +0000241 ind.set_allocated_intf_oper_ind(intf_oper_ind);
242
243 oltIndQ.push(ind);
244 return BCM_ERR_OK;
245}
246
247bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) {
248 openolt::Indication ind;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400249 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
250 openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication;
251
252 bcmbal_subscriber_terminal_key *key =
253 &((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->key;
254
255 bcmbal_subscriber_terminal_alarms *alarms =
256 &(((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->data.alarm);
257
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400258 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",
259 key->intf_id, key->sub_term_id, alarms->los, alarms->lob, alarms->lopc_miss, alarms->lopc_mic_error);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400260
261 onu_alarm_ind->set_intf_id(key->intf_id);
262 onu_alarm_ind->set_onu_id(key->sub_term_id);
263 onu_alarm_ind->set_los_status(alarm_status_to_string(alarms->los));
264 onu_alarm_ind->set_lob_status(alarm_status_to_string(alarms->lob));
265 onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(alarms->lopc_miss));
266 onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(alarms->lopc_mic_error));
267
268 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
269 ind.set_allocated_alarm_ind(alarm_ind);
270
271 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000272 return BCM_ERR_OK;
273}
274
275bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) {
276 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400277 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
278 openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication;
nickc063ffd2018-05-22 14:35:28 -0400279
280 bcmbal_subscriber_terminal_key *key =
281 &(((bcmbal_subscriber_terminal_dgi*)obj)->key);
282
283 bcmbal_subscriber_terminal_dgi_data *data =
284 &(((bcmbal_subscriber_terminal_dgi*)obj)->data);
285
286
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400287 BCM_LOG(WARNING, openolt_log_id, "onu dying-gasp indication, intf_id %d, onu_id %d, alarm %d\n",
288 key->intf_id, key->sub_term_id, data->dgi_status);
nickc063ffd2018-05-22 14:35:28 -0400289
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400290 dg_ind->set_intf_id(key->intf_id);
291 dg_ind->set_onu_id(key->sub_term_id);
292 dg_ind->set_status(alarm_status_to_string(data->dgi_status));
nickc063ffd2018-05-22 14:35:28 -0400293
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400294 alarm_ind->set_allocated_dying_gasp_ind(dg_ind);
295 ind.set_allocated_alarm_ind(alarm_ind);
nickc063ffd2018-05-22 14:35:28 -0400296
297 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000298 return BCM_ERR_OK;
299}
300
301bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) {
302 openolt::Indication ind;
303 openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
304 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
305
306 bcmbal_subscriber_terminal_key *key =
307 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key);
308
309 bcmbal_subscriber_terminal_sub_term_disc_data *data =
310 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data);
311
312 bcmbal_serial_number *in_serial_number = &(data->serial_number);
313
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400314 BCM_LOG(INFO, openolt_log_id, "onu discover indication, intf_id %d, serial_number %s\n",
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500315 key->intf_id, serial_number_to_str(in_serial_number).c_str());
Shad Ansari01b0e652018-04-05 21:02:53 +0000316
317 onu_disc_ind->set_intf_id(key->intf_id);
318 serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4);
319 serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8);
320 onu_disc_ind->set_allocated_serial_number(serial_number);
321 ind.set_allocated_onu_disc_ind(onu_disc_ind);
322
323 oltIndQ.push(ind);
324
325 return BCM_ERR_OK;
326}
327
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700328bcmos_errno OnuIndication(bcmbal_obj *obj) {
329 openolt::Indication ind;
330 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
331
332 bcmbal_subscriber_terminal_key *key =
333 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
334
335 bcmbal_subscriber_terminal_oper_status_change_data *data =
336 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
337
338 BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper_state %d, admin_state %d\n",
339 key->intf_id, key->sub_term_id, data->new_oper_status, data->admin_state);
340
341 onu_ind->set_intf_id(key->intf_id);
342 onu_ind->set_onu_id(key->sub_term_id);
343 if (data->new_oper_status == BCMBAL_STATUS_UP) {
344 onu_ind->set_oper_state("up");
345 } else {
346 onu_ind->set_oper_state("down");
347 }
348 if (data->admin_state == BCMBAL_STATE_UP) {
349 onu_ind->set_admin_state("up");
350 } else {
351 onu_ind->set_admin_state("down");
352 }
Girish Gowdru376b33c2019-05-06 21:46:31 -0700353 const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
354 onu_ind->set_registration_id(reg_id);
355
356 BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper state %s, admin_state %s,registration id %s\n",
357 onu_ind->intf_id(), onu_ind->onu_id(),onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700358
359 ind.set_allocated_onu_ind(onu_ind);
360
361 oltIndQ.push(ind);
362 return BCM_ERR_OK;
363}
364
Shad Ansari01b0e652018-04-05 21:02:53 +0000365bcmos_errno OnuOperIndication(bcmbal_obj *obj) {
366 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400367 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
nickc063ffd2018-05-22 14:35:28 -0400368
369 bcmbal_subscriber_terminal_key *key =
370 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
371
372 bcmbal_subscriber_terminal_oper_status_change_data *data =
373 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
374
nickc063ffd2018-05-22 14:35:28 -0400375 onu_ind->set_intf_id(key->intf_id);
376 onu_ind->set_onu_id(key->sub_term_id);
Craig Lutgen19512312018-11-02 10:14:46 -0500377 if (data->new_oper_status == BCMBAL_STATUS_UP) {
nickc063ffd2018-05-22 14:35:28 -0400378 onu_ind->set_oper_state("up");
379 } else {
380 onu_ind->set_oper_state("down");
381 }
382 if (data->admin_state == BCMBAL_STATE_UP) {
383 onu_ind->set_admin_state("up");
384 } else {
385 onu_ind->set_admin_state("down");
386 }
Girish Gowdru376b33c2019-05-06 21:46:31 -0700387 const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
388 onu_ind->set_registration_id(reg_id);
nickc063ffd2018-05-22 14:35:28 -0400389 ind.set_allocated_onu_ind(onu_ind);
390
Girish Gowdru376b33c2019-05-06 21:46:31 -0700391 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 registraion_id %s\n",
392 key->intf_id, key->sub_term_id, data->old_oper_status, onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500393
nickc063ffd2018-05-22 14:35:28 -0400394 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000395 return BCM_ERR_OK;
396}
397
398bcmos_errno OmciIndication(bcmbal_obj *obj) {
399 openolt::Indication ind;
400 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000401 bcmbal_packet_itu_omci_channel_rx *in =
Shad Ansari01b0e652018-04-05 21:02:53 +0000402 (bcmbal_packet_itu_omci_channel_rx *)obj;
403
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400404 BCM_LOG(DEBUG, omci_log_id, "OMCI indication: intf_id %d, onu_id %d\n",
405 in->key.packet_send_dest.u.itu_omci_channel.intf_id,
406 in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000407
Shad Ansari5fe93682018-04-26 05:24:19 +0000408 omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id);
409 omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
410 omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
Shad Ansari01b0e652018-04-05 21:02:53 +0000411
412 ind.set_allocated_omci_ind(omci_ind);
413 oltIndQ.push(ind);
414
415 return BCM_ERR_OK;
416}
417
Shad Ansari5fe93682018-04-26 05:24:19 +0000418bcmos_errno PacketIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000419 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000420 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
421 bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj;
422
Craig Lutgen967a1d02018-11-27 10:41:51 -0600423 uint32_t port_no = GetPortNum_(in->data.flow_id);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500424 pkt_ind->set_intf_type(bcmbal_to_grpc_intf_type(in->data.intf_type));
Shad Ansari5fe93682018-04-26 05:24:19 +0000425 pkt_ind->set_intf_id(in->data.intf_id);
426 pkt_ind->set_gemport_id(in->data.svc_port);
427 pkt_ind->set_flow_id(in->data.flow_id);
428 pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
Craig Lutgen967a1d02018-11-27 10:41:51 -0600429 pkt_ind->set_port_no(port_no);
430 pkt_ind->set_cookie(in->data.flow_cookie);
Shad Ansari5fe93682018-04-26 05:24:19 +0000431
432 ind.set_allocated_pkt_ind(pkt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500433
Craig Lutgenecd353a2018-12-12 22:33:17 -0600434 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 Lutgen967a1d02018-11-27 10:41:51 -0600435 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 Lutgen88a22ad2018-10-04 12:30:46 -0500436
Shad Ansari5fe93682018-04-26 05:24:19 +0000437 oltIndQ.push(ind);
438
Shad Ansari01b0e652018-04-05 21:02:53 +0000439 return BCM_ERR_OK;
440}
441
442bcmos_errno FlowOperIndication(bcmbal_obj *obj) {
443 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400444 BCM_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000445 return BCM_ERR_OK;
446}
447
448bcmos_errno FlowIndication(bcmbal_obj *obj) {
449 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400450 BCM_LOG(DEBUG, openolt_log_id, "flow indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000451 return BCM_ERR_OK;
452}
453
454bcmos_errno TmQIndication(bcmbal_obj *obj) {
455 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400456 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000457 return BCM_ERR_OK;
458}
459
460bcmos_errno TmSchedIndication(bcmbal_obj *obj) {
461 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400462 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000463 return BCM_ERR_OK;
464}
465
466bcmos_errno McastGroupIndication(bcmbal_obj *obj) {
467 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400468 BCM_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000469 return BCM_ERR_OK;
470}
471
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400472bcmos_errno OnuStartupFailureIndication(bcmbal_obj *obj) {
473 openolt::Indication ind;
474 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
475 openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication;
476
477 bcmbal_subscriber_terminal_key *key =
478 &(((bcmbal_subscriber_terminal_sufi*)obj)->key);
479
480 bcmbal_subscriber_terminal_sufi_data *data =
481 &(((bcmbal_subscriber_terminal_sufi*)obj)->data);
482
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400483 BCM_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
484 key->intf_id, key->sub_term_id, data->sufi_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400485
486 sufi_ind->set_intf_id(key->intf_id);
487 sufi_ind->set_onu_id(key->sub_term_id);
488 sufi_ind->set_status(alarm_status_to_string(data->sufi_status));
489
490 alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
491 ind.set_allocated_alarm_ind(alarm_ind);
492
493 oltIndQ.push(ind);
494 return BCM_ERR_OK;
495}
496
497bcmos_errno OnuSignalDegradeIndication(bcmbal_obj *obj) {
498 openolt::Indication ind;
499 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
500 openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication;
501
502 bcmbal_subscriber_terminal_key *key =
503 &(((bcmbal_subscriber_terminal_sdi*)obj)->key);
504
505 bcmbal_subscriber_terminal_sdi_data *data =
506 &(((bcmbal_subscriber_terminal_sdi*)obj)->data);
507
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400508 BCM_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
509 key->intf_id, key->sub_term_id, data->sdi_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400510
511 sdi_ind->set_intf_id(key->intf_id);
512 sdi_ind->set_onu_id(key->sub_term_id);
513 sdi_ind->set_status(alarm_status_to_string(data->sdi_status));
514 sdi_ind->set_inverse_bit_error_rate(data->ber);
515
516 alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind);
517 ind.set_allocated_alarm_ind(alarm_ind);
518
519 oltIndQ.push(ind);
520 return BCM_ERR_OK;
521}
522
523bcmos_errno OnuDriftOfWindowIndication(bcmbal_obj *obj) {
524 openolt::Indication ind;
525 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
526 openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication;
527
528 bcmbal_subscriber_terminal_key *key =
529 &(((bcmbal_subscriber_terminal_dowi*)obj)->key);
530
531 bcmbal_subscriber_terminal_dowi_data *data =
532 &(((bcmbal_subscriber_terminal_dowi*)obj)->data);
533
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400534 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",
535 key->intf_id, key->sub_term_id, data->dowi_status, data->drift_value, data->new_eqd);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400536
537 dowi_ind->set_intf_id(key->intf_id);
538 dowi_ind->set_onu_id(key->sub_term_id);
539 dowi_ind->set_status(alarm_status_to_string(data->dowi_status));
540 dowi_ind->set_drift(data->drift_value);
541 dowi_ind->set_new_eqd(data->new_eqd);
542
543 alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind);
544 ind.set_allocated_alarm_ind(alarm_ind);
545
546 oltIndQ.push(ind);
547 return BCM_ERR_OK;
548}
549
550bcmos_errno OnuLossOfOmciChannelIndication(bcmbal_obj *obj) {
551 openolt::Indication ind;
552 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
553 openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication;
554
555 bcmbal_subscriber_terminal_key *key =
556 &(((bcmbal_subscriber_terminal_looci*)obj)->key);
557
558 bcmbal_subscriber_terminal_looci_data *data =
559 &(((bcmbal_subscriber_terminal_looci*)obj)->data);
560
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400561 BCM_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
562 key->intf_id, key->sub_term_id, data->looci_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400563
564 looci_ind->set_intf_id(key->intf_id);
565 looci_ind->set_onu_id(key->sub_term_id);
566 looci_ind->set_status(alarm_status_to_string(data->looci_status));
567
568 alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
569 ind.set_allocated_alarm_ind(alarm_ind);
570
571 oltIndQ.push(ind);
572 return BCM_ERR_OK;
573}
574
575bcmos_errno OnuSignalsFailureIndication(bcmbal_obj *obj) {
576 openolt::Indication ind;
577 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
578 openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication;
579
580 bcmbal_subscriber_terminal_key *key =
581 &(((bcmbal_subscriber_terminal_sfi*)obj)->key);
582
583 bcmbal_subscriber_terminal_sfi_data *data =
584 &(((bcmbal_subscriber_terminal_sfi*)obj)->data);
585
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400586 BCM_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
587 key->intf_id, key->sub_term_id, data->sfi_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400588
589
590 sfi_ind->set_intf_id(key->intf_id);
591 sfi_ind->set_onu_id(key->sub_term_id);
592 sfi_ind->set_status(alarm_status_to_string(data->sfi_status));
593 sfi_ind->set_inverse_bit_error_rate(data->ber);
594
595 alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
596 ind.set_allocated_alarm_ind(alarm_ind);
597
598 oltIndQ.push(ind);
599 return BCM_ERR_OK;
600}
601
602bcmos_errno OnuTransmissionInterferenceWarningIndication(bcmbal_obj *obj) {
603 openolt::Indication ind;
604 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
605 openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning;
606
607 bcmbal_subscriber_terminal_key *key =
608 &(((bcmbal_subscriber_terminal_tiwi*)obj)->key);
609
610 bcmbal_subscriber_terminal_tiwi_data *data =
611 &(((bcmbal_subscriber_terminal_tiwi*)obj)->data);
612
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400613 BCM_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
614 key->intf_id, key->sub_term_id, data->tiwi_status, data->drift_value);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400615
616 tiwi_ind->set_intf_id(key->intf_id);
617 tiwi_ind->set_onu_id(key->sub_term_id);
618 tiwi_ind->set_status(alarm_status_to_string(data->tiwi_status));
619 tiwi_ind->set_drift(data->drift_value);
620
621 alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
622 ind.set_allocated_alarm_ind(alarm_ind);
623
624 oltIndQ.push(ind);
625 return BCM_ERR_OK;
626}
627
628bcmos_errno OnuActivationFailureIndication(bcmbal_obj *obj) {
629 openolt::Indication ind;
630 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
631 openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication;
632
633 bcmbal_subscriber_terminal_key *key =
634 &(((bcmbal_subscriber_terminal_sub_term_act_fail*)obj)->key);
635
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400636 BCM_LOG(WARNING, openolt_log_id, "onu activation failure indication, intf_id %d, onu_id %d\n",
637 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400638
639
640 activation_fail_ind->set_intf_id(key->intf_id);
641 activation_fail_ind->set_onu_id(key->sub_term_id);
642
643 alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
644 ind.set_allocated_alarm_ind(alarm_ind);
645
646 oltIndQ.push(ind);
647 return BCM_ERR_OK;
648}
649
650bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) {
651 openolt::Indication ind;
652 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
653 openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication;
654
655 bcmbal_subscriber_terminal_key *key =
656 &(((bcmbal_subscriber_terminal_processing_error*)obj)->key);
657
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400658 BCM_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n",
659 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400660
661
662 onu_proc_error_ind->set_intf_id(key->intf_id);
663 onu_proc_error_ind->set_onu_id(key->sub_term_id);
664
665 alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind);
666 ind.set_allocated_alarm_ind(alarm_ind);
667
668 oltIndQ.push(ind);
669 return BCM_ERR_OK;
670}
671
Shad Ansari01b0e652018-04-05 21:02:53 +0000672Status SubscribeIndication() {
673 bcmbal_cb_cfg cb_cfg = {};
674 uint16_t ind_subgroup;
675
676 if (subscribed) {
677 return Status::OK;
678 }
679
680 cb_cfg.module = BCMOS_MODULE_ID_NONE;
681
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500682 /* OLT device operational state change indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000683 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Shad Ansaricb004c52018-05-30 18:07:23 +0000684 ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000685 cb_cfg.p_subgroup = &ind_subgroup;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500686 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltOperIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000687 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500688 return Status(grpc::StatusCode::INTERNAL, "Olt operations state change indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000689 }
690
691 /* Interface LOS indication */
692 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
693 ind_subgroup = bcmbal_interface_auto_id_los;
694 cb_cfg.p_subgroup = &ind_subgroup;
695 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication;
696 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
697 return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
698 }
699
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700700 /* Interface indication */
701 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
702 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
703 cb_cfg.p_subgroup = &ind_subgroup;
704 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication;
705 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
706 return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed");
707 }
708
Shad Ansari01b0e652018-04-05 21:02:53 +0000709 /* Interface operational state change indication */
710 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
711 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
712 cb_cfg.p_subgroup = &ind_subgroup;
713 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication;
714 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
715 return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed");
716 }
717
718 /* onu alarm indication */
719 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
720 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
721 cb_cfg.p_subgroup = &ind_subgroup;
722 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication;
723 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
724 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
725 }
726
727 /* onu dying-gasp indication */
728 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
729 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
730 cb_cfg.p_subgroup = &ind_subgroup;
731 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication;
732 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
733 return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
734 }
735
736 /* onu discovery indication */
737 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
738 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
739 cb_cfg.p_subgroup = &ind_subgroup;
740 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication;
741 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
742 return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
743 }
744
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700745 /* onu indication */
746 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
747 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
748 cb_cfg.p_subgroup = &ind_subgroup;
749 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication;
750 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
751 return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
752 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000753 /* onu operational state change indication */
754 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
755 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
756 cb_cfg.p_subgroup = &ind_subgroup;
757 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication;
758 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
759 return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed");
760 }
761
Shad Ansari5fe93682018-04-26 05:24:19 +0000762 /* Packet (bearer) indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000763 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
764 ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
765 cb_cfg.p_subgroup = &ind_subgroup;
Shad Ansari5fe93682018-04-26 05:24:19 +0000766 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000767 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Shad Ansari5fe93682018-04-26 05:24:19 +0000768 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000769 }
770
771 /* Flow Operational State Change */
772 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
773 ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
774 cb_cfg.p_subgroup = &ind_subgroup;
775 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication;
776 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
777 return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed");
778 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000779#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000780 /* Flow Indication */
781 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
782 ind_subgroup = bcmbal_flow_auto_id_ind;
783 cb_cfg.p_subgroup = &ind_subgroup;
784 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication;
785 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
786 return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed");
787 }
788
789 /* TM queue indication */
790 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE;
791 ind_subgroup = bcmbal_tm_queue_auto_id_ind;
792 cb_cfg.p_subgroup = &ind_subgroup;
793 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication;
794 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
795 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
796 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000797#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000798
799 /* TM sched indication */
800 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
Shad Ansaricb004c52018-05-30 18:07:23 +0000801 ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000802 cb_cfg.p_subgroup = &ind_subgroup;
803 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication;
804 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
805 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
806 }
807
Shad Ansaricb004c52018-05-30 18:07:23 +0000808#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000809 /* Multicast group indication */
810 cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP;
811 ind_subgroup = bcmbal_group_auto_id_ind;
812 cb_cfg.p_subgroup = &ind_subgroup;
813 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication;
814 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
815 return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed");
816 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000817#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000818
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400819
820 /* ONU startup failure indication */
821 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
822 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi;
823 cb_cfg.p_subgroup = &ind_subgroup;
824 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuStartupFailureIndication;
825 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
826 return Status(grpc::StatusCode::INTERNAL, "onu startup failure indication subscribe failed");
827 }
828
829 /* SDI indication */
830 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
831 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi;
832 cb_cfg.p_subgroup = &ind_subgroup;
833 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalDegradeIndication;
834 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
835 return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed");
836 }
837
838 /* DOWI indication */
839 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
840 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi;
841 cb_cfg.p_subgroup = &ind_subgroup;
842 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDriftOfWindowIndication;
843 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
844 return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed");
845 }
846
847 /* LOOCI indication */
848 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
849 ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci;
850 cb_cfg.p_subgroup = &ind_subgroup;
851 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuLossOfOmciChannelIndication;
852 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
853 return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed");
854 }
855
856 /* SFI indication */
857 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
858 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi;
859 cb_cfg.p_subgroup = &ind_subgroup;
860 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalsFailureIndication;
861 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
862 return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed");
863 }
864
865 /* TIWI indication */
866 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
867 ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi;
868 cb_cfg.p_subgroup = &ind_subgroup;
869 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuTransmissionInterferenceWarningIndication;
870 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
871 return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed");
872 }
873
874 /* TIWI indication */
875 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
876 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail;
877 cb_cfg.p_subgroup = &ind_subgroup;
878 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuActivationFailureIndication;
879 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
880 return Status(grpc::StatusCode::INTERNAL, "onu activation falaire indication subscribe failed");
881 }
882
883 /* ONU processing error indication */
884 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
885 ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error;
886 cb_cfg.p_subgroup = &ind_subgroup;
887 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuProcessingErrorIndication;
888 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
889 return Status(grpc::StatusCode::INTERNAL, "onu processing error indication subscribe failed");
890 }
891
Shad Ansari01b0e652018-04-05 21:02:53 +0000892 subscribed = true;
893
894 return Status::OK;
895}