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; |
| 148 | Status status; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 149 | std::string admin_state; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 150 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 151 | switch (msg->subgroup) { |
| 152 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE: |
| 153 | admin_state = "up"; |
| 154 | olt_ind->set_oper_state("up"); |
| 155 | break; |
| 156 | case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE: |
| 157 | admin_state = "down"; |
| 158 | olt_ind->set_oper_state("down"); |
| 159 | break; |
| 160 | case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE: |
| 161 | admin_state = "failure"; |
| 162 | olt_ind->set_oper_state("failure"); |
| 163 | break; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 164 | } |
| 165 | ind.set_allocated_olt_ind(olt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 166 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 167 | if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) { |
| 168 | /* register for omci indication */ |
| 169 | { |
| 170 | bcmolt_rx_cfg rx_cfg = {}; |
| 171 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 172 | rx_cfg.rx_cb = OmciIndication; |
| 173 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet; |
| 174 | rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT; |
| 175 | bcmolt_ind_subscribe(current_device, &rx_cfg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 176 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 177 | state.activate(); |
| 178 | } |
| 179 | else { |
| 180 | state.deactivate(); |
| 181 | } |
| 182 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 183 | oltIndQ.push(ind); |
| 184 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 185 | } |
| 186 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 187 | static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 188 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 189 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 190 | openolt::LosIndication* los_ind = new openolt::LosIndication; |
| 191 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 192 | switch (msg->obj_type) { |
| 193 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 194 | switch (msg->subgroup) { |
| 195 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS: |
| 196 | { |
| 197 | bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg; |
| 198 | int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni, |
| 199 | BCMOLT_INTERFACE_TYPE_PON); |
| 200 | std::string status = alarm_status_to_string(bcm_los_ind->data.status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 201 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 202 | OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n", |
| 203 | bcm_los_ind->key.pon_ni, intf_id, status.c_str()); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 204 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 205 | los_ind->set_intf_id(intf_id); |
| 206 | los_ind->set_status(status); |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 207 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 208 | alarm_ind->set_allocated_los_ind(los_ind); |
| 209 | ind.set_allocated_alarm_ind(alarm_ind); |
| 210 | break; |
| 211 | } |
| 212 | } |
| 213 | } |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 214 | |
| 215 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 216 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 219 | static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 220 | openolt::Indication ind; |
| 221 | openolt::IntfIndication* intf_ind = new openolt::IntfIndication; |
| 222 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 223 | switch (msg->obj_type) { |
| 224 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 225 | switch (msg->subgroup) { |
| 226 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
| 227 | { |
| 228 | bcmolt_pon_interface_key *key = |
| 229 | &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
| 230 | bcmolt_pon_interface_state_change_completed_data *data = |
| 231 | &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 232 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 233 | intf_ind->set_intf_id(key->pon_ni); |
| 234 | SET_OPER_STATE(intf_ind, data->new_state); |
| 235 | ind.set_allocated_intf_ind(intf_ind); |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | break; |
| 240 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 241 | switch (msg->subgroup) { |
| 242 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 243 | { |
| 244 | OPENOLT_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n", |
| 245 | ((bcmolt_nni_interface_state_change *)msg)->key.id); |
| 246 | bcmolt_nni_interface_key *key = |
| 247 | &((bcmolt_nni_interface_state_change *)msg)->key; |
| 248 | bcmolt_nni_interface_state_change_data *data = |
| 249 | &((bcmolt_nni_interface_state_change *)msg)->data; |
| 250 | |
| 251 | intf_ind->set_intf_id(key->id); |
| 252 | SET_OPER_STATE(intf_ind, data->new_state); |
| 253 | ind.set_allocated_intf_ind(intf_ind); |
| 254 | break; |
| 255 | } |
| 256 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 257 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 258 | |
| 259 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 260 | bcmolt_msg_free(msg); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 263 | static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 264 | openolt::Indication ind; |
| 265 | openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 266 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 267 | switch (msg->obj_type) { |
| 268 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 269 | switch (msg->subgroup) { |
| 270 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
| 271 | { |
| 272 | bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
| 273 | bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data; |
| 274 | intf_oper_ind->set_intf_id(key->pon_ni); |
| 275 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON)); |
| 276 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
| 277 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 278 | intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str()); |
| 279 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | case BCMOLT_OBJ_ID_NNI_INTERFACE: |
| 284 | switch (msg->subgroup) { |
| 285 | case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE: |
| 286 | { |
| 287 | bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key; |
| 288 | bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data; |
| 289 | bcmolt_interface intf_id = key->id; |
| 290 | bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI; |
| 291 | intf_oper_ind->set_intf_id(key->id); |
| 292 | intf_oper_ind->set_type(bcmolt_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI)); |
| 293 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
| 294 | OPENOLT_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n", |
| 295 | intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str()); |
| 296 | ind.set_allocated_intf_oper_ind(intf_oper_ind); |
| 297 | break; |
| 298 | } |
| 299 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 300 | } |
| 301 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 302 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 303 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 304 | } |
| 305 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 306 | static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 307 | openolt::Indication ind; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 308 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 309 | openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication; |
| 310 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 311 | switch (msg->obj_type) { |
| 312 | case BCMOLT_OBJ_ID_ONU: |
| 313 | switch (msg->subgroup) { |
| 314 | case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM: |
| 315 | { |
| 316 | bcmolt_xgpon_onu_alarms *onu_alarms = |
| 317 | &((bcmolt_onu_xgpon_alarm_data *)msg)->xgpon_onu_alarm; |
| 318 | onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi)); |
| 319 | onu_alarm_ind->set_lob_status(alarm_status_to_string(onu_alarms->lobi)); |
| 320 | onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string( |
| 321 | onu_alarms->lopci_miss)); |
| 322 | onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string( |
| 323 | onu_alarms->lopci_mic_error)); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 324 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 325 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 326 | ind.set_allocated_alarm_ind(alarm_ind); |
| 327 | break; |
| 328 | } |
| 329 | case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM: |
| 330 | { |
| 331 | bcmolt_gpon_onu_alarms *onu_alarms = |
| 332 | &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm; |
| 333 | onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi)); |
| 334 | /* TODO: need to set lofi and loami |
| 335 | onu_alarm_ind->set_lof_status(alarm_status_to_string(onu_alarms->lofi)); |
| 336 | onu_alarm_ind->set_loami_status(alarm_status_to_string( |
| 337 | onu_alarms->loami)); |
| 338 | */ |
| 339 | alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind); |
| 340 | ind.set_allocated_alarm_ind(alarm_ind); |
| 341 | break; |
| 342 | } |
| 343 | } |
| 344 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 345 | |
| 346 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 347 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 348 | } |
| 349 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 350 | static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 351 | openolt::Indication ind; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 352 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 353 | openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 354 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 355 | switch (msg->obj_type) { |
| 356 | case BCMOLT_OBJ_ID_ONU: |
| 357 | switch (msg->subgroup) { |
| 358 | case BCMOLT_ONU_AUTO_SUBGROUP_DGI: |
| 359 | { |
| 360 | bcmolt_onu_dgi_data* dgi_data = (bcmolt_onu_dgi_data *)msg; |
| 361 | dgi_ind->set_status(alarm_status_to_string(dgi_data->alarm_status)); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 362 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 363 | alarm_ind->set_allocated_dying_gasp_ind(dgi_ind); |
| 364 | ind.set_allocated_alarm_ind(alarm_ind); |
| 365 | break; |
| 366 | } |
| 367 | } |
| 368 | } |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 369 | |
| 370 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 371 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 374 | static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 375 | openolt::Indication ind; |
| 376 | openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication; |
| 377 | openolt::SerialNumber* serial_number = new openolt::SerialNumber; |
| 378 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 379 | switch (msg->obj_type) { |
| 380 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 381 | switch (msg->subgroup) { |
| 382 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED: |
| 383 | { |
| 384 | bcmolt_pon_interface_key *key = |
| 385 | &((bcmolt_pon_interface_onu_discovered *)msg)->key; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 386 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 387 | bcmolt_pon_interface_onu_discovered_data *data = |
| 388 | &((bcmolt_pon_interface_onu_discovered *)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 389 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 390 | bcmolt_serial_number *in_serial_number = &(data->serial_number); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 391 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 392 | OPENOLT_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n", |
| 393 | key->pon_ni, serial_number_to_str(in_serial_number).c_str()); |
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 | onu_disc_ind->set_intf_id(key->pon_ni); |
| 396 | serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4); |
| 397 | serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8); |
| 398 | onu_disc_ind->set_allocated_serial_number(serial_number); |
| 399 | ind.set_allocated_onu_disc_ind(onu_disc_ind); |
| 400 | break; |
| 401 | } |
| 402 | } |
| 403 | } |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 404 | |
| 405 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 406 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 407 | } |
| 408 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 409 | static void OnuIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 410 | openolt::Indication ind; |
| 411 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
| 412 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 413 | switch (msg->obj_type) { |
| 414 | case BCMOLT_OBJ_ID_ONU: |
| 415 | switch (msg->subgroup) { |
| 416 | case BCMOLT_ONU_AUTO_SUBGROUP_RANGING_COMPLETED: |
| 417 | { |
| 418 | bcmolt_onu_key *key = &((bcmolt_onu_ranging_completed*)msg)->key; |
| 419 | bcmolt_onu_ranging_completed_data *data = &((bcmolt_onu_ranging_completed*)msg)->data; |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 420 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 421 | onu_ind->set_intf_id(key->pon_ni); |
| 422 | onu_ind->set_onu_id(key->onu_id); |
| 423 | if (ONU_RANGING_STATE_IF_UP(data->status)) |
| 424 | onu_ind->set_oper_state("up"); |
| 425 | if (ONU_RANGING_STATE_IF_DOWN(data->status)) |
| 426 | onu_ind->set_oper_state("down"); |
| 427 | (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down"); |
| 428 | ind.set_allocated_onu_ind(onu_ind); |
| 429 | OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n", |
| 430 | key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down", |
| 431 | (key->onu_id)?"up":"down"); |
| 432 | } |
| 433 | } |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 434 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 435 | /*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] | 436 | onu_ind->set_registration_id(reg_id); |
| 437 | |
| 438 | 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^] | 439 | 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] | 440 | |
| 441 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 442 | bcmolt_msg_free(msg); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 443 | } |
| 444 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 445 | static void OnuOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 446 | openolt::Indication ind; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 447 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 448 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 449 | switch (msg->obj_type) { |
| 450 | case BCMOLT_OBJ_ID_ONU: |
| 451 | switch (msg->subgroup) { |
| 452 | case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE: |
| 453 | { |
| 454 | bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key; |
| 455 | bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data; |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 456 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 457 | onu_ind->set_intf_id(key->pon_ni); |
| 458 | onu_ind->set_onu_id(key->onu_id); |
| 459 | if (ONU_STATE_IF_UP(data->new_onu_state)) |
| 460 | onu_ind->set_oper_state("up"); |
| 461 | if (ONU_STATE_IF_DOWN(data->new_onu_state)) |
| 462 | onu_ind->set_oper_state("down"); |
| 463 | ind.set_allocated_onu_ind(onu_ind); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 464 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 465 | 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", |
| 466 | key->pon_ni, key->onu_id, data->new_onu_state, onu_ind->oper_state().c_str()); |
| 467 | } |
| 468 | } |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 469 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 470 | /*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] | 471 | onu_ind->set_registration_id(reg_id); |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 472 | ind.set_allocated_onu_ind(onu_ind); |
| 473 | |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 474 | 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^] | 475 | 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] | 476 | |
nick | c063ffd | 2018-05-22 14:35:28 -0400 | [diff] [blame] | 477 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 478 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 479 | } |
| 480 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 481 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 482 | openolt::Indication ind; |
| 483 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 484 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 485 | switch (msg->obj_type) { |
| 486 | case BCMOLT_OBJ_ID_ONU: |
| 487 | switch (msg->subgroup) { |
| 488 | case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET: |
| 489 | { |
| 490 | bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key; |
| 491 | bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 492 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 493 | OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n", |
| 494 | key->pon_ni, key->onu_id); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 495 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 496 | omci_ind->set_intf_id(key->pon_ni); |
| 497 | omci_ind->set_onu_id(key->onu_id); |
| 498 | omci_ind->set_pkt(data->buffer.arr, data->buffer.len); |
| 499 | |
| 500 | ind.set_allocated_omci_ind(omci_ind); |
| 501 | break; |
| 502 | } |
| 503 | } |
| 504 | } |
| 505 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 506 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 507 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 508 | } |
| 509 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 510 | static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 511 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 512 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 513 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 514 | switch (msg->obj_type) { |
| 515 | case BCMOLT_OBJ_ID_FLOW: |
| 516 | switch (msg->subgroup) { |
| 517 | case BCMOLT_FLOW_AUTO_SUBGROUP_RECEIVE_ETH_PACKET: |
| 518 | { |
| 519 | bcmolt_flow_receive_eth_packet *pkt = |
| 520 | (bcmolt_flow_receive_eth_packet*)msg; |
| 521 | bcmolt_flow_receive_eth_packet_data *pkt_data = |
| 522 | &((bcmolt_flow_receive_eth_packet*)msg)->data; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 523 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 524 | uint32_t port_no = GetPortNum_(pkt->key.flow_id); |
| 525 | 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))); |
| 526 | pkt_ind->set_intf_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, INGRESS_INTF_ID)); |
| 527 | pkt_ind->set_gemport_id(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, SVC_PORT_ID)); |
| 528 | pkt_ind->set_flow_id(pkt->key.flow_id); |
| 529 | pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len); |
| 530 | pkt_ind->set_port_no(port_no); |
| 531 | pkt_ind->set_cookie(get_flow_status(pkt->key.flow_id, pkt->key.flow_type, COOKIE)); |
| 532 | ind.set_allocated_pkt_ind(pkt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 533 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 534 | 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", |
| 535 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id(), |
| 536 | 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(), |
| 537 | get_flow_status(pkt->key.flow_id, pkt->key.flow_type, EGRESS_INTF_ID), |
| 538 | pkt_ind->gemport_id(), GET_FLOW_TYPE(pkt->key.flow_type), |
| 539 | pkt_ind->flow_id(), port_no, pkt_ind->cookie()); |
| 540 | } |
| 541 | } |
| 542 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 543 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 544 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 545 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 546 | } |
| 547 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 548 | static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 549 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 550 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow oper state indication\n"); |
| 551 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 552 | } |
| 553 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 554 | static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 555 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 556 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow indication\n"); |
| 557 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 558 | } |
| 559 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 560 | static void TmQIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 561 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 562 | OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n"); |
| 563 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 564 | } |
| 565 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 566 | static void TmSchedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 567 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 568 | OPENOLT_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n"); |
| 569 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 570 | } |
| 571 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 572 | static void McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 573 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 574 | OPENOLT_LOG(DEBUG, openolt_log_id, "mcast group indication\n"); |
| 575 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 576 | } |
| 577 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 578 | static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 579 | openolt::Indication ind; |
| 580 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 581 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 582 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 583 | switch (msg->obj_type) { |
| 584 | case BCMOLT_OBJ_ID_ONU: |
| 585 | switch (msg->subgroup) { |
| 586 | case BCMOLT_ONU_AUTO_SUBGROUP_SUFI: |
| 587 | { |
| 588 | bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key; |
| 589 | bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 590 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 591 | OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n", |
| 592 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 593 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 594 | sufi_ind->set_intf_id(key->pon_ni); |
| 595 | sufi_ind->set_onu_id(key->onu_id); |
| 596 | sufi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 597 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 598 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 599 | ind.set_allocated_alarm_ind(alarm_ind); |
| 600 | } |
| 601 | } |
| 602 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 603 | |
| 604 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 605 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 606 | } |
| 607 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 608 | static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 609 | openolt::Indication ind; |
| 610 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 611 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 612 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 613 | switch (msg->obj_type) { |
| 614 | case BCMOLT_OBJ_ID_ONU: |
| 615 | switch (msg->subgroup) { |
| 616 | case BCMOLT_ONU_AUTO_SUBGROUP_SDI: |
| 617 | { |
| 618 | bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key; |
| 619 | bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 620 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 621 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 622 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 623 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 624 | sdi_ind->set_intf_id(key->pon_ni); |
| 625 | sdi_ind->set_onu_id(key->onu_id); |
| 626 | sdi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 627 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 628 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 629 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 630 | ind.set_allocated_alarm_ind(alarm_ind); |
| 631 | } |
| 632 | } |
| 633 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 634 | |
| 635 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 636 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 637 | } |
| 638 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 639 | static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 640 | openolt::Indication ind; |
| 641 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 642 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 643 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 644 | switch (msg->obj_type) { |
| 645 | case BCMOLT_OBJ_ID_ONU: |
| 646 | switch (msg->subgroup) { |
| 647 | case BCMOLT_ONU_AUTO_SUBGROUP_DOWI: |
| 648 | { |
| 649 | bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key; |
| 650 | bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 651 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 652 | 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", |
| 653 | 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] | 654 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 655 | dowi_ind->set_intf_id(key->pon_ni); |
| 656 | dowi_ind->set_onu_id(key->onu_id); |
| 657 | dowi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 658 | dowi_ind->set_drift(data->drift_value); |
| 659 | dowi_ind->set_new_eqd(data->new_eqd); |
| 660 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 661 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 662 | ind.set_allocated_alarm_ind(alarm_ind); |
| 663 | } |
| 664 | } |
| 665 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 666 | |
| 667 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 668 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 669 | } |
| 670 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 671 | static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 672 | openolt::Indication ind; |
| 673 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 674 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 675 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 676 | switch (msg->obj_type) { |
| 677 | case BCMOLT_OBJ_ID_ONU: |
| 678 | switch (msg->subgroup) { |
| 679 | case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI: |
| 680 | { |
| 681 | bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key; |
| 682 | bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 683 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 684 | OPENOLT_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n", |
| 685 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 686 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 687 | looci_ind->set_intf_id(key->pon_ni); |
| 688 | looci_ind->set_onu_id(key->onu_id); |
| 689 | looci_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 690 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 691 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 692 | ind.set_allocated_alarm_ind(alarm_ind); |
| 693 | } |
| 694 | } |
| 695 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 696 | |
| 697 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 698 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 699 | } |
| 700 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 701 | static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 702 | openolt::Indication ind; |
| 703 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 704 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 705 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 706 | switch (msg->obj_type) { |
| 707 | case BCMOLT_OBJ_ID_ONU: |
| 708 | switch (msg->subgroup) { |
| 709 | case BCMOLT_ONU_AUTO_SUBGROUP_SFI: |
| 710 | { |
| 711 | bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key; |
| 712 | bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 713 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 714 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 715 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 716 | |
| 717 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 718 | sfi_ind->set_intf_id(key->pon_ni); |
| 719 | sfi_ind->set_onu_id(key->onu_id); |
| 720 | sfi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 721 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 722 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 723 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 724 | ind.set_allocated_alarm_ind(alarm_ind); |
| 725 | } |
| 726 | } |
| 727 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 728 | |
| 729 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 730 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 731 | } |
| 732 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 733 | static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 734 | openolt::Indication ind; |
| 735 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 736 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 737 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 738 | switch (msg->obj_type) { |
| 739 | case BCMOLT_OBJ_ID_ONU: |
| 740 | switch (msg->subgroup) { |
| 741 | case BCMOLT_ONU_AUTO_SUBGROUP_TIWI: |
| 742 | { |
| 743 | bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key; |
| 744 | bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 745 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 746 | OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n", |
| 747 | key->pon_ni, key->onu_id, data->alarm_status, data->drift_value); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 748 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 749 | tiwi_ind->set_intf_id(key->pon_ni); |
| 750 | tiwi_ind->set_onu_id(key->onu_id); |
| 751 | tiwi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 752 | tiwi_ind->set_drift(data->drift_value); |
| 753 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 754 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 755 | ind.set_allocated_alarm_ind(alarm_ind); |
| 756 | } |
| 757 | } |
| 758 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 759 | |
| 760 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 761 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 762 | } |
| 763 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 764 | static void OnuActivationFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 765 | openolt::Indication ind; |
| 766 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 767 | openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication; |
| 768 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 769 | switch (msg->obj_type) { |
| 770 | case BCMOLT_OBJ_ID_ONU: |
| 771 | switch (msg->subgroup) { |
| 772 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED: |
| 773 | { |
| 774 | bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key; |
| 775 | bcmolt_onu_onu_activation_completed_data *data = |
| 776 | &((bcmolt_onu_onu_activation_completed*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 777 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 778 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d\n", |
| 779 | key->pon_ni, key->onu_id, data->fail_reason); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 780 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 781 | activation_fail_ind->set_intf_id(key->pon_ni); |
| 782 | activation_fail_ind->set_onu_id(key->onu_id); |
| 783 | alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 784 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 785 | ind.set_allocated_alarm_ind(alarm_ind); |
| 786 | } |
| 787 | } |
| 788 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 789 | |
| 790 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 791 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 792 | } |
| 793 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 794 | /* removed by BAL v3.0 |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 795 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 796 | openolt::Indication ind; |
| 797 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 798 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 799 | |
| 800 | bcmbal_subscriber_terminal_key *key = |
| 801 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 802 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 803 | 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] | 804 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 805 | |
| 806 | |
| 807 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 808 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 809 | |
| 810 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 811 | ind.set_allocated_alarm_ind(alarm_ind); |
| 812 | |
| 813 | oltIndQ.push(ind); |
| 814 | return BCM_ERR_OK; |
| 815 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 816 | */ |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 817 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 818 | Status SubscribeIndication() { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 819 | bcmolt_rx_cfg rx_cfg = {}; |
| 820 | bcmos_errno rc; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 821 | |
| 822 | if (subscribed) { |
| 823 | return Status::OK; |
| 824 | } |
| 825 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 826 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 827 | rx_cfg.rx_cb = OltOperIndication; |
| 828 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 829 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete; |
| 830 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 831 | if(rc != BCM_ERR_OK) |
| 832 | return Status(grpc::StatusCode::INTERNAL, |
| 833 | "Olt connection complete state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 834 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 835 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 836 | rx_cfg.rx_cb = OltOperIndication; |
| 837 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 838 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete; |
| 839 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 840 | if(rc != BCM_ERR_OK) |
| 841 | return Status(grpc::StatusCode::INTERNAL, |
| 842 | "Olt disconnection complete state indication subscribe failed"); |
| 843 | |
| 844 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 845 | rx_cfg.rx_cb = OltOperIndication; |
| 846 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 847 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure; |
| 848 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 849 | if(rc != BCM_ERR_OK) |
| 850 | return Status(grpc::StatusCode::INTERNAL, |
| 851 | "Olt connection failure state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 852 | |
| 853 | /* Interface LOS indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 854 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 855 | rx_cfg.rx_cb = LosIndication; |
| 856 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 857 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los; |
| 858 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 859 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 860 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 861 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 862 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 863 | rx_cfg.rx_cb = IfOperIndication; |
| 864 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 865 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed; |
| 866 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 867 | if(rc != BCM_ERR_OK) |
| 868 | return Status(grpc::StatusCode::INTERNAL, |
| 869 | "PON Interface operations state change indication subscribe failed"); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 870 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 871 | rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE; |
| 872 | rx_cfg.rx_cb = IfOperIndication; |
| 873 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 874 | rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change; |
| 875 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 876 | if(rc != BCM_ERR_OK) |
| 877 | return Status(grpc::StatusCode::INTERNAL, |
| 878 | "NNI Interface operations state change indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 879 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 880 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 881 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 882 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 883 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm; |
| 884 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 885 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 886 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 887 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 888 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 889 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 890 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 891 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm; |
| 892 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 893 | if(rc != BCM_ERR_OK) |
| 894 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 895 | |
| 896 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 897 | rx_cfg.rx_cb = OnuDyingGaspIndication; |
| 898 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 899 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi; |
| 900 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 901 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 902 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 903 | |
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 = OnuDiscoveryIndication; |
| 906 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 907 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered; |
| 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, "onu discovery 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_ONU; |
| 913 | rx_cfg.rx_cb = OnuIndication; |
| 914 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 915 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_ranging_completed; |
| 916 | |
| 917 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 918 | if(rc != BCM_ERR_OK) |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 919 | return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 920 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 921 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 922 | rx_cfg.rx_cb = OnuStartupFailureIndication; |
| 923 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 924 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi; |
| 925 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 926 | if(rc != BCM_ERR_OK) |
| 927 | return Status(grpc::StatusCode::INTERNAL, |
| 928 | "onu startup failure 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 = OnuSignalDegradeIndication; |
| 932 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 933 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi; |
| 934 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 935 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 936 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [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 = OnuDriftOfWindowIndication; |
| 940 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 941 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi; |
| 942 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 943 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 944 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 945 | |
| 946 | /* LOOCI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 947 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 948 | rx_cfg.rx_cb = OnuLossOfOmciChannelIndication; |
| 949 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 950 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci; |
| 951 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 952 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 953 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 954 | |
| 955 | /* SFI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 956 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 957 | rx_cfg.rx_cb = OnuSignalsFailureIndication; |
| 958 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 959 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi; |
| 960 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 961 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 962 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 963 | |
| 964 | /* TIWI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 965 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 966 | rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication; |
| 967 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 968 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi; |
| 969 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 970 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 971 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 972 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 973 | /* ONU Activation Failure Indiction */ |
| 974 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 975 | rx_cfg.rx_cb = OnuActivationFailureIndication; |
| 976 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 977 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed; |
| 978 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 979 | if(rc != BCM_ERR_OK) |
| 980 | return Status(grpc::StatusCode::INTERNAL, |
| 981 | "onu activation falaire indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 982 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame^] | 983 | rx_cfg.obj_type = BCMOLT_OBJ_ID_FLOW; |
| 984 | rx_cfg.rx_cb = PacketIndication; |
| 985 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 986 | rx_cfg.subgroup = bcmolt_flow_auto_subgroup_receive_eth_packet; |
| 987 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 988 | if(rc != BCM_ERR_OK) |
| 989 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 990 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 991 | subscribed = true; |
| 992 | |
| 993 | return Status::OK; |
| 994 | } |