Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2018 Open Networking Foundation |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include "indications.h" |
Shad Ansari | b7b0ced | 2018-05-11 21:53:32 +0000 | [diff] [blame] | 18 | #include "core.h" |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 19 | #include "utils.h" |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 20 | #include "stats_collection.h" |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 21 | #include "translation.h" |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 22 | #include "state.h" |
| 23 | |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 24 | #include <string> |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 25 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 26 | extern "C" |
| 27 | { |
| 28 | #include <bcmos_system.h> |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 29 | #include <bcmolt_api.h> |
| 30 | #include <bcmolt_host_api.h> |
| 31 | #include <bcmolt_api_model_api_structs.h> |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | using grpc::Status; |
| 35 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 36 | extern Queue<openolt::Indication> oltIndQ; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 37 | //Queue<openolt::Indication*> oltIndQ; |
| 38 | |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 39 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 40 | bool subscribed = false; |
Girish Gowdru | c8ed2ef | 2019-02-13 08:18:44 -0800 | [diff] [blame] | 41 | uint32_t nni_intf_id = 0; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 42 | #define current_device 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 43 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 44 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg); |
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 | #define INTERFACE_STATE_IF_DOWN(state) \ |
| 47 | ((state == BCMOLT_INTERFACE_STATE_INACTIVE || \ |
| 48 | state == BCMOLT_INTERFACE_STATE_PROCESSING || \ |
| 49 | state == BCMOLT_INTERFACE_STATE_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE) |
| 50 | #define INTERFACE_STATE_IF_UP(state) \ |
| 51 | ((state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) ? BCMOS_TRUE : BCMOS_FALSE) |
| 52 | #define ONU_STATE_IF_DOWN(state) \ |
| 53 | ((state == BCMOLT_ONU_OPERATION_INACTIVE || \ |
| 54 | state == BCMOLT_ONU_OPERATION_DISABLE || \ |
| 55 | state == BCMOLT_ONU_OPERATION_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE) |
| 56 | #define ONU_STATE_IF_UP(state) \ |
| 57 | ((state == BCMOLT_ONU_OPERATION_ACTIVE) ? BCMOS_TRUE : BCMOS_FALSE) |
| 58 | #define ONU_RANGING_STATE_IF_UP(state) \ |
| 59 | ((state == BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE) |
| 60 | #define ONU_RANGING_STATE_IF_DOWN(state) \ |
| 61 | ((state != BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE) |
| 62 | #define SET_OPER_STATE(indication,state) \ |
| 63 | (INTERFACE_STATE_IF_UP(state)) ? indication->set_oper_state("up") : \ |
| 64 | indication->set_oper_state("down") |
| 65 | #define GET_FLOW_TYPE(type) \ |
| 66 | (type == BCMOLT_FLOW_TYPE_UPSTREAM) ? "upstream" : \ |
| 67 | (type == BCMOLT_FLOW_TYPE_DOWNSTREAM) ? "downstream" : \ |
| 68 | (type == BCMOLT_FLOW_TYPE_MULTICAST) ? "multicast" : "unknown" |
| 69 | |
| 70 | std::string bcmolt_to_grpc_intf_type(bcmolt_interface_type intf_type) |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 71 | { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 72 | if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 73 | return "nni"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 74 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 75 | return "pon"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 76 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) { |
| 77 | return "host"; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 78 | } |
| 79 | return "unknown"; |
| 80 | } |
| 81 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 82 | std::string bcmolt_to_grpc_flow_intf_type(bcmolt_flow_interface_type intf_type) |
| 83 | { |
| 84 | if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_NNI) { |
| 85 | return "nni"; |
| 86 | } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_PON) { |
| 87 | return "pon"; |
| 88 | } else if (intf_type == BCMOLT_FLOW_INTERFACE_TYPE_HOST) { |
| 89 | return "host"; |
| 90 | } |
| 91 | return "unknown"; |
| 92 | } |
| 93 | |
| 94 | /*std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 95 | bcmbal_subscriber_terminal_key key; |
| 96 | bcmbal_subscriber_terminal_cfg sub_term_obj = {}; |
| 97 | uint8_t *list_mem;// to fetch config details for ONU |
| 98 | bcmos_errno err = BCM_ERR_OK; |
| 99 | |
| 100 | key.sub_term_id =onu_id; |
| 101 | key.intf_id = intf_id; |
| 102 | BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id); |
| 103 | |
| 104 | BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key); |
| 105 | |
| 106 | BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties); |
| 107 | char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH); |
| 108 | memset(reg_id, '\0', MAX_REGID_LENGTH); |
| 109 | |
| 110 | //set memory to use for variable-sized lists |
| 111 | list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 112 | |
| 113 | if (list_mem == NULL) |
| 114 | { |
| 115 | BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \ |
| 116 | cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id); |
| 117 | return reg_id; |
| 118 | } |
| 119 | |
| 120 | memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 121 | BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 122 | |
| 123 | //call API |
| 124 | err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr); |
| 125 | |
| 126 | if (err != BCM_ERR_OK) |
| 127 | { |
| 128 | BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)", |
| 129 | key.sub_term_id, key.intf_id); |
| 130 | free(list_mem); |
| 131 | return reg_id; |
| 132 | } |
| 133 | |
| 134 | BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)", |
| 135 | key.sub_term_id, key.intf_id); |
| 136 | |
| 137 | for (int i=0; i<MAX_REGID_LENGTH ; i++){ |
| 138 | reg_id[i]=sub_term_obj.data.registration_id.arr[i]; |
| 139 | } |
| 140 | |
| 141 | free(list_mem); |
| 142 | return reg_id; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 143 | }*/ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 144 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 145 | static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 146 | openolt::Indication ind; |
| 147 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 148 | std::string admin_state; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 149 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 150 | switch (msg->subgroup) { |
| 151 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE: |
| 152 | admin_state = "up"; |
| 153 | olt_ind->set_oper_state("up"); |
| 154 | break; |
| 155 | case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE: |
| 156 | admin_state = "down"; |
| 157 | olt_ind->set_oper_state("down"); |
| 158 | break; |
| 159 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE: |
| 160 | admin_state = "failure"; |
| 161 | olt_ind->set_oper_state("failure"); |
| 162 | break; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 163 | } |
| 164 | ind.set_allocated_olt_ind(olt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 165 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 166 | if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) { |
| 167 | /* register for omci indication */ |
| 168 | { |
| 169 | bcmolt_rx_cfg rx_cfg = {}; |
| 170 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 171 | rx_cfg.rx_cb = OmciIndication; |
| 172 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet; |
| 173 | rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT; |
| 174 | bcmolt_ind_subscribe(current_device, &rx_cfg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 175 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 176 | state.activate(); |
| 177 | } |
| 178 | else { |
| 179 | state.deactivate(); |
| 180 | } |
| 181 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 182 | oltIndQ.push(ind); |
| 183 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 186 | static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 187 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 188 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 189 | openolt::LosIndication* los_ind = new openolt::LosIndication; |
| 190 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 191 | switch (msg->obj_type) { |
| 192 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 193 | switch (msg->subgroup) { |
| 194 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS: |
| 195 | { |
| 196 | bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg; |
| 197 | int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni, |
| 198 | BCMOLT_INTERFACE_TYPE_PON); |
| 199 | std::string status = alarm_status_to_string(bcm_los_ind->data.status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 200 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 201 | OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n", |
| 202 | bcm_los_ind->key.pon_ni, intf_id, status.c_str()); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 203 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 204 | los_ind->set_intf_id(intf_id); |
| 205 | los_ind->set_status(status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 206 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 207 | alarm_ind->set_allocated_los_ind(los_ind); |
| 208 | ind.set_allocated_alarm_ind(alarm_ind); |
| 209 | break; |
| 210 | } |
| 211 | } |
| 212 | } |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 213 | |
| 214 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 215 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 216 | } |
| 217 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 218 | static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 219 | openolt::Indication ind; |
| 220 | openolt::IntfIndication* intf_ind = new openolt::IntfIndication; |
| 221 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 222 | switch (msg->obj_type) { |
| 223 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 224 | switch (msg->subgroup) { |
| 225 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
| 226 | { |
| 227 | bcmolt_pon_interface_key *key = |
| 228 | &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
| 229 | bcmolt_pon_interface_state_change_completed_data *data = |
| 230 | &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 231 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 232 | intf_ind->set_intf_id(key->pon_ni); |
| 233 | SET_OPER_STATE(intf_ind, data->new_state); |
| 234 | ind.set_allocated_intf_ind(intf_ind); |
| 235 | break; |
| 236 | } |
| 237 | } |
| 238 | break; |
| 239 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 240 | switch (msg->subgroup) { |
| 241 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 242 | { |
| 243 | OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n", |
| 244 | ((bcmolt_nni_interface_state_change *)msg)->key.id); |
| 245 | bcmolt_nni_interface_key *key = |
| 246 | &((bcmolt_nni_interface_state_change *)msg)->key; |
| 247 | bcmolt_nni_interface_state_change_data *data = |
| 248 | &((bcmolt_nni_interface_state_change *)msg)->data; |
| 249 | |
| 250 | intf_ind->set_intf_id(key->id); |
| 251 | SET_OPER_STATE(intf_ind, data->new_state); |
| 252 | ind.set_allocated_intf_ind(intf_ind); |
| 253 | break; |
| 254 | } |
| 255 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 256 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 257 | |
| 258 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 259 | bcmolt_msg_free(msg); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 260 | } |
| 261 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 262 | static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 263 | openolt::Indication ind; |
| 264 | openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 265 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 266 | switch (msg->obj_type) { |
| 267 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 268 | switch (msg->subgroup) { |
| 269 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
| 270 | { |
| 271 | bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
| 272 | bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
| 273 | intf_oper_ind->set_intf_id(key->pon_ni); |
| 274 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON)); |
| 275 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
| 276 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 277 | intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str()); |
| 278 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 279 | break; |
| 280 | } |
| 281 | } |
| 282 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 283 | switch (msg->subgroup) { |
| 284 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 285 | { |
| 286 | bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key; |
| 287 | bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data; |
| 288 | bcmolt_interface intf_id = key->id; |
| 289 | bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI; |
| 290 | intf_oper_ind->set_intf_id(key->id); |
| 291 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI)); |
| 292 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
| 293 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 294 | intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str()); |
| 295 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 296 | break; |
| 297 | } |
| 298 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 299 | } |
| 300 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 301 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 302 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 303 | } |
| 304 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 305 | static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 306 | openolt::Indication ind; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 307 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 308 | openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication; |
| 309 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 310 | switch (msg->obj_type) { |
| 311 | case BCMOLT_OBJ_ID_ONU: |
| 312 | switch (msg->subgroup) { |
| 313 | case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM: |
| 314 | { |
| 315 | bcmolt_xgpon_onu_alarms *onu_alarms = |
| 316 | &((bcmolt_onu_xgpon_alarm_data *)msg)->xgpon_onu_alarm; |
| 317 | onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi)); |
| 318 | onu_alarm_ind->set_lob_status(alarm_status_to_string(onu_alarms->lobi)); |
| 319 | onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string( |
| 320 | onu_alarms->lopci_miss)); |
| 321 | onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string( |
| 322 | onu_alarms->lopci_mic_error)); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 323 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 324 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 325 | ind.set_allocated_alarm_ind(alarm_ind); |
| 326 | break; |
| 327 | } |
| 328 | case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM: |
| 329 | { |
| 330 | bcmolt_gpon_onu_alarms *onu_alarms = |
| 331 | &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm; |
| 332 | onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi)); |
| 333 | /* TODO: need to set lofi and loami |
| 334 | onu_alarm_ind->set_lof_status(alarm_status_to_string(onu_alarms->lofi)); |
| 335 | onu_alarm_ind->set_loami_status(alarm_status_to_string( |
| 336 | onu_alarms->loami)); |
| 337 | */ |
| 338 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 339 | ind.set_allocated_alarm_ind(alarm_ind); |
| 340 | break; |
| 341 | } |
| 342 | } |
| 343 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 344 | |
| 345 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 346 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 347 | } |
| 348 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 349 | static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 350 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 351 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 352 | openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 353 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 354 | switch (msg->obj_type) { |
| 355 | case BCMOLT_OBJ_ID_ONU: |
| 356 | switch (msg->subgroup) { |
| 357 | case BCMOLT_ONU_AUTO_SUBGROUP_DGI: |
| 358 | { |
| 359 | bcmolt_onu_dgi_data* dgi_data = (bcmolt_onu_dgi_data *)msg; |
| 360 | dgi_ind->set_status(alarm_status_to_string(dgi_data->alarm_status)); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 361 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 362 | alarm_ind->set_allocated_dying_gasp_ind(dgi_ind); |
| 363 | ind.set_allocated_alarm_ind(alarm_ind); |
| 364 | break; |
| 365 | } |
| 366 | } |
| 367 | } |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 368 | |
| 369 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 370 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 371 | } |
| 372 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 373 | static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 374 | openolt::Indication ind; |
| 375 | openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication; |
| 376 | openolt::SerialNumber* serial_number = new openolt::SerialNumber; |
| 377 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 378 | switch (msg->obj_type) { |
| 379 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 380 | switch (msg->subgroup) { |
| 381 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED: |
| 382 | { |
| 383 | bcmolt_pon_interface_key *key = |
| 384 | &((bcmolt_pon_interface_onu_discovered *)msg)->key; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 385 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 386 | bcmolt_pon_interface_onu_discovered_data *data = |
| 387 | &((bcmolt_pon_interface_onu_discovered *)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 388 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 389 | bcmolt_serial_number *in_serial_number = &(data->serial_number); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 390 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 391 | OPENOLT_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n", |
| 392 | key->pon_ni, serial_number_to_str(in_serial_number).c_str()); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 393 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 394 | onu_disc_ind->set_intf_id(key->pon_ni); |
| 395 | serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4); |
| 396 | serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8); |
| 397 | onu_disc_ind->set_allocated_serial_number(serial_number); |
| 398 | ind.set_allocated_onu_disc_ind(onu_disc_ind); |
| 399 | break; |
| 400 | } |
| 401 | } |
| 402 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 403 | |
| 404 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 405 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 406 | } |
| 407 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 408 | static void OnuIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 409 | openolt::Indication ind; |
| 410 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
| 411 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 412 | switch (msg->obj_type) { |
| 413 | case BCMOLT_OBJ_ID_ONU: |
| 414 | switch (msg->subgroup) { |
| 415 | case BCMOLT_ONU_AUTO_SUBGROUP_RANGING_COMPLETED: |
| 416 | { |
| 417 | bcmolt_onu_key *key = &((bcmolt_onu_ranging_completed*)msg)->key; |
| 418 | bcmolt_onu_ranging_completed_data *data = &((bcmolt_onu_ranging_completed*)msg)->data; |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 419 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 420 | onu_ind->set_intf_id(key->pon_ni); |
| 421 | onu_ind->set_onu_id(key->onu_id); |
| 422 | if (ONU_RANGING_STATE_IF_UP(data->status)) |
| 423 | onu_ind->set_oper_state("up"); |
| 424 | if (ONU_RANGING_STATE_IF_DOWN(data->status)) |
| 425 | onu_ind->set_oper_state("down"); |
| 426 | (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down"); |
| 427 | ind.set_allocated_onu_ind(onu_ind); |
| 428 | OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n", |
| 429 | key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down", |
| 430 | (key->onu_id)?"up":"down"); |
| 431 | } |
| 432 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 433 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 434 | /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id); |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 435 | onu_ind->set_registration_id(reg_id); |
| 436 | |
| 437 | BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper state %s, admin_state %s,registration id %s\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 438 | onu_ind->intf_id(), onu_ind->onu_id(),onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());*/ |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 439 | |
| 440 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 441 | bcmolt_msg_free(msg); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 444 | static void OnuOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 445 | openolt::Indication ind; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 446 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 447 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 448 | switch (msg->obj_type) { |
| 449 | case BCMOLT_OBJ_ID_ONU: |
| 450 | switch (msg->subgroup) { |
| 451 | case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE: |
| 452 | { |
| 453 | bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key; |
| 454 | bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 455 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 456 | onu_ind->set_intf_id(key->pon_ni); |
| 457 | onu_ind->set_onu_id(key->onu_id); |
| 458 | if (ONU_STATE_IF_UP(data->new_onu_state)) |
| 459 | onu_ind->set_oper_state("up"); |
| 460 | if (ONU_STATE_IF_DOWN(data->new_onu_state)) |
| 461 | onu_ind->set_oper_state("down"); |
| 462 | ind.set_allocated_onu_ind(onu_ind); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 463 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 464 | OPENOLT_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s\n", |
| 465 | key->pon_ni, key->onu_id, data->new_onu_state, onu_ind->oper_state().c_str()); |
| 466 | } |
| 467 | } |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 468 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 469 | /*const std::string reg_id = getOnuRegistrationId(key->intf_id,key->sub_term_id); |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 470 | onu_ind->set_registration_id(reg_id); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 471 | ind.set_allocated_onu_ind(onu_ind); |
| 472 | |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 473 | BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s, admin_state %s registraion_id %s\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 474 | key->intf_id, key->sub_term_id, data->old_oper_status, onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str(),onu_ind->registration_id().c_str());*/ |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 475 | |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [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 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 480 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 481 | openolt::Indication ind; |
| 482 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 483 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 484 | switch (msg->obj_type) { |
| 485 | case BCMOLT_OBJ_ID_ONU: |
| 486 | switch (msg->subgroup) { |
| 487 | case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET: |
| 488 | { |
| 489 | bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key; |
| 490 | bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 491 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 492 | OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n", |
| 493 | key->pon_ni, key->onu_id); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 494 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 495 | omci_ind->set_intf_id(key->pon_ni); |
| 496 | omci_ind->set_onu_id(key->onu_id); |
| 497 | omci_ind->set_pkt(data->buffer.arr, data->buffer.len); |
| 498 | |
| 499 | ind.set_allocated_omci_ind(omci_ind); |
| 500 | break; |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 505 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 506 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 507 | } |
| 508 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 509 | static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 510 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 511 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 512 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 513 | switch (msg->obj_type) { |
| 514 | case BCMOLT_OBJ_ID_FLOW: |
| 515 | switch (msg->subgroup) { |
| 516 | case BCMOLT_FLOW_AUTO_SUBGROUP_RECEIVE_ETH_PACKET: |
| 517 | { |
| 518 | bcmolt_flow_receive_eth_packet *pkt = |
| 519 | (bcmolt_flow_receive_eth_packet*)msg; |
| 520 | bcmolt_flow_receive_eth_packet_data *pkt_data = |
| 521 | &((bcmolt_flow_receive_eth_packet*)msg)->data; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 522 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 523 | uint32_t port_no = GetPortNum_(pkt->key.flow_id); |
| 524 | pkt_ind->set_intf_type(bcmolt_to_grpc_flow_intf_type((bcmolt_flow_interface_type)get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_TYPE))); |
| 525 | pkt_ind->set_intf_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_ID)); |
| 526 | pkt_ind->set_gemport_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, SVC_PORT_ID)); |
| 527 | pkt_ind->set_flow_id(pkt->key.flow_id); |
| 528 | pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len); |
| 529 | pkt_ind->set_port_no(port_no); |
| 530 | pkt_ind->set_cookie(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, COOKIE)); |
| 531 | ind.set_allocated_pkt_ind(pkt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 532 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 533 | OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d, egress intf_type %s, egress intf_id %lu, svc_port %d, flow_type %s, flow_id %d, port_no %d, cookie %"PRIu64"\n", |
| 534 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id(), |
| 535 | bcmolt_to_grpc_flow_intf_type((bcmolt_flow_interface_type)get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_TYPE)).c_str(), |
| 536 | get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_ID), |
| 537 | pkt_ind->gemport_id(), GET_FLOW_TYPE(pkt->key.flow_type), |
| 538 | pkt_ind->flow_id(), port_no, pkt_ind->cookie()); |
| 539 | } |
| 540 | } |
| 541 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 542 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 543 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 FlowOperIndication(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 oper state 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 FlowIndication(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, "flow 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 TmQIndication(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 queue 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 TmSchedIndication(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, "traffic mgmt sheduler 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 McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 572 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 573 | OPENOLT_LOG(DEBUG, openolt_log_id, "mcast group indication\n"); |
| 574 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 575 | } |
| 576 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 577 | static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 578 | openolt::Indication ind; |
| 579 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 580 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 581 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 582 | switch (msg->obj_type) { |
| 583 | case BCMOLT_OBJ_ID_ONU: |
| 584 | switch (msg->subgroup) { |
| 585 | case BCMOLT_ONU_AUTO_SUBGROUP_SUFI: |
| 586 | { |
| 587 | bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key; |
| 588 | bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 589 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 590 | OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n", |
| 591 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 592 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 593 | sufi_ind->set_intf_id(key->pon_ni); |
| 594 | sufi_ind->set_onu_id(key->onu_id); |
| 595 | sufi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 596 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
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 | ind.set_allocated_alarm_ind(alarm_ind); |
| 599 | } |
| 600 | } |
| 601 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 602 | |
| 603 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 604 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 605 | } |
| 606 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 607 | static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 608 | openolt::Indication ind; |
| 609 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 610 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 611 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 612 | switch (msg->obj_type) { |
| 613 | case BCMOLT_OBJ_ID_ONU: |
| 614 | switch (msg->subgroup) { |
| 615 | case BCMOLT_ONU_AUTO_SUBGROUP_SDI: |
| 616 | { |
| 617 | bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key; |
| 618 | bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 619 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 620 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 621 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
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 | sdi_ind->set_intf_id(key->pon_ni); |
| 624 | sdi_ind->set_onu_id(key->onu_id); |
| 625 | sdi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 626 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 627 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 628 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 629 | ind.set_allocated_alarm_ind(alarm_ind); |
| 630 | } |
| 631 | } |
| 632 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 633 | |
| 634 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 635 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 636 | } |
| 637 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 638 | static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 639 | openolt::Indication ind; |
| 640 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 641 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 642 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 643 | switch (msg->obj_type) { |
| 644 | case BCMOLT_OBJ_ID_ONU: |
| 645 | switch (msg->subgroup) { |
| 646 | case BCMOLT_ONU_AUTO_SUBGROUP_DOWI: |
| 647 | { |
| 648 | bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key; |
| 649 | bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 650 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 651 | 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", |
| 652 | 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] | 653 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 654 | dowi_ind->set_intf_id(key->pon_ni); |
| 655 | dowi_ind->set_onu_id(key->onu_id); |
| 656 | dowi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 657 | dowi_ind->set_drift(data->drift_value); |
| 658 | dowi_ind->set_new_eqd(data->new_eqd); |
| 659 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 660 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 661 | ind.set_allocated_alarm_ind(alarm_ind); |
| 662 | } |
| 663 | } |
| 664 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 665 | |
| 666 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 667 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 668 | } |
| 669 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 670 | static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 671 | openolt::Indication ind; |
| 672 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 673 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 674 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 675 | switch (msg->obj_type) { |
| 676 | case BCMOLT_OBJ_ID_ONU: |
| 677 | switch (msg->subgroup) { |
| 678 | case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI: |
| 679 | { |
| 680 | bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key; |
| 681 | bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 682 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 683 | OPENOLT_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n", |
| 684 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 685 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 686 | looci_ind->set_intf_id(key->pon_ni); |
| 687 | looci_ind->set_onu_id(key->onu_id); |
| 688 | looci_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 689 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
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 | ind.set_allocated_alarm_ind(alarm_ind); |
| 692 | } |
| 693 | } |
| 694 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 695 | |
| 696 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 697 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 698 | } |
| 699 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 700 | static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 701 | openolt::Indication ind; |
| 702 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 703 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 704 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 705 | switch (msg->obj_type) { |
| 706 | case BCMOLT_OBJ_ID_ONU: |
| 707 | switch (msg->subgroup) { |
| 708 | case BCMOLT_ONU_AUTO_SUBGROUP_SFI: |
| 709 | { |
| 710 | bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key; |
| 711 | bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 712 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 713 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 714 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 715 | |
| 716 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 717 | sfi_ind->set_intf_id(key->pon_ni); |
| 718 | sfi_ind->set_onu_id(key->onu_id); |
| 719 | sfi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 720 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 721 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 722 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 723 | ind.set_allocated_alarm_ind(alarm_ind); |
| 724 | } |
| 725 | } |
| 726 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 727 | |
| 728 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 729 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 730 | } |
| 731 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 732 | static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 733 | openolt::Indication ind; |
| 734 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 735 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 736 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 737 | switch (msg->obj_type) { |
| 738 | case BCMOLT_OBJ_ID_ONU: |
| 739 | switch (msg->subgroup) { |
| 740 | case BCMOLT_ONU_AUTO_SUBGROUP_TIWI: |
| 741 | { |
| 742 | bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key; |
| 743 | bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 744 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 745 | OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n", |
| 746 | key->pon_ni, key->onu_id, data->alarm_status, data->drift_value); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 747 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 748 | tiwi_ind->set_intf_id(key->pon_ni); |
| 749 | tiwi_ind->set_onu_id(key->onu_id); |
| 750 | tiwi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 751 | tiwi_ind->set_drift(data->drift_value); |
| 752 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 753 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 754 | ind.set_allocated_alarm_ind(alarm_ind); |
| 755 | } |
| 756 | } |
| 757 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 758 | |
| 759 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 760 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 761 | } |
| 762 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 763 | static void OnuActivationFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 764 | openolt::Indication ind; |
| 765 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 766 | openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication; |
| 767 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 768 | switch (msg->obj_type) { |
| 769 | case BCMOLT_OBJ_ID_ONU: |
| 770 | switch (msg->subgroup) { |
| 771 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED: |
| 772 | { |
| 773 | bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key; |
| 774 | bcmolt_onu_onu_activation_completed_data *data = |
| 775 | &((bcmolt_onu_onu_activation_completed*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 776 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 777 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d\n", |
| 778 | key->pon_ni, key->onu_id, data->fail_reason); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 779 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 780 | activation_fail_ind->set_intf_id(key->pon_ni); |
| 781 | activation_fail_ind->set_onu_id(key->onu_id); |
| 782 | alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 783 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 784 | ind.set_allocated_alarm_ind(alarm_ind); |
| 785 | } |
| 786 | } |
| 787 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 788 | |
| 789 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 790 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 791 | } |
| 792 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 793 | /* removed by BAL v3.0 |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 794 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 795 | openolt::Indication ind; |
| 796 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 797 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 798 | |
| 799 | bcmbal_subscriber_terminal_key *key = |
| 800 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 801 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 802 | 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] | 803 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 804 | |
| 805 | |
| 806 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 807 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 808 | |
| 809 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 810 | ind.set_allocated_alarm_ind(alarm_ind); |
| 811 | |
| 812 | oltIndQ.push(ind); |
| 813 | return BCM_ERR_OK; |
| 814 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 815 | */ |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 816 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 817 | Status SubscribeIndication() { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 818 | bcmolt_rx_cfg rx_cfg = {}; |
| 819 | bcmos_errno rc; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 820 | |
| 821 | if (subscribed) { |
| 822 | return Status::OK; |
| 823 | } |
| 824 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 825 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 826 | rx_cfg.rx_cb = OltOperIndication; |
| 827 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 828 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete; |
| 829 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 830 | if(rc != BCM_ERR_OK) |
| 831 | return Status(grpc::StatusCode::INTERNAL, |
| 832 | "Olt connection complete state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 833 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 834 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 835 | rx_cfg.rx_cb = OltOperIndication; |
| 836 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 837 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete; |
| 838 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 839 | if(rc != BCM_ERR_OK) |
| 840 | return Status(grpc::StatusCode::INTERNAL, |
| 841 | "Olt disconnection complete state indication subscribe failed"); |
| 842 | |
| 843 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 844 | rx_cfg.rx_cb = OltOperIndication; |
| 845 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 846 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure; |
| 847 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 848 | if(rc != BCM_ERR_OK) |
| 849 | return Status(grpc::StatusCode::INTERNAL, |
| 850 | "Olt connection failure state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 851 | |
| 852 | /* Interface LOS indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 853 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 854 | rx_cfg.rx_cb = LosIndication; |
| 855 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 856 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los; |
| 857 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 858 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 859 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 860 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 861 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 862 | rx_cfg.rx_cb = IfOperIndication; |
| 863 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 864 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed; |
| 865 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 866 | if(rc != BCM_ERR_OK) |
| 867 | return Status(grpc::StatusCode::INTERNAL, |
| 868 | "PON Interface operations state change indication subscribe failed"); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 869 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 870 | rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE; |
| 871 | rx_cfg.rx_cb = IfOperIndication; |
| 872 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 873 | rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change; |
| 874 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 875 | if(rc != BCM_ERR_OK) |
| 876 | return Status(grpc::StatusCode::INTERNAL, |
| 877 | "NNI Interface operations state change indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 878 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 879 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 880 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 881 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 882 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm; |
| 883 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 884 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 885 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 886 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 887 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 888 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 889 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 890 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm; |
| 891 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 892 | if(rc != BCM_ERR_OK) |
| 893 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 894 | |
| 895 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 896 | rx_cfg.rx_cb = OnuDyingGaspIndication; |
| 897 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 898 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi; |
| 899 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 900 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 901 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 902 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 903 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 904 | rx_cfg.rx_cb = OnuDiscoveryIndication; |
| 905 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 906 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered; |
| 907 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 908 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 909 | return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 910 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 911 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 912 | rx_cfg.rx_cb = OnuIndication; |
| 913 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 914 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_ranging_completed; |
| 915 | |
| 916 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 917 | if(rc != BCM_ERR_OK) |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 918 | return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 919 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 920 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 921 | rx_cfg.rx_cb = OnuStartupFailureIndication; |
| 922 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 923 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi; |
| 924 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 925 | if(rc != BCM_ERR_OK) |
| 926 | return Status(grpc::StatusCode::INTERNAL, |
| 927 | "onu startup failure indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 928 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 929 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 930 | rx_cfg.rx_cb = OnuSignalDegradeIndication; |
| 931 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 932 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi; |
| 933 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 934 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 935 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 936 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 937 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 938 | rx_cfg.rx_cb = OnuDriftOfWindowIndication; |
| 939 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 940 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi; |
| 941 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 942 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 943 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 944 | |
| 945 | /* LOOCI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 946 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 947 | rx_cfg.rx_cb = OnuLossOfOmciChannelIndication; |
| 948 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 949 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci; |
| 950 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 951 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 952 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 953 | |
| 954 | /* SFI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 955 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 956 | rx_cfg.rx_cb = OnuSignalsFailureIndication; |
| 957 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 958 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi; |
| 959 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 960 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 961 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 962 | |
| 963 | /* TIWI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 964 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 965 | rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication; |
| 966 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 967 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi; |
| 968 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 969 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 970 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 971 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 972 | /* ONU Activation Failure Indiction */ |
| 973 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 974 | rx_cfg.rx_cb = OnuActivationFailureIndication; |
| 975 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 976 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed; |
| 977 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 978 | if(rc != BCM_ERR_OK) |
| 979 | return Status(grpc::StatusCode::INTERNAL, |
| 980 | "onu activation falaire indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 981 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 982 | rx_cfg.obj_type = BCMOLT_OBJ_ID_FLOW; |
| 983 | rx_cfg.rx_cb = PacketIndication; |
| 984 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 985 | rx_cfg.subgroup = bcmolt_flow_auto_subgroup_receive_eth_packet; |
| 986 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 987 | if(rc != BCM_ERR_OK) |
| 988 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 989 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 990 | subscribed = true; |
| 991 | |
| 992 | return Status::OK; |
| 993 | } |