blob: 8425f0bbcd082dc379998f2fa9619d94976ede6e [file] [log] [blame]
Shad Ansari01b0e652018-04-05 21:02:53 +00001/*
Girish Gowdraa707e7c2019-11-07 11:36:13 +05302 * Copyright 2018-present Open Networking Foundation
Shad Ansari01b0e652018-04-05 21:02:53 +00003
Girish Gowdraa707e7c2019-11-07 11:36:13 +05304 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Shad Ansari01b0e652018-04-05 21:02:53 +00007
Girish Gowdraa707e7c2019-11-07 11:36:13 +05308 * http://www.apache.org/licenses/LICENSE-2.0
Shad Ansari01b0e652018-04-05 21:02:53 +00009
Girish Gowdraa707e7c2019-11-07 11:36:13 +053010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Shad Ansari01b0e652018-04-05 21:02:53 +000017#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;
Girish Gowdra96461052019-11-22 20:13:59 +053037extern std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *> alloc_cfg_compltd_map;
38extern bcmos_fastlock alloc_cfg_wait_lock;
Shad Ansari01b0e652018-04-05 21:02:53 +000039
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040040
Shad Ansari01b0e652018-04-05 21:02:53 +000041bool subscribed = false;
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080042uint32_t nni_intf_id = 0;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000043#define current_device 0
Shad Ansari01b0e652018-04-05 21:02:53 +000044
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000045static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg);
Shad Ansari01b0e652018-04-05 21:02:53 +000046
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000047#define INTERFACE_STATE_IF_DOWN(state) \
48 ((state == BCMOLT_INTERFACE_STATE_INACTIVE || \
49 state == BCMOLT_INTERFACE_STATE_PROCESSING || \
50 state == BCMOLT_INTERFACE_STATE_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
51#define INTERFACE_STATE_IF_UP(state) \
52 ((state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) ? BCMOS_TRUE : BCMOS_FALSE)
53#define ONU_STATE_IF_DOWN(state) \
54 ((state == BCMOLT_ONU_OPERATION_INACTIVE || \
55 state == BCMOLT_ONU_OPERATION_DISABLE || \
56 state == BCMOLT_ONU_OPERATION_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
57#define ONU_STATE_IF_UP(state) \
58 ((state == BCMOLT_ONU_OPERATION_ACTIVE) ? BCMOS_TRUE : BCMOS_FALSE)
59#define ONU_RANGING_STATE_IF_UP(state) \
60 ((state == BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE)
61#define ONU_RANGING_STATE_IF_DOWN(state) \
62 ((state != BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE)
63#define SET_OPER_STATE(indication,state) \
64 (INTERFACE_STATE_IF_UP(state)) ? indication->set_oper_state("up") : \
65 indication->set_oper_state("down")
66#define GET_FLOW_TYPE(type) \
67 (type == BCMOLT_FLOW_TYPE_UPSTREAM) ? "upstream" : \
68 (type == BCMOLT_FLOW_TYPE_DOWNSTREAM) ? "downstream" : \
69 (type == BCMOLT_FLOW_TYPE_MULTICAST) ? "multicast" : "unknown"
70
71std::string bcmolt_to_grpc_intf_type(bcmolt_interface_type intf_type)
Craig Lutgen88a22ad2018-10-04 12:30:46 -050072{
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000073 if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050074 return "nni";
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000075 } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050076 return "pon";
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000077 } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) {
78 return "host";
Craig Lutgen88a22ad2018-10-04 12:30:46 -050079 }
80 return "unknown";
81}
82
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000083std::string bcmolt_to_grpc_flow_intf_type(bcmolt_flow_interface_type intf_type)
84{
85 if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_NNI) {
86 return "nni";
87 } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_PON) {
88 return "pon";
89 } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_HOST) {
90 return "host";
91 }
92 return "unknown";
93}
94
95/*std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){
Girish Gowdru376b33c2019-05-06 21:46:31 -070096 bcmbal_subscriber_terminal_key key;
97 bcmbal_subscriber_terminal_cfg sub_term_obj = {};
98 uint8_t *list_mem;// to fetch config details for ONU
99 bcmos_errno err = BCM_ERR_OK;
100
101 key.sub_term_id =onu_id;
102 key.intf_id = intf_id;
103 BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id);
104
105 BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key);
106
107 BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties);
108 char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH);
109 memset(reg_id, '\0', MAX_REGID_LENGTH);
110
111 //set memory to use for variable-sized lists
112 list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE);
113
114 if (list_mem == NULL)
115 {
116 BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \
117 cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id);
118 return reg_id;
119 }
120
121 memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE);
122 BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE);
123
124 //call API
125 err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr);
126
127 if (err != BCM_ERR_OK)
128 {
129 BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)",
130 key.sub_term_id, key.intf_id);
131 free(list_mem);
132 return reg_id;
133 }
134
135 BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)",
136 key.sub_term_id, key.intf_id);
137
138 for (int i=0; i<MAX_REGID_LENGTH ; i++){
139 reg_id[i]=sub_term_obj.data.registration_id.arr[i];
140 }
141
142 free(list_mem);
143 return reg_id;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000144}*/
Girish Gowdru376b33c2019-05-06 21:46:31 -0700145
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000146static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000147 openolt::Indication ind;
148 openolt::OltIndication* olt_ind = new openolt::OltIndication;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500149 std::string admin_state;
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500150
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000151 switch (msg->subgroup) {
152 case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE:
153 admin_state = "up";
154 olt_ind->set_oper_state("up");
155 break;
156 case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE:
157 admin_state = "down";
158 olt_ind->set_oper_state("down");
159 break;
160 case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE:
161 admin_state = "failure";
162 olt_ind->set_oper_state("failure");
163 break;
Shad Ansari01b0e652018-04-05 21:02:53 +0000164 }
165 ind.set_allocated_olt_ind(olt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500166
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000167 if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) {
168 /* register for omci indication */
169 {
170 bcmolt_rx_cfg rx_cfg = {};
171 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
172 rx_cfg.rx_cb = OmciIndication;
173 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet;
174 rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT;
175 bcmolt_ind_subscribe(current_device, &rx_cfg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000176 }
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500177 state.activate();
178 }
179 else {
180 state.deactivate();
181 }
182
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000183 oltIndQ.push(ind);
184 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000185}
186
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000187static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000188 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400189 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
190 openolt::LosIndication* los_ind = new openolt::LosIndication;
191
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000192 switch (msg->obj_type) {
193 case BCMOLT_OBJ_ID_PON_INTERFACE:
194 switch (msg->subgroup) {
195 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS:
196 {
197 bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg;
198 int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni,
199 BCMOLT_INTERFACE_TYPE_PON);
200 std::string status = alarm_status_to_string(bcm_los_ind->data.status);
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400201
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000202 OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n",
203 bcm_los_ind->key.pon_ni, intf_id, status.c_str());
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400204
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000205 los_ind->set_intf_id(intf_id);
206 los_ind->set_status(status);
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400207
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000208 alarm_ind->set_allocated_los_ind(los_ind);
209 ind.set_allocated_alarm_ind(alarm_ind);
210 break;
211 }
212 }
213 }
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400214
215 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000216 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000217}
218
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000219static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700220 openolt::Indication ind;
221 openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
222
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000223 switch (msg->obj_type) {
224 case BCMOLT_OBJ_ID_PON_INTERFACE:
225 switch (msg->subgroup) {
226 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
227 {
228 bcmolt_pon_interface_key *key =
229 &((bcmolt_pon_interface_state_change_completed*)msg)->key;
230 bcmolt_pon_interface_state_change_completed_data *data =
231 &((bcmolt_pon_interface_state_change_completed*)msg)->data;
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700232
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000233 intf_ind->set_intf_id(key->pon_ni);
234 SET_OPER_STATE(intf_ind, data->new_state);
235 ind.set_allocated_intf_ind(intf_ind);
236 break;
237 }
238 }
239 break;
240 case BCMOLT_OBJ_ID_NNI_INTERFACE:
241 switch (msg->subgroup) {
242 case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
243 {
244 OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
245 ((bcmolt_nni_interface_state_change *)msg)->key.id);
246 bcmolt_nni_interface_key *key =
247 &((bcmolt_nni_interface_state_change *)msg)->key;
248 bcmolt_nni_interface_state_change_data *data =
249 &((bcmolt_nni_interface_state_change *)msg)->data;
250
251 intf_ind->set_intf_id(key->id);
252 SET_OPER_STATE(intf_ind, data->new_state);
253 ind.set_allocated_intf_ind(intf_ind);
254 break;
255 }
256 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700257 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700258
259 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000260 bcmolt_msg_free(msg);
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700261}
262
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000263static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000264 openolt::Indication ind;
265 openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000266
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000267 switch (msg->obj_type) {
268 case BCMOLT_OBJ_ID_PON_INTERFACE:
269 switch (msg->subgroup) {
270 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
271 {
272 bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key;
273 bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data;
274 intf_oper_ind->set_intf_id(key->pon_ni);
275 intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON));
276 SET_OPER_STATE(intf_oper_ind, data->new_state);
277 OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
278 intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str());
279 ind.set_allocated_intf_oper_ind(intf_oper_ind);
280 break;
281 }
282 }
283 case BCMOLT_OBJ_ID_NNI_INTERFACE:
284 switch (msg->subgroup) {
285 case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
286 {
287 bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key;
288 bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data;
289 bcmolt_interface intf_id = key->id;
290 bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI;
291 intf_oper_ind->set_intf_id(key->id);
292 intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI));
293 SET_OPER_STATE(intf_oper_ind, data->new_state);
294 OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
295 intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str());
296 ind.set_allocated_intf_oper_ind(intf_oper_ind);
297 break;
298 }
299 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000300 }
301
Shad Ansari01b0e652018-04-05 21:02:53 +0000302 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000303 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000304}
305
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000306static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000307 openolt::Indication ind;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400308 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
309 openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication;
310
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000311 switch (msg->obj_type) {
312 case BCMOLT_OBJ_ID_ONU:
313 switch (msg->subgroup) {
314 case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM:
315 {
316 bcmolt_xgpon_onu_alarms *onu_alarms =
317 &((bcmolt_onu_xgpon_alarm_data *)msg)->xgpon_onu_alarm;
318 onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
319 onu_alarm_ind->set_lob_status(alarm_status_to_string(onu_alarms->lobi));
320 onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(
321 onu_alarms->lopci_miss));
322 onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(
323 onu_alarms->lopci_mic_error));
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400324
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000325 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
326 ind.set_allocated_alarm_ind(alarm_ind);
327 break;
328 }
329 case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM:
330 {
331 bcmolt_gpon_onu_alarms *onu_alarms =
332 &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm;
333 onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
334 /* TODO: need to set lofi and loami
335 onu_alarm_ind->set_lof_status(alarm_status_to_string(onu_alarms->lofi));
336 onu_alarm_ind->set_loami_status(alarm_status_to_string(
337 onu_alarms->loami));
338 */
339 alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
340 ind.set_allocated_alarm_ind(alarm_ind);
341 break;
342 }
343 }
344 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400345
346 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000347 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000348}
349
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000350static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000351 openolt::Indication ind;
Nicolas Palpacuera32f4c32018-06-28 12:55:10 -0400352 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000353 openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication;
nickc063ffd2018-05-22 14:35:28 -0400354
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000355 switch (msg->obj_type) {
356 case BCMOLT_OBJ_ID_ONU:
357 switch (msg->subgroup) {
358 case BCMOLT_ONU_AUTO_SUBGROUP_DGI:
359 {
360 bcmolt_onu_dgi_data* dgi_data = (bcmolt_onu_dgi_data *)msg;
361 dgi_ind->set_status(alarm_status_to_string(dgi_data->alarm_status));
nickc063ffd2018-05-22 14:35:28 -0400362
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000363 alarm_ind->set_allocated_dying_gasp_ind(dgi_ind);
364 ind.set_allocated_alarm_ind(alarm_ind);
365 break;
366 }
367 }
368 }
nickc063ffd2018-05-22 14:35:28 -0400369
370 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000371 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000372}
373
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000374static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000375 openolt::Indication ind;
376 openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
377 openolt::SerialNumber* serial_number = new openolt::SerialNumber;
378
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000379 switch (msg->obj_type) {
380 case BCMOLT_OBJ_ID_PON_INTERFACE:
381 switch (msg->subgroup) {
382 case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED:
383 {
384 bcmolt_pon_interface_key *key =
385 &((bcmolt_pon_interface_onu_discovered *)msg)->key;
Shad Ansari01b0e652018-04-05 21:02:53 +0000386
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000387 bcmolt_pon_interface_onu_discovered_data *data =
388 &((bcmolt_pon_interface_onu_discovered *)msg)->data;
Shad Ansari01b0e652018-04-05 21:02:53 +0000389
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000390 bcmolt_serial_number *in_serial_number = &(data->serial_number);
Shad Ansari01b0e652018-04-05 21:02:53 +0000391
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000392 OPENOLT_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n",
393 key->pon_ni, serial_number_to_str(in_serial_number).c_str());
Shad Ansari01b0e652018-04-05 21:02:53 +0000394
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000395 onu_disc_ind->set_intf_id(key->pon_ni);
396 serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4);
397 serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8);
398 onu_disc_ind->set_allocated_serial_number(serial_number);
399 ind.set_allocated_onu_disc_ind(onu_disc_ind);
400 break;
401 }
402 }
403 }
Shad Ansari01b0e652018-04-05 21:02:53 +0000404
405 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000406 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000407}
408
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000409static void OnuIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700410 openolt::Indication ind;
411 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
412
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000413 switch (msg->obj_type) {
414 case BCMOLT_OBJ_ID_ONU:
415 switch (msg->subgroup) {
416 case BCMOLT_ONU_AUTO_SUBGROUP_RANGING_COMPLETED:
417 {
418 bcmolt_onu_key *key = &((bcmolt_onu_ranging_completed*)msg)->key;
419 bcmolt_onu_ranging_completed_data *data = &((bcmolt_onu_ranging_completed*)msg)->data;
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700420
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000421 onu_ind->set_intf_id(key->pon_ni);
422 onu_ind->set_onu_id(key->onu_id);
423 if (ONU_RANGING_STATE_IF_UP(data->status))
424 onu_ind->set_oper_state("up");
425 if (ONU_RANGING_STATE_IF_DOWN(data->status))
426 onu_ind->set_oper_state("down");
427 (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down");
428 ind.set_allocated_onu_ind(onu_ind);
429 OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n",
430 key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down",
431 (key->onu_id)?"up":"down");
432 }
433 }
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700434 }
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000435 /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
Girish Gowdru376b33c2019-05-06 21:46:31 -0700436 onu_ind->set_registration_id(reg_id);
437
438 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 +0000439 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 -0700440
441 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000442 bcmolt_msg_free(msg);
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700443}
444
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000445static void OnuOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000446 openolt::Indication ind;
nickc063ffd2018-05-22 14:35:28 -0400447 openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
nickc063ffd2018-05-22 14:35:28 -0400448
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000449 switch (msg->obj_type) {
450 case BCMOLT_OBJ_ID_ONU:
451 switch (msg->subgroup) {
452 case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE:
453 {
454 bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key;
455 bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data;
nickc063ffd2018-05-22 14:35:28 -0400456
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000457 onu_ind->set_intf_id(key->pon_ni);
458 onu_ind->set_onu_id(key->onu_id);
459 if (ONU_STATE_IF_UP(data->new_onu_state))
460 onu_ind->set_oper_state("up");
461 if (ONU_STATE_IF_DOWN(data->new_onu_state))
462 onu_ind->set_oper_state("down");
463 ind.set_allocated_onu_ind(onu_ind);
nickc063ffd2018-05-22 14:35:28 -0400464
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000465 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",
466 key->pon_ni, key->onu_id, data->new_onu_state, onu_ind->oper_state().c_str());
467 }
468 }
nickc063ffd2018-05-22 14:35:28 -0400469 }
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000470 /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id);
Girish Gowdru376b33c2019-05-06 21:46:31 -0700471 onu_ind->set_registration_id(reg_id);
nickc063ffd2018-05-22 14:35:28 -0400472 ind.set_allocated_onu_ind(onu_ind);
473
Girish Gowdru376b33c2019-05-06 21:46:31 -0700474 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 +0000475 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 -0500476
nickc063ffd2018-05-22 14:35:28 -0400477 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000478 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000479}
480
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000481static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000482 openolt::Indication ind;
483 openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
Shad Ansari01b0e652018-04-05 21:02:53 +0000484
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000485 switch (msg->obj_type) {
486 case BCMOLT_OBJ_ID_ONU:
487 switch (msg->subgroup) {
488 case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET:
489 {
490 bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key;
491 bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data;
Shad Ansari01b0e652018-04-05 21:02:53 +0000492
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000493 OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n",
494 key->pon_ni, key->onu_id);
Shad Ansari01b0e652018-04-05 21:02:53 +0000495
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000496 omci_ind->set_intf_id(key->pon_ni);
497 omci_ind->set_onu_id(key->onu_id);
498 omci_ind->set_pkt(data->buffer.arr, data->buffer.len);
499
500 ind.set_allocated_omci_ind(omci_ind);
501 break;
502 }
503 }
504 }
505
Shad Ansari01b0e652018-04-05 21:02:53 +0000506 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000507 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000508}
509
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000510static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000511 openolt::Indication ind;
Shad Ansari5fe93682018-04-26 05:24:19 +0000512 openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
Shad Ansari5fe93682018-04-26 05:24:19 +0000513
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000514 switch (msg->obj_type) {
515 case BCMOLT_OBJ_ID_FLOW:
516 switch (msg->subgroup) {
517 case BCMOLT_FLOW_AUTO_SUBGROUP_RECEIVE_ETH_PACKET:
518 {
519 bcmolt_flow_receive_eth_packet *pkt =
520 (bcmolt_flow_receive_eth_packet*)msg;
521 bcmolt_flow_receive_eth_packet_data *pkt_data =
522 &((bcmolt_flow_receive_eth_packet*)msg)->data;
Shad Ansari5fe93682018-04-26 05:24:19 +0000523
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000524 uint32_t port_no = GetPortNum_(pkt->key.flow_id);
525 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)));
526 pkt_ind->set_intf_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_ID));
527 pkt_ind->set_gemport_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, SVC_PORT_ID));
528 pkt_ind->set_flow_id(pkt->key.flow_id);
529 pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len);
530 pkt_ind->set_port_no(port_no);
531 pkt_ind->set_cookie(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, COOKIE));
532 ind.set_allocated_pkt_ind(pkt_ind);
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500533
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000534 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",
535 pkt_ind->intf_type().c_str(), pkt_ind->intf_id(),
536 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(),
537 get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_ID),
538 pkt_ind->gemport_id(), GET_FLOW_TYPE(pkt->key.flow_type),
539 pkt_ind->flow_id(), port_no, pkt_ind->cookie());
540 }
541 }
542 }
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500543
Shad Ansari5fe93682018-04-26 05:24:19 +0000544 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000545 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000546}
547
Girish Gowdra96461052019-11-22 20:13:59 +0530548static void ItuPonAllocConfigCompletedInd(bcmolt_devid olt, bcmolt_msg *msg) {
549
550 switch (msg->obj_type) {
551 case BCMOLT_OBJ_ID_ITUPON_ALLOC:
552 switch (msg->subgroup) {
553 case BCMOLT_ITUPON_ALLOC_AUTO_SUBGROUP_CONFIGURATION_COMPLETED:
554 {
555 bcmolt_itupon_alloc_configuration_completed *pkt =
556 (bcmolt_itupon_alloc_configuration_completed*)msg;
557 bcmolt_itupon_alloc_configuration_completed_data *pkt_data =
558 &((bcmolt_itupon_alloc_configuration_completed*)msg)->data;
559
560 alloc_cfg_compltd_key key((uint32_t)pkt->key.pon_ni, (uint32_t) pkt->key.alloc_id);
561 alloc_cfg_complete_result res;
562 res.pon_intf_id = pkt->key.pon_ni;
563 res.alloc_id = pkt->key.alloc_id;
564
565 pkt_data->status == BCMOLT_RESULT_SUCCESS ? res.status = ALLOC_CFG_STATUS_SUCCESS: res.status = ALLOC_CFG_STATUS_FAIL;
566 switch (pkt_data->new_state) {
567 case BCMOLT_ACTIVATION_STATE_NOT_CONFIGURED:
568 res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED;
569 break;
570 case BCMOLT_ACTIVATION_STATE_INACTIVE:
571 res.state = ALLOC_OBJECT_STATE_INACTIVE;
572 break;
573 case BCMOLT_ACTIVATION_STATE_PROCESSING:
574 res.state = ALLOC_OBJECT_STATE_PROCESSING;
575 break;
576 case BCMOLT_ACTIVATION_STATE_ACTIVE:
577 res.state = ALLOC_OBJECT_STATE_ACTIVE;
578 break;
579 default:
580 OPENOLT_LOG(ERROR, openolt_log_id, "invalid itu pon alloc activation new_state, pon_intf %u, alloc_id %u, new_state %d\n",
581 pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->new_state);
582 res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED;
583 }
584 OPENOLT_LOG(INFO, openolt_log_id, "received itu pon alloc cfg complete ind, pon intf %u, alloc_id %u, status %u, new_state %u\n",
585 pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->status, pkt_data->new_state);
586
587 bcmos_fastlock_lock(&alloc_cfg_wait_lock);
588 // Push the result from BAL to queue
589 std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *>::iterator it = alloc_cfg_compltd_map.find(key);
590 if (it == alloc_cfg_compltd_map.end()) {
591 // could be case of spurious aysnc response, OR, the application timed-out waiting for response and cleared the key.
592 bcmolt_msg_free(msg);
593 OPENOLT_LOG(ERROR, openolt_log_id, "alloc config key not found for alloc_id = %u, pon_intf = %u\n", pkt->key.alloc_id, pkt->key.pon_ni);
594 bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0);
595 return;
596 }
597 if (it->second) {
598 // Push the result
599 it->second->push(res);
600 }
601 bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0);
602 }
603 }
604 }
605
606 bcmolt_msg_free(msg);
607}
608
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000609static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000610 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000611 OPENOLT_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
612 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000613}
614
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000615static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000616 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000617 OPENOLT_LOG(DEBUG, openolt_log_id, "flow indication\n");
618 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000619}
620
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000621static void TmQIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000622 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000623 OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
624 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000625}
626
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000627static void TmSchedIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000628 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000629 OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
630 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000631}
632
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000633static void McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Shad Ansari01b0e652018-04-05 21:02:53 +0000634 openolt::Indication ind;
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000635 OPENOLT_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
636 bcmolt_msg_free(msg);
Shad Ansari01b0e652018-04-05 21:02:53 +0000637}
638
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000639static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400640 openolt::Indication ind;
641 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
642 openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication;
643
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000644 switch (msg->obj_type) {
645 case BCMOLT_OBJ_ID_ONU:
646 switch (msg->subgroup) {
647 case BCMOLT_ONU_AUTO_SUBGROUP_SUFI:
648 {
649 bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key;
650 bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400651
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000652 OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
653 key->pon_ni, key->onu_id, data->alarm_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400654
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000655 sufi_ind->set_intf_id(key->pon_ni);
656 sufi_ind->set_onu_id(key->onu_id);
657 sufi_ind->set_status(alarm_status_to_string(data->alarm_status));
658 alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400659
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000660 ind.set_allocated_alarm_ind(alarm_ind);
661 }
662 }
663 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400664
665 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000666 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400667}
668
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000669static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400670 openolt::Indication ind;
671 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
672 openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication;
673
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000674 switch (msg->obj_type) {
675 case BCMOLT_OBJ_ID_ONU:
676 switch (msg->subgroup) {
677 case BCMOLT_ONU_AUTO_SUBGROUP_SDI:
678 {
679 bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key;
680 bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400681
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000682 OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
683 key->pon_ni, key->onu_id, data->alarm_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400684
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000685 sdi_ind->set_intf_id(key->pon_ni);
686 sdi_ind->set_onu_id(key->onu_id);
687 sdi_ind->set_status(alarm_status_to_string(data->alarm_status));
688 sdi_ind->set_inverse_bit_error_rate(data->ber);
689 alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_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 OnuDriftOfWindowIndication(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::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication;
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_DOWI:
709 {
710 bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key;
711 bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)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 drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n",
714 key->pon_ni, key->onu_id, data->alarm_status, data->drift_value, data->new_eqd);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400715
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000716 dowi_ind->set_intf_id(key->pon_ni);
717 dowi_ind->set_onu_id(key->onu_id);
718 dowi_ind->set_status(alarm_status_to_string(data->alarm_status));
719 dowi_ind->set_drift(data->drift_value);
720 dowi_ind->set_new_eqd(data->new_eqd);
721 alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_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 OnuLossOfOmciChannelIndication(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::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication;
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_LOOCI:
741 {
742 bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key;
743 bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)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 loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
746 key->pon_ni, key->onu_id, data->alarm_status);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400747
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000748 looci_ind->set_intf_id(key->pon_ni);
749 looci_ind->set_onu_id(key->onu_id);
750 looci_ind->set_status(alarm_status_to_string(data->alarm_status));
751 alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400752
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000753 ind.set_allocated_alarm_ind(alarm_ind);
754 }
755 }
756 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400757
758 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000759 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400760}
761
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000762static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400763 openolt::Indication ind;
764 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
765 openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication;
766
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000767 switch (msg->obj_type) {
768 case BCMOLT_OBJ_ID_ONU:
769 switch (msg->subgroup) {
770 case BCMOLT_ONU_AUTO_SUBGROUP_SFI:
771 {
772 bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key;
773 bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400774
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000775 OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
776 key->pon_ni, key->onu_id, data->alarm_status, data->ber);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400777
778
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000779 sfi_ind->set_intf_id(key->pon_ni);
780 sfi_ind->set_onu_id(key->onu_id);
781 sfi_ind->set_status(alarm_status_to_string(data->alarm_status));
782 sfi_ind->set_inverse_bit_error_rate(data->ber);
783 alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400784
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000785 ind.set_allocated_alarm_ind(alarm_ind);
786 }
787 }
788 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400789
790 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000791 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400792}
793
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000794static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400795 openolt::Indication ind;
796 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
797 openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning;
798
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000799 switch (msg->obj_type) {
800 case BCMOLT_OBJ_ID_ONU:
801 switch (msg->subgroup) {
802 case BCMOLT_ONU_AUTO_SUBGROUP_TIWI:
803 {
804 bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key;
805 bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400806
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000807 OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
808 key->pon_ni, key->onu_id, data->alarm_status, data->drift_value);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400809
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000810 tiwi_ind->set_intf_id(key->pon_ni);
811 tiwi_ind->set_onu_id(key->onu_id);
812 tiwi_ind->set_status(alarm_status_to_string(data->alarm_status));
813 tiwi_ind->set_drift(data->drift_value);
814 alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400815
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000816 ind.set_allocated_alarm_ind(alarm_ind);
817 }
818 }
819 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400820
821 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000822 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400823}
824
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000825static void OnuActivationFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400826 openolt::Indication ind;
827 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
828 openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication;
829
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000830 switch (msg->obj_type) {
831 case BCMOLT_OBJ_ID_ONU:
832 switch (msg->subgroup) {
833 case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED:
834 {
835 bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key;
836 bcmolt_onu_onu_activation_completed_data *data =
837 &((bcmolt_onu_onu_activation_completed*)msg)->data;
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400838
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000839 OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d\n",
840 key->pon_ni, key->onu_id, data->fail_reason);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400841
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000842 activation_fail_ind->set_intf_id(key->pon_ni);
843 activation_fail_ind->set_onu_id(key->onu_id);
844 alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400845
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000846 ind.set_allocated_alarm_ind(alarm_ind);
847 }
848 }
849 }
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400850
851 oltIndQ.push(ind);
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000852 bcmolt_msg_free(msg);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400853}
854
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000855/* removed by BAL v3.0
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400856bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) {
857 openolt::Indication ind;
858 openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
859 openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication;
860
861 bcmbal_subscriber_terminal_key *key =
862 &(((bcmbal_subscriber_terminal_processing_error*)obj)->key);
863
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000864 OPENOLT_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n",
Nicolas Palpacuer967438f2018-09-07 14:41:54 -0400865 key->intf_id, key->sub_term_id);
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400866
867
868 onu_proc_error_ind->set_intf_id(key->intf_id);
869 onu_proc_error_ind->set_onu_id(key->sub_term_id);
870
871 alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind);
872 ind.set_allocated_alarm_ind(alarm_ind);
873
874 oltIndQ.push(ind);
875 return BCM_ERR_OK;
876}
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000877*/
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400878
Shad Ansari01b0e652018-04-05 21:02:53 +0000879Status SubscribeIndication() {
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000880 bcmolt_rx_cfg rx_cfg = {};
881 bcmos_errno rc;
Shad Ansari01b0e652018-04-05 21:02:53 +0000882
883 if (subscribed) {
884 return Status::OK;
885 }
886
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000887 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
888 rx_cfg.rx_cb = OltOperIndication;
889 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
890 rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete;
891 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
892 if(rc != BCM_ERR_OK)
893 return Status(grpc::StatusCode::INTERNAL,
894 "Olt connection complete state indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000895
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000896 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
897 rx_cfg.rx_cb = OltOperIndication;
898 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
899 rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete;
900 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
901 if(rc != BCM_ERR_OK)
902 return Status(grpc::StatusCode::INTERNAL,
903 "Olt disconnection complete state indication subscribe failed");
904
905 rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
906 rx_cfg.rx_cb = OltOperIndication;
907 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
908 rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure;
909 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
910 if(rc != BCM_ERR_OK)
911 return Status(grpc::StatusCode::INTERNAL,
912 "Olt connection failure state indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000913
914 /* Interface LOS indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000915 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
916 rx_cfg.rx_cb = LosIndication;
917 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
918 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los;
919 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
920 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000921 return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000922
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000923 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
924 rx_cfg.rx_cb = IfOperIndication;
925 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
926 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed;
927 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
928 if(rc != BCM_ERR_OK)
929 return Status(grpc::StatusCode::INTERNAL,
930 "PON Interface operations state change indication subscribe failed");
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700931
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000932 rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE;
933 rx_cfg.rx_cb = IfOperIndication;
934 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
935 rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change;
936 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
937 if(rc != BCM_ERR_OK)
938 return Status(grpc::StatusCode::INTERNAL,
939 "NNI Interface operations state change indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000940
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000941 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
942 rx_cfg.rx_cb = OnuAlarmIndication;
943 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
944 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm;
945 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
946 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000947 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000948
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000949 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
950 rx_cfg.rx_cb = OnuAlarmIndication;
951 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
952 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm;
953 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
954 if(rc != BCM_ERR_OK)
955 return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
956
957 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
958 rx_cfg.rx_cb = OnuDyingGaspIndication;
959 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
960 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi;
961 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
962 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000963 return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000964
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000965 rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
966 rx_cfg.rx_cb = OnuDiscoveryIndication;
967 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
968 rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered;
969 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
970 if(rc != BCM_ERR_OK)
Shad Ansari01b0e652018-04-05 21:02:53 +0000971 return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000972
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000973 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
974 rx_cfg.rx_cb = OnuIndication;
975 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
976 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_ranging_completed;
977
978 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
979 if(rc != BCM_ERR_OK)
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -0700980 return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000981
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000982 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
983 rx_cfg.rx_cb = OnuStartupFailureIndication;
984 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
985 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi;
986 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
987 if(rc != BCM_ERR_OK)
988 return Status(grpc::StatusCode::INTERNAL,
989 "onu startup failure indication subscribe failed");
Shad Ansari01b0e652018-04-05 21:02:53 +0000990
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000991 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
992 rx_cfg.rx_cb = OnuSignalDegradeIndication;
993 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
994 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi;
995 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
996 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400997 return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -0400998
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000999 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
1000 rx_cfg.rx_cb = OnuDriftOfWindowIndication;
1001 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1002 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi;
1003 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1004 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001005 return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001006
1007 /* LOOCI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +00001008 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
1009 rx_cfg.rx_cb = OnuLossOfOmciChannelIndication;
1010 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1011 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci;
1012 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1013 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001014 return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001015
1016 /* SFI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +00001017 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
1018 rx_cfg.rx_cb = OnuSignalsFailureIndication;
1019 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1020 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi;
1021 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1022 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001023 return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001024
1025 /* TIWI indication */
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +00001026 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
1027 rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication;
1028 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1029 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi;
1030 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1031 if(rc != BCM_ERR_OK)
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001032 return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001033
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +00001034 /* ONU Activation Failure Indiction */
1035 rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
1036 rx_cfg.rx_cb = OnuActivationFailureIndication;
1037 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1038 rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed;
1039 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1040 if(rc != BCM_ERR_OK)
1041 return Status(grpc::StatusCode::INTERNAL,
1042 "onu activation falaire indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001043
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +00001044 rx_cfg.obj_type = BCMOLT_OBJ_ID_FLOW;
1045 rx_cfg.rx_cb = PacketIndication;
1046 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1047 rx_cfg.subgroup = bcmolt_flow_auto_subgroup_receive_eth_packet;
1048 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1049 if(rc != BCM_ERR_OK)
1050 return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
Nicolas Palpacuerde4325b2018-07-03 11:18:42 -04001051
Girish Gowdra96461052019-11-22 20:13:59 +05301052 rx_cfg.obj_type = BCMOLT_OBJ_ID_ITUPON_ALLOC;
1053 rx_cfg.rx_cb = ItuPonAllocConfigCompletedInd;
1054 rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
1055 rx_cfg.subgroup = bcmolt_itupon_alloc_auto_subgroup_configuration_completed;
1056 rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
1057 if(rc != BCM_ERR_OK)
1058 return Status(grpc::StatusCode::INTERNAL, "ITU PON Alloc Configuration \
1059Complete Indication subscribe failed");
1060
Shad Ansari01b0e652018-04-05 21:02:53 +00001061 subscribed = true;
1062
1063 return Status::OK;
1064}