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