blob: 985c3512e60eae883ab55214efd6b8b4c0935634 [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;
40
41bcmos_errno OmciIndication(bcmbal_obj *obj);
42
Craig Lutgen88a22ad2018-10-04 12:30:46 -050043std::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
53bcmos_errno OltOperIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +000054 openolt::Indication ind;
55 openolt::OltIndication* olt_ind = new openolt::OltIndication;
56 Status status;
57
Shad Ansaricb004c52018-05-30 18:07:23 +000058 bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj;
Craig Lutgen88a22ad2018-10-04 12:30:46 -050059 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 Ansaricb004c52018-05-30 18:07:23 +000066 if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050067 // Determine device capabilities before transitionto acive state
68 ProbeDeviceCapabilities_();
Shad Ansari01b0e652018-04-05 21:02:53 +000069 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 Lutgen88a22ad2018-10-04 12:30:46 -050074
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 Ansari01b0e652018-04-05 21:02:53 +000079 oltIndQ.push(ind);
80
Craig Lutgen88a22ad2018-10-04 12:30:46 -050081 // Enable all PON interfaces.
82 //
83 for (int i = 0; i < NumPonIf_(); i++) {
Shad Ansari01b0e652018-04-05 21:02:53 +000084 status = EnablePonIf_(i);
85 if (!status.ok()) {
86 // FIXME - raise alarm to report error in enabling PON
87 }
88 }
89
Craig Lutgend0bae9b2018-10-18 18:02:07 -050090 // 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 Ansari01b0e652018-04-05 21:02:53 +000099 /* 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 Lutgen88a22ad2018-10-04 12:30:46 -0500113 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 Ansari01b0e652018-04-05 21:02:53 +0000121 return BCM_ERR_OK;
122}
123
124bcmos_errno LosIndication(bcmbal_obj *obj) {
125 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400126 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 Lutgen88a22ad2018-10-04 12:30:46 -0500133 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 Palpacuera32f4c32018-06-28 12:55:10 -0400135
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 Ansari01b0e652018-04-05 21:02:53 +0000143 return BCM_ERR_OK;
144}
145
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700146bcmos_errno IfIndication(bcmbal_obj *obj) {
147 openolt::Indication ind;
148 openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
149
150 BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
151 ((bcmbal_interface_oper_status_change *)obj)->key.intf_id );
152
153 intf_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id);
154 if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) {
155 intf_ind->set_oper_state("up");
156 } else {
157 intf_ind->set_oper_state("down");
158 }
159 ind.set_allocated_intf_ind(intf_ind);
160
161 oltIndQ.push(ind);
162
163 return BCM_ERR_OK;
164}
165
Shad Ansari01b0e652018-04-05 21:02:53 +0000166bcmos_errno IfOperIndication(bcmbal_obj *obj) {
167 openolt::Indication ind;
168 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500169 bcmbal_interface_oper_status_change* bcm_if_oper_ind = (bcmbal_interface_oper_status_change *) obj;
Shad Ansari01b0e652018-04-05 21:02:53 +0000170
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500171 intf_oper_ind->set_type(bcmbal_to_grpc_intf_type(bcm_if_oper_ind->key.intf_type));
172 intf_oper_ind->set_intf_id(bcm_if_oper_ind->key.intf_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000173
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500174 if (bcm_if_oper_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000175 intf_oper_ind->set_oper_state("up");
176 } else {
177 intf_oper_ind->set_oper_state("down");
178 }
179
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700180 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 -0500181 intf_oper_ind->type().c_str(),
182 bcm_if_oper_ind->key.intf_id,
183 intf_oper_ind->oper_state().c_str(),
184 bcm_if_oper_ind->data.admin_state);
185
Shad Ansari01b0e652018-04-05 21:02:53 +0000186 ind.set_allocated_intf_oper_ind(intf_oper_ind);
187
188 oltIndQ.push(ind);
189 return BCM_ERR_OK;
190}
191
192bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) {
193 openolt::Indication ind;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400194 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
195 openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication;
196
197 bcmbal_subscriber_terminal_key *key =
198 &((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->key;
199
200 bcmbal_subscriber_terminal_alarms *alarms =
201 &(((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->data.alarm);
202
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400203 BCM_LOG(WARNING, openolt_log_id, "onu alarm indication intf_id %d, onu_id %d, alarm: los %d, lob %d, lopc_miss %d, lopc_mic_error %d\n",
204 key->intf_id, key->sub_term_id, alarms->los, alarms->lob, alarms->lopc_miss, alarms->lopc_mic_error);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400205
206 onu_alarm_ind->set_intf_id(key->intf_id);
207 onu_alarm_ind->set_onu_id(key->sub_term_id);
208 onu_alarm_ind->set_los_status(alarm_status_to_string(alarms->los));
209 onu_alarm_ind->set_lob_status(alarm_status_to_string(alarms->lob));
210 onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(alarms->lopc_miss));
211 onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(alarms->lopc_mic_error));
212
213 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
214 ind.set_allocated_alarm_ind(alarm_ind);
215
216 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000217 return BCM_ERR_OK;
218}
219
220bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) {
221 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400222 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
223 openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication;
nickc063ffd2018-05-22 14:35:28 -0400224
225 bcmbal_subscriber_terminal_key *key =
226 &(((bcmbal_subscriber_terminal_dgi*)obj)->key);
227
228 bcmbal_subscriber_terminal_dgi_data *data =
229 &(((bcmbal_subscriber_terminal_dgi*)obj)->data);
230
231
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400232 BCM_LOG(WARNING, openolt_log_id, "onu dying-gasp indication, intf_id %d, onu_id %d, alarm %d\n",
233 key->intf_id, key->sub_term_id, data->dgi_status);
nickc063ffd2018-05-22 14:35:28 -0400234
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400235 dg_ind->set_intf_id(key->intf_id);
236 dg_ind->set_onu_id(key->sub_term_id);
237 dg_ind->set_status(alarm_status_to_string(data->dgi_status));
nickc063ffd2018-05-22 14:35:28 -0400238
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400239 alarm_ind->set_allocated_dying_gasp_ind(dg_ind);
240 ind.set_allocated_alarm_ind(alarm_ind);
nickc063ffd2018-05-22 14:35:28 -0400241
242 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000243 return BCM_ERR_OK;
244}
245
246bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) {
247 openolt::Indication ind;
248 openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
249 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
250
251 bcmbal_subscriber_terminal_key *key =
252 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key);
253
254 bcmbal_subscriber_terminal_sub_term_disc_data *data =
255 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data);
256
257 bcmbal_serial_number *in_serial_number = &(data->serial_number);
258
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400259 BCM_LOG(INFO, openolt_log_id, "onu discover indication, intf_id %d, serial_number %s\n",
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500260 key->intf_id, serial_number_to_str(in_serial_number).c_str());
Shad Ansari01b0e652018-04-05 21:02:53 +0000261
262 onu_disc_ind->set_intf_id(key->intf_id);
263 serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4);
264 serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8);
265 onu_disc_ind->set_allocated_serial_number(serial_number);
266 ind.set_allocated_onu_disc_ind(onu_disc_ind);
267
268 oltIndQ.push(ind);
269
270 return BCM_ERR_OK;
271}
272
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700273bcmos_errno OnuIndication(bcmbal_obj *obj) {
274 openolt::Indication ind;
275 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
276
277 bcmbal_subscriber_terminal_key *key =
278 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
279
280 bcmbal_subscriber_terminal_oper_status_change_data *data =
281 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
282
283 BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper_state %d, admin_state %d\n",
284 key->intf_id, key->sub_term_id, data->new_oper_status, data->admin_state);
285
286 onu_ind->set_intf_id(key->intf_id);
287 onu_ind->set_onu_id(key->sub_term_id);
288 if (data->new_oper_status == BCMBAL_STATUS_UP) {
289 onu_ind->set_oper_state("up");
290 } else {
291 onu_ind->set_oper_state("down");
292 }
293 if (data->admin_state == BCMBAL_STATE_UP) {
294 onu_ind->set_admin_state("up");
295 } else {
296 onu_ind->set_admin_state("down");
297 }
298
299 ind.set_allocated_onu_ind(onu_ind);
300
301 oltIndQ.push(ind);
302 return BCM_ERR_OK;
303}
304
Shad Ansari01b0e652018-04-05 21:02:53 +0000305bcmos_errno OnuOperIndication(bcmbal_obj *obj) {
306 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400307 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
nickc063ffd2018-05-22 14:35:28 -0400308
309 bcmbal_subscriber_terminal_key *key =
310 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
311
312 bcmbal_subscriber_terminal_oper_status_change_data *data =
313 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
314
nickc063ffd2018-05-22 14:35:28 -0400315 onu_ind->set_intf_id(key->intf_id);
316 onu_ind->set_onu_id(key->sub_term_id);
Craig Lutgen19512312018-11-02 10:14:46 -0500317 if (data->new_oper_status == BCMBAL_STATUS_UP) {
nickc063ffd2018-05-22 14:35:28 -0400318 onu_ind->set_oper_state("up");
319 } else {
320 onu_ind->set_oper_state("down");
321 }
322 if (data->admin_state == BCMBAL_STATE_UP) {
323 onu_ind->set_admin_state("up");
324 } else {
325 onu_ind->set_admin_state("down");
326 }
327
328 ind.set_allocated_onu_ind(onu_ind);
329
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500330 BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s, admin_state %s\n",
331 key->intf_id, key->sub_term_id, data->old_oper_status, onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str());
332
nickc063ffd2018-05-22 14:35:28 -0400333 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000334 return BCM_ERR_OK;
335}
336
337bcmos_errno OmciIndication(bcmbal_obj *obj) {
338 openolt::Indication ind;
339 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000340 bcmbal_packet_itu_omci_channel_rx *in =
Shad Ansari01b0e652018-04-05 21:02:53 +0000341 (bcmbal_packet_itu_omci_channel_rx *)obj;
342
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400343 BCM_LOG(DEBUG, omci_log_id, "OMCI indication: intf_id %d, onu_id %d\n",
344 in->key.packet_send_dest.u.itu_omci_channel.intf_id,
345 in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000346
Shad Ansari5fe93682018-04-26 05:24:19 +0000347 omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id);
348 omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
349 omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
Shad Ansari01b0e652018-04-05 21:02:53 +0000350
351 ind.set_allocated_omci_ind(omci_ind);
352 oltIndQ.push(ind);
353
354 return BCM_ERR_OK;
355}
356
Shad Ansari5fe93682018-04-26 05:24:19 +0000357bcmos_errno PacketIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000358 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000359 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
360 bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj;
361
Craig Lutgen967a1d02018-11-27 10:41:51 -0600362 uint32_t port_no = GetPortNum_(in->data.flow_id);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500363 pkt_ind->set_intf_type(bcmbal_to_grpc_intf_type(in->data.intf_type));
Shad Ansari5fe93682018-04-26 05:24:19 +0000364 pkt_ind->set_intf_id(in->data.intf_id);
365 pkt_ind->set_gemport_id(in->data.svc_port);
366 pkt_ind->set_flow_id(in->data.flow_id);
367 pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
Craig Lutgen967a1d02018-11-27 10:41:51 -0600368 pkt_ind->set_port_no(port_no);
369 pkt_ind->set_cookie(in->data.flow_cookie);
Shad Ansari5fe93682018-04-26 05:24:19 +0000370
371 ind.set_allocated_pkt_ind(pkt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500372
Craig Lutgen967a1d02018-11-27 10:41:51 -0600373 BCM_LOG(INFO, openolt_log_id, "packet indication, intf_type %s, intf_id %d, svc_port %d, flow_id %d port_no %d cookie %u\n",
374 pkt_ind->intf_type().c_str(), in->data.intf_id, in->data.svc_port, in->data.flow_id, port_no, in->data.flow_cookie);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500375
Shad Ansari5fe93682018-04-26 05:24:19 +0000376 oltIndQ.push(ind);
377
Shad Ansari01b0e652018-04-05 21:02:53 +0000378 return BCM_ERR_OK;
379}
380
381bcmos_errno FlowOperIndication(bcmbal_obj *obj) {
382 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400383 BCM_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000384 return BCM_ERR_OK;
385}
386
387bcmos_errno FlowIndication(bcmbal_obj *obj) {
388 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400389 BCM_LOG(DEBUG, openolt_log_id, "flow indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000390 return BCM_ERR_OK;
391}
392
393bcmos_errno TmQIndication(bcmbal_obj *obj) {
394 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400395 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000396 return BCM_ERR_OK;
397}
398
399bcmos_errno TmSchedIndication(bcmbal_obj *obj) {
400 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400401 BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000402 return BCM_ERR_OK;
403}
404
405bcmos_errno McastGroupIndication(bcmbal_obj *obj) {
406 openolt::Indication ind;
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400407 BCM_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
Shad Ansari01b0e652018-04-05 21:02:53 +0000408 return BCM_ERR_OK;
409}
410
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400411bcmos_errno OnuStartupFailureIndication(bcmbal_obj *obj) {
412 openolt::Indication ind;
413 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
414 openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication;
415
416 bcmbal_subscriber_terminal_key *key =
417 &(((bcmbal_subscriber_terminal_sufi*)obj)->key);
418
419 bcmbal_subscriber_terminal_sufi_data *data =
420 &(((bcmbal_subscriber_terminal_sufi*)obj)->data);
421
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400422 BCM_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
423 key->intf_id, key->sub_term_id, data->sufi_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400424
425 sufi_ind->set_intf_id(key->intf_id);
426 sufi_ind->set_onu_id(key->sub_term_id);
427 sufi_ind->set_status(alarm_status_to_string(data->sufi_status));
428
429 alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
430 ind.set_allocated_alarm_ind(alarm_ind);
431
432 oltIndQ.push(ind);
433 return BCM_ERR_OK;
434}
435
436bcmos_errno OnuSignalDegradeIndication(bcmbal_obj *obj) {
437 openolt::Indication ind;
438 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
439 openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication;
440
441 bcmbal_subscriber_terminal_key *key =
442 &(((bcmbal_subscriber_terminal_sdi*)obj)->key);
443
444 bcmbal_subscriber_terminal_sdi_data *data =
445 &(((bcmbal_subscriber_terminal_sdi*)obj)->data);
446
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400447 BCM_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
448 key->intf_id, key->sub_term_id, data->sdi_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400449
450 sdi_ind->set_intf_id(key->intf_id);
451 sdi_ind->set_onu_id(key->sub_term_id);
452 sdi_ind->set_status(alarm_status_to_string(data->sdi_status));
453 sdi_ind->set_inverse_bit_error_rate(data->ber);
454
455 alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind);
456 ind.set_allocated_alarm_ind(alarm_ind);
457
458 oltIndQ.push(ind);
459 return BCM_ERR_OK;
460}
461
462bcmos_errno OnuDriftOfWindowIndication(bcmbal_obj *obj) {
463 openolt::Indication ind;
464 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
465 openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication;
466
467 bcmbal_subscriber_terminal_key *key =
468 &(((bcmbal_subscriber_terminal_dowi*)obj)->key);
469
470 bcmbal_subscriber_terminal_dowi_data *data =
471 &(((bcmbal_subscriber_terminal_dowi*)obj)->data);
472
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400473 BCM_LOG(WARNING, openolt_log_id, "onu drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n",
474 key->intf_id, key->sub_term_id, data->dowi_status, data->drift_value, data->new_eqd);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400475
476 dowi_ind->set_intf_id(key->intf_id);
477 dowi_ind->set_onu_id(key->sub_term_id);
478 dowi_ind->set_status(alarm_status_to_string(data->dowi_status));
479 dowi_ind->set_drift(data->drift_value);
480 dowi_ind->set_new_eqd(data->new_eqd);
481
482 alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind);
483 ind.set_allocated_alarm_ind(alarm_ind);
484
485 oltIndQ.push(ind);
486 return BCM_ERR_OK;
487}
488
489bcmos_errno OnuLossOfOmciChannelIndication(bcmbal_obj *obj) {
490 openolt::Indication ind;
491 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
492 openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication;
493
494 bcmbal_subscriber_terminal_key *key =
495 &(((bcmbal_subscriber_terminal_looci*)obj)->key);
496
497 bcmbal_subscriber_terminal_looci_data *data =
498 &(((bcmbal_subscriber_terminal_looci*)obj)->data);
499
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400500 BCM_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
501 key->intf_id, key->sub_term_id, data->looci_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400502
503 looci_ind->set_intf_id(key->intf_id);
504 looci_ind->set_onu_id(key->sub_term_id);
505 looci_ind->set_status(alarm_status_to_string(data->looci_status));
506
507 alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
508 ind.set_allocated_alarm_ind(alarm_ind);
509
510 oltIndQ.push(ind);
511 return BCM_ERR_OK;
512}
513
514bcmos_errno OnuSignalsFailureIndication(bcmbal_obj *obj) {
515 openolt::Indication ind;
516 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
517 openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication;
518
519 bcmbal_subscriber_terminal_key *key =
520 &(((bcmbal_subscriber_terminal_sfi*)obj)->key);
521
522 bcmbal_subscriber_terminal_sfi_data *data =
523 &(((bcmbal_subscriber_terminal_sfi*)obj)->data);
524
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400525 BCM_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
526 key->intf_id, key->sub_term_id, data->sfi_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400527
528
529 sfi_ind->set_intf_id(key->intf_id);
530 sfi_ind->set_onu_id(key->sub_term_id);
531 sfi_ind->set_status(alarm_status_to_string(data->sfi_status));
532 sfi_ind->set_inverse_bit_error_rate(data->ber);
533
534 alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
535 ind.set_allocated_alarm_ind(alarm_ind);
536
537 oltIndQ.push(ind);
538 return BCM_ERR_OK;
539}
540
541bcmos_errno OnuTransmissionInterferenceWarningIndication(bcmbal_obj *obj) {
542 openolt::Indication ind;
543 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
544 openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning;
545
546 bcmbal_subscriber_terminal_key *key =
547 &(((bcmbal_subscriber_terminal_tiwi*)obj)->key);
548
549 bcmbal_subscriber_terminal_tiwi_data *data =
550 &(((bcmbal_subscriber_terminal_tiwi*)obj)->data);
551
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400552 BCM_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
553 key->intf_id, key->sub_term_id, data->tiwi_status, data->drift_value);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400554
555 tiwi_ind->set_intf_id(key->intf_id);
556 tiwi_ind->set_onu_id(key->sub_term_id);
557 tiwi_ind->set_status(alarm_status_to_string(data->tiwi_status));
558 tiwi_ind->set_drift(data->drift_value);
559
560 alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
561 ind.set_allocated_alarm_ind(alarm_ind);
562
563 oltIndQ.push(ind);
564 return BCM_ERR_OK;
565}
566
567bcmos_errno OnuActivationFailureIndication(bcmbal_obj *obj) {
568 openolt::Indication ind;
569 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
570 openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication;
571
572 bcmbal_subscriber_terminal_key *key =
573 &(((bcmbal_subscriber_terminal_sub_term_act_fail*)obj)->key);
574
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400575 BCM_LOG(WARNING, openolt_log_id, "onu activation failure indication, intf_id %d, onu_id %d\n",
576 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400577
578
579 activation_fail_ind->set_intf_id(key->intf_id);
580 activation_fail_ind->set_onu_id(key->sub_term_id);
581
582 alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
583 ind.set_allocated_alarm_ind(alarm_ind);
584
585 oltIndQ.push(ind);
586 return BCM_ERR_OK;
587}
588
589bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) {
590 openolt::Indication ind;
591 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
592 openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication;
593
594 bcmbal_subscriber_terminal_key *key =
595 &(((bcmbal_subscriber_terminal_processing_error*)obj)->key);
596
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400597 BCM_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n",
598 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400599
600
601 onu_proc_error_ind->set_intf_id(key->intf_id);
602 onu_proc_error_ind->set_onu_id(key->sub_term_id);
603
604 alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind);
605 ind.set_allocated_alarm_ind(alarm_ind);
606
607 oltIndQ.push(ind);
608 return BCM_ERR_OK;
609}
610
Shad Ansari01b0e652018-04-05 21:02:53 +0000611Status SubscribeIndication() {
612 bcmbal_cb_cfg cb_cfg = {};
613 uint16_t ind_subgroup;
614
615 if (subscribed) {
616 return Status::OK;
617 }
618
619 cb_cfg.module = BCMOS_MODULE_ID_NONE;
620
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500621 /* OLT device operational state change indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000622 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Shad Ansaricb004c52018-05-30 18:07:23 +0000623 ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000624 cb_cfg.p_subgroup = &ind_subgroup;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500625 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltOperIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000626 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500627 return Status(grpc::StatusCode::INTERNAL, "Olt operations state change indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000628 }
629
630 /* Interface LOS indication */
631 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
632 ind_subgroup = bcmbal_interface_auto_id_los;
633 cb_cfg.p_subgroup = &ind_subgroup;
634 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication;
635 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
636 return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
637 }
638
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700639 /* Interface indication */
640 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
641 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
642 cb_cfg.p_subgroup = &ind_subgroup;
643 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication;
644 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
645 return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed");
646 }
647
Shad Ansari01b0e652018-04-05 21:02:53 +0000648 /* Interface operational state change indication */
649 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
650 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
651 cb_cfg.p_subgroup = &ind_subgroup;
652 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication;
653 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
654 return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed");
655 }
656
657 /* onu alarm indication */
658 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
659 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
660 cb_cfg.p_subgroup = &ind_subgroup;
661 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication;
662 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
663 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
664 }
665
666 /* onu dying-gasp indication */
667 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
668 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
669 cb_cfg.p_subgroup = &ind_subgroup;
670 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication;
671 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
672 return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
673 }
674
675 /* onu discovery indication */
676 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
677 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
678 cb_cfg.p_subgroup = &ind_subgroup;
679 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication;
680 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
681 return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
682 }
683
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700684 /* onu indication */
685 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
686 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
687 cb_cfg.p_subgroup = &ind_subgroup;
688 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication;
689 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
690 return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
691 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000692 /* onu operational state change indication */
693 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
694 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
695 cb_cfg.p_subgroup = &ind_subgroup;
696 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication;
697 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
698 return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed");
699 }
700
Shad Ansari5fe93682018-04-26 05:24:19 +0000701 /* Packet (bearer) indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000702 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
703 ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
704 cb_cfg.p_subgroup = &ind_subgroup;
Shad Ansari5fe93682018-04-26 05:24:19 +0000705 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000706 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Shad Ansari5fe93682018-04-26 05:24:19 +0000707 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000708 }
709
710 /* Flow Operational State Change */
711 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
712 ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
713 cb_cfg.p_subgroup = &ind_subgroup;
714 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication;
715 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
716 return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed");
717 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000718#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000719 /* Flow Indication */
720 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
721 ind_subgroup = bcmbal_flow_auto_id_ind;
722 cb_cfg.p_subgroup = &ind_subgroup;
723 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication;
724 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
725 return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed");
726 }
727
728 /* TM queue indication */
729 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE;
730 ind_subgroup = bcmbal_tm_queue_auto_id_ind;
731 cb_cfg.p_subgroup = &ind_subgroup;
732 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication;
733 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
734 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
735 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000736#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000737
738 /* TM sched indication */
739 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
Shad Ansaricb004c52018-05-30 18:07:23 +0000740 ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000741 cb_cfg.p_subgroup = &ind_subgroup;
742 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication;
743 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
744 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
745 }
746
Shad Ansaricb004c52018-05-30 18:07:23 +0000747#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000748 /* Multicast group indication */
749 cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP;
750 ind_subgroup = bcmbal_group_auto_id_ind;
751 cb_cfg.p_subgroup = &ind_subgroup;
752 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication;
753 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
754 return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed");
755 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000756#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000757
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400758
759 /* ONU startup failure indication */
760 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
761 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi;
762 cb_cfg.p_subgroup = &ind_subgroup;
763 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuStartupFailureIndication;
764 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
765 return Status(grpc::StatusCode::INTERNAL, "onu startup failure indication subscribe failed");
766 }
767
768 /* SDI indication */
769 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
770 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi;
771 cb_cfg.p_subgroup = &ind_subgroup;
772 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalDegradeIndication;
773 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
774 return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed");
775 }
776
777 /* DOWI indication */
778 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
779 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi;
780 cb_cfg.p_subgroup = &ind_subgroup;
781 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDriftOfWindowIndication;
782 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
783 return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed");
784 }
785
786 /* LOOCI indication */
787 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
788 ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci;
789 cb_cfg.p_subgroup = &ind_subgroup;
790 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuLossOfOmciChannelIndication;
791 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
792 return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed");
793 }
794
795 /* SFI indication */
796 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
797 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi;
798 cb_cfg.p_subgroup = &ind_subgroup;
799 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalsFailureIndication;
800 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
801 return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed");
802 }
803
804 /* TIWI indication */
805 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
806 ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi;
807 cb_cfg.p_subgroup = &ind_subgroup;
808 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuTransmissionInterferenceWarningIndication;
809 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
810 return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed");
811 }
812
813 /* TIWI indication */
814 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
815 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail;
816 cb_cfg.p_subgroup = &ind_subgroup;
817 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuActivationFailureIndication;
818 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
819 return Status(grpc::StatusCode::INTERNAL, "onu activation falaire indication subscribe failed");
820 }
821
822 /* ONU processing error indication */
823 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
824 ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error;
825 cb_cfg.p_subgroup = &ind_subgroup;
826 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuProcessingErrorIndication;
827 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
828 return Status(grpc::StatusCode::INTERNAL, "onu processing error indication subscribe failed");
829 }
830
Shad Ansari01b0e652018-04-05 21:02:53 +0000831 subscribed = true;
832
833 return Status::OK;
834}