Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1 | /* |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 3 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 4 | * 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 Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 7 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 9 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 10 | * 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 Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 17 | #include "indications.h" |
Shad Ansari | b7b0ced | 2018-05-11 21:53:32 +0000 | [diff] [blame] | 18 | #include "core.h" |
Girish Gowdra | ddf9a16 | 2020-01-27 12:56:27 +0530 | [diff] [blame] | 19 | #include "core_data.h" |
| 20 | #include "core_utils.h" |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 21 | #include "stats_collection.h" |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 22 | #include "translation.h" |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 23 | #include "state.h" |
| 24 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 25 | #include <string> |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 26 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 27 | extern "C" |
| 28 | { |
| 29 | #include <bcmos_system.h> |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 30 | #include <bcmolt_api.h> |
| 31 | #include <bcmolt_host_api.h> |
| 32 | #include <bcmolt_api_model_api_structs.h> |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | using grpc::Status; |
| 36 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 37 | extern Queue<openolt::Indication> oltIndQ; |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 38 | extern std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *> alloc_cfg_compltd_map; |
| 39 | extern bcmos_fastlock alloc_cfg_wait_lock; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 40 | |
| 41 | bool subscribed = false; |
Girish Gowdru | c8ed2ef | 2019-02-13 08:18:44 -0800 | [diff] [blame] | 42 | uint32_t nni_intf_id = 0; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 43 | #define current_device 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 44 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 45 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 46 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 47 | #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) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 59 | #define ONU_ACTIVATION_COMPLETED_SUCCESS(state) \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 60 | ((state == BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 61 | #define ONU_ACTIVATION_COMPLETED_FAIL(state) \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 | |
| 71 | std::string bcmolt_to_grpc_intf_type(bcmolt_interface_type intf_type) |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 72 | { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 73 | if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 74 | return "nni"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 75 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 76 | return "pon"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 77 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) { |
| 78 | return "host"; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 79 | } |
| 80 | return "unknown"; |
| 81 | } |
| 82 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 83 | std::string bcmolt_to_grpc_interface_rf__intf_type(bcmolt_interface_type intf_type) |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 84 | { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 85 | if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 86 | return "nni"; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 87 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 88 | return "pon"; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 89 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 90 | return "host"; |
| 91 | } |
| 92 | return "unknown"; |
| 93 | } |
| 94 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 95 | inline uint64_t get_pon_stats_alarms_data(bcmolt_interface pon_ni, bcmolt_onu_id onu_id, bcmolt_onu_itu_pon_stats_data_id stat) { |
| 96 | bcmos_errno err; |
| 97 | bcmolt_onu_itu_pon_stats itu_pon_stat; /* declare main API struct */ |
| 98 | bcmolt_onu_key key = {}; /* declare key */ |
| 99 | bcmolt_stat_flags clear_on_read = BCMOLT_STAT_FLAGS_NONE; /* declare 'clear on read' flag */ |
| 100 | |
| 101 | key.pon_ni = pon_ni; |
| 102 | key.onu_id = onu_id; |
| 103 | |
| 104 | /* Initialize the API struct. */ |
| 105 | BCMOLT_STAT_INIT(&itu_pon_stat, onu, itu_pon_stats, key); |
| 106 | switch (stat) { |
| 107 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_RDI_ERRORS: |
| 108 | BCMOLT_FIELD_SET_PRESENT(&itu_pon_stat.data, onu_itu_pon_stats_data, rdi_errors); |
| 109 | err = bcmolt_stat_get(dev_id, &itu_pon_stat.hdr, clear_on_read ? BCMOLT_STAT_FLAGS_CLEAR_ON_READ : BCMOLT_STAT_FLAGS_NONE); |
| 110 | if (err) { |
| 111 | OPENOLT_LOG(ERROR, openolt_log_id, "Failed to get rdi_errors, err = %s\n", bcmos_strerror(err)); |
| 112 | return err; |
| 113 | } |
| 114 | return itu_pon_stat.data.rdi_errors; |
| 115 | /* It is a further requirement |
| 116 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_BIP_ERRORS: |
| 117 | BCMOLT_FIELD_SET_PRESENT(&itu_pon_stat.data, onu_itu_pon_stats_data, bip_errors); |
| 118 | err = bcmolt_stat_get(dev_id, &itu_pon_stat.hdr, clear_on_read ? BCMOLT_STAT_FLAGS_CLEAR_ON_READ : BCMOLT_STAT_FLAGS_NONE); |
| 119 | if (err) { |
| 120 | OPENOLT_LOG(ERROR, openolt_log_id, "Failed to get bip_errors, err = %s\n", bcmos_strerror(err)); |
| 121 | return err; |
| 122 | } |
| 123 | return itu_pon_stat.data.bip_errors; |
| 124 | */ |
| 125 | default: |
| 126 | return BCM_ERR_INTERNAL; |
| 127 | } |
| 128 | |
| 129 | return err; |
| 130 | } |
| 131 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 132 | /*std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 133 | bcmbal_subscriber_terminal_key key; |
| 134 | bcmbal_subscriber_terminal_cfg sub_term_obj = {}; |
| 135 | uint8_t *list_mem;// to fetch config details for ONU |
| 136 | bcmos_errno err = BCM_ERR_OK; |
| 137 | |
| 138 | key.sub_term_id =onu_id; |
| 139 | key.intf_id = intf_id; |
| 140 | BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id); |
| 141 | |
| 142 | BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key); |
| 143 | |
| 144 | BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties); |
| 145 | char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH); |
| 146 | memset(reg_id, '\0', MAX_REGID_LENGTH); |
| 147 | |
| 148 | //set memory to use for variable-sized lists |
| 149 | list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 150 | |
| 151 | if (list_mem == NULL) |
| 152 | { |
| 153 | BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \ |
| 154 | cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id); |
| 155 | return reg_id; |
| 156 | } |
| 157 | |
| 158 | memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 159 | BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 160 | |
| 161 | //call API |
| 162 | err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr); |
| 163 | |
| 164 | if (err != BCM_ERR_OK) |
| 165 | { |
| 166 | BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)", |
| 167 | key.sub_term_id, key.intf_id); |
| 168 | free(list_mem); |
| 169 | return reg_id; |
| 170 | } |
| 171 | |
| 172 | BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)", |
| 173 | key.sub_term_id, key.intf_id); |
| 174 | |
| 175 | for (int i=0; i<MAX_REGID_LENGTH ; i++){ |
| 176 | reg_id[i]=sub_term_obj.data.registration_id.arr[i]; |
| 177 | } |
| 178 | |
| 179 | free(list_mem); |
| 180 | return reg_id; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 181 | }*/ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 182 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 183 | static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 184 | openolt::Indication ind; |
| 185 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 186 | std::string admin_state; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 187 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 188 | switch (msg->subgroup) { |
| 189 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE: |
| 190 | admin_state = "up"; |
| 191 | olt_ind->set_oper_state("up"); |
| 192 | break; |
| 193 | case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE: |
| 194 | admin_state = "down"; |
| 195 | olt_ind->set_oper_state("down"); |
| 196 | break; |
| 197 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE: |
| 198 | admin_state = "failure"; |
| 199 | olt_ind->set_oper_state("failure"); |
| 200 | break; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 201 | } |
| 202 | ind.set_allocated_olt_ind(olt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 203 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 204 | if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) { |
| 205 | /* register for omci indication */ |
| 206 | { |
| 207 | bcmolt_rx_cfg rx_cfg = {}; |
| 208 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 209 | rx_cfg.rx_cb = OmciIndication; |
| 210 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet; |
| 211 | rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT; |
| 212 | bcmolt_ind_subscribe(current_device, &rx_cfg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 213 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 214 | state.activate(); |
| 215 | } |
| 216 | else { |
| 217 | state.deactivate(); |
| 218 | } |
| 219 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 220 | oltIndQ.push(ind); |
| 221 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 224 | static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 225 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 226 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 227 | openolt::LosIndication* los_ind = new openolt::LosIndication; |
| 228 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 229 | switch (msg->obj_type) { |
| 230 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 231 | switch (msg->subgroup) { |
| 232 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS: |
| 233 | { |
| 234 | bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg; |
| 235 | int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni, |
| 236 | BCMOLT_INTERFACE_TYPE_PON); |
| 237 | std::string status = alarm_status_to_string(bcm_los_ind->data.status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 238 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 239 | OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 240 | bcm_los_ind->key.pon_ni, intf_id, status.c_str()); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 241 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 242 | los_ind->set_intf_id(intf_id); |
| 243 | los_ind->set_status(status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 244 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 245 | alarm_ind->set_allocated_los_ind(los_ind); |
| 246 | ind.set_allocated_alarm_ind(alarm_ind); |
| 247 | break; |
| 248 | } |
| 249 | } |
| 250 | } |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 251 | |
| 252 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 253 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 256 | static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 257 | openolt::Indication ind; |
| 258 | openolt::IntfIndication* intf_ind = new openolt::IntfIndication; |
| 259 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 260 | switch (msg->obj_type) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 261 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 262 | switch (msg->subgroup) { |
| 263 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 264 | { |
| 265 | bcmolt_pon_interface_key *key = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 266 | &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 267 | bcmolt_pon_interface_state_change_completed_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 268 | &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 269 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 270 | intf_ind->set_intf_id(key->pon_ni); |
| 271 | SET_OPER_STATE(intf_ind, data->new_state); |
Thiyagarajan Subramani | ad46323 | 2020-02-28 19:10:43 +0530 | [diff] [blame] | 272 | |
| 273 | OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 274 | bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON).c_str(), key->pon_ni, intf_ind->oper_state().c_str()); |
| 275 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 276 | ind.set_allocated_intf_ind(intf_ind); |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | break; |
| 281 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 282 | switch (msg->subgroup) { |
| 283 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 284 | { |
| 285 | OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n", |
| 286 | ((bcmolt_nni_interface_state_change *)msg)->key.id); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 287 | bcmolt_nni_interface_key *key = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 288 | &((bcmolt_nni_interface_state_change *)msg)->key; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 289 | bcmolt_nni_interface_state_change_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 290 | &((bcmolt_nni_interface_state_change *)msg)->data; |
| 291 | |
| 292 | intf_ind->set_intf_id(key->id); |
| 293 | SET_OPER_STATE(intf_ind, data->new_state); |
| 294 | ind.set_allocated_intf_ind(intf_ind); |
| 295 | break; |
| 296 | } |
| 297 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 298 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 299 | |
| 300 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 301 | bcmolt_msg_free(msg); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 302 | } |
| 303 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 304 | static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 305 | openolt::Indication ind; |
| 306 | openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 307 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 308 | switch (msg->obj_type) { |
| 309 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 310 | switch (msg->subgroup) { |
| 311 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
| 312 | { |
| 313 | bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
| 314 | bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
| 315 | intf_oper_ind->set_intf_id(key->pon_ni); |
| 316 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON)); |
| 317 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
| 318 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 319 | intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str()); |
| 320 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 321 | break; |
| 322 | } |
| 323 | } |
| 324 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 325 | switch (msg->subgroup) { |
| 326 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 327 | { |
| 328 | bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key; |
| 329 | bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data; |
| 330 | bcmolt_interface intf_id = key->id; |
| 331 | bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI; |
| 332 | intf_oper_ind->set_intf_id(key->id); |
| 333 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI)); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 334 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 335 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 336 | intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str()); |
| 337 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 338 | break; |
| 339 | } |
| 340 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 341 | } |
| 342 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 343 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 344 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 345 | } |
| 346 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 347 | static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 348 | openolt::Indication ind; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 349 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 350 | openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication; |
| 351 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 352 | switch (msg->obj_type) { |
| 353 | case BCMOLT_OBJ_ID_ONU: |
| 354 | switch (msg->subgroup) { |
| 355 | case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM: |
| 356 | { |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 357 | bcmolt_onu_xgpon_alarm_data *data = &((bcmolt_onu_xgpon_alarm *)msg)->data; |
| 358 | bcmolt_onu_key *key = &((bcmolt_onu_xgpon_alarm *)msg)->key; |
Thiyagarajan Subramani | ad46323 | 2020-02-28 19:10:43 +0530 | [diff] [blame] | 359 | |
| 360 | int port_no = interface_key_to_port_no(key->pon_ni, BCMOLT_INTERFACE_TYPE_PON); |
| 361 | |
| 362 | OPENOLT_LOG(INFO, openolt_log_id, "onu alarm indication, pon_ni %d, onu_id %d, port_no %d, los_status %s, lob_status %s, lopc_miss_status %s, lopc_mic_error_status %s\n", key->pon_ni, key->onu_id, port_no, alarm_status_to_string(data->xgpon_onu_alarm.losi).c_str(), alarm_status_to_string(data->xgpon_onu_alarm.lobi).c_str(), alarm_status_to_string(data->xgpon_onu_alarm.lopci_miss).c_str(), alarm_status_to_string(data->xgpon_onu_alarm.lopci_mic_error).c_str()); |
| 363 | |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 364 | onu_alarm_ind->set_los_status(alarm_status_to_string(data->xgpon_onu_alarm.losi)); |
| 365 | onu_alarm_ind->set_lob_status(alarm_status_to_string(data->xgpon_onu_alarm.lobi)); |
| 366 | onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(data->xgpon_onu_alarm.lopci_miss)); |
| 367 | onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(data->xgpon_onu_alarm.lopci_mic_error)); |
| 368 | onu_alarm_ind->set_intf_id(key->pon_ni); |
| 369 | onu_alarm_ind->set_onu_id(key->onu_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 370 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 371 | ind.set_allocated_alarm_ind(alarm_ind); |
| 372 | break; |
| 373 | } |
| 374 | case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM: |
| 375 | { |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 376 | bcmolt_onu_gpon_alarm_data *data = &((bcmolt_onu_gpon_alarm *)msg)->data; |
| 377 | bcmolt_onu_key *key = &((bcmolt_onu_gpon_alarm *)msg)->key; |
| 378 | onu_alarm_ind->set_los_status(alarm_status_to_string(data->gpon_onu_alarm.losi)); |
| 379 | onu_alarm_ind->set_lofi_status(alarm_status_to_string(data->gpon_onu_alarm.lofi)); |
| 380 | onu_alarm_ind->set_loami_status(alarm_status_to_string(data->gpon_onu_alarm.loami)); |
| 381 | onu_alarm_ind->set_intf_id(key->pon_ni); |
| 382 | onu_alarm_ind->set_onu_id(key->onu_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 383 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 384 | ind.set_allocated_alarm_ind(alarm_ind); |
| 385 | break; |
| 386 | } |
| 387 | } |
| 388 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 389 | |
| 390 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 391 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 392 | } |
| 393 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 394 | static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 395 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 396 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 397 | openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 398 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 399 | switch (msg->obj_type) { |
| 400 | case BCMOLT_OBJ_ID_ONU: |
| 401 | switch (msg->subgroup) { |
| 402 | case BCMOLT_ONU_AUTO_SUBGROUP_DGI: |
| 403 | { |
Chaitrashree G S | d8feddd | 2020-01-20 21:42:40 -0500 | [diff] [blame] | 404 | bcmolt_onu_dgi* dgi_data = (bcmolt_onu_dgi *)msg; |
Chaitrashree G S | 7bc19ce | 2020-01-28 18:27:42 -0500 | [diff] [blame] | 405 | bcmolt_onu_key *key = &((bcmolt_onu_dgi *)msg)->key; |
| 406 | |
Thiyagarajan Subramani | ad46323 | 2020-02-28 19:10:43 +0530 | [diff] [blame] | 407 | int port_no = interface_key_to_port_no(key->pon_ni, BCMOLT_INTERFACE_TYPE_PON); |
| 408 | |
| 409 | OPENOLT_LOG(INFO, openolt_log_id, "onu dyinggasp indication, pon_ni %d, onu_id %d, port_no %d, status %s\n", |
| 410 | key->pon_ni, key->onu_id, port_no, alarm_status_to_string(dgi_data->data.alarm_status).c_str()); |
| 411 | |
Chaitrashree G S | d8feddd | 2020-01-20 21:42:40 -0500 | [diff] [blame] | 412 | dgi_ind->set_status(alarm_status_to_string(dgi_data->data.alarm_status)); |
Chaitrashree G S | 7bc19ce | 2020-01-28 18:27:42 -0500 | [diff] [blame] | 413 | dgi_ind->set_intf_id(key->pon_ni); |
| 414 | dgi_ind->set_onu_id(key->onu_id); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 415 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 416 | alarm_ind->set_allocated_dying_gasp_ind(dgi_ind); |
| 417 | ind.set_allocated_alarm_ind(alarm_ind); |
| 418 | break; |
| 419 | } |
| 420 | } |
| 421 | } |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 422 | |
| 423 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 424 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 425 | } |
| 426 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 427 | static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 428 | openolt::Indication ind; |
| 429 | openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication; |
| 430 | openolt::SerialNumber* serial_number = new openolt::SerialNumber; |
| 431 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 432 | switch (msg->obj_type) { |
| 433 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 434 | switch (msg->subgroup) { |
| 435 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED: |
| 436 | { |
| 437 | bcmolt_pon_interface_key *key = |
| 438 | &((bcmolt_pon_interface_onu_discovered *)msg)->key; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 439 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 440 | bcmolt_pon_interface_onu_discovered_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 441 | &((bcmolt_pon_interface_onu_discovered *)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 442 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 443 | bcmolt_serial_number *in_serial_number = &(data->serial_number); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 444 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 445 | OPENOLT_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n", |
| 446 | key->pon_ni, serial_number_to_str(in_serial_number).c_str()); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 447 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 448 | onu_disc_ind->set_intf_id(key->pon_ni); |
| 449 | serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4); |
| 450 | serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8); |
| 451 | onu_disc_ind->set_allocated_serial_number(serial_number); |
| 452 | ind.set_allocated_onu_disc_ind(onu_disc_ind); |
| 453 | break; |
| 454 | } |
| 455 | } |
| 456 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 457 | |
| 458 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 459 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 460 | } |
| 461 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 462 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 463 | openolt::Indication ind; |
| 464 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 465 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 466 | switch (msg->obj_type) { |
| 467 | case BCMOLT_OBJ_ID_ONU: |
| 468 | switch (msg->subgroup) { |
| 469 | case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET: |
| 470 | { |
| 471 | bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key; |
| 472 | bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 473 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 474 | OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 475 | key->pon_ni, key->onu_id); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 476 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 477 | omci_ind->set_intf_id(key->pon_ni); |
| 478 | omci_ind->set_onu_id(key->onu_id); |
| 479 | omci_ind->set_pkt(data->buffer.arr, data->buffer.len); |
| 480 | |
| 481 | ind.set_allocated_omci_ind(omci_ind); |
| 482 | break; |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 487 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 488 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 489 | } |
| 490 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 491 | static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 492 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 493 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 494 | switch (msg->obj_type) { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 495 | case BCMOLT_OBJ_ID_ACCESS_CONTROL: |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 496 | switch (msg->subgroup) { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 497 | case BCMOLT_ACCESS_CONTROL_AUTO_SUBGROUP_RECEIVE_ETH_PACKET: |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 498 | { |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 499 | int32_t gemport_id; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 500 | bcmolt_access_control_receive_eth_packet *pkt = |
| 501 | (bcmolt_access_control_receive_eth_packet*)msg; |
| 502 | bcmolt_access_control_receive_eth_packet_data *pkt_data = |
| 503 | &((bcmolt_access_control_receive_eth_packet*)msg)->data; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 504 | |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 505 | // Set the gemport_id to be passed to is_packet_allowed function |
| 506 | gemport_id = pkt_data->svc_port_id == BCMOLT_SERVICE_PORT_ID_INVALID ? -1 : pkt_data->svc_port_id; |
| 507 | |
| 508 | // Allow the packet to host only if "is_packet_allowed" routine returns true, else drop the packet. |
| 509 | if (! is_packet_allowed(pkt_data, gemport_id) ) { |
| 510 | OPENOLT_LOG(WARNING, openolt_log_id, "packet not allowed to host\n"); |
| 511 | bcmolt_msg_free(msg); |
| 512 | return; |
| 513 | } |
| 514 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 515 | pkt_ind->set_intf_type(bcmolt_to_grpc_interface_rf__intf_type( |
| 516 | (bcmolt_interface_type)pkt_data->interface_ref.intf_type)); |
| 517 | pkt_ind->set_intf_id((bcmolt_interface_id)pkt_data->interface_ref.intf_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 518 | pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len); |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 519 | pkt_ind->set_gemport_id(pkt_data->svc_port_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 520 | ind.set_allocated_pkt_ind(pkt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 521 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 522 | if (pkt_data->interface_ref.intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
| 523 | OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d, gem_port %d\n", |
| 524 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id(), pkt_data->svc_port_id); |
| 525 | } else if (pkt_data->interface_ref.intf_type == BCMOLT_INTERFACE_TYPE_NNI ) { |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 526 | OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d, gem_port %d \n", |
| 527 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id(), pkt_data->svc_port_id); |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 528 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 529 | } |
| 530 | } |
| 531 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 532 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 533 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 534 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 535 | } |
| 536 | |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 537 | static void ItuPonAllocConfigCompletedInd(bcmolt_devid olt, bcmolt_msg *msg) { |
| 538 | |
| 539 | switch (msg->obj_type) { |
| 540 | case BCMOLT_OBJ_ID_ITUPON_ALLOC: |
| 541 | switch (msg->subgroup) { |
| 542 | case BCMOLT_ITUPON_ALLOC_AUTO_SUBGROUP_CONFIGURATION_COMPLETED: |
| 543 | { |
| 544 | bcmolt_itupon_alloc_configuration_completed *pkt = |
| 545 | (bcmolt_itupon_alloc_configuration_completed*)msg; |
| 546 | bcmolt_itupon_alloc_configuration_completed_data *pkt_data = |
| 547 | &((bcmolt_itupon_alloc_configuration_completed*)msg)->data; |
| 548 | |
| 549 | alloc_cfg_compltd_key key((uint32_t)pkt->key.pon_ni, (uint32_t) pkt->key.alloc_id); |
| 550 | alloc_cfg_complete_result res; |
| 551 | res.pon_intf_id = pkt->key.pon_ni; |
| 552 | res.alloc_id = pkt->key.alloc_id; |
| 553 | |
| 554 | pkt_data->status == BCMOLT_RESULT_SUCCESS ? res.status = ALLOC_CFG_STATUS_SUCCESS: res.status = ALLOC_CFG_STATUS_FAIL; |
| 555 | switch (pkt_data->new_state) { |
| 556 | case BCMOLT_ACTIVATION_STATE_NOT_CONFIGURED: |
| 557 | res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED; |
| 558 | break; |
| 559 | case BCMOLT_ACTIVATION_STATE_INACTIVE: |
| 560 | res.state = ALLOC_OBJECT_STATE_INACTIVE; |
| 561 | break; |
| 562 | case BCMOLT_ACTIVATION_STATE_PROCESSING: |
| 563 | res.state = ALLOC_OBJECT_STATE_PROCESSING; |
| 564 | break; |
| 565 | case BCMOLT_ACTIVATION_STATE_ACTIVE: |
| 566 | res.state = ALLOC_OBJECT_STATE_ACTIVE; |
| 567 | break; |
| 568 | default: |
| 569 | OPENOLT_LOG(ERROR, openolt_log_id, "invalid itu pon alloc activation new_state, pon_intf %u, alloc_id %u, new_state %d\n", |
| 570 | pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->new_state); |
| 571 | res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED; |
| 572 | } |
| 573 | 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", |
| 574 | pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->status, pkt_data->new_state); |
| 575 | |
| 576 | bcmos_fastlock_lock(&alloc_cfg_wait_lock); |
| 577 | // Push the result from BAL to queue |
| 578 | std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *>::iterator it = alloc_cfg_compltd_map.find(key); |
| 579 | if (it == alloc_cfg_compltd_map.end()) { |
| 580 | // could be case of spurious aysnc response, OR, the application timed-out waiting for response and cleared the key. |
| 581 | bcmolt_msg_free(msg); |
| 582 | 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); |
| 583 | bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0); |
| 584 | return; |
| 585 | } |
| 586 | if (it->second) { |
| 587 | // Push the result |
| 588 | it->second->push(res); |
| 589 | } |
| 590 | bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0); |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | bcmolt_msg_free(msg); |
| 596 | } |
| 597 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 598 | static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 599 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 600 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow oper state indication\n"); |
| 601 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 602 | } |
| 603 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 604 | static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 605 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 606 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow indication\n"); |
| 607 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 608 | } |
| 609 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 610 | static void TmQIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 611 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 612 | OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n"); |
| 613 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 614 | } |
| 615 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 616 | static void TmSchedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 617 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 618 | OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n"); |
| 619 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 620 | } |
| 621 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 622 | static void McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 623 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 624 | OPENOLT_LOG(DEBUG, openolt_log_id, "mcast group indication\n"); |
| 625 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 626 | } |
| 627 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 628 | static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 629 | openolt::Indication ind; |
| 630 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 631 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 632 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 633 | switch (msg->obj_type) { |
| 634 | case BCMOLT_OBJ_ID_ONU: |
| 635 | switch (msg->subgroup) { |
| 636 | case BCMOLT_ONU_AUTO_SUBGROUP_SUFI: |
| 637 | { |
| 638 | bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key; |
| 639 | bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 640 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 641 | OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n", |
| 642 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 643 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 644 | sufi_ind->set_intf_id(key->pon_ni); |
| 645 | sufi_ind->set_onu_id(key->onu_id); |
| 646 | sufi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 647 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 648 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 649 | ind.set_allocated_alarm_ind(alarm_ind); |
| 650 | } |
| 651 | } |
| 652 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 653 | |
| 654 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 655 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 656 | } |
| 657 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 658 | static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 659 | openolt::Indication ind; |
| 660 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 661 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 662 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 663 | switch (msg->obj_type) { |
| 664 | case BCMOLT_OBJ_ID_ONU: |
| 665 | switch (msg->subgroup) { |
| 666 | case BCMOLT_ONU_AUTO_SUBGROUP_SDI: |
| 667 | { |
| 668 | bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key; |
| 669 | bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 670 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 671 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 672 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 673 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 674 | sdi_ind->set_intf_id(key->pon_ni); |
| 675 | sdi_ind->set_onu_id(key->onu_id); |
| 676 | sdi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 677 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 678 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 679 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 680 | ind.set_allocated_alarm_ind(alarm_ind); |
| 681 | } |
| 682 | } |
| 683 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 684 | |
| 685 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 686 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 687 | } |
| 688 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 689 | static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 690 | openolt::Indication ind; |
| 691 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 692 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 693 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 694 | switch (msg->obj_type) { |
| 695 | case BCMOLT_OBJ_ID_ONU: |
| 696 | switch (msg->subgroup) { |
| 697 | case BCMOLT_ONU_AUTO_SUBGROUP_DOWI: |
| 698 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 699 | bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 700 | bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 701 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 702 | 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", |
| 703 | key->pon_ni, key->onu_id, data->alarm_status, data->drift_value, data->new_eqd); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 704 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 705 | dowi_ind->set_intf_id(key->pon_ni); |
| 706 | dowi_ind->set_onu_id(key->onu_id); |
| 707 | dowi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 708 | dowi_ind->set_drift(data->drift_value); |
| 709 | dowi_ind->set_new_eqd(data->new_eqd); |
| 710 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 711 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 712 | ind.set_allocated_alarm_ind(alarm_ind); |
| 713 | } |
| 714 | } |
| 715 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 716 | |
| 717 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 718 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 719 | } |
| 720 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 721 | static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 722 | openolt::Indication ind; |
| 723 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 724 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 725 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 726 | switch (msg->obj_type) { |
| 727 | case BCMOLT_OBJ_ID_ONU: |
| 728 | switch (msg->subgroup) { |
| 729 | case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI: |
| 730 | { |
| 731 | bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key; |
| 732 | bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 733 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 734 | OPENOLT_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n", |
| 735 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 736 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 737 | looci_ind->set_intf_id(key->pon_ni); |
| 738 | looci_ind->set_onu_id(key->onu_id); |
| 739 | looci_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 740 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 741 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 742 | ind.set_allocated_alarm_ind(alarm_ind); |
| 743 | } |
| 744 | } |
| 745 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 746 | |
| 747 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 748 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 749 | } |
| 750 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 751 | static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 752 | openolt::Indication ind; |
| 753 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 754 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 755 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 756 | switch (msg->obj_type) { |
| 757 | case BCMOLT_OBJ_ID_ONU: |
| 758 | switch (msg->subgroup) { |
| 759 | case BCMOLT_ONU_AUTO_SUBGROUP_SFI: |
| 760 | { |
| 761 | bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key; |
| 762 | bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 763 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 764 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 765 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 766 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 767 | sfi_ind->set_intf_id(key->pon_ni); |
| 768 | sfi_ind->set_onu_id(key->onu_id); |
| 769 | sfi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 770 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 771 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 772 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 773 | ind.set_allocated_alarm_ind(alarm_ind); |
| 774 | } |
| 775 | } |
| 776 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 777 | |
| 778 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 779 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 780 | } |
| 781 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 782 | static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 783 | openolt::Indication ind; |
| 784 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 785 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 786 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 787 | switch (msg->obj_type) { |
| 788 | case BCMOLT_OBJ_ID_ONU: |
| 789 | switch (msg->subgroup) { |
| 790 | case BCMOLT_ONU_AUTO_SUBGROUP_TIWI: |
| 791 | { |
| 792 | bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key; |
| 793 | bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 794 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 795 | OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n", |
| 796 | key->pon_ni, key->onu_id, data->alarm_status, data->drift_value); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 797 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 798 | tiwi_ind->set_intf_id(key->pon_ni); |
| 799 | tiwi_ind->set_onu_id(key->onu_id); |
| 800 | tiwi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 801 | tiwi_ind->set_drift(data->drift_value); |
| 802 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 803 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 804 | ind.set_allocated_alarm_ind(alarm_ind); |
| 805 | } |
| 806 | } |
| 807 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 808 | |
| 809 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 810 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 811 | } |
| 812 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 813 | static void OnuActivationCompletedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 814 | openolt::Indication ind; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 815 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
| 816 | |
| 817 | switch (msg->obj_type) { |
| 818 | case BCMOLT_OBJ_ID_ONU: |
| 819 | switch (msg->subgroup) { |
| 820 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_ACTIVATION_COMPLETED: |
| 821 | { |
| 822 | bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key; |
| 823 | bcmolt_onu_onu_activation_completed_data*data = &((bcmolt_onu_onu_activation_completed*)msg)->data; |
| 824 | |
| 825 | onu_ind->set_intf_id(key->pon_ni); |
| 826 | onu_ind->set_onu_id(key->onu_id); |
| 827 | if (ONU_ACTIVATION_COMPLETED_SUCCESS(data->status)) |
| 828 | onu_ind->set_oper_state("up"); |
| 829 | if (ONU_ACTIVATION_COMPLETED_FAIL(data->status)) |
| 830 | onu_ind->set_oper_state("down"); |
kesavand | 88fdddd | 2020-09-04 12:06:34 +0530 | [diff] [blame] | 831 | switch (data->fail_reason) { |
| 832 | case BCMOLT_ACTIVATION_FAIL_REASON_RANGING: |
| 833 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_RANGING); |
| 834 | break; |
| 835 | case BCMOLT_ACTIVATION_FAIL_REASON_PASSWORD_AUTHENTICATION: |
| 836 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_PASSWORD_AUTHENTICATION); |
| 837 | break; |
| 838 | case BCMOLT_ACTIVATION_FAIL_REASON_LOS: |
| 839 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_LOS); |
| 840 | break; |
| 841 | case BCMOLT_ACTIVATION_FAIL_REASON_ONU_ALARM: |
| 842 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_ONU_ALARM); |
| 843 | break; |
| 844 | case BCMOLT_ACTIVATION_FAIL_REASON_SWITCH_OVER: |
| 845 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_SWITCH_OVER); |
| 846 | break; |
| 847 | default: |
| 848 | onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_NONE); |
| 849 | } |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 850 | // Setting the admin_state state field based on a valid onu_id does not make any sense. |
| 851 | // The adapter too does not seem to interpret this seriously. |
| 852 | // Legacy code, lets keep this as is for now. |
| 853 | (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down"); |
| 854 | ind.set_allocated_onu_ind(onu_ind); |
| 855 | OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n", |
| 856 | key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down", |
| 857 | (key->onu_id)?"up":"down"); |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | oltIndQ.push(ind); |
| 863 | bcmolt_msg_free(msg); |
| 864 | } |
| 865 | |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 866 | static void OnuLossOfKeySyncFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 867 | openolt::Indication ind; |
| 868 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 869 | openolt::OnuLossOfKeySyncFailureIndication* loss_of_sync_fail_ind = new openolt::OnuLossOfKeySyncFailureIndication; |
| 870 | |
| 871 | switch (msg->obj_type) { |
| 872 | case BCMOLT_OBJ_ID_ONU: |
| 873 | switch (msg->subgroup) { |
| 874 | case BCMOLT_ONU_AUTO_SUBGROUP_LOKI: |
| 875 | { |
| 876 | bcmolt_onu_key *key = &((bcmolt_onu_loki*)msg)->key; |
| 877 | bcmolt_onu_loki_data *data = &((bcmolt_onu_loki*)msg)->data; |
| 878 | |
| 879 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu loss of key sync, intf_id %d, onu_id %d, alarm_status %d\n", |
| 880 | key->pon_ni, key->onu_id, data->alarm_status); |
| 881 | |
| 882 | loss_of_sync_fail_ind->set_intf_id(key->pon_ni); |
| 883 | loss_of_sync_fail_ind->set_onu_id(key->onu_id); |
| 884 | loss_of_sync_fail_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 885 | alarm_ind->set_allocated_onu_loss_of_sync_fail_ind(loss_of_sync_fail_ind); |
| 886 | |
| 887 | ind.set_allocated_alarm_ind(alarm_ind); |
| 888 | } |
| 889 | } |
| 890 | } |
| 891 | |
| 892 | oltIndQ.push(ind); |
| 893 | bcmolt_msg_free(msg); |
| 894 | } |
| 895 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 896 | static void OnuItuPonStatsAlarmRaisedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 897 | openolt::Indication ind; |
| 898 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 899 | openolt::OnuItuPonStatsIndication* onu_itu_pon_stats_ind = new openolt::OnuItuPonStatsIndication; |
| 900 | |
| 901 | switch (msg->obj_type) { |
| 902 | case BCMOLT_OBJ_ID_ONU: |
| 903 | switch (msg->subgroup) { |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 904 | case BCMOLT_ONU_AUTO_SUBGROUP_ITU_PON_STATS_ALARM_RAISED: |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 905 | { |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 906 | bcmolt_onu_key *onu_key = &((bcmolt_onu_itu_pon_stats_alarm_raised*)msg)->key; |
| 907 | bcmolt_onu_itu_pon_stats_alarm_raised_data *data = &((bcmolt_onu_itu_pon_stats_alarm_raised*)msg)->data; |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 908 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 909 | if (_BCMOLT_FIELD_MASK_BIT_IS_SET(data->presence_mask, BCMOLT_ONU_ITU_PON_STATS_ALARM_RAISED_DATA_ID_STAT)) { |
| 910 | switch (data->stat) |
| 911 | { |
| 912 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_RDI_ERRORS: |
| 913 | uint64_t rdi_errors; |
| 914 | openolt::RdiErrorIndication* rdi_err_ind = new openolt::RdiErrorIndication; |
| 915 | rdi_errors = get_pon_stats_alarms_data(onu_key->pon_ni, onu_key->onu_id, data->stat); |
| 916 | onu_itu_pon_stats_ind->set_intf_id(onu_key->pon_ni); |
| 917 | onu_itu_pon_stats_ind->set_onu_id(onu_key->onu_id); |
| 918 | rdi_err_ind->set_rdi_error_count(rdi_errors); |
| 919 | rdi_err_ind->set_status("on"); |
| 920 | onu_itu_pon_stats_ind->set_allocated_rdi_error_ind(rdi_err_ind); |
| 921 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu raised alarm indication, intf_id %d, onu_id %d, \ |
| 922 | rdi_errors %"PRIu64"\n", onu_key->pon_ni, onu_key->onu_id, rdi_errors); |
| 923 | alarm_ind->set_allocated_onu_itu_pon_stats_ind(onu_itu_pon_stats_ind); |
| 924 | break; |
| 925 | /* It is a further requirement |
| 926 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_BIP_ERRORS: |
| 927 | uint64_t bip_errors; |
| 928 | bip_errors = get_pon_stats_alarms_data(onu_key->pon_ni, onu_key->onu_id, data->stat); |
| 929 | onu_itu_pon_stats_ind->set_intf_id(onu_key->pon_ni); |
| 930 | onu_itu_pon_stats_ind->set_onu_id(onu_key->onu_id); |
| 931 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu raised alarm indication, intf_id %d, onu_id %d, \ |
| 932 | bip_errors %"PRIu64"\n", onu_key->pon_ni, onu_key->onu_id, bip_errors); |
| 933 | alarm_ind->set_allocated_onu_itu_pon_stats_ind(onu_itu_pon_stats_ind); |
| 934 | break; |
| 935 | */ |
| 936 | } |
| 937 | ind.set_allocated_alarm_ind(alarm_ind); |
| 938 | } |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 939 | } |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | oltIndQ.push(ind); |
| 944 | bcmolt_msg_free(msg); |
| 945 | } |
| 946 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 947 | static void OnuItuPonStatsAlarmClearedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 948 | openolt::Indication ind; |
| 949 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 950 | openolt::OnuItuPonStatsIndication* onu_itu_pon_stats_ind = new openolt::OnuItuPonStatsIndication; |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 951 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 952 | switch (msg->obj_type) { |
| 953 | case BCMOLT_OBJ_ID_ONU: |
| 954 | switch (msg->subgroup) { |
| 955 | case BCMOLT_ONU_AUTO_SUBGROUP_ITU_PON_STATS_ALARM_CLEARED: |
| 956 | { |
| 957 | bcmolt_onu_key *onu_key = &((bcmolt_onu_itu_pon_stats_alarm_cleared*)msg)->key; |
| 958 | bcmolt_onu_itu_pon_stats_alarm_cleared_data *data = &((bcmolt_onu_itu_pon_stats_alarm_cleared*)msg)->data; |
| 959 | |
| 960 | if (_BCMOLT_FIELD_MASK_BIT_IS_SET(data->presence_mask, BCMOLT_ONU_ITU_PON_STATS_ALARM_CLEARED_DATA_ID_STAT)) { |
| 961 | switch (data->stat) |
| 962 | { |
| 963 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_RDI_ERRORS: |
| 964 | uint64_t rdi_errors; |
| 965 | openolt::RdiErrorIndication* rdi_err_ind = new openolt::RdiErrorIndication; |
| 966 | |
| 967 | rdi_errors = get_pon_stats_alarms_data(onu_key->pon_ni, onu_key->onu_id, data->stat); |
| 968 | onu_itu_pon_stats_ind->set_intf_id(onu_key->pon_ni); |
| 969 | onu_itu_pon_stats_ind->set_onu_id(onu_key->onu_id); |
| 970 | rdi_err_ind->set_rdi_error_count(rdi_errors); |
| 971 | rdi_err_ind->set_status("off"); |
| 972 | onu_itu_pon_stats_ind->set_allocated_rdi_error_ind(rdi_err_ind); |
| 973 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu cleared alarm indication, intf_id %d, onu_id %d, \ |
| 974 | rdi_errors %"PRIu64"\n", onu_key->pon_ni, onu_key->onu_id, rdi_errors); |
| 975 | alarm_ind->set_allocated_onu_itu_pon_stats_ind(onu_itu_pon_stats_ind); |
| 976 | break; |
| 977 | /* It is a further requirement |
| 978 | case BCMOLT_ONU_ITU_PON_STATS_DATA_ID_BIP_ERRORS: |
| 979 | uint64_t bip_errors; |
| 980 | bip_errors = get_pon_stats_alarms_data(onu_key->pon_ni, onu_key->onu_id, data->stat); |
| 981 | onu_itu_pon_stats_ind->set_intf_id(onu_key->pon_ni); |
| 982 | onu_itu_pon_stats_ind->set_onu_id(onu_key->onu_id); |
| 983 | onu_itu_pon_stats_ind->set_bip_errors(bip_errors); |
| 984 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu cleared alarm indication, intf_id %d, onu_id %d, \ |
| 985 | bip_errors %"PRIu64"\n", onu_key->pon_ni, onu_key->onu_id, bip_errors); |
| 986 | alarm_ind->set_allocated_onu_itu_pon_stats_ind(onu_itu_pon_stats_ind); |
| 987 | break; |
| 988 | */ |
| 989 | } |
| 990 | ind.set_allocated_alarm_ind(alarm_ind); |
| 991 | } |
| 992 | } |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | oltIndQ.push(ind); |
| 997 | bcmolt_msg_free(msg); |
| 998 | } |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 999 | |
| 1000 | static void OnuDeactivationCompletedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 1001 | openolt::Indication ind; |
| 1002 | |
| 1003 | openolt::Indication onu_ind; |
| 1004 | openolt::OnuIndication* onu_ind_data = new openolt::OnuIndication; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1005 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1006 | switch (msg->obj_type) { |
| 1007 | case BCMOLT_OBJ_ID_ONU: |
| 1008 | switch (msg->subgroup) { |
| 1009 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED: |
| 1010 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1011 | bcmolt_onu_key *key = &((bcmolt_onu_onu_deactivation_completed*)msg)->key; |
| 1012 | bcmolt_onu_onu_deactivation_completed_data *data = |
| 1013 | &((bcmolt_onu_onu_deactivation_completed*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1014 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1015 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d, result_status %s\n", |
| 1016 | key->pon_ni, key->onu_id, data->fail_reason, bcmolt_result_to_string(data->status).c_str()); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1017 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1018 | onu_ind_data->set_intf_id(key->pon_ni); |
| 1019 | onu_ind_data->set_onu_id(key->onu_id); |
| 1020 | onu_ind_data->set_oper_state("down"); |
| 1021 | onu_ind_data->set_admin_state("down"); |
| 1022 | onu_ind.set_allocated_onu_ind(onu_ind_data); |
Girish Gowdra | 7a79dae | 2020-02-10 18:22:11 +0530 | [diff] [blame] | 1023 | |
| 1024 | onu_deact_compltd_key onu_key((uint32_t)key->pon_ni, (uint32_t) key->onu_id); |
| 1025 | onu_deactivate_complete_result res; |
| 1026 | res.pon_intf_id = (uint32_t)key->pon_ni; |
| 1027 | res.onu_id = (uint32_t) key->onu_id; |
| 1028 | res.result = data->status; |
| 1029 | res.reason = data->fail_reason; |
| 1030 | |
| 1031 | OPENOLT_LOG(INFO, openolt_log_id, "received onu deactivate result, pon intf %u, onu_id %u, status %u, reason %u\n", |
| 1032 | key->pon_ni, key->onu_id, data->status, data->fail_reason); |
| 1033 | |
| 1034 | bcmos_fastlock_lock(&onu_deactivate_wait_lock); |
| 1035 | // Push the result from BAL to queue |
| 1036 | std::map<onu_deact_compltd_key, Queue<onu_deactivate_complete_result> *>::iterator it = onu_deact_compltd_map.find(onu_key); |
| 1037 | if (it == onu_deact_compltd_map.end()) { |
| 1038 | // could be case of spurious aysnc response, OR, the application timed-out waiting for response and cleared the key. |
Girish Gowdra | 6675fa0 | 2020-03-03 20:27:50 -0800 | [diff] [blame] | 1039 | // OR most importantly, could be a case of ONU going down (reboot, PON cable plug-out) where |
| 1040 | // BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED is received without any explicit request from the application. |
| 1041 | // The application has to take care handling spurious indications. |
Thiyagarajan Subramani | ad46323 | 2020-02-28 19:10:43 +0530 | [diff] [blame] | 1042 | OPENOLT_LOG(WARNING, openolt_log_id, "onu deactivate completed key not found for pon intf %u, onu_id %u\n", |
Girish Gowdra | 7a79dae | 2020-02-10 18:22:11 +0530 | [diff] [blame] | 1043 | key->pon_ni, key->onu_id); |
Girish Gowdra | 7a79dae | 2020-02-10 18:22:11 +0530 | [diff] [blame] | 1044 | } |
Girish Gowdra | 6675fa0 | 2020-03-03 20:27:50 -0800 | [diff] [blame] | 1045 | else if (it->second) { |
Girish Gowdra | 7a79dae | 2020-02-10 18:22:11 +0530 | [diff] [blame] | 1046 | // Push the result |
| 1047 | it->second->push(res); |
| 1048 | } |
| 1049 | bcmos_fastlock_unlock(&onu_deactivate_wait_lock, 0); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1050 | } |
| 1051 | } |
| 1052 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1053 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1054 | oltIndQ.push(onu_ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1055 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1056 | } |
| 1057 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1058 | /* removed by BAL v3.0 |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1059 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 1060 | openolt::Indication ind; |
| 1061 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 1062 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 1063 | |
| 1064 | bcmbal_subscriber_terminal_key *key = |
| 1065 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 1066 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1067 | OPENOLT_LOG(WARNING, openolt_log_id, "onu processing error indication, intf_id %d, onu_id %d\n", |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 1068 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1069 | |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1070 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 1071 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 1072 | |
| 1073 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 1074 | ind.set_allocated_alarm_ind(alarm_ind); |
| 1075 | |
| 1076 | oltIndQ.push(ind); |
| 1077 | return BCM_ERR_OK; |
| 1078 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1079 | */ |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1080 | |
Burak Gurdag | c78b9e1 | 2019-11-29 11:14:51 +0000 | [diff] [blame] | 1081 | static void GroupIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 1082 | |
| 1083 | switch (msg->obj_type) { |
| 1084 | case BCMOLT_OBJ_ID_GROUP: |
| 1085 | switch (msg->subgroup) { |
| 1086 | case BCMOLT_GROUP_AUTO_SUBGROUP_COMPLETE_MEMBERS_UPDATE: |
| 1087 | { |
| 1088 | bcmolt_group_key *key = &((bcmolt_group_complete_members_update*)msg)->key; |
| 1089 | bcmolt_group_complete_members_update_data *data = |
| 1090 | &((bcmolt_group_complete_members_update*)msg)->data; |
| 1091 | |
| 1092 | if (data->result == BCMOLT_RESULT_SUCCESS) { |
| 1093 | OPENOLT_LOG(INFO, openolt_log_id, "Complete members update indication for group %d (successful)\n", key->id); |
| 1094 | } else { |
| 1095 | OPENOLT_LOG(ERROR, openolt_log_id, "Complete members update indication for group %d (failed with reason %d)\n", key->id, data->fail_reason); |
| 1096 | } |
| 1097 | } |
| 1098 | } |
| 1099 | } |
| 1100 | bcmolt_msg_free(msg); |
| 1101 | } |
| 1102 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1103 | Status SubscribeIndication() { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1104 | bcmolt_rx_cfg rx_cfg = {}; |
| 1105 | bcmos_errno rc; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1106 | |
| 1107 | if (subscribed) { |
| 1108 | return Status::OK; |
| 1109 | } |
| 1110 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1111 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 1112 | rx_cfg.rx_cb = OltOperIndication; |
| 1113 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1114 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete; |
| 1115 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1116 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1117 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1118 | "Olt connection complete state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1119 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1120 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 1121 | rx_cfg.rx_cb = OltOperIndication; |
| 1122 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1123 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete; |
| 1124 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1125 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1126 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1127 | "Olt disconnection complete state indication subscribe failed"); |
| 1128 | |
| 1129 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 1130 | rx_cfg.rx_cb = OltOperIndication; |
| 1131 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1132 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure; |
| 1133 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1134 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1135 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1136 | "Olt connection failure state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1137 | |
| 1138 | /* Interface LOS indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1139 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 1140 | rx_cfg.rx_cb = LosIndication; |
| 1141 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1142 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los; |
| 1143 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1144 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1145 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1146 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1147 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 1148 | rx_cfg.rx_cb = IfOperIndication; |
| 1149 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1150 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed; |
| 1151 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1152 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1153 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1154 | "PON Interface operations state change indication subscribe failed"); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 1155 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1156 | rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE; |
| 1157 | rx_cfg.rx_cb = IfOperIndication; |
| 1158 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1159 | rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change; |
| 1160 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1161 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1162 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1163 | "NNI Interface operations state change indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1164 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1165 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1166 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 1167 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1168 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm; |
| 1169 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1170 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1171 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1172 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1173 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1174 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 1175 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1176 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm; |
| 1177 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1178 | if(rc != BCM_ERR_OK) |
| 1179 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 1180 | |
| 1181 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1182 | rx_cfg.rx_cb = OnuDyingGaspIndication; |
| 1183 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1184 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi; |
| 1185 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1186 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1187 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1188 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1189 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 1190 | rx_cfg.rx_cb = OnuDiscoveryIndication; |
| 1191 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1192 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered; |
| 1193 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1194 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1195 | return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1196 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1197 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1198 | rx_cfg.rx_cb = OnuStartupFailureIndication; |
| 1199 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1200 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi; |
| 1201 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1202 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1203 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1204 | "onu startup failure indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1205 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1206 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1207 | rx_cfg.rx_cb = OnuSignalDegradeIndication; |
| 1208 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1209 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi; |
| 1210 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1211 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1212 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1213 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1214 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1215 | rx_cfg.rx_cb = OnuDriftOfWindowIndication; |
| 1216 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1217 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi; |
| 1218 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1219 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1220 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1221 | |
| 1222 | /* LOOCI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1223 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1224 | rx_cfg.rx_cb = OnuLossOfOmciChannelIndication; |
| 1225 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1226 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci; |
| 1227 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1228 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1229 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1230 | |
| 1231 | /* SFI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1232 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1233 | rx_cfg.rx_cb = OnuSignalsFailureIndication; |
| 1234 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1235 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi; |
| 1236 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1237 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1238 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1239 | |
| 1240 | /* TIWI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1241 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1242 | rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication; |
| 1243 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1244 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi; |
| 1245 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1246 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1247 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1248 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1249 | /* ONU Activation Completed Indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1250 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1251 | rx_cfg.rx_cb = OnuActivationCompletedIndication; |
| 1252 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1253 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_activation_completed; |
| 1254 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1255 | if(rc != BCM_ERR_OK) |
| 1256 | return Status(grpc::StatusCode::INTERNAL, |
| 1257 | "onu activation completed indication subscribe failed"); |
| 1258 | |
| 1259 | /* ONU Deactivation Completed Indication */ |
| 1260 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1261 | rx_cfg.rx_cb = OnuDeactivationCompletedIndication; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1262 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1263 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed; |
| 1264 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1265 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1266 | return Status(grpc::StatusCode::INTERNAL, |
| 1267 | "onu deactivation indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1268 | |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1269 | /* ONU Loss of Key Sync Indiction */ |
| 1270 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1271 | rx_cfg.rx_cb = OnuLossOfKeySyncFailureIndication; |
| 1272 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1273 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_loki; |
| 1274 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1275 | if(rc != BCM_ERR_OK) |
| 1276 | return Status(grpc::StatusCode::INTERNAL, "onu loss of key sync indication subscribe failed"); |
| 1277 | |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 1278 | /* ONU ITU-PON Raised Stats Indiction */ |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1279 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 1280 | rx_cfg.rx_cb = OnuItuPonStatsAlarmRaisedIndication; |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1281 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 1282 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_itu_pon_stats_alarm_raised; |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1283 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1284 | if(rc != BCM_ERR_OK) |
Jason Huang | 5d9ab1a | 2020-04-15 16:53:49 +0800 | [diff] [blame] | 1285 | return Status(grpc::StatusCode::INTERNAL, "onu itu-pon raised stats indication subscribe failed"); |
| 1286 | |
| 1287 | /* ONU ITU-PON Cleared Stats Indiction */ |
| 1288 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1289 | rx_cfg.rx_cb = OnuItuPonStatsAlarmClearedIndication; |
| 1290 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1291 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_itu_pon_stats_alarm_cleared; |
| 1292 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1293 | if(rc != BCM_ERR_OK) |
| 1294 | return Status(grpc::StatusCode::INTERNAL, "onu itu-pon cleared stats indication subscribe failed"); |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1295 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 1296 | /* Packet-In by Access_Control */ |
| 1297 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ACCESS_CONTROL; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1298 | rx_cfg.rx_cb = PacketIndication; |
| 1299 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 1300 | rx_cfg.subgroup = bcmolt_access_control_auto_subgroup_receive_eth_packet; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1301 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1302 | if(rc != BCM_ERR_OK) |
| 1303 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1304 | |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 1305 | #ifndef SCALE_AND_PERF |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 1306 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ITUPON_ALLOC; |
| 1307 | rx_cfg.rx_cb = ItuPonAllocConfigCompletedInd; |
| 1308 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1309 | rx_cfg.subgroup = bcmolt_itupon_alloc_auto_subgroup_configuration_completed; |
| 1310 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1311 | if(rc != BCM_ERR_OK) |
Jason Huang | 9343053 | 2020-02-04 17:16:02 +0800 | [diff] [blame] | 1312 | return Status(grpc::StatusCode::INTERNAL, "ITU PON Alloc Configuration Complete Indication subscribe failed"); |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 1313 | #endif |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 1314 | |
Burak Gurdag | c78b9e1 | 2019-11-29 11:14:51 +0000 | [diff] [blame] | 1315 | rx_cfg.obj_type = BCMOLT_OBJ_ID_GROUP; |
| 1316 | rx_cfg.rx_cb = GroupIndication; |
| 1317 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1318 | rx_cfg.subgroup = bcmolt_group_auto_subgroup_complete_members_update; |
| 1319 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1320 | if(rc != BCM_ERR_OK) |
| 1321 | return Status(grpc::StatusCode::INTERNAL, "Complete members update indication subscribe failed"); |
| 1322 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1323 | subscribed = true; |
| 1324 | |
| 1325 | return Status::OK; |
| 1326 | } |