blob: 30a04ab63ad13148f4ccb0b590c2d1cd208baca0 [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
54bcmos_errno OltOperIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +000055 openolt::Indication ind;
56 openolt::OltIndication* olt_ind = new openolt::OltIndication;
57 Status status;
58
Shad Ansaricb004c52018-05-30 18:07:23 +000059 bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj;
Craig Lutgen88a22ad2018-10-04 12:30:46 -050060 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 Ansaricb004c52018-05-30 18:07:23 +000067 if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050068 // Determine device capabilities before transitionto acive state
69 ProbeDeviceCapabilities_();
Shad Ansari01b0e652018-04-05 21:02:53 +000070 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 Lutgen88a22ad2018-10-04 12:30:46 -050075
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 Ansari01b0e652018-04-05 21:02:53 +000080 oltIndQ.push(ind);
81
Craig Lutgen88a22ad2018-10-04 12:30:46 -050082 // Enable all PON interfaces.
83 //
84 for (int i = 0; i < NumPonIf_(); i++) {
Shad Ansari01b0e652018-04-05 21:02:53 +000085 status = EnablePonIf_(i);
86 if (!status.ok()) {
87 // FIXME - raise alarm to report error in enabling PON
88 }
89 }
90
Craig Lutgend0bae9b2018-10-18 18:02:07 -050091 // 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 Ansari01b0e652018-04-05 21:02:53 +0000100 /* 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 Lutgen88a22ad2018-10-04 12:30:46 -0500114 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 Ansari01b0e652018-04-05 21:02:53 +0000122 return BCM_ERR_OK;
123}
124
125bcmos_errno LosIndication(bcmbal_obj *obj) {
126 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400127 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 Lutgen88a22ad2018-10-04 12:30:46 -0500134 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 Palpacuera32f4c32018-06-28 12:55:10 -0400136
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 Ansari01b0e652018-04-05 21:02:53 +0000144 return BCM_ERR_OK;
145}
146
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700147bcmos_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 Ansari01b0e652018-04-05 21:02:53 +0000167bcmos_errno IfOperIndication(bcmbal_obj *obj) {
168 openolt::Indication ind;
169 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500170 bcmbal_interface_oper_status_change* bcm_if_oper_ind = (bcmbal_interface_oper_status_change *) obj;
Shad Ansari01b0e652018-04-05 21:02:53 +0000171
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500172 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 Ansari01b0e652018-04-05 21:02:53 +0000174
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500175 if (bcm_if_oper_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000176 intf_oper_ind->set_oper_state("up");
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -0800177 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 Ansari01b0e652018-04-05 21:02:53 +0000180 } else {
181 intf_oper_ind->set_oper_state("down");
182 }
183
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700184 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 -0500185 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 Ansari01b0e652018-04-05 21:02:53 +0000190 ind.set_allocated_intf_oper_ind(intf_oper_ind);
191
192 oltIndQ.push(ind);
193 return BCM_ERR_OK;
194}
195
196bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) {
197 openolt::Indication ind;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400198 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 Palpacuer967438f2018-09-07 14:41:54 -0400207 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 Palpacuerde4325b2018-07-03 11:18:42 -0400209
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 Ansari01b0e652018-04-05 21:02:53 +0000221 return BCM_ERR_OK;
222}
223
224bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) {
225 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400226 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
227 openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication;
nickc063ffd2018-05-22 14:35:28 -0400228
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 Palpacuer967438f2018-09-07 14:41:54 -0400236 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);
nickc063ffd2018-05-22 14:35:28 -0400238
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400239 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));
nickc063ffd2018-05-22 14:35:28 -0400242
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400243 alarm_ind->set_allocated_dying_gasp_ind(dg_ind);
244 ind.set_allocated_alarm_ind(alarm_ind);
nickc063ffd2018-05-22 14:35:28 -0400245
246 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000247 return BCM_ERR_OK;
248}
249
250bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400263 BCM_LOG(INFO, openolt_log_id, "onu discover indication, intf_id %d, serial_number %s\n",
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500264 key->intf_id, serial_number_to_str(in_serial_number).c_str());
Shad Ansari01b0e652018-04-05 21:02:53 +0000265
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 Gowdru7c4ec2d2018-10-25 00:29:54 -0700277bcmos_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 Ansari01b0e652018-04-05 21:02:53 +0000309bcmos_errno OnuOperIndication(bcmbal_obj *obj) {
310 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400311 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
nickc063ffd2018-05-22 14:35:28 -0400312
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
nickc063ffd2018-05-22 14:35:28 -0400319 onu_ind->set_intf_id(key->intf_id);
320 onu_ind->set_onu_id(key->sub_term_id);
Craig Lutgen19512312018-11-02 10:14:46 -0500321 if (data->new_oper_status == BCMBAL_STATUS_UP) {
nickc063ffd2018-05-22 14:35:28 -0400322 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 Lutgen88a22ad2018-10-04 12:30:46 -0500334 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
nickc063ffd2018-05-22 14:35:28 -0400337 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000338 return BCM_ERR_OK;
339}
340
341bcmos_errno OmciIndication(bcmbal_obj *obj) {
342 openolt::Indication ind;
343 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000344 bcmbal_packet_itu_omci_channel_rx *in =
Shad Ansari01b0e652018-04-05 21:02:53 +0000345 (bcmbal_packet_itu_omci_channel_rx *)obj;
346
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400347 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 Ansari01b0e652018-04-05 21:02:53 +0000350
Shad Ansari5fe93682018-04-26 05:24:19 +0000351 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 Ansari01b0e652018-04-05 21:02:53 +0000354
355 ind.set_allocated_omci_ind(omci_ind);
356 oltIndQ.push(ind);
357
358 return BCM_ERR_OK;
359}
360
Shad Ansari5fe93682018-04-26 05:24:19 +0000361bcmos_errno PacketIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000362 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000363 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
364 bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj;
365
Craig Lutgen967a1d02018-11-27 10:41:51 -0600366 uint32_t port_no = GetPortNum_(in->data.flow_id);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500367 pkt_ind->set_intf_type(bcmbal_to_grpc_intf_type(in->data.intf_type));
Shad Ansari5fe93682018-04-26 05:24:19 +0000368 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 Lutgen967a1d02018-11-27 10:41:51 -0600372 pkt_ind->set_port_no(port_no);
373 pkt_ind->set_cookie(in->data.flow_cookie);
Shad Ansari5fe93682018-04-26 05:24:19 +0000374
375 ind.set_allocated_pkt_ind(pkt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500376
Craig Lutgenecd353a2018-12-12 22:33:17 -0600377 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 -0600378 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 -0500379
Shad Ansari5fe93682018-04-26 05:24:19 +0000380 oltIndQ.push(ind);
381
Shad Ansari01b0e652018-04-05 21:02:53 +0000382 return BCM_ERR_OK;
383}
384
385bcmos_errno FlowOperIndication(bcmbal_obj *obj) {
386 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400387 BCM_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000388 return BCM_ERR_OK;
389}
390
391bcmos_errno FlowIndication(bcmbal_obj *obj) {
392 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400393 BCM_LOG(DEBUG, openolt_log_id, "flow indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000394 return BCM_ERR_OK;
395}
396
397bcmos_errno TmQIndication(bcmbal_obj *obj) {
398 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400399 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000400 return BCM_ERR_OK;
401}
402
403bcmos_errno TmSchedIndication(bcmbal_obj *obj) {
404 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400405 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000406 return BCM_ERR_OK;
407}
408
409bcmos_errno McastGroupIndication(bcmbal_obj *obj) {
410 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400411 BCM_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000412 return BCM_ERR_OK;
413}
414
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400415bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400426 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 Palpacuerde4325b2018-07-03 11:18:42 -0400428
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
440bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400451 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 Palpacuerde4325b2018-07-03 11:18:42 -0400453
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
466bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400477 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 Palpacuerde4325b2018-07-03 11:18:42 -0400479
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
493bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400504 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 Palpacuerde4325b2018-07-03 11:18:42 -0400506
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
518bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400529 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 Palpacuerde4325b2018-07-03 11:18:42 -0400531
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
545bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400556 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 Palpacuerde4325b2018-07-03 11:18:42 -0400558
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
571bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400579 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 Palpacuerde4325b2018-07-03 11:18:42 -0400581
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
593bcmos_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 Palpacuer967438f2018-09-07 14:41:54 -0400601 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 Palpacuerde4325b2018-07-03 11:18:42 -0400603
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 Ansari01b0e652018-04-05 21:02:53 +0000615Status 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 Lutgen88a22ad2018-10-04 12:30:46 -0500625 /* OLT device operational state change indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000626 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Shad Ansaricb004c52018-05-30 18:07:23 +0000627 ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000628 cb_cfg.p_subgroup = &ind_subgroup;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500629 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltOperIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000630 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500631 return Status(grpc::StatusCode::INTERNAL, "Olt operations state change indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000632 }
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 Gowdru7c4ec2d2018-10-25 00:29:54 -0700643 /* 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 Ansari01b0e652018-04-05 21:02:53 +0000652 /* 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 Gowdru7c4ec2d2018-10-25 00:29:54 -0700688 /* 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 Ansari01b0e652018-04-05 21:02:53 +0000696 /* 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 Ansari5fe93682018-04-26 05:24:19 +0000705 /* Packet (bearer) indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000706 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 Ansari5fe93682018-04-26 05:24:19 +0000709 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000710 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Shad Ansari5fe93682018-04-26 05:24:19 +0000711 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000712 }
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 Ansaricb004c52018-05-30 18:07:23 +0000722#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000723 /* 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 Ansaricb004c52018-05-30 18:07:23 +0000740#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000741
742 /* TM sched indication */
743 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
Shad Ansaricb004c52018-05-30 18:07:23 +0000744 ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000745 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 Ansaricb004c52018-05-30 18:07:23 +0000751#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000752 /* 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 Ansaricb004c52018-05-30 18:07:23 +0000760#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000761
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400762
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 Ansari01b0e652018-04-05 21:02:53 +0000835 subscribed = true;
836
837 return Status::OK;
838}