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