Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1 | /* |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 3 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 7 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 9 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 17 | #include "indications.h" |
Shad Ansari | b7b0ced | 2018-05-11 21:53:32 +0000 | [diff] [blame] | 18 | #include "core.h" |
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; |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 37 | extern std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *> alloc_cfg_compltd_map; |
| 38 | extern bcmos_fastlock alloc_cfg_wait_lock; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 39 | |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 40 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 41 | bool subscribed = false; |
Girish Gowdru | c8ed2ef | 2019-02-13 08:18:44 -0800 | [diff] [blame] | 42 | uint32_t nni_intf_id = 0; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 43 | #define current_device 0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 44 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 45 | static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 46 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 47 | #define INTERFACE_STATE_IF_DOWN(state) \ |
| 48 | ((state == BCMOLT_INTERFACE_STATE_INACTIVE || \ |
| 49 | state == BCMOLT_INTERFACE_STATE_PROCESSING || \ |
| 50 | state == BCMOLT_INTERFACE_STATE_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE) |
| 51 | #define INTERFACE_STATE_IF_UP(state) \ |
| 52 | ((state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) ? BCMOS_TRUE : BCMOS_FALSE) |
| 53 | #define ONU_STATE_IF_DOWN(state) \ |
| 54 | ((state == BCMOLT_ONU_OPERATION_INACTIVE || \ |
| 55 | state == BCMOLT_ONU_OPERATION_DISABLE || \ |
| 56 | state == BCMOLT_ONU_OPERATION_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE) |
| 57 | #define ONU_STATE_IF_UP(state) \ |
| 58 | ((state == BCMOLT_ONU_OPERATION_ACTIVE) ? BCMOS_TRUE : BCMOS_FALSE) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 59 | #define ONU_ACTIVATION_COMPLETED_SUCCESS(state) \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 60 | ((state == BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 61 | #define ONU_ACTIVATION_COMPLETED_FAIL(state) \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 62 | ((state != BCMOLT_RESULT_SUCCESS) ? BCMOS_TRUE : BCMOS_FALSE) |
| 63 | #define SET_OPER_STATE(indication,state) \ |
| 64 | (INTERFACE_STATE_IF_UP(state)) ? indication->set_oper_state("up") : \ |
| 65 | indication->set_oper_state("down") |
| 66 | #define GET_FLOW_TYPE(type) \ |
| 67 | (type == BCMOLT_FLOW_TYPE_UPSTREAM) ? "upstream" : \ |
| 68 | (type == BCMOLT_FLOW_TYPE_DOWNSTREAM) ? "downstream" : \ |
| 69 | (type == BCMOLT_FLOW_TYPE_MULTICAST) ? "multicast" : "unknown" |
| 70 | |
| 71 | std::string bcmolt_to_grpc_intf_type(bcmolt_interface_type intf_type) |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 72 | { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 73 | if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 74 | return "nni"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 75 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 76 | return "pon"; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 77 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) { |
| 78 | return "host"; |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 79 | } |
| 80 | return "unknown"; |
| 81 | } |
| 82 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 83 | std::string bcmolt_to_grpc_interface_rf__intf_type(bcmolt_interface_type intf_type) |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 84 | { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 85 | if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 86 | return "nni"; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 87 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 88 | return "pon"; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 89 | } else if (intf_type == BCMOLT_INTERFACE_TYPE_HOST) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 90 | return "host"; |
| 91 | } |
| 92 | return "unknown"; |
| 93 | } |
| 94 | |
| 95 | /*std::string getOnuRegistrationId(uint32_t intf_id, uint32_t onu_id){ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 96 | bcmbal_subscriber_terminal_key key; |
| 97 | bcmbal_subscriber_terminal_cfg sub_term_obj = {}; |
| 98 | uint8_t *list_mem;// to fetch config details for ONU |
| 99 | bcmos_errno err = BCM_ERR_OK; |
| 100 | |
| 101 | key.sub_term_id =onu_id; |
| 102 | key.intf_id = intf_id; |
| 103 | BCM_LOG(INFO, openolt_log_id,"Processing subscriber terminal cfg get for: %d",key.intf_id); |
| 104 | |
| 105 | BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, key); |
| 106 | |
| 107 | BCMBAL_CFG_PROP_GET(&sub_term_obj, subscriber_terminal, all_properties); |
| 108 | char *reg_id = (char*)malloc(sizeof(char)*MAX_REGID_LENGTH); |
| 109 | memset(reg_id, '\0', MAX_REGID_LENGTH); |
| 110 | |
| 111 | //set memory to use for variable-sized lists |
| 112 | list_mem = (uint8_t*)malloc(BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 113 | |
| 114 | if (list_mem == NULL) |
| 115 | { |
| 116 | BCM_LOG(ERROR,openolt_log_id,"Memory allocation failed while handling subscriber terminal \ |
| 117 | cfg get subscriber_terminal_id(%d), Interface ID(%d)",key.sub_term_id, key.intf_id); |
| 118 | return reg_id; |
| 119 | } |
| 120 | |
| 121 | memset(list_mem, 0, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 122 | BCMBAL_CFG_LIST_BUF_SET(&sub_term_obj, subscriber_terminal, list_mem, BAL_DYNAMIC_LIST_BUFFER_SIZE); |
| 123 | |
| 124 | //call API |
| 125 | err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &sub_term_obj.hdr); |
| 126 | |
| 127 | if (err != BCM_ERR_OK) |
| 128 | { |
| 129 | BCM_LOG(ERROR,openolt_log_id, "Failed to get information from BAL subscriber_terminal_id(%d), Interface ID(%d)", |
| 130 | key.sub_term_id, key.intf_id); |
| 131 | free(list_mem); |
| 132 | return reg_id; |
| 133 | } |
| 134 | |
| 135 | BCM_LOG(INFO,openolt_log_id, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)", |
| 136 | key.sub_term_id, key.intf_id); |
| 137 | |
| 138 | for (int i=0; i<MAX_REGID_LENGTH ; i++){ |
| 139 | reg_id[i]=sub_term_obj.data.registration_id.arr[i]; |
| 140 | } |
| 141 | |
| 142 | free(list_mem); |
| 143 | return reg_id; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 144 | }*/ |
Girish Gowdru | 376b33c | 2019-05-06 21:46:31 -0700 | [diff] [blame] | 145 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 146 | static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 147 | openolt::Indication ind; |
| 148 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
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 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 202 | OPENOLT_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 223 | switch (msg->obj_type) { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 224 | case BCMOLT_OBJ_ID_PON_INTERFACE: |
| 225 | switch (msg->subgroup) { |
| 226 | case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED: |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 227 | { |
| 228 | bcmolt_pon_interface_key *key = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 229 | &((bcmolt_pon_interface_state_change_completed*)msg)->key; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 230 | bcmolt_pon_interface_state_change_completed_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 246 | bcmolt_nni_interface_key *key = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 247 | &((bcmolt_nni_interface_state_change *)msg)->key; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 248 | bcmolt_nni_interface_state_change_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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)); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 293 | SET_OPER_STATE(intf_oper_ind, data->new_state); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 316 | bcmolt_xgpon_onu_alarms *onu_alarms = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 331 | bcmolt_gpon_onu_alarms *onu_alarms = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 332 | &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm; |
| 333 | onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi)); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 334 | /* TODO: need to set lofi and loami |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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)); |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 338 | */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 | { |
Chaitrashree G S | d8feddd | 2020-01-20 21:42:40 -0500 | [diff] [blame] | 360 | bcmolt_onu_dgi* dgi_data = (bcmolt_onu_dgi *)msg; |
| 361 | dgi_ind->set_status(alarm_status_to_string(dgi_data->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 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 387 | bcmolt_pon_interface_onu_discovered_data *data = |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 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 OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 410 | openolt::Indication ind; |
| 411 | openolt::OmciIndication* omci_ind = new openolt::OmciIndication; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 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_OMCI_PACKET: |
| 417 | { |
| 418 | bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key; |
| 419 | bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 420 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 421 | OPENOLT_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n", |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 422 | key->pon_ni, key->onu_id); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 423 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 424 | omci_ind->set_intf_id(key->pon_ni); |
| 425 | omci_ind->set_onu_id(key->onu_id); |
| 426 | omci_ind->set_pkt(data->buffer.arr, data->buffer.len); |
| 427 | |
| 428 | ind.set_allocated_omci_ind(omci_ind); |
| 429 | break; |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 434 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 435 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 436 | } |
| 437 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 438 | static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 439 | openolt::Indication ind; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 440 | openolt::PacketIndication* pkt_ind = new openolt::PacketIndication; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 441 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 442 | switch (msg->obj_type) { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 443 | case BCMOLT_OBJ_ID_ACCESS_CONTROL: |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 444 | switch (msg->subgroup) { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 445 | case BCMOLT_ACCESS_CONTROL_AUTO_SUBGROUP_RECEIVE_ETH_PACKET: |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 446 | { |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 447 | bcmolt_access_control_receive_eth_packet *pkt = |
| 448 | (bcmolt_access_control_receive_eth_packet*)msg; |
| 449 | bcmolt_access_control_receive_eth_packet_data *pkt_data = |
| 450 | &((bcmolt_access_control_receive_eth_packet*)msg)->data; |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 451 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 452 | pkt_ind->set_intf_type(bcmolt_to_grpc_interface_rf__intf_type( |
| 453 | (bcmolt_interface_type)pkt_data->interface_ref.intf_type)); |
| 454 | pkt_ind->set_intf_id((bcmolt_interface_id)pkt_data->interface_ref.intf_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 455 | pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len); |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 456 | //pkt_ind->set_gemport_id(getPacketInGemPort(pkt->key.id)); |
| 457 | pkt_ind->set_gemport_id(pkt_data->svc_port_id); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 458 | ind.set_allocated_pkt_ind(pkt_ind); |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 459 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 460 | if (pkt_data->interface_ref.intf_type == BCMOLT_INTERFACE_TYPE_PON) { |
| 461 | OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d, gem_port %d\n", |
| 462 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id(), pkt_data->svc_port_id); |
| 463 | } else if (pkt_data->interface_ref.intf_type == BCMOLT_INTERFACE_TYPE_NNI ) { |
| 464 | OPENOLT_LOG(INFO, openolt_log_id, "packet indication, ingress intf_type %s, ingress intf_id %d\n", |
| 465 | pkt_ind->intf_type().c_str(), pkt_ind->intf_id()); |
| 466 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 467 | } |
| 468 | } |
| 469 | } |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 470 | |
Shad Ansari | 5fe9368 | 2018-04-26 05:24:19 +0000 | [diff] [blame] | 471 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 472 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 473 | } |
| 474 | |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 475 | static void ItuPonAllocConfigCompletedInd(bcmolt_devid olt, bcmolt_msg *msg) { |
| 476 | |
| 477 | switch (msg->obj_type) { |
| 478 | case BCMOLT_OBJ_ID_ITUPON_ALLOC: |
| 479 | switch (msg->subgroup) { |
| 480 | case BCMOLT_ITUPON_ALLOC_AUTO_SUBGROUP_CONFIGURATION_COMPLETED: |
| 481 | { |
| 482 | bcmolt_itupon_alloc_configuration_completed *pkt = |
| 483 | (bcmolt_itupon_alloc_configuration_completed*)msg; |
| 484 | bcmolt_itupon_alloc_configuration_completed_data *pkt_data = |
| 485 | &((bcmolt_itupon_alloc_configuration_completed*)msg)->data; |
| 486 | |
| 487 | alloc_cfg_compltd_key key((uint32_t)pkt->key.pon_ni, (uint32_t) pkt->key.alloc_id); |
| 488 | alloc_cfg_complete_result res; |
| 489 | res.pon_intf_id = pkt->key.pon_ni; |
| 490 | res.alloc_id = pkt->key.alloc_id; |
| 491 | |
| 492 | pkt_data->status == BCMOLT_RESULT_SUCCESS ? res.status = ALLOC_CFG_STATUS_SUCCESS: res.status = ALLOC_CFG_STATUS_FAIL; |
| 493 | switch (pkt_data->new_state) { |
| 494 | case BCMOLT_ACTIVATION_STATE_NOT_CONFIGURED: |
| 495 | res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED; |
| 496 | break; |
| 497 | case BCMOLT_ACTIVATION_STATE_INACTIVE: |
| 498 | res.state = ALLOC_OBJECT_STATE_INACTIVE; |
| 499 | break; |
| 500 | case BCMOLT_ACTIVATION_STATE_PROCESSING: |
| 501 | res.state = ALLOC_OBJECT_STATE_PROCESSING; |
| 502 | break; |
| 503 | case BCMOLT_ACTIVATION_STATE_ACTIVE: |
| 504 | res.state = ALLOC_OBJECT_STATE_ACTIVE; |
| 505 | break; |
| 506 | default: |
| 507 | OPENOLT_LOG(ERROR, openolt_log_id, "invalid itu pon alloc activation new_state, pon_intf %u, alloc_id %u, new_state %d\n", |
| 508 | pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->new_state); |
| 509 | res.state = ALLOC_OBJECT_STATE_NOT_CONFIGURED; |
| 510 | } |
| 511 | OPENOLT_LOG(INFO, openolt_log_id, "received itu pon alloc cfg complete ind, pon intf %u, alloc_id %u, status %u, new_state %u\n", |
| 512 | pkt->key.pon_ni, pkt->key.alloc_id, pkt_data->status, pkt_data->new_state); |
| 513 | |
| 514 | bcmos_fastlock_lock(&alloc_cfg_wait_lock); |
| 515 | // Push the result from BAL to queue |
| 516 | std::map<alloc_cfg_compltd_key, Queue<alloc_cfg_complete_result> *>::iterator it = alloc_cfg_compltd_map.find(key); |
| 517 | if (it == alloc_cfg_compltd_map.end()) { |
| 518 | // could be case of spurious aysnc response, OR, the application timed-out waiting for response and cleared the key. |
| 519 | bcmolt_msg_free(msg); |
| 520 | OPENOLT_LOG(ERROR, openolt_log_id, "alloc config key not found for alloc_id = %u, pon_intf = %u\n", pkt->key.alloc_id, pkt->key.pon_ni); |
| 521 | bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0); |
| 522 | return; |
| 523 | } |
| 524 | if (it->second) { |
| 525 | // Push the result |
| 526 | it->second->push(res); |
| 527 | } |
| 528 | bcmos_fastlock_unlock(&alloc_cfg_wait_lock, 0); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | bcmolt_msg_free(msg); |
| 534 | } |
| 535 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 536 | static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 537 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 538 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow oper state indication\n"); |
| 539 | bcmolt_msg_free(msg); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 540 | } |
| 541 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 542 | static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 543 | openolt::Indication ind; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 544 | OPENOLT_LOG(DEBUG, openolt_log_id, "flow indication\n"); |
| 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 TmQIndication(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, "traffic mgmt queue 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 TmSchedIndication(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, "traffic mgmt sheduler 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 McastGroupIndication(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, "mcast group 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 OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 567 | openolt::Indication ind; |
| 568 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 569 | openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication; |
| 570 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 571 | switch (msg->obj_type) { |
| 572 | case BCMOLT_OBJ_ID_ONU: |
| 573 | switch (msg->subgroup) { |
| 574 | case BCMOLT_ONU_AUTO_SUBGROUP_SUFI: |
| 575 | { |
| 576 | bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key; |
| 577 | bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 578 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 579 | OPENOLT_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n", |
| 580 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 581 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 582 | sufi_ind->set_intf_id(key->pon_ni); |
| 583 | sufi_ind->set_onu_id(key->onu_id); |
| 584 | sufi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 585 | alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 586 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 587 | ind.set_allocated_alarm_ind(alarm_ind); |
| 588 | } |
| 589 | } |
| 590 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 591 | |
| 592 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 593 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 594 | } |
| 595 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 596 | static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 597 | openolt::Indication ind; |
| 598 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 599 | openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication; |
| 600 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 601 | switch (msg->obj_type) { |
| 602 | case BCMOLT_OBJ_ID_ONU: |
| 603 | switch (msg->subgroup) { |
| 604 | case BCMOLT_ONU_AUTO_SUBGROUP_SDI: |
| 605 | { |
| 606 | bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key; |
| 607 | bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 608 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 609 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 610 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 611 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 612 | sdi_ind->set_intf_id(key->pon_ni); |
| 613 | sdi_ind->set_onu_id(key->onu_id); |
| 614 | sdi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 615 | sdi_ind->set_inverse_bit_error_rate(data->ber); |
| 616 | alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 617 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 618 | ind.set_allocated_alarm_ind(alarm_ind); |
| 619 | } |
| 620 | } |
| 621 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 622 | |
| 623 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 624 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 625 | } |
| 626 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 627 | static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 628 | openolt::Indication ind; |
| 629 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 630 | openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication; |
| 631 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 632 | switch (msg->obj_type) { |
| 633 | case BCMOLT_OBJ_ID_ONU: |
| 634 | switch (msg->subgroup) { |
| 635 | case BCMOLT_ONU_AUTO_SUBGROUP_DOWI: |
| 636 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 637 | bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 638 | bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 639 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 640 | 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", |
| 641 | 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] | 642 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 643 | dowi_ind->set_intf_id(key->pon_ni); |
| 644 | dowi_ind->set_onu_id(key->onu_id); |
| 645 | dowi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 646 | dowi_ind->set_drift(data->drift_value); |
| 647 | dowi_ind->set_new_eqd(data->new_eqd); |
| 648 | alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 649 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 650 | ind.set_allocated_alarm_ind(alarm_ind); |
| 651 | } |
| 652 | } |
| 653 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 654 | |
| 655 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 656 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 657 | } |
| 658 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 659 | static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 660 | openolt::Indication ind; |
| 661 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 662 | openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication; |
| 663 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 664 | switch (msg->obj_type) { |
| 665 | case BCMOLT_OBJ_ID_ONU: |
| 666 | switch (msg->subgroup) { |
| 667 | case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI: |
| 668 | { |
| 669 | bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key; |
| 670 | bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 671 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 672 | OPENOLT_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n", |
| 673 | key->pon_ni, key->onu_id, data->alarm_status); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 674 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 675 | looci_ind->set_intf_id(key->pon_ni); |
| 676 | looci_ind->set_onu_id(key->onu_id); |
| 677 | looci_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 678 | alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 679 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 680 | ind.set_allocated_alarm_ind(alarm_ind); |
| 681 | } |
| 682 | } |
| 683 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 684 | |
| 685 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 686 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 687 | } |
| 688 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 689 | static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 690 | openolt::Indication ind; |
| 691 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 692 | openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication; |
| 693 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 694 | switch (msg->obj_type) { |
| 695 | case BCMOLT_OBJ_ID_ONU: |
| 696 | switch (msg->subgroup) { |
| 697 | case BCMOLT_ONU_AUTO_SUBGROUP_SFI: |
| 698 | { |
| 699 | bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key; |
| 700 | bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 701 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 702 | OPENOLT_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n", |
| 703 | key->pon_ni, key->onu_id, data->alarm_status, data->ber); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 704 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 705 | sfi_ind->set_intf_id(key->pon_ni); |
| 706 | sfi_ind->set_onu_id(key->onu_id); |
| 707 | sfi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 708 | sfi_ind->set_inverse_bit_error_rate(data->ber); |
| 709 | alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 710 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 711 | ind.set_allocated_alarm_ind(alarm_ind); |
| 712 | } |
| 713 | } |
| 714 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 715 | |
| 716 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 717 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 718 | } |
| 719 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 720 | static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 721 | openolt::Indication ind; |
| 722 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 723 | openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning; |
| 724 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 725 | switch (msg->obj_type) { |
| 726 | case BCMOLT_OBJ_ID_ONU: |
| 727 | switch (msg->subgroup) { |
| 728 | case BCMOLT_ONU_AUTO_SUBGROUP_TIWI: |
| 729 | { |
| 730 | bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key; |
| 731 | bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 732 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 733 | OPENOLT_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n", |
| 734 | key->pon_ni, key->onu_id, data->alarm_status, data->drift_value); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 735 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 736 | tiwi_ind->set_intf_id(key->pon_ni); |
| 737 | tiwi_ind->set_onu_id(key->onu_id); |
| 738 | tiwi_ind->set_status(alarm_status_to_string(data->alarm_status)); |
| 739 | tiwi_ind->set_drift(data->drift_value); |
| 740 | alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 741 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 742 | ind.set_allocated_alarm_ind(alarm_ind); |
| 743 | } |
| 744 | } |
| 745 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 746 | |
| 747 | oltIndQ.push(ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 748 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 749 | } |
| 750 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 751 | static void OnuActivationCompletedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 752 | openolt::Indication ind; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 753 | openolt::OnuIndication* onu_ind = new openolt::OnuIndication; |
| 754 | |
| 755 | switch (msg->obj_type) { |
| 756 | case BCMOLT_OBJ_ID_ONU: |
| 757 | switch (msg->subgroup) { |
| 758 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_ACTIVATION_COMPLETED: |
| 759 | { |
| 760 | bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key; |
| 761 | bcmolt_onu_onu_activation_completed_data*data = &((bcmolt_onu_onu_activation_completed*)msg)->data; |
| 762 | |
| 763 | onu_ind->set_intf_id(key->pon_ni); |
| 764 | onu_ind->set_onu_id(key->onu_id); |
| 765 | if (ONU_ACTIVATION_COMPLETED_SUCCESS(data->status)) |
| 766 | onu_ind->set_oper_state("up"); |
| 767 | if (ONU_ACTIVATION_COMPLETED_FAIL(data->status)) |
| 768 | onu_ind->set_oper_state("down"); |
| 769 | // Setting the admin_state state field based on a valid onu_id does not make any sense. |
| 770 | // The adapter too does not seem to interpret this seriously. |
| 771 | // Legacy code, lets keep this as is for now. |
| 772 | (key->onu_id)?onu_ind->set_admin_state("up"):onu_ind->set_admin_state("down"); |
| 773 | ind.set_allocated_onu_ind(onu_ind); |
| 774 | OPENOLT_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %s, onu_admin %s\n", |
| 775 | key->pon_ni, key->onu_id, (data->status==BCMOLT_RESULT_SUCCESS)?"up":"down", |
| 776 | (key->onu_id)?"up":"down"); |
| 777 | } |
| 778 | } |
| 779 | } |
| 780 | |
| 781 | oltIndQ.push(ind); |
| 782 | bcmolt_msg_free(msg); |
| 783 | } |
| 784 | |
| 785 | |
| 786 | static void OnuDeactivationCompletedIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 787 | openolt::Indication ind; |
| 788 | |
| 789 | openolt::Indication onu_ind; |
| 790 | openolt::OnuIndication* onu_ind_data = new openolt::OnuIndication; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 791 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 792 | switch (msg->obj_type) { |
| 793 | case BCMOLT_OBJ_ID_ONU: |
| 794 | switch (msg->subgroup) { |
| 795 | case BCMOLT_ONU_AUTO_SUBGROUP_ONU_DEACTIVATION_COMPLETED: |
| 796 | { |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 797 | bcmolt_onu_key *key = &((bcmolt_onu_onu_deactivation_completed*)msg)->key; |
| 798 | bcmolt_onu_onu_deactivation_completed_data *data = |
| 799 | &((bcmolt_onu_onu_deactivation_completed*)msg)->data; |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 800 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 801 | OPENOLT_LOG(INFO, openolt_log_id, "Got onu deactivation, intf_id %d, onu_id %d, fail_reason %d, result_status %s\n", |
| 802 | key->pon_ni, key->onu_id, data->fail_reason, bcmolt_result_to_string(data->status).c_str()); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 803 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 804 | onu_ind_data->set_intf_id(key->pon_ni); |
| 805 | onu_ind_data->set_onu_id(key->onu_id); |
| 806 | onu_ind_data->set_oper_state("down"); |
| 807 | onu_ind_data->set_admin_state("down"); |
| 808 | onu_ind.set_allocated_onu_ind(onu_ind_data); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 809 | } |
| 810 | } |
| 811 | } |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 812 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 813 | oltIndQ.push(onu_ind); |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 814 | bcmolt_msg_free(msg); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 815 | } |
| 816 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 817 | /* removed by BAL v3.0 |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 818 | bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) { |
| 819 | openolt::Indication ind; |
| 820 | openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication; |
| 821 | openolt::OnuProcessingErrorIndication* onu_proc_error_ind = new openolt::OnuProcessingErrorIndication; |
| 822 | |
| 823 | bcmbal_subscriber_terminal_key *key = |
| 824 | &(((bcmbal_subscriber_terminal_processing_error*)obj)->key); |
| 825 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 826 | 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] | 827 | key->intf_id, key->sub_term_id); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 828 | |
| 829 | |
| 830 | onu_proc_error_ind->set_intf_id(key->intf_id); |
| 831 | onu_proc_error_ind->set_onu_id(key->sub_term_id); |
| 832 | |
| 833 | alarm_ind->set_allocated_onu_processing_error_ind(onu_proc_error_ind); |
| 834 | ind.set_allocated_alarm_ind(alarm_ind); |
| 835 | |
| 836 | oltIndQ.push(ind); |
| 837 | return BCM_ERR_OK; |
| 838 | } |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 839 | */ |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 840 | |
Burak Gurdag | c78b9e1 | 2019-11-29 11:14:51 +0000 | [diff] [blame] | 841 | static void GroupIndication(bcmolt_devid olt, bcmolt_msg *msg) { |
| 842 | |
| 843 | switch (msg->obj_type) { |
| 844 | case BCMOLT_OBJ_ID_GROUP: |
| 845 | switch (msg->subgroup) { |
| 846 | case BCMOLT_GROUP_AUTO_SUBGROUP_COMPLETE_MEMBERS_UPDATE: |
| 847 | { |
| 848 | bcmolt_group_key *key = &((bcmolt_group_complete_members_update*)msg)->key; |
| 849 | bcmolt_group_complete_members_update_data *data = |
| 850 | &((bcmolt_group_complete_members_update*)msg)->data; |
| 851 | |
| 852 | if (data->result == BCMOLT_RESULT_SUCCESS) { |
| 853 | OPENOLT_LOG(INFO, openolt_log_id, "Complete members update indication for group %d (successful)\n", key->id); |
| 854 | } else { |
| 855 | OPENOLT_LOG(ERROR, openolt_log_id, "Complete members update indication for group %d (failed with reason %d)\n", key->id, data->fail_reason); |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 | } |
| 860 | bcmolt_msg_free(msg); |
| 861 | } |
| 862 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 863 | Status SubscribeIndication() { |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 864 | bcmolt_rx_cfg rx_cfg = {}; |
| 865 | bcmos_errno rc; |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 866 | |
| 867 | if (subscribed) { |
| 868 | return Status::OK; |
| 869 | } |
| 870 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 871 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 872 | rx_cfg.rx_cb = OltOperIndication; |
| 873 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 874 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete; |
| 875 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 876 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 877 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 878 | "Olt connection complete state 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_DEVICE; |
| 881 | rx_cfg.rx_cb = OltOperIndication; |
| 882 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 883 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete; |
| 884 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 885 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 886 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 887 | "Olt disconnection complete state indication subscribe failed"); |
| 888 | |
| 889 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE; |
| 890 | rx_cfg.rx_cb = OltOperIndication; |
| 891 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 892 | rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure; |
| 893 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 894 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 895 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 896 | "Olt connection failure state indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 897 | |
| 898 | /* Interface LOS indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 899 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 900 | rx_cfg.rx_cb = LosIndication; |
| 901 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 902 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los; |
| 903 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 904 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 905 | return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 906 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 907 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 908 | rx_cfg.rx_cb = IfOperIndication; |
| 909 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 910 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed; |
| 911 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 912 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 913 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 914 | "PON Interface operations state change indication subscribe failed"); |
Girish Gowdru | 7c4ec2d | 2018-10-25 00:29:54 -0700 | [diff] [blame] | 915 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 916 | rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE; |
| 917 | rx_cfg.rx_cb = IfOperIndication; |
| 918 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 919 | rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change; |
| 920 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 921 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 922 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 923 | "NNI Interface operations state change indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 924 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 925 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 926 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 927 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 928 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm; |
| 929 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 930 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 931 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 932 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 933 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 934 | rx_cfg.rx_cb = OnuAlarmIndication; |
| 935 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 936 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm; |
| 937 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 938 | if(rc != BCM_ERR_OK) |
| 939 | return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed"); |
| 940 | |
| 941 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 942 | rx_cfg.rx_cb = OnuDyingGaspIndication; |
| 943 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 944 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi; |
| 945 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 946 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 947 | return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 948 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 949 | rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE; |
| 950 | rx_cfg.rx_cb = OnuDiscoveryIndication; |
| 951 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 952 | rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered; |
| 953 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 954 | if(rc != BCM_ERR_OK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 955 | return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 956 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 957 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 958 | rx_cfg.rx_cb = OnuStartupFailureIndication; |
| 959 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 960 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi; |
| 961 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 962 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 963 | return Status(grpc::StatusCode::INTERNAL, |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 964 | "onu startup failure indication subscribe failed"); |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 965 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 966 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 967 | rx_cfg.rx_cb = OnuSignalDegradeIndication; |
| 968 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 969 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi; |
| 970 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 971 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 972 | return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 973 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 974 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 975 | rx_cfg.rx_cb = OnuDriftOfWindowIndication; |
| 976 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 977 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi; |
| 978 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 979 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 980 | return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 981 | |
| 982 | /* LOOCI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 983 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 984 | rx_cfg.rx_cb = OnuLossOfOmciChannelIndication; |
| 985 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 986 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci; |
| 987 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 988 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 989 | return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 990 | |
| 991 | /* SFI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 992 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 993 | rx_cfg.rx_cb = OnuSignalsFailureIndication; |
| 994 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 995 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi; |
| 996 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 997 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 998 | return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 999 | |
| 1000 | /* TIWI indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1001 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1002 | rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication; |
| 1003 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1004 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi; |
| 1005 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1006 | if(rc != BCM_ERR_OK) |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1007 | return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1008 | |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1009 | /* ONU Activation Completed Indication */ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1010 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1011 | rx_cfg.rx_cb = OnuActivationCompletedIndication; |
| 1012 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1013 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_activation_completed; |
| 1014 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1015 | if(rc != BCM_ERR_OK) |
| 1016 | return Status(grpc::StatusCode::INTERNAL, |
| 1017 | "onu activation completed indication subscribe failed"); |
| 1018 | |
| 1019 | /* ONU Deactivation Completed Indication */ |
| 1020 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU; |
| 1021 | rx_cfg.rx_cb = OnuDeactivationCompletedIndication; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1022 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1023 | rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_deactivation_completed; |
| 1024 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1025 | if(rc != BCM_ERR_OK) |
Girish Gowdra | 0c0b5c0 | 2019-12-16 14:11:08 +0530 | [diff] [blame] | 1026 | return Status(grpc::StatusCode::INTERNAL, |
| 1027 | "onu deactivation indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1028 | |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 1029 | /* Packet-In by Access_Control */ |
| 1030 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ACCESS_CONTROL; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1031 | rx_cfg.rx_cb = PacketIndication; |
| 1032 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame^] | 1033 | rx_cfg.subgroup = bcmolt_access_control_auto_subgroup_receive_eth_packet; |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 1034 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1035 | if(rc != BCM_ERR_OK) |
| 1036 | return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed"); |
Nicolas Palpacuer | de4325b | 2018-07-03 11:18:42 -0400 | [diff] [blame] | 1037 | |
Girish Gowdra | 9646105 | 2019-11-22 20:13:59 +0530 | [diff] [blame] | 1038 | rx_cfg.obj_type = BCMOLT_OBJ_ID_ITUPON_ALLOC; |
| 1039 | rx_cfg.rx_cb = ItuPonAllocConfigCompletedInd; |
| 1040 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1041 | rx_cfg.subgroup = bcmolt_itupon_alloc_auto_subgroup_configuration_completed; |
| 1042 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1043 | if(rc != BCM_ERR_OK) |
| 1044 | return Status(grpc::StatusCode::INTERNAL, "ITU PON Alloc Configuration \ |
| 1045 | Complete Indication subscribe failed"); |
| 1046 | |
Burak Gurdag | c78b9e1 | 2019-11-29 11:14:51 +0000 | [diff] [blame] | 1047 | rx_cfg.obj_type = BCMOLT_OBJ_ID_GROUP; |
| 1048 | rx_cfg.rx_cb = GroupIndication; |
| 1049 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 1050 | rx_cfg.subgroup = bcmolt_group_auto_subgroup_complete_members_update; |
| 1051 | rc = bcmolt_ind_subscribe(current_device, &rx_cfg); |
| 1052 | if(rc != BCM_ERR_OK) |
| 1053 | return Status(grpc::StatusCode::INTERNAL, "Complete members update indication subscribe failed"); |
| 1054 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1055 | subscribed = true; |
| 1056 | |
| 1057 | return Status::OK; |
| 1058 | } |