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