blob: 3f49fcb7e9fff16c1caf3796a3aac833de6b258a [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"
Shad Ansari01b0e652018-04-05 21:02:53 +000021extern "C"
22{
23#include <bcmos_system.h>
24#include <bal_api.h>
25#include <bal_api_end.h>
26}
27
28using grpc::Status;
29
30Queue<openolt::Indication> oltIndQ;
31//Queue<openolt::Indication*> oltIndQ;
32
33bool subscribed = false;
34
35bcmos_errno OmciIndication(bcmbal_obj *obj);
36
37bcmos_errno OltIndication(bcmbal_obj *obj) {
38 openolt::Indication ind;
39 openolt::OltIndication* olt_ind = new openolt::OltIndication;
40 Status status;
41
Shad Ansaricb004c52018-05-30 18:07:23 +000042 bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj;
43 if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
Shad Ansari01b0e652018-04-05 21:02:53 +000044 olt_ind->set_oper_state("up");
Nicolas Palpacuer0f19b1a2018-06-07 17:29:31 -040045 start_collecting_statistics();
Shad Ansari01b0e652018-04-05 21:02:53 +000046 } else {
47 olt_ind->set_oper_state("down");
Nicolas Palpacuer0f19b1a2018-06-07 17:29:31 -040048 stop_collecting_statistics();
Shad Ansari01b0e652018-04-05 21:02:53 +000049 }
50 ind.set_allocated_olt_ind(olt_ind);
51 std::cout << "olt indication, oper_state:" << ind.olt_ind().oper_state() << std::endl;
52 oltIndQ.push(ind);
53
Shad Ansaricb004c52018-05-30 18:07:23 +000054#define MAX_SUPPORTED_INTF 16
Shad Ansari01b0e652018-04-05 21:02:53 +000055 // Enable all PON interfaces.
56 for (int i = 0; i < MAX_SUPPORTED_INTF; i++) {
57 status = EnablePonIf_(i);
58 if (!status.ok()) {
59 // FIXME - raise alarm to report error in enabling PON
60 }
61 }
62
63 /* register for omci indication */
64 {
65 bcmbal_cb_cfg cb_cfg = {};
66 uint16_t ind_subgroup;
67
68 cb_cfg.module = BCMOS_MODULE_ID_NONE;
69 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
70 ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx);
71 cb_cfg.p_object_key_info = NULL;
72 cb_cfg.p_subgroup = &ind_subgroup;
73 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OmciIndication;
74 bcmbal_subscribe_ind(0, &cb_cfg);
75 }
76
77 return BCM_ERR_OK;
78}
79
80bcmos_errno LosIndication(bcmbal_obj *obj) {
81 openolt::Indication ind;
82 std::cout << "LOS indication " << std::endl;
83 return BCM_ERR_OK;
84}
85
86bcmos_errno IfIndication(bcmbal_obj *obj) {
87 openolt::Indication ind;
88 openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
89
90 std::cout << "intf indication, intf_id:"
Shad Ansaricb004c52018-05-30 18:07:23 +000091 << ((bcmbal_interface_oper_status_change *)obj)->key.intf_id << std::endl;
Shad Ansari01b0e652018-04-05 21:02:53 +000092
Shad Ansaricb004c52018-05-30 18:07:23 +000093 intf_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id);
94 if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) {
Shad Ansari01b0e652018-04-05 21:02:53 +000095 intf_ind->set_oper_state("up");
96 } else {
97 intf_ind->set_oper_state("down");
98 }
99 ind.set_allocated_intf_ind(intf_ind);
100
101 oltIndQ.push(ind);
102
103 return BCM_ERR_OK;
104}
105
106bcmos_errno IfOperIndication(bcmbal_obj *obj) {
107 openolt::Indication ind;
108 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
109 std::cout << "intf oper state indication, intf_id:"
nickc063ffd2018-05-22 14:35:28 -0400110 << ((bcmbal_interface_oper_status_change *)obj)->key.intf_id
Shad Ansari01b0e652018-04-05 21:02:53 +0000111 << " type:" << ((bcmbal_interface_oper_status_change *)obj)->key.intf_type
112 << " oper_state:" << ((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status
113 << " admin_state:" << ((bcmbal_interface_oper_status_change *)obj)->data.admin_state
114 << std::endl;
115
116 intf_oper_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id);
117
118 if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_NNI) {
119 intf_oper_ind->set_type("nni");
120 } else if (((bcmbal_interface_oper_status_change *)obj)->key.intf_type == BCMBAL_INTF_TYPE_PON) {
121 intf_oper_ind->set_type("pon");
122 } else {
123 intf_oper_ind->set_type("unknown");
124 }
125
126 if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) {
127 intf_oper_ind->set_oper_state("up");
128 } else {
129 intf_oper_ind->set_oper_state("down");
130 }
131
132 ind.set_allocated_intf_oper_ind(intf_oper_ind);
133
134 oltIndQ.push(ind);
135 return BCM_ERR_OK;
136}
137
138bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) {
139 openolt::Indication ind;
140 std::cout << "onu alarm indication" << std::endl;
141 return BCM_ERR_OK;
142}
143
144bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) {
145 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400146 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
147 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
148
149 bcmbal_subscriber_terminal_key *key =
150 &(((bcmbal_subscriber_terminal_dgi*)obj)->key);
151
152 bcmbal_subscriber_terminal_dgi_data *data =
153 &(((bcmbal_subscriber_terminal_dgi*)obj)->data);
154
155
156 std::cout << "onu dying-gasp indication, intf_id:"
157 << key->intf_id
158 << ", onu_id:"
159 << key->sub_term_id
160 << ", alarm: "
161 << data->dgi_status << std::endl;
162
163 onu_ind->set_intf_id(key->intf_id);
164 onu_ind->set_onu_id(key->sub_term_id);
165 const char* zeros4 = "0000";
166 const char* zeros8 = "00000000";
167 serial_number->set_vendor_id(zeros4);
168 serial_number->set_vendor_specific(zeros8);
169 onu_ind->set_allocated_serial_number(serial_number);
170 //ONU is dying, set operating state to down
171 onu_ind->set_oper_state("down");
172 //TODO: set admin state to unknow ? For now assume that it is up otherwise
173 //we would not have received the alarm
174 onu_ind->set_admin_state("up");
175
176
177 ind.set_allocated_onu_ind(onu_ind);
178
179 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000180 return BCM_ERR_OK;
181}
182
183bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) {
184 openolt::Indication ind;
185 openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
186 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
187
188 bcmbal_subscriber_terminal_key *key =
189 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key);
190
191 bcmbal_subscriber_terminal_sub_term_disc_data *data =
192 &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data);
193
194 bcmbal_serial_number *in_serial_number = &(data->serial_number);
195
196 std::cout << "onu discover indication, intf_id:"
197 << key->intf_id
198 << " serial_number:"
199 << serial_number_to_str(in_serial_number) << std::endl;
200
201 onu_disc_ind->set_intf_id(key->intf_id);
202 serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4);
203 serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8);
204 onu_disc_ind->set_allocated_serial_number(serial_number);
205 ind.set_allocated_onu_disc_ind(onu_disc_ind);
206
207 oltIndQ.push(ind);
208
209 return BCM_ERR_OK;
210}
211
212bcmos_errno OnuIndication(bcmbal_obj *obj) {
213 openolt::Indication ind;
214 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000215
216 bcmbal_subscriber_terminal_key *key =
Shad Ansaricb004c52018-05-30 18:07:23 +0000217 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
Shad Ansari01b0e652018-04-05 21:02:53 +0000218
Shad Ansaricb004c52018-05-30 18:07:23 +0000219 bcmbal_subscriber_terminal_oper_status_change_data *data =
220 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
Shad Ansari01b0e652018-04-05 21:02:53 +0000221
222 std::cout << "onu indication, intf_id:"
223 << key->intf_id
Shad Ansaricb004c52018-05-30 18:07:23 +0000224 << " oper_state:" << data->new_oper_status
225 << " admin_state:" << data->admin_state
226 << " onu_id:" << key->sub_term_id << std::endl;
Shad Ansari01b0e652018-04-05 21:02:53 +0000227
228 onu_ind->set_intf_id(key->intf_id);
229 onu_ind->set_onu_id(key->sub_term_id);
Shad Ansaricb004c52018-05-30 18:07:23 +0000230 if (data->new_oper_status == BCMBAL_STATE_UP) {
nickc063ffd2018-05-22 14:35:28 -0400231 onu_ind->set_oper_state("up");
232 } else {
233 onu_ind->set_oper_state("down");
234 }
235 if (data->admin_state == BCMBAL_STATE_UP) {
236 onu_ind->set_admin_state("up");
237 } else {
238 onu_ind->set_admin_state("down");
239 }
240
Shad Ansari01b0e652018-04-05 21:02:53 +0000241 ind.set_allocated_onu_ind(onu_ind);
242
243 oltIndQ.push(ind);
244 return BCM_ERR_OK;
245}
246
247bcmos_errno OnuOperIndication(bcmbal_obj *obj) {
248 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400249 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
250 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
251
252 bcmbal_subscriber_terminal_key *key =
253 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
254
255 bcmbal_subscriber_terminal_oper_status_change_data *data =
256 &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
257
258
259 std::cout << "onu oper state indication, intf_id:"
260 << key->intf_id
261 << " onu_id: "
262 << key->sub_term_id
263 << " old oper state: "
264 << data->old_oper_status
265 << " new oper state:"
266 << data->new_oper_status << std::endl;
267
268 onu_ind->set_intf_id(key->intf_id);
269 onu_ind->set_onu_id(key->sub_term_id);
270 const char* zeros4 = "0000";
271 const char* zeros8 = "00000000";
272 serial_number->set_vendor_id(zeros4);
273 serial_number->set_vendor_specific(zeros8);
274 onu_ind->set_allocated_serial_number(serial_number);
275 if (data->new_oper_status == BCMBAL_STATE_UP) {
276 onu_ind->set_oper_state("up");
277 } else {
278 onu_ind->set_oper_state("down");
279 }
280 if (data->admin_state == BCMBAL_STATE_UP) {
281 onu_ind->set_admin_state("up");
282 } else {
283 onu_ind->set_admin_state("down");
284 }
285
286 ind.set_allocated_onu_ind(onu_ind);
287
288 oltIndQ.push(ind);
Shad Ansari01b0e652018-04-05 21:02:53 +0000289 return BCM_ERR_OK;
290}
291
292bcmos_errno OmciIndication(bcmbal_obj *obj) {
293 openolt::Indication ind;
294 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000295 bcmbal_packet_itu_omci_channel_rx *in =
Shad Ansari01b0e652018-04-05 21:02:53 +0000296 (bcmbal_packet_itu_omci_channel_rx *)obj;
297
298 std::cout << "omci indication" << std::endl;
299
Shad Ansari5fe93682018-04-26 05:24:19 +0000300 omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id);
301 omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
302 omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
Shad Ansari01b0e652018-04-05 21:02:53 +0000303
304 ind.set_allocated_omci_ind(omci_ind);
305 oltIndQ.push(ind);
306
307 return BCM_ERR_OK;
308}
309
Shad Ansari5fe93682018-04-26 05:24:19 +0000310bcmos_errno PacketIndication(bcmbal_obj *obj) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000311 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000312 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
313 bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj;
314
315 std::cout << "packet indication"
316 << " intf_id:" << in->data.intf_id
317 << " svc_port:" << in->data.svc_port
318 << " flow_id:" << in->data.flow_id
319 << std::endl;
320
321 pkt_ind->set_intf_id(in->data.intf_id);
322 pkt_ind->set_gemport_id(in->data.svc_port);
323 pkt_ind->set_flow_id(in->data.flow_id);
324 pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
325
326 ind.set_allocated_pkt_ind(pkt_ind);
327 oltIndQ.push(ind);
328
Shad Ansari01b0e652018-04-05 21:02:53 +0000329 return BCM_ERR_OK;
330}
331
332bcmos_errno FlowOperIndication(bcmbal_obj *obj) {
333 openolt::Indication ind;
334 std::cout << "flow oper state indication" << std::endl;
335 return BCM_ERR_OK;
336}
337
338bcmos_errno FlowIndication(bcmbal_obj *obj) {
339 openolt::Indication ind;
340 std::cout << "flow indication" << std::endl;
341 return BCM_ERR_OK;
342}
343
344bcmos_errno TmQIndication(bcmbal_obj *obj) {
345 openolt::Indication ind;
346 std::cout << "traffic mgmt queue indication" << std::endl;
347 return BCM_ERR_OK;
348}
349
350bcmos_errno TmSchedIndication(bcmbal_obj *obj) {
351 openolt::Indication ind;
352 std::cout << "traffic mgmt sheduler indication" << std::endl;
353 return BCM_ERR_OK;
354}
355
356bcmos_errno McastGroupIndication(bcmbal_obj *obj) {
357 openolt::Indication ind;
358 std::cout << "mcast group indication" << std::endl;
359 return BCM_ERR_OK;
360}
361
362Status SubscribeIndication() {
363 bcmbal_cb_cfg cb_cfg = {};
364 uint16_t ind_subgroup;
365
366 if (subscribed) {
367 return Status::OK;
368 }
369
370 cb_cfg.module = BCMOS_MODULE_ID_NONE;
371
372
373 /* OLT device indication */
374 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Shad Ansaricb004c52018-05-30 18:07:23 +0000375 ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000376 cb_cfg.p_subgroup = &ind_subgroup;
377 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltIndication;
378 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
379 return Status(grpc::StatusCode::INTERNAL, "Olt indication subscribe failed");
380 }
381
382 /* Interface LOS indication */
383 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
384 ind_subgroup = bcmbal_interface_auto_id_los;
385 cb_cfg.p_subgroup = &ind_subgroup;
386 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication;
387 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
388 return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
389 }
390
391 /* Interface indication */
392 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
Shad Ansaricb004c52018-05-30 18:07:23 +0000393 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000394 cb_cfg.p_subgroup = &ind_subgroup;
395 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication;
396 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
397 return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed");
398 }
399
400 /* Interface operational state change indication */
401 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
402 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
403 cb_cfg.p_subgroup = &ind_subgroup;
404 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication;
405 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
406 return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed");
407 }
408
409 /* onu alarm indication */
410 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
411 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
412 cb_cfg.p_subgroup = &ind_subgroup;
413 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication;
414 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
415 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
416 }
417
418 /* onu dying-gasp indication */
419 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
420 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
421 cb_cfg.p_subgroup = &ind_subgroup;
422 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication;
423 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
424 return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
425 }
426
427 /* onu discovery indication */
428 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
429 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
430 cb_cfg.p_subgroup = &ind_subgroup;
431 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication;
432 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
433 return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
434 }
435
436 /* onu indication */
437 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
Shad Ansaricb004c52018-05-30 18:07:23 +0000438 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000439 cb_cfg.p_subgroup = &ind_subgroup;
440 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication;
441 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
442 return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
443 }
444 /* onu operational state change indication */
445 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
446 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
447 cb_cfg.p_subgroup = &ind_subgroup;
448 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication;
449 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
450 return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed");
451 }
452
Shad Ansari5fe93682018-04-26 05:24:19 +0000453 /* Packet (bearer) indication */
Shad Ansari01b0e652018-04-05 21:02:53 +0000454 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
455 ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
456 cb_cfg.p_subgroup = &ind_subgroup;
Shad Ansari5fe93682018-04-26 05:24:19 +0000457 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000458 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
Shad Ansari5fe93682018-04-26 05:24:19 +0000459 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000460 }
461
462 /* Flow Operational State Change */
463 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
464 ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
465 cb_cfg.p_subgroup = &ind_subgroup;
466 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication;
467 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
468 return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed");
469 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000470#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000471 /* Flow Indication */
472 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
473 ind_subgroup = bcmbal_flow_auto_id_ind;
474 cb_cfg.p_subgroup = &ind_subgroup;
475 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication;
476 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
477 return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed");
478 }
479
480 /* TM queue indication */
481 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE;
482 ind_subgroup = bcmbal_tm_queue_auto_id_ind;
483 cb_cfg.p_subgroup = &ind_subgroup;
484 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication;
485 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
486 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
487 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000488#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000489
490 /* TM sched indication */
491 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
Shad Ansaricb004c52018-05-30 18:07:23 +0000492 ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
Shad Ansari01b0e652018-04-05 21:02:53 +0000493 cb_cfg.p_subgroup = &ind_subgroup;
494 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication;
495 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
496 return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
497 }
498
Shad Ansaricb004c52018-05-30 18:07:23 +0000499#if 0
Shad Ansari01b0e652018-04-05 21:02:53 +0000500 /* Multicast group indication */
501 cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP;
502 ind_subgroup = bcmbal_group_auto_id_ind;
503 cb_cfg.p_subgroup = &ind_subgroup;
504 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication;
505 if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
506 return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed");
507 }
Shad Ansaricb004c52018-05-30 18:07:23 +0000508#endif
Shad Ansari01b0e652018-04-05 21:02:53 +0000509
510 subscribed = true;
511
512 return Status::OK;
513}