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