blob: cc42adcfb2b36b6e7274551b4ff8d0c66eff21e0 [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>
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000029#include <bcmolt_api.h>
30#include <bcmolt_host_api.h>
31#include <bcmolt_api_model_api_structs.h>
Shad Ansari01b0e652018-04-05 21:02:53 +000032}
33
34using grpc::Status;
35
Shad Ansari627b5782018-08-13 22:49:32 +000036extern Queue<openolt::Indication> oltIndQ;
Shad Ansari01b0e652018-04-05 21:02:53 +000037//Queue<openolt::Indication*> oltIndQ;
38
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040039
Shad Ansari01b0e652018-04-05 21:02:53 +000040bool subscribed = false;
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080041uint32_t nni_intf_id = 0;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000042#define current_device 0
Shad Ansari01b0e652018-04-05 21:02:53 +000043
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000044static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg);
Shad Ansari01b0e652018-04-05 21:02:53 +000045
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000046#define INTERFACE_STATE_IF_DOWN(state) \
47 ((state == BCMOLT_INTERFACE_STATE_INACTIVE || \
48 state == BCMOLT_INTERFACE_STATE_PROCESSING || \
49 state == BCMOLT_INTERFACE_STATE_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
50#define INTERFACE_STATE_IF_UP(state) \
51 ((state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) ? BCMOS_TRUE : BCMOS_FALSE)
52#define ONU_STATE_IF_DOWN(state) \
53 ((state == BCMOLT_ONU_OPERATION_INACTIVE || \
54 state == BCMOLT_ONU_OPERATION_DISABLE || \
55 state == BCMOLT_ONU_OPERATION_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
56#define ONU_STATE_IF_UP(state) \
57 ((state == BCMOLT_ONU_OPERATION_ACTIVE) ? BCMOS_TRUE : BCMOS_FALSE)
58#define ONU_RANGING_STATE_IF_UP(state) \
59 ((state == BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE)
60#define ONU_RANGING_STATE_IF_DOWN(state) \
61 ((state != BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE)
62#define SET_OPER_STATE(indication,state) \
63 (INTERFACE_STATE_IF_UP(state)) ? indication->set_oper_state("up") : \
64 indication->set_oper_state("down")
65#define GET_FLOW_TYPE(type) \
66 (type == BCMOLT_FLOW_TYPE_UPSTREAM) ? "upstream" : \
67 (type == BCMOLT_FLOW_TYPE_DOWNSTREAM) ? "downstream" : \
68 (type == BCMOLT_FLOW_TYPE_MULTICAST) ? "multicast" : "unknown"
69
70std::string bcmolt_to_grpc_intf_type(bcmolt_interface_type intf_type)
Craig Lutgen88a22ad2018-10-04 12:30:46 -050071{
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000072 if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050073 return "nni";
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000074 } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050075 return "pon";
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000076 } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) {
77 return "host";
Craig Lutgen88a22ad2018-10-04 12:30:46 -050078 }
79 return "unknown";
80}
81
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000082std::string bcmolt_to_grpc_flow_intf_type(bcmolt_flow_interface_type intf_type)
83{
84 if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_NNI) {
85 return "nni";
86 } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_PON) {
87 return "pon";
88 } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_HOST) {
89 return "host";
90 }
91 return "unknown";
92}
93
94/*std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){
Girish Gowdru376b33c2019-05-06 21:46:31 -070095 bcmbal_subscriber_terminal_key key;
96 bcmbal_subscriber_terminal_cfg sub_term_obj = {};
97 uint8_t *list_mem;// to fetch config details for ONU
98 bcmos_errno err = BCM_ERR_OK;
99
100 key.sub_term_id =onu_id;
101 key.intf_id = intf_id;
102 BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id);
103
104 BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key);
105
106 BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties);
107 char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH);
108 memset(reg_id, '\0', MAX_REGID_LENGTH);
109
110 //set memory to use for variable-sized lists
111 list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE);
112
113 if (list_mem == NULL)
114 {
115 BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \
116 cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id);
117 return reg_id;
118 }
119
120 memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE);
121 BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE);
122
123 //call API
124 err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr);
125
126 if (err != BCM_ERR_OK)
127 {
128 BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)",
129 key.sub_term_id, key.intf_id);
130 free(list_mem);
131 return reg_id;
132 }
133
134 BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)",
135 key.sub_term_id, key.intf_id);
136
137 for (int i=0; i<MAX_REGID_LENGTH ; i++){
138 reg_id[i]=sub_term_obj.data.registration_id.arr[i];
139 }
140
141 free(list_mem);
142 return reg_id;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000143}*/
Girish Gowdru376b33c2019-05-06 21:46:31 -0700144
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000145static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000146 openolt::Indication ind;
147 openolt::OltIndication* olt_ind = new openolt::OltIndication;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500148 std::string admin_state;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500149
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000150 switch (msg->subgroup) {
151 case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE:
152 admin_state = "up";
153 olt_ind->set_oper_state("up");
154 break;
155 case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE:
156 admin_state = "down";
157 olt_ind->set_oper_state("down");
158 break;
159 case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE:
160 admin_state = "failure";
161 olt_ind->set_oper_state("failure");
162 break;
Shad Ansari01b0e652018-04-05 21:02:53 +0000163 }
164 ind.set_allocated_olt_ind(olt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500165
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000166 if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) {
167 /* register for omci indication */
168 {
169 bcmolt_rx_cfg rx_cfg = {};
170 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
171 rx_cfg.rx_cb = OmciIndication;
172 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet;
173 rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT;
174 bcmolt_ind_subscribe(current_device, &rx_cfg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000175 }
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500176 state.activate();
177 }
178 else {
179 state.deactivate();
180 }
181
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000182 oltIndQ.push(ind);
183 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000184}
185
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000186static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000187 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400188 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
189 openolt::LosIndication* los_ind = new openolt::LosIndication;
190
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000191 switch (msg->obj_type) {
192 case BCMOLT_OBJ_ID_PON_INTERFACE:
193 switch (msg->subgroup) {
194 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS:
195 {
196 bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg;
197 int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni,
198 BCMOLT_INTERFACE_TYPE_PON);
199 std::string status = alarm_status_to_string(bcm_los_ind->data.status);
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400200
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000201 OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n",
202 bcm_los_ind->key.pon_ni, intf_id, status.c_str());
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400203
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000204 los_ind->set_intf_id(intf_id);
205 los_ind->set_status(status);
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400206
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000207 alarm_ind->set_allocated_los_ind(los_ind);
208 ind.set_allocated_alarm_ind(alarm_ind);
209 break;
210 }
211 }
212 }
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400213
214 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000215 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000216}
217
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000218static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700219 openolt::Indication ind;
220 openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
221
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000222 switch (msg->obj_type) {
223 case BCMOLT_OBJ_ID_PON_INTERFACE:
224 switch (msg->subgroup) {
225 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
226 {
227 bcmolt_pon_interface_key *key =
228 &((bcmolt_pon_interface_state_change_completed*)msg)->key;
229 bcmolt_pon_interface_state_change_completed_data *data =
230 &((bcmolt_pon_interface_state_change_completed*)msg)->data;
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700231
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000232 intf_ind->set_intf_id(key->pon_ni);
233 SET_OPER_STATE(intf_ind, data->new_state);
234 ind.set_allocated_intf_ind(intf_ind);
235 break;
236 }
237 }
238 break;
239 case BCMOLT_OBJ_ID_NNI_INTERFACE:
240 switch (msg->subgroup) {
241 case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
242 {
243 OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
244 ((bcmolt_nni_interface_state_change *)msg)->key.id);
245 bcmolt_nni_interface_key *key =
246 &((bcmolt_nni_interface_state_change *)msg)->key;
247 bcmolt_nni_interface_state_change_data *data =
248 &((bcmolt_nni_interface_state_change *)msg)->data;
249
250 intf_ind->set_intf_id(key->id);
251 SET_OPER_STATE(intf_ind, data->new_state);
252 ind.set_allocated_intf_ind(intf_ind);
253 break;
254 }
255 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700256 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700257
258 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000259 bcmolt_msg_free(msg);
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700260}
261
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000262static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000263 openolt::Indication ind;
264 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000265
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000266 switch (msg->obj_type) {
267 case BCMOLT_OBJ_ID_PON_INTERFACE:
268 switch (msg->subgroup) {
269 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
270 {
271 bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key;
272 bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data;
273 intf_oper_ind->set_intf_id(key->pon_ni);
274 intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON));
275 SET_OPER_STATE(intf_oper_ind, data->new_state);
276 OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
277 intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str());
278 ind.set_allocated_intf_oper_ind(intf_oper_ind);
279 break;
280 }
281 }
282 case BCMOLT_OBJ_ID_NNI_INTERFACE:
283 switch (msg->subgroup) {
284 case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
285 {
286 bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key;
287 bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data;
288 bcmolt_interface intf_id = key->id;
289 bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI;
290 intf_oper_ind->set_intf_id(key->id);
291 intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI));
292 SET_OPER_STATE(intf_oper_ind, data->new_state);
293 OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
294 intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str());
295 ind.set_allocated_intf_oper_ind(intf_oper_ind);
296 break;
297 }
298 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000299 }
300
Shad Ansari01b0e652018-04-05 21:02:53 +0000301 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000302 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000303}
304
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000305static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000306 openolt::Indication ind;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400307 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
308 openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication;
309
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000310 switch (msg->obj_type) {
311 case BCMOLT_OBJ_ID_ONU:
312 switch (msg->subgroup) {
313 case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM:
314 {
315 bcmolt_xgpon_onu_alarms *onu_alarms =
316 &((bcmolt_onu_xgpon_alarm_data *)msg)->xgpon_onu_alarm;
317 onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
318 onu_alarm_ind->set_lob_status(alarm_status_to_string(onu_alarms->lobi));
319 onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(
320 onu_alarms->lopci_miss));
321 onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(
322 onu_alarms->lopci_mic_error));
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400323
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000324 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
325 ind.set_allocated_alarm_ind(alarm_ind);
326 break;
327 }
328 case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM:
329 {
330 bcmolt_gpon_onu_alarms *onu_alarms =
331 &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm;
332 onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
333 /* TODO: need to set lofi and loami
334 onu_alarm_ind->set_lof_status(alarm_status_to_string(onu_alarms->lofi));
335 onu_alarm_ind->set_loami_status(alarm_status_to_string(
336 onu_alarms->loami));
337 */
338 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
339 ind.set_allocated_alarm_ind(alarm_ind);
340 break;
341 }
342 }
343 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400344
345 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000346 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000347}
348
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000349static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000350 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400351 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000352 openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication;
nickc063ffd2018-05-22 14:35:28 -0400353
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000354 switch (msg->obj_type) {
355 case BCMOLT_OBJ_ID_ONU:
356 switch (msg->subgroup) {
357 case BCMOLT_ONU_AUTO_SUBGROUP_DGI:
358 {
359 bcmolt_onu_dgi_data* dgi_data = (bcmolt_onu_dgi_data *)msg;
360 dgi_ind->set_status(alarm_status_to_string(dgi_data->alarm_status));
nickc063ffd2018-05-22 14:35:28 -0400361
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000362 alarm_ind->set_allocated_dying_gasp_ind(dgi_ind);
363 ind.set_allocated_alarm_ind(alarm_ind);
364 break;
365 }
366 }
367 }
nickc063ffd2018-05-22 14:35:28 -0400368
369 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000370 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000371}
372
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000373static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000374 openolt::Indication ind;
375 openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
376 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
377
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000378 switch (msg->obj_type) {
379 case BCMOLT_OBJ_ID_PON_INTERFACE:
380 switch (msg->subgroup) {
381 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED:
382 {
383 bcmolt_pon_interface_key *key =
384 &((bcmolt_pon_interface_onu_discovered *)msg)->key;
Shad Ansari01b0e652018-04-05 21:02:53 +0000385
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000386 bcmolt_pon_interface_onu_discovered_data *data =
387 &((bcmolt_pon_interface_onu_discovered *)msg)->data;
Shad Ansari01b0e652018-04-05 21:02:53 +0000388
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000389 bcmolt_serial_number *in_serial_number = &(data->serial_number);
Shad Ansari01b0e652018-04-05 21:02:53 +0000390
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000391 OPENOLT_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n",
392 key->pon_ni, serial_number_to_str(in_serial_number).c_str());
Shad Ansari01b0e652018-04-05 21:02:53 +0000393
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000394 onu_disc_ind->set_intf_id(key->pon_ni);
395 serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4);
396 serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8);
397 onu_disc_ind->set_allocated_serial_number(serial_number);
398 ind.set_allocated_onu_disc_ind(onu_disc_ind);
399 break;
400 }
401 }
402 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000403
404 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000405 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000406}
407
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000408static void OnuIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700409 openolt::Indication ind;
410 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
411
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000412 switch (msg->obj_type) {
413 case BCMOLT_OBJ_ID_ONU:
414 switch (msg->subgroup) {
415 case BCMOLT_ONU_AUTO_SUBGROUP_RANGING_COMPLETED:
416 {
417 bcmolt_onu_key *key = &((bcmolt_onu_ranging_completed*)msg)->key;
418 bcmolt_onu_ranging_completed_data *data = &((bcmolt_onu_ranging_completed*)msg)->data;
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700419
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000420 onu_ind->set_intf_id(key->pon_ni);
421 onu_ind->set_onu_id(key->onu_id);
422 if (ONU_RANGING_STATE_IF_UP(data->status))
423 onu_ind->set_oper_state("up");
424 if (ONU_RANGING_STATE_IF_DOWN(data->status))
425 onu_ind->set_oper_state("down");
426 (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down");
427 ind.set_allocated_onu_ind(onu_ind);
428 OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n",
429 key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down",
430 (key->onu_id)?"up":"down");
431 }
432 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700433 }
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000434 /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
Girish Gowdru376b33c2019-05-06 21:46:31 -0700435 onu_ind->set_registration_id(reg_id);
436
437 BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper state %s, admin_state %s,registration id %s\n",
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000438 onu_ind->intf_id(), onu_ind->onu_id(),onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());*/
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700439
440 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000441 bcmolt_msg_free(msg);
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700442}
443
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000444static void OnuOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000445 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400446 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
nickc063ffd2018-05-22 14:35:28 -0400447
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000448 switch (msg->obj_type) {
449 case BCMOLT_OBJ_ID_ONU:
450 switch (msg->subgroup) {
451 case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE:
452 {
453 bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key;
454 bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data;
nickc063ffd2018-05-22 14:35:28 -0400455
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000456 onu_ind->set_intf_id(key->pon_ni);
457 onu_ind->set_onu_id(key->onu_id);
458 if (ONU_STATE_IF_UP(data->new_onu_state))
459 onu_ind->set_oper_state("up");
460 if (ONU_STATE_IF_DOWN(data->new_onu_state))
461 onu_ind->set_oper_state("down");
462 ind.set_allocated_onu_ind(onu_ind);
nickc063ffd2018-05-22 14:35:28 -0400463
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000464 OPENOLT_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s\n",
465 key->pon_ni, key->onu_id, data->new_onu_state, onu_ind->oper_state().c_str());
466 }
467 }
nickc063ffd2018-05-22 14:35:28 -0400468 }
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000469 /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
Girish Gowdru376b33c2019-05-06 21:46:31 -0700470 onu_ind->set_registration_id(reg_id);
nickc063ffd2018-05-22 14:35:28 -0400471 ind.set_allocated_onu_ind(onu_ind);
472
Girish Gowdru376b33c2019-05-06 21:46:31 -0700473 BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s, admin_state %s registraion_id %s\n",
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000474 key->intf_id, key->sub_term_id, data->old_oper_status, onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());*/
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500475
nickc063ffd2018-05-22 14:35:28 -0400476 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000477 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000478}
479
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000480static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000481 openolt::Indication ind;
482 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000483
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000484 switch (msg->obj_type) {
485 case BCMOLT_OBJ_ID_ONU:
486 switch (msg->subgroup) {
487 case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET:
488 {
489 bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key;
490 bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data;
Shad Ansari01b0e652018-04-05 21:02:53 +0000491
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000492 OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n",
493 key->pon_ni, key->onu_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000494
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000495 omci_ind->set_intf_id(key->pon_ni);
496 omci_ind->set_onu_id(key->onu_id);
497 omci_ind->set_pkt(data->buffer.arr, data->buffer.len);
498
499 ind.set_allocated_omci_ind(omci_ind);
500 break;
501 }
502 }
503 }
504
Shad Ansari01b0e652018-04-05 21:02:53 +0000505 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000506 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000507}
508
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000509static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000510 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000511 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000512
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000513 switch (msg->obj_type) {
514 case BCMOLT_OBJ_ID_FLOW:
515 switch (msg->subgroup) {
516 case BCMOLT_FLOW_AUTO_SUBGROUP_RECEIVE_ETH_PACKET:
517 {
518 bcmolt_flow_receive_eth_packet *pkt =
519 (bcmolt_flow_receive_eth_packet*)msg;
520 bcmolt_flow_receive_eth_packet_data *pkt_data =
521 &((bcmolt_flow_receive_eth_packet*)msg)->data;
Shad Ansari5fe93682018-04-26 05:24:19 +0000522
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000523 uint32_t port_no = GetPortNum_(pkt->key.flow_id);
524 pkt_ind->set_intf_type(bcmolt_to_grpc_flow_intf_type((bcmolt_flow_interface_type)get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_TYPE)));
525 pkt_ind->set_intf_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_ID));
526 pkt_ind->set_gemport_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, SVC_PORT_ID));
527 pkt_ind->set_flow_id(pkt->key.flow_id);
528 pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len);
529 pkt_ind->set_port_no(port_no);
530 pkt_ind->set_cookie(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, COOKIE));
531 ind.set_allocated_pkt_ind(pkt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500532
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000533 OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d, egress intf_type %s, egress intf_id %lu, svc_port %d, flow_type %s, flow_id %d, port_no %d, cookie %"PRIu64"\n",
534 pkt_ind->intf_type().c_str(), pkt_ind->intf_id(),
535 bcmolt_to_grpc_flow_intf_type((bcmolt_flow_interface_type)get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_TYPE)).c_str(),
536 get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_ID),
537 pkt_ind->gemport_id(), GET_FLOW_TYPE(pkt->key.flow_type),
538 pkt_ind->flow_id(), port_no, pkt_ind->cookie());
539 }
540 }
541 }
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500542
Shad Ansari5fe93682018-04-26 05:24:19 +0000543 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000544 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000545}
546
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000547static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000548 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000549 OPENOLT_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
550 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000551}
552
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000553static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000554 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000555 OPENOLT_LOG(DEBUG, openolt_log_id, "flow indication\n");
556 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000557}
558
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000559static void TmQIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000560 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000561 OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
562 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000563}
564
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000565static void TmSchedIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000566 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000567 OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
568 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000569}
570
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000571static void McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000572 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000573 OPENOLT_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
574 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000575}
576
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000577static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400578 openolt::Indication ind;
579 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
580 openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication;
581
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000582 switch (msg->obj_type) {
583 case BCMOLT_OBJ_ID_ONU:
584 switch (msg->subgroup) {
585 case BCMOLT_ONU_AUTO_SUBGROUP_SUFI:
586 {
587 bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key;
588 bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400589
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000590 OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
591 key->pon_ni, key->onu_id, data->alarm_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400592
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000593 sufi_ind->set_intf_id(key->pon_ni);
594 sufi_ind->set_onu_id(key->onu_id);
595 sufi_ind->set_status(alarm_status_to_string(data->alarm_status));
596 alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400597
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000598 ind.set_allocated_alarm_ind(alarm_ind);
599 }
600 }
601 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400602
603 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000604 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400605}
606
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000607static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400608 openolt::Indication ind;
609 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
610 openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication;
611
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000612 switch (msg->obj_type) {
613 case BCMOLT_OBJ_ID_ONU:
614 switch (msg->subgroup) {
615 case BCMOLT_ONU_AUTO_SUBGROUP_SDI:
616 {
617 bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key;
618 bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400619
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000620 OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
621 key->pon_ni, key->onu_id, data->alarm_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400622
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000623 sdi_ind->set_intf_id(key->pon_ni);
624 sdi_ind->set_onu_id(key->onu_id);
625 sdi_ind->set_status(alarm_status_to_string(data->alarm_status));
626 sdi_ind->set_inverse_bit_error_rate(data->ber);
627 alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400628
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000629 ind.set_allocated_alarm_ind(alarm_ind);
630 }
631 }
632 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400633
634 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000635 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400636}
637
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000638static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400639 openolt::Indication ind;
640 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
641 openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication;
642
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000643 switch (msg->obj_type) {
644 case BCMOLT_OBJ_ID_ONU:
645 switch (msg->subgroup) {
646 case BCMOLT_ONU_AUTO_SUBGROUP_DOWI:
647 {
648 bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key;
649 bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400650
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000651 OPENOLT_LOG(WARNING, openolt_log_id, "onu drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n",
652 key->pon_ni, key->onu_id, data->alarm_status, data->drift_value, data->new_eqd);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400653
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000654 dowi_ind->set_intf_id(key->pon_ni);
655 dowi_ind->set_onu_id(key->onu_id);
656 dowi_ind->set_status(alarm_status_to_string(data->alarm_status));
657 dowi_ind->set_drift(data->drift_value);
658 dowi_ind->set_new_eqd(data->new_eqd);
659 alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400660
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000661 ind.set_allocated_alarm_ind(alarm_ind);
662 }
663 }
664 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400665
666 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000667 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400668}
669
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000670static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400671 openolt::Indication ind;
672 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
673 openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication;
674
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000675 switch (msg->obj_type) {
676 case BCMOLT_OBJ_ID_ONU:
677 switch (msg->subgroup) {
678 case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI:
679 {
680 bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key;
681 bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400682
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000683 OPENOLT_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
684 key->pon_ni, key->onu_id, data->alarm_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400685
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000686 looci_ind->set_intf_id(key->pon_ni);
687 looci_ind->set_onu_id(key->onu_id);
688 looci_ind->set_status(alarm_status_to_string(data->alarm_status));
689 alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400690
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000691 ind.set_allocated_alarm_ind(alarm_ind);
692 }
693 }
694 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400695
696 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000697 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400698}
699
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000700static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400701 openolt::Indication ind;
702 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
703 openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication;
704
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000705 switch (msg->obj_type) {
706 case BCMOLT_OBJ_ID_ONU:
707 switch (msg->subgroup) {
708 case BCMOLT_ONU_AUTO_SUBGROUP_SFI:
709 {
710 bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key;
711 bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400712
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000713 OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
714 key->pon_ni, key->onu_id, data->alarm_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400715
716
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000717 sfi_ind->set_intf_id(key->pon_ni);
718 sfi_ind->set_onu_id(key->onu_id);
719 sfi_ind->set_status(alarm_status_to_string(data->alarm_status));
720 sfi_ind->set_inverse_bit_error_rate(data->ber);
721 alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400722
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000723 ind.set_allocated_alarm_ind(alarm_ind);
724 }
725 }
726 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400727
728 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000729 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400730}
731
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000732static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400733 openolt::Indication ind;
734 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
735 openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning;
736
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000737 switch (msg->obj_type) {
738 case BCMOLT_OBJ_ID_ONU:
739 switch (msg->subgroup) {
740 case BCMOLT_ONU_AUTO_SUBGROUP_TIWI:
741 {
742 bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key;
743 bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400744
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000745 OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
746 key->pon_ni, key->onu_id, data->alarm_status, data->drift_value);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400747
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000748 tiwi_ind->set_intf_id(key->pon_ni);
749 tiwi_ind->set_onu_id(key->onu_id);
750 tiwi_ind->set_status(alarm_status_to_string(data->alarm_status));
751 tiwi_ind->set_drift(data->drift_value);
752 alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400753
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000754 ind.set_allocated_alarm_ind(alarm_ind);
755 }
756 }
757 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400758
759 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000760 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400761}
762
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000763static void OnuActivationFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400764 openolt::Indication ind;
765 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
766 openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication;
767
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000768 switch (msg->obj_type) {
769 case BCMOLT_OBJ_ID_ONU:
770 switch (msg->subgroup) {
771 case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED:
772 {
773 bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key;
774 bcmolt_onu_onu_activation_completed_data *data =
775 &((bcmolt_onu_onu_activation_completed*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400776
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000777 OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d\n",
778 key->pon_ni, key->onu_id, data->fail_reason);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400779
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000780 activation_fail_ind->set_intf_id(key->pon_ni);
781 activation_fail_ind->set_onu_id(key->onu_id);
782 alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400783
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000784 ind.set_allocated_alarm_ind(alarm_ind);
785 }
786 }
787 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400788
789 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000790 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400791}
792
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000793/* removed by BAL v3.0
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400794bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) {
795 openolt::Indication ind;
796 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
797 openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication;
798
799 bcmbal_subscriber_terminal_key *key =
800 &(((bcmbal_subscriber_terminal_processing_error*)obj)->key);
801
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000802 OPENOLT_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n",
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400803 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400804
805
806 onu_proc_error_ind->set_intf_id(key->intf_id);
807 onu_proc_error_ind->set_onu_id(key->sub_term_id);
808
809 alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind);
810 ind.set_allocated_alarm_ind(alarm_ind);
811
812 oltIndQ.push(ind);
813 return BCM_ERR_OK;
814}
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000815*/
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400816
Shad Ansari01b0e652018-04-05 21:02:53 +0000817Status SubscribeIndication() {
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000818 bcmolt_rx_cfg rx_cfg = {};
819 bcmos_errno rc;
Shad Ansari01b0e652018-04-05 21:02:53 +0000820
821 if (subscribed) {
822 return Status::OK;
823 }
824
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000825 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
826 rx_cfg.rx_cb = OltOperIndication;
827 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
828 rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete;
829 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
830 if(rc != BCM_ERR_OK)
831 return Status(grpc::StatusCode::INTERNAL,
832 "Olt connection complete state indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000833
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000834 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
835 rx_cfg.rx_cb = OltOperIndication;
836 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
837 rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete;
838 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
839 if(rc != BCM_ERR_OK)
840 return Status(grpc::StatusCode::INTERNAL,
841 "Olt disconnection complete state indication subscribe failed");
842
843 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
844 rx_cfg.rx_cb = OltOperIndication;
845 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
846 rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure;
847 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
848 if(rc != BCM_ERR_OK)
849 return Status(grpc::StatusCode::INTERNAL,
850 "Olt connection failure state indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000851
852 /* Interface LOS indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000853 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
854 rx_cfg.rx_cb = LosIndication;
855 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
856 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los;
857 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
858 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000859 return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000860
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000861 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
862 rx_cfg.rx_cb = IfOperIndication;
863 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
864 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed;
865 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
866 if(rc != BCM_ERR_OK)
867 return Status(grpc::StatusCode::INTERNAL,
868 "PON Interface operations state change indication subscribe failed");
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700869
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000870 rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE;
871 rx_cfg.rx_cb = IfOperIndication;
872 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
873 rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change;
874 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
875 if(rc != BCM_ERR_OK)
876 return Status(grpc::StatusCode::INTERNAL,
877 "NNI Interface operations state change indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000878
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000879 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
880 rx_cfg.rx_cb = OnuAlarmIndication;
881 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
882 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm;
883 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
884 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000885 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000886
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000887 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
888 rx_cfg.rx_cb = OnuAlarmIndication;
889 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
890 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm;
891 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
892 if(rc != BCM_ERR_OK)
893 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
894
895 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
896 rx_cfg.rx_cb = OnuDyingGaspIndication;
897 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
898 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi;
899 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
900 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000901 return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000902
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000903 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
904 rx_cfg.rx_cb = OnuDiscoveryIndication;
905 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
906 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered;
907 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
908 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000909 return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000910
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000911 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
912 rx_cfg.rx_cb = OnuIndication;
913 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
914 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_ranging_completed;
915
916 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
917 if(rc != BCM_ERR_OK)
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700918 return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000919
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000920 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
921 rx_cfg.rx_cb = OnuStartupFailureIndication;
922 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
923 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi;
924 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
925 if(rc != BCM_ERR_OK)
926 return Status(grpc::StatusCode::INTERNAL,
927 "onu startup failure indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000928
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000929 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
930 rx_cfg.rx_cb = OnuSignalDegradeIndication;
931 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
932 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi;
933 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
934 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400935 return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400936
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000937 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
938 rx_cfg.rx_cb = OnuDriftOfWindowIndication;
939 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
940 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi;
941 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
942 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400943 return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400944
945 /* LOOCI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000946 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
947 rx_cfg.rx_cb = OnuLossOfOmciChannelIndication;
948 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
949 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci;
950 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
951 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400952 return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400953
954 /* SFI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000955 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
956 rx_cfg.rx_cb = OnuSignalsFailureIndication;
957 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
958 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi;
959 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
960 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400961 return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400962
963 /* TIWI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000964 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
965 rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication;
966 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
967 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi;
968 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
969 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400970 return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400971
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000972 /* ONU Activation Failure Indiction */
973 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
974 rx_cfg.rx_cb = OnuActivationFailureIndication;
975 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
976 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed;
977 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
978 if(rc != BCM_ERR_OK)
979 return Status(grpc::StatusCode::INTERNAL,
980 "onu activation falaire indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400981
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000982 rx_cfg.obj_type = BCMOLT_OBJ_ID_FLOW;
983 rx_cfg.rx_cb = PacketIndication;
984 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
985 rx_cfg.subgroup = bcmolt_flow_auto_subgroup_receive_eth_packet;
986 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
987 if(rc != BCM_ERR_OK)
988 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400989
Shad Ansari01b0e652018-04-05 21:02:53 +0000990 subscribed = true;
991
992 return Status::OK;
993}