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