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