Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1 | /* |
| 2 | ** Copyright 2017-present Open Networking Foundation |
| 3 | ** |
| 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 |
| 7 | ** |
| 8 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ** |
| 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 | |
| 17 | #include "bal_indications_hdlr.h" |
| 18 | |
| 19 | /*static bcmos_mutex bal_ind_lock; - Need to define bcm independent mutex*/ |
| 20 | /********************************************************************\ |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 21 | * Function : bal_acc_term_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 22 | * Description : This function will handle the indications for * |
| 23 | * Access Terminal Indication * |
| 24 | * * |
| 25 | ********************************************************************/ |
| 26 | bcmos_errno bal_acc_term_indication_cb(bcmbal_obj *obj) |
| 27 | { |
| 28 | bcmos_errno result = BCM_ERR_OK; |
| 29 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 30 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 31 | bcmbal_access_terminal_auto_id_ind != obj->subgroup) |
| 32 | { |
| 33 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 34 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 35 | result = BCM_ERR_INTERNAL; |
| 36 | } |
| 37 | else |
| 38 | { |
| 39 | ASFVOLT_LOG(ASFVOLT_DEBUG, "suhas:Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 40 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 41 | BalIndications balIndCfg; |
| 42 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 43 | bal_indications__init(&balIndCfg); |
| 44 | balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND; |
| 45 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 46 | balIndCfg.objtype = obj->obj_type; |
| 47 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 48 | balIndCfg.sub_group = obj->subgroup; |
| 49 | balIndCfg.device_id = voltha_device_id; |
| 50 | |
| 51 | bcmbal_access_terminal_ind *acc_term_ind = (bcmbal_access_terminal_ind *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 52 | |
| 53 | BalAccessTerminalInd acessTermInd; |
| 54 | memset(&acessTermInd, 0, sizeof(BalAccessTerminalInd)); |
| 55 | bal_access_terminal_ind__init(&acessTermInd); |
| 56 | balIndCfg.access_term_ind = &acessTermInd; |
| 57 | |
| 58 | BalObj hdr; |
| 59 | memset(&hdr, 0, sizeof(BalObj)); |
| 60 | bal_obj__init(&hdr); |
| 61 | balIndCfg.access_term_ind->hdr = &hdr; |
| 62 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 63 | BalAccessTerminalKey accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 64 | memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 65 | bal_access_terminal_key__init(&accessTermkey); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 66 | balIndCfg.access_term_ind->key = &accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 67 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 68 | balIndCfg.access_term_ind->key->has_access_term_id = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 69 | balIndCfg.access_term_ind->key->access_term_id = acc_term_ind->key.access_term_id; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 70 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 71 | BalAccessTerminalIndData accessTermIndData; |
| 72 | memset(&accessTermIndData, 0, sizeof(BalAccessTerminalIndData)); |
| 73 | bal_access_terminal_ind_data__init(&accessTermIndData); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 74 | balIndCfg.access_term_ind->data = &accessTermIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 75 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 76 | balIndCfg.access_term_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 77 | balIndCfg.access_term_ind->data->admin_state = acc_term_ind->data.admin_state; |
| 78 | balIndCfg.access_term_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 79 | balIndCfg.access_term_ind->data->oper_status = acc_term_ind->data.oper_status; |
| 80 | balIndCfg.access_term_ind->data->has_iwf_mode = BAL_GRPC_PRES; |
| 81 | balIndCfg.access_term_ind->data->iwf_mode = acc_term_ind->data.iwf_mode; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 82 | |
| 83 | BalTopology balTop; |
| 84 | memset(&balTop, 0, sizeof(BalTopology)); |
| 85 | bal_topology__init(&balTop); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 86 | balIndCfg.access_term_ind->data->topology = &balTop; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 87 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 88 | balIndCfg.access_term_ind->data->topology->has_num_of_nni_ports = BAL_GRPC_PRES; |
| 89 | balIndCfg.access_term_ind->data->topology->num_of_nni_ports = |
| 90 | acc_term_ind->data.topology.num_of_nni_ports; |
| 91 | balIndCfg.access_term_ind->data->topology->has_num_of_pon_ports = BAL_GRPC_PRES; |
| 92 | balIndCfg.access_term_ind->data->topology->num_of_pon_ports = |
| 93 | acc_term_ind->data.topology.num_of_pon_ports; |
| 94 | balIndCfg.access_term_ind->data->topology->has_num_of_mac_devs = BAL_GRPC_PRES; |
| 95 | balIndCfg.access_term_ind->data->topology->num_of_mac_devs = |
| 96 | acc_term_ind->data.topology.num_of_mac_devs; |
| 97 | balIndCfg.access_term_ind->data->topology->has_num_of_pons_per_mac_dev = BAL_GRPC_PRES; |
| 98 | balIndCfg.access_term_ind->data->topology->num_of_pons_per_mac_dev = |
| 99 | acc_term_ind->data.topology.num_of_pons_per_mac_dev; |
| 100 | balIndCfg.access_term_ind->data->topology->has_pon_family = BAL_GRPC_PRES; |
| 101 | balIndCfg.access_term_ind->data->topology->pon_family = |
| 102 | acc_term_ind->data.topology.pon_family; |
| 103 | balIndCfg.access_term_ind->data->topology->has_pon_sub_family = BAL_GRPC_PRES; |
| 104 | balIndCfg.access_term_ind->data->topology->pon_sub_family = |
| 105 | acc_term_ind->data.topology.pon_sub_family; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 106 | |
| 107 | BalSwVersion balsv; |
| 108 | memset(&balsv, 0, sizeof(BalSwVersion)); |
| 109 | bal_sw_version__init(&balsv); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 110 | balIndCfg.access_term_ind->data->sw_version = &balsv; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 111 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 112 | balIndCfg.access_term_ind->data->sw_version->has_version_type = BAL_GRPC_PRES; |
| 113 | balIndCfg.access_term_ind->data->sw_version->version_type = |
| 114 | acc_term_ind->data.sw_version.version_type; |
| 115 | balIndCfg.access_term_ind->data->sw_version->has_major_rev = BAL_GRPC_PRES; |
| 116 | balIndCfg.access_term_ind->data->sw_version->major_rev = |
| 117 | acc_term_ind->data.sw_version.major_rev; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 118 | balIndCfg.access_term_ind->data->sw_version->has_minor_rev = BAL_GRPC_PRES; |
| 119 | balIndCfg.access_term_ind->data->sw_version->minor_rev = |
| 120 | acc_term_ind->data.sw_version.minor_rev; |
| 121 | balIndCfg.access_term_ind->data->sw_version->has_patch_rev = BAL_GRPC_PRES; |
| 122 | balIndCfg.access_term_ind->data->sw_version->patch_rev = |
| 123 | acc_term_ind->data.sw_version.patch_rev; |
| 124 | balIndCfg.access_term_ind->data->sw_version->has_om_version = BAL_GRPC_PRES; |
| 125 | balIndCfg.access_term_ind->data->sw_version->om_version = |
| 126 | acc_term_ind->data.sw_version.om_version; |
| 127 | balIndCfg.access_term_ind->data->sw_version->has_dev_point = BAL_GRPC_PRES; |
| 128 | balIndCfg.access_term_ind->data->sw_version->dev_point = |
| 129 | acc_term_ind->data.sw_version.dev_point; |
| 130 | |
| 131 | bal_register_indication_cbs(); |
| 132 | |
| 133 | BalErr *output; |
| 134 | result = bal_ind__bal_acc_term_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 135 | } |
| 136 | |
| 137 | return result; |
| 138 | } |
| 139 | |
| 140 | /********************************************************************\ |
| 141 | * Function : bal_acc_term_osc_indication_cb * |
| 142 | * Description : This function will handle the indications for * |
| 143 | * Access Terminal Operational State Change * |
| 144 | * * |
| 145 | ********************************************************************/ |
| 146 | bcmos_errno bal_acc_term_osc_indication_cb(bcmbal_obj *obj) |
| 147 | { |
| 148 | bcmos_errno result = BCM_ERR_OK; |
| 149 | |
| 150 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
| 151 | bcmbal_access_terminal_auto_id_oper_status_change != obj->subgroup) |
| 152 | { |
| 153 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 154 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 155 | result = BCM_ERR_INTERNAL; |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | BalIndications balIndCfg; |
| 160 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 161 | bal_indications__init(&balIndCfg); |
| 162 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 163 | balIndCfg.objtype = obj->obj_type; |
| 164 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 165 | balIndCfg.sub_group = obj->subgroup; |
| 166 | balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE; |
| 167 | balIndCfg.device_id = voltha_device_id; |
| 168 | |
| 169 | bcmbal_access_terminal_oper_status_change *acc_term_osc = |
| 170 | (bcmbal_access_terminal_oper_status_change *)obj; |
| 171 | |
| 172 | BalAccessTerminalOperStatusChange acessTermOSC; |
| 173 | memset(&acessTermOSC, 0, sizeof(BalAccessTerminalOperStatusChange)); |
| 174 | bal_access_terminal_oper_status_change__init(&acessTermOSC); |
| 175 | balIndCfg.access_term_ind_op_state = &acessTermOSC; |
| 176 | |
| 177 | BalAccessTerminalKey accessTermkey; |
| 178 | memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 179 | bal_access_terminal_key__init(&accessTermkey); |
| 180 | balIndCfg.access_term_ind_op_state->key = &accessTermkey; |
| 181 | |
| 182 | balIndCfg.access_term_ind_op_state->key->has_access_term_id = BAL_GRPC_PRES; |
| 183 | balIndCfg.access_term_ind_op_state->key->access_term_id = |
| 184 | acc_term_osc->key.access_term_id; |
| 185 | |
| 186 | BalAccessTerminalOperStatusChangeData accessTermOscData; |
| 187 | memset(&accessTermOscData, 0, sizeof(BalAccessTerminalOperStatusChangeData)); |
| 188 | bal_access_terminal_oper_status_change_data__init(&accessTermOscData); |
| 189 | balIndCfg.access_term_ind_op_state->data = &accessTermOscData; |
| 190 | |
| 191 | balIndCfg.access_term_ind_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 192 | balIndCfg.access_term_ind_op_state->data->new_oper_status = |
| 193 | acc_term_osc->data.new_oper_status; |
| 194 | balIndCfg.access_term_ind_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 195 | balIndCfg.access_term_ind_op_state->data->old_oper_status = |
| 196 | acc_term_osc->data.old_oper_status; |
| 197 | balIndCfg.access_term_ind_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 198 | balIndCfg.access_term_ind_op_state->data->admin_state = |
| 199 | acc_term_osc->data.admin_state; |
| 200 | |
| 201 | BalErr *output; |
| 202 | result = bal_ind__bal_acc_term_oper_sts_cng_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 203 | } |
| 204 | |
| 205 | return result; |
| 206 | } |
| 207 | |
| 208 | /********************************************************************\ |
| 209 | * Function : bal_flow_osc_indication_cb * |
| 210 | * Description : This function will handle the indications for * |
| 211 | * Flow Operational State Change * |
| 212 | * * |
| 213 | ********************************************************************/ |
| 214 | bcmos_errno bal_flow_osc_indication_cb(bcmbal_obj *obj) |
| 215 | { |
| 216 | bcmos_errno result = BCM_ERR_OK; |
| 217 | |
| 218 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
| 219 | bcmbal_flow_auto_id_oper_status_change != obj->subgroup) |
| 220 | { |
| 221 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 222 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 223 | result = BCM_ERR_INTERNAL; |
| 224 | } |
| 225 | else |
| 226 | { |
| 227 | BalIndications balIndCfg; |
| 228 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 229 | bal_indications__init(&balIndCfg); |
| 230 | balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_OP_STATE; |
| 231 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 232 | balIndCfg.objtype = obj->obj_type; |
| 233 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 234 | balIndCfg.sub_group = obj->subgroup; |
| 235 | balIndCfg.device_id = voltha_device_id; |
| 236 | |
| 237 | bcmbal_flow_oper_status_change *flow_osc = (bcmbal_flow_oper_status_change *)obj; |
| 238 | |
| 239 | BalFlowOperStatusChange flowOscInd; |
| 240 | memset(&flowOscInd, 0, sizeof(BalFlowOperStatusChange)); |
| 241 | bal_flow_oper_status_change__init(&flowOscInd); |
| 242 | balIndCfg.flow_op_state = &flowOscInd; |
| 243 | |
| 244 | BalFlowKey flowkey; |
| 245 | memset(&flowkey, 0, sizeof(BalFlowKey)); |
| 246 | bal_flow_key__init(&flowkey); |
| 247 | balIndCfg.flow_op_state->key = &flowkey; |
| 248 | |
| 249 | balIndCfg.flow_op_state->key->has_flow_id = BAL_GRPC_PRES; |
| 250 | balIndCfg.flow_op_state->key->flow_id = flow_osc->key.flow_id; |
| 251 | balIndCfg.flow_op_state->key->has_flow_type = BAL_GRPC_PRES; |
| 252 | balIndCfg.flow_op_state->key->flow_type = flow_osc->key.flow_type; |
| 253 | |
| 254 | BalFlowOperStatusChangeData flowOscIndData; |
| 255 | memset(&flowOscIndData, 0, sizeof(BalFlowOperStatusChangeData)); |
| 256 | bal_flow_oper_status_change_data__init(&flowOscIndData); |
| 257 | balIndCfg.flow_op_state->data = &flowOscIndData; |
| 258 | |
| 259 | balIndCfg.flow_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 260 | balIndCfg.flow_op_state->data->new_oper_status = flow_osc->data.new_oper_status; |
| 261 | balIndCfg.flow_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 262 | balIndCfg.flow_op_state->data->old_oper_status = flow_osc->data.old_oper_status; |
| 263 | balIndCfg.flow_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 264 | balIndCfg.flow_op_state->data->admin_state = flow_osc->data.admin_state; |
| 265 | balIndCfg.flow_op_state->data->has_svc_port_id = BAL_GRPC_PRES; |
| 266 | balIndCfg.flow_op_state->data->svc_port_id = flow_osc->data.svc_port_id; |
| 267 | balIndCfg.flow_op_state->data->has_dba_tm_sched_id = BAL_GRPC_PRES; |
| 268 | balIndCfg.flow_op_state->data->dba_tm_sched_id = flow_osc->data.dba_tm_sched_id; |
| 269 | balIndCfg.flow_op_state->data->has_cookie = BAL_GRPC_PRES; |
| 270 | balIndCfg.flow_op_state->data->cookie = flow_osc->data.cookie; |
| 271 | |
| 272 | BalErr *output; |
| 273 | result = bal_ind__bal_flow_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 274 | } |
| 275 | |
| 276 | return result; |
| 277 | } |
| 278 | |
| 279 | /********************************************************************\ |
| 280 | * Function : bal_flow_indication_cb * |
| 281 | * Description : This function will handle the indications for * |
| 282 | * Flow Indication * |
| 283 | * * |
| 284 | ********************************************************************/ |
| 285 | bcmos_errno bal_flow_indication_cb(bcmbal_obj *obj) |
| 286 | { |
| 287 | bcmos_errno result = BCM_ERR_OK; |
| 288 | |
| 289 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
| 290 | bcmbal_flow_auto_id_ind != obj->subgroup) |
| 291 | { |
| 292 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 293 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 294 | result = BCM_ERR_INTERNAL; |
| 295 | } |
| 296 | else |
| 297 | { |
| 298 | BalIndications balIndCfg; |
| 299 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 300 | bal_indications__init(&balIndCfg); |
| 301 | balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_IND; |
| 302 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 303 | balIndCfg.objtype = obj->obj_type; |
| 304 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 305 | balIndCfg.sub_group = obj->subgroup; |
| 306 | balIndCfg.device_id = voltha_device_id; |
| 307 | |
| 308 | bcmbal_flow_ind *flow_ind = (bcmbal_flow_ind *)obj; |
| 309 | |
| 310 | BalFlowInd flowInd; |
| 311 | memset(&flowInd, 0, sizeof(BalFlowInd)); |
| 312 | bal_flow_ind__init(&flowInd); |
| 313 | balIndCfg.flow_ind = &flowInd; |
| 314 | |
| 315 | BalFlowKey flowkey; |
| 316 | memset(&flowkey, 0, sizeof(BalFlowKey)); |
| 317 | bal_flow_key__init(&flowkey); |
| 318 | balIndCfg.flow_ind->key = &flowkey; |
| 319 | |
| 320 | balIndCfg.flow_ind->key->has_flow_id = BAL_GRPC_PRES; |
| 321 | balIndCfg.flow_ind->key->flow_id = flow_ind->key.flow_id; |
| 322 | balIndCfg.flow_ind->key->has_flow_type = BAL_GRPC_PRES; |
| 323 | balIndCfg.flow_ind->key->flow_type = flow_ind->key.flow_type; |
| 324 | |
| 325 | BalFlowIndData flowIndData; |
| 326 | memset(&flowIndData, 0, sizeof(BalFlowIndData)); |
| 327 | bal_flow_ind_data__init(&flowIndData); |
| 328 | balIndCfg.flow_ind->data = &flowIndData; |
| 329 | |
| 330 | balIndCfg.flow_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 331 | balIndCfg.flow_ind->data->admin_state = flow_ind->data.admin_state; |
| 332 | balIndCfg.flow_ind->data->has_oper_status= BAL_GRPC_PRES; |
| 333 | balIndCfg.flow_ind->data->oper_status= flow_ind->data.oper_status; |
| 334 | balIndCfg.flow_ind->data->has_access_int_id = BAL_GRPC_PRES; |
| 335 | balIndCfg.flow_ind->data->access_int_id = flow_ind->data.access_int_id; |
| 336 | balIndCfg.flow_ind->data->has_network_int_id = BAL_GRPC_PRES; |
| 337 | balIndCfg.flow_ind->data->network_int_id = flow_ind->data.network_int_id; |
| 338 | balIndCfg.flow_ind->data->has_sub_term_id = BAL_GRPC_PRES; |
| 339 | balIndCfg.flow_ind->data->sub_term_id = flow_ind->data.sub_term_id; |
| 340 | balIndCfg.flow_ind->data->has_sub_term_uni_idx = BAL_GRPC_PRES; |
| 341 | balIndCfg.flow_ind->data->sub_term_uni_idx = flow_ind->data.sub_term_uni_idx; |
| 342 | balIndCfg.flow_ind->data->has_svc_port_id = BAL_GRPC_PRES; |
| 343 | balIndCfg.flow_ind->data->svc_port_id = flow_ind->data.svc_port_id; |
| 344 | balIndCfg.flow_ind->data->has_resolve_mac = BAL_GRPC_PRES; |
| 345 | balIndCfg.flow_ind->data->resolve_mac = flow_ind->data.resolve_mac; |
| 346 | balIndCfg.flow_ind->data->has_cookie = BAL_GRPC_PRES; |
| 347 | balIndCfg.flow_ind->data->cookie = flow_ind->data.cookie; |
| 348 | |
| 349 | BalClassifier balClassifier; |
| 350 | memset(&balClassifier, 0, sizeof(BalClassifier)); |
| 351 | bal_classifier__init(&balClassifier); |
| 352 | balIndCfg.flow_ind->data->classifier = &balClassifier; |
| 353 | |
| 354 | balIndCfg.flow_ind->data->classifier->has_presence_mask = BAL_GRPC_PRES; |
| 355 | balIndCfg.flow_ind->data->classifier->presence_mask = flow_ind->data.classifier.presence_mask; |
| 356 | balIndCfg.flow_ind->data->classifier->has_o_tpid = BAL_GRPC_PRES; |
| 357 | balIndCfg.flow_ind->data->classifier->o_tpid = flow_ind->data.classifier.o_tpid; |
| 358 | balIndCfg.flow_ind->data->classifier->has_o_vid = BAL_GRPC_PRES; |
| 359 | balIndCfg.flow_ind->data->classifier->o_vid = flow_ind->data.classifier.o_vid; |
| 360 | balIndCfg.flow_ind->data->classifier->has_i_tpid = BAL_GRPC_PRES; |
| 361 | balIndCfg.flow_ind->data->classifier->i_tpid = flow_ind->data.classifier.i_tpid; |
| 362 | balIndCfg.flow_ind->data->classifier->has_i_vid = BAL_GRPC_PRES; |
| 363 | balIndCfg.flow_ind->data->classifier->i_vid = flow_ind->data.classifier.i_vid; |
| 364 | balIndCfg.flow_ind->data->classifier->has_o_pbits = BAL_GRPC_PRES; |
| 365 | balIndCfg.flow_ind->data->classifier->o_pbits = flow_ind->data.classifier.o_pbits; |
| 366 | balIndCfg.flow_ind->data->classifier->has_i_pbits = BAL_GRPC_PRES; |
| 367 | balIndCfg.flow_ind->data->classifier->i_pbits = flow_ind->data.classifier.i_pbits; |
| 368 | balIndCfg.flow_ind->data->classifier->has_ether_type = BAL_GRPC_PRES; |
| 369 | balIndCfg.flow_ind->data->classifier->ether_type = flow_ind->data.classifier.ether_type; |
| 370 | balIndCfg.flow_ind->data->classifier->has_dst_mac = BAL_GRPC_PRES; |
| 371 | balIndCfg.flow_ind->data->classifier->dst_mac.len = |
| 372 | (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.dst_mac.u8); |
| 373 | memcpy(balIndCfg.flow_ind->data->classifier->dst_mac.data, |
| 374 | flow_ind->data.classifier.dst_mac.u8, |
| 375 | balIndCfg.flow_ind->data->classifier->dst_mac.len); |
| 376 | balIndCfg.flow_ind->data->classifier->has_src_mac = BAL_GRPC_PRES; |
| 377 | balIndCfg.flow_ind->data->classifier->src_mac.len = |
| 378 | (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.src_mac.u8); |
| 379 | memcpy(balIndCfg.flow_ind->data->classifier->src_mac.data, |
| 380 | flow_ind->data.classifier.src_mac.u8, |
| 381 | balIndCfg.flow_ind->data->classifier->src_mac.len); |
| 382 | balIndCfg.flow_ind->data->classifier->has_ip_proto = BAL_GRPC_PRES; |
| 383 | balIndCfg.flow_ind->data->classifier->ip_proto = flow_ind->data.classifier.ip_proto; |
| 384 | balIndCfg.flow_ind->data->classifier->has_dst_ip = BAL_GRPC_PRES; |
| 385 | balIndCfg.flow_ind->data->classifier->dst_ip = flow_ind->data.classifier.dst_ip.u32; |
| 386 | balIndCfg.flow_ind->data->classifier->has_src_ip = BAL_GRPC_PRES; |
| 387 | balIndCfg.flow_ind->data->classifier->src_ip = flow_ind->data.classifier.src_ip.u32; |
| 388 | balIndCfg.flow_ind->data->classifier->has_src_port = BAL_GRPC_PRES; |
| 389 | balIndCfg.flow_ind->data->classifier->src_port = flow_ind->data.classifier.src_port; |
| 390 | balIndCfg.flow_ind->data->classifier->has_dst_port = BAL_GRPC_PRES; |
| 391 | balIndCfg.flow_ind->data->classifier->dst_port = flow_ind->data.classifier.dst_port; |
| 392 | balIndCfg.flow_ind->data->classifier->has_pkt_tag_type = BAL_GRPC_PRES; |
| 393 | balIndCfg.flow_ind->data->classifier->pkt_tag_type = flow_ind->data.classifier.pkt_tag_type; |
| 394 | |
| 395 | BalAction balAction; |
| 396 | memset(&balAction, 0, sizeof(BalAction)); |
| 397 | bal_action__init(&balAction); |
| 398 | balIndCfg.flow_ind->data->action = &balAction; |
| 399 | |
| 400 | balIndCfg.flow_ind->data->action->has_presence_mask = BAL_GRPC_PRES; |
| 401 | balIndCfg.flow_ind->data->action->presence_mask = flow_ind->data.action.presence_mask; |
| 402 | balIndCfg.flow_ind->data->action->has_cmds_bitmask = BAL_GRPC_PRES; |
| 403 | balIndCfg.flow_ind->data->action->cmds_bitmask = flow_ind->data.action.cmds_bitmask; |
| 404 | balIndCfg.flow_ind->data->action->has_o_vid = BAL_GRPC_PRES; |
| 405 | balIndCfg.flow_ind->data->action->o_vid = flow_ind->data.action.o_vid; |
| 406 | balIndCfg.flow_ind->data->action->has_o_pbits = BAL_GRPC_PRES; |
| 407 | balIndCfg.flow_ind->data->action->o_pbits = flow_ind->data.action.o_pbits; |
| 408 | balIndCfg.flow_ind->data->action->has_o_tpid = BAL_GRPC_PRES; |
| 409 | balIndCfg.flow_ind->data->action->o_tpid = flow_ind->data.action.o_tpid; |
| 410 | balIndCfg.flow_ind->data->action->has_i_vid = BAL_GRPC_PRES; |
| 411 | balIndCfg.flow_ind->data->action->i_vid = flow_ind->data.action.i_vid; |
| 412 | balIndCfg.flow_ind->data->action->has_i_pbits = BAL_GRPC_PRES; |
| 413 | balIndCfg.flow_ind->data->action->i_pbits = flow_ind->data.action.i_pbits; |
| 414 | balIndCfg.flow_ind->data->action->has_i_tpid = BAL_GRPC_PRES; |
| 415 | balIndCfg.flow_ind->data->action->i_tpid = flow_ind->data.action.i_tpid; |
| 416 | BalErr *output; |
| 417 | result = bal_ind__bal_flow_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 418 | } |
| 419 | |
| 420 | return result; |
| 421 | } |
| 422 | |
| 423 | /********************************************************************\ |
| 424 | * Function : bal_group_indication_cb * |
| 425 | * Description : This function will handle the indications for * |
| 426 | * Group Indication * |
| 427 | * * |
| 428 | ********************************************************************/ |
| 429 | bcmos_errno bal_group_indication_cb(bcmbal_obj *obj) |
| 430 | { |
| 431 | bcmos_errno result = BCM_ERR_OK; |
| 432 | |
| 433 | if(BCMBAL_OBJ_ID_GROUP != obj->obj_type || |
| 434 | bcmbal_group_auto_id_ind != obj->subgroup) |
| 435 | { |
| 436 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 437 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 438 | result = BCM_ERR_INTERNAL; |
| 439 | } |
| 440 | else |
| 441 | { |
| 442 | BalIndications balIndCfg; |
| 443 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 444 | bal_indications__init(&balIndCfg); |
| 445 | balIndCfg.u_case = BAL_INDICATIONS__U_GROUP_IND; |
| 446 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 447 | balIndCfg.objtype = obj->obj_type; |
| 448 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 449 | balIndCfg.sub_group = obj->subgroup; |
| 450 | balIndCfg.device_id = voltha_device_id; |
| 451 | |
| 452 | bcmbal_group_ind *group_ind = (bcmbal_group_ind *)obj; |
| 453 | |
| 454 | BalGroupInd groupInd; |
| 455 | memset(&groupInd, 0, sizeof(BalGroupInd)); |
| 456 | bal_group_ind__init(&groupInd); |
| 457 | balIndCfg.group_ind = &groupInd; |
| 458 | |
| 459 | BalGroupKey groupkey; |
| 460 | memset(&groupkey, 0, sizeof(BalGroupKey)); |
| 461 | bal_group_key__init(&groupkey); |
| 462 | balIndCfg.group_ind->key = &groupkey; |
| 463 | |
| 464 | balIndCfg.group_ind->key->has_group_id = BAL_GRPC_PRES; |
| 465 | balIndCfg.group_ind->key->group_id = group_ind->key.group_id; |
| 466 | |
| 467 | BalGroupIndData groupIndData; |
| 468 | memset(&groupIndData, 0, sizeof(BalGroupIndData)); |
| 469 | bal_group_ind_data__init(&groupIndData); |
| 470 | balIndCfg.group_ind->data = &groupIndData; |
| 471 | |
| 472 | balIndCfg.group_ind->data->has_members_cmd = BAL_GRPC_PRES; |
| 473 | balIndCfg.group_ind->data->members_cmd = group_ind->data.members_cmd; |
| 474 | balIndCfg.group_ind->data->has_cookie = BAL_GRPC_PRES; |
| 475 | balIndCfg.group_ind->data->cookie = group_ind->data.cookie; |
| 476 | balIndCfg.group_ind->data->has_owner = BAL_GRPC_PRES; |
| 477 | balIndCfg.group_ind->data->owner = group_ind->data.owner; |
| 478 | |
| 479 | BalGroupMemberInfoList balMembers; |
| 480 | memset(&balMembers, 0, sizeof(BalGroupMemberInfoList)); |
| 481 | bal_group_member_info_list__init(&balMembers); |
| 482 | balIndCfg.group_ind->data->members = &balMembers; |
| 483 | |
| 484 | balIndCfg.group_ind->data->members->n_val = group_ind->data.members.len; |
| 485 | |
| 486 | BalGroupMemberInfo *balMemberInfo; |
| 487 | balMemberInfo = (BalGroupMemberInfo *)malloc(sizeof(BalGroupMemberInfo)); |
| 488 | memset(&balMemberInfo, 0, sizeof(BalGroupMemberInfo)); |
| 489 | bal_group_member_info__init(balMemberInfo); |
| 490 | balIndCfg.group_ind->data->members->val = &balMemberInfo; |
| 491 | |
| 492 | balMemberInfo->has_intf_id = BAL_GRPC_PRES; |
| 493 | balMemberInfo->intf_id = group_ind->data.members.val->intf_id; |
| 494 | balMemberInfo->has_svc_port_id = BAL_GRPC_PRES; |
| 495 | balMemberInfo->svc_port_id = group_ind->data.members.val->svc_port_id; |
| 496 | |
| 497 | BalAction balAction; |
| 498 | memset(&balAction, 0, sizeof(BalAction)); |
| 499 | bal_action__init(&balAction); |
| 500 | balMemberInfo->action = &balAction; |
| 501 | |
| 502 | balMemberInfo->action->has_presence_mask = BAL_GRPC_PRES; |
| 503 | balMemberInfo->action->presence_mask = group_ind->data.members.val->action.presence_mask; |
| 504 | balMemberInfo->action->has_cmds_bitmask = BAL_GRPC_PRES; |
| 505 | balMemberInfo->action->cmds_bitmask = group_ind->data.members.val->action.cmds_bitmask; |
| 506 | balMemberInfo->action->has_o_vid = BAL_GRPC_PRES; |
| 507 | balMemberInfo->action->o_vid = group_ind->data.members.val->action.o_vid; |
| 508 | balMemberInfo->action->has_o_pbits = BAL_GRPC_PRES; |
| 509 | balMemberInfo->action->o_pbits = group_ind->data.members.val->action.o_pbits; |
| 510 | balMemberInfo->action->has_o_tpid = BAL_GRPC_PRES; |
| 511 | balMemberInfo->action->o_tpid = group_ind->data.members.val->action.o_tpid; |
| 512 | balMemberInfo->action->has_i_vid = BAL_GRPC_PRES; |
| 513 | balMemberInfo->action->i_vid = group_ind->data.members.val->action.i_vid; |
| 514 | balMemberInfo->action->has_i_pbits = BAL_GRPC_PRES; |
| 515 | balMemberInfo->action->i_pbits = group_ind->data.members.val->action.i_pbits; |
| 516 | balMemberInfo->action->has_i_tpid = BAL_GRPC_PRES; |
| 517 | balMemberInfo->action->i_tpid = group_ind->data.members.val->action.i_tpid; |
| 518 | |
| 519 | BalTmQueueRef balQueue; |
| 520 | memset(&balQueue, 0, sizeof(BalTmQueueRef)); |
| 521 | bal_tm_queue_ref__init(&balQueue); |
| 522 | balMemberInfo->queue = &balQueue; |
| 523 | |
| 524 | balMemberInfo->queue->has_sched_id = BAL_GRPC_PRES; |
| 525 | balMemberInfo->queue->sched_id = group_ind->data.members.val->queue.sched_id; |
| 526 | balMemberInfo->queue->has_queue_id = BAL_GRPC_PRES; |
| 527 | balMemberInfo->queue->queue_id = group_ind->data.members.val->queue.queue_id; |
| 528 | |
| 529 | BalIdList balFlows; |
| 530 | memset(&balFlows, 0, sizeof(BalIdList)); |
| 531 | bal_id_list__init(&balFlows); |
| 532 | balIndCfg.group_ind->data->flows = &balFlows; |
| 533 | |
| 534 | balIndCfg.group_ind->data->flows->n_val = group_ind->data.flows.len; |
| 535 | memcpy(balIndCfg.group_ind->data->flows->val, group_ind->data.flows.val, |
| 536 | balIndCfg.group_ind->data->flows->n_val); |
| 537 | |
| 538 | BalErr *output; |
| 539 | result = bal_ind__bal_group_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 540 | } |
| 541 | |
| 542 | return result; |
| 543 | } |
| 544 | |
| 545 | /********************************************************************\ |
| 546 | * Function : bal_interface_osc_indication_cb * |
| 547 | * Description : This function will handle the indications for * |
| 548 | * Interface Operational State Change * |
| 549 | * * |
| 550 | ********************************************************************/ |
| 551 | bcmos_errno bal_interface_osc_indication_cb(bcmbal_obj *obj) |
| 552 | { |
| 553 | bcmos_errno result = BCM_ERR_OK; |
| 554 | |
| 555 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
| 556 | bcmbal_interface_auto_id_oper_status_change != obj->subgroup) |
| 557 | { |
| 558 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 559 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 560 | result = BCM_ERR_INTERNAL; |
| 561 | } |
| 562 | else |
| 563 | { |
| 564 | BalIndications balIndCfg; |
| 565 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 566 | bal_indications__init(&balIndCfg); |
| 567 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_OP_STATE; |
| 568 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 569 | balIndCfg.objtype = obj->obj_type; |
| 570 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 571 | balIndCfg.sub_group = obj->subgroup; |
| 572 | balIndCfg.device_id = voltha_device_id; |
| 573 | |
| 574 | bcmbal_interface_oper_status_change *int_osc_ind = |
| 575 | (bcmbal_interface_oper_status_change *)obj; |
| 576 | |
| 577 | BalInterfaceOperStatusChange ifOsc; |
| 578 | memset(&ifOsc, 0, sizeof(BalInterfaceOperStatusChange)); |
| 579 | bal_interface_oper_status_change__init(&ifOsc); |
| 580 | balIndCfg.interface_op_state = &ifOsc; |
| 581 | |
| 582 | BalInterfaceKey ifkey; |
| 583 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 584 | bal_interface_key__init(&ifkey); |
| 585 | balIndCfg.interface_op_state->key = &ifkey; |
| 586 | |
| 587 | balIndCfg.interface_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 588 | balIndCfg.interface_op_state->key->intf_id = int_osc_ind->key.intf_id; |
| 589 | balIndCfg.interface_op_state->key->has_intf_type = BAL_GRPC_PRES; |
| 590 | balIndCfg.interface_op_state->key->intf_type = int_osc_ind->key.intf_type; |
| 591 | |
| 592 | BalInterfaceOperStatusChangeData ifOscIndData; |
| 593 | memset(&ifOscIndData, 0, sizeof(BalInterfaceOperStatusChangeData)); |
| 594 | bal_interface_oper_status_change_data__init(&ifOscIndData); |
| 595 | balIndCfg.interface_op_state->data = &ifOscIndData; |
| 596 | |
| 597 | balIndCfg.interface_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 598 | balIndCfg.interface_op_state->data->new_oper_status = int_osc_ind->data.new_oper_status; |
| 599 | balIndCfg.interface_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 600 | balIndCfg.interface_op_state->data->old_oper_status = int_osc_ind->data.old_oper_status; |
| 601 | balIndCfg.interface_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 602 | balIndCfg.interface_op_state->data->admin_state = int_osc_ind->data.admin_state; |
| 603 | |
| 604 | BalErr *output; |
| 605 | result = bal_ind__bal_iface_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 606 | } |
| 607 | |
| 608 | return result; |
| 609 | } |
| 610 | |
| 611 | /********************************************************************\ |
| 612 | * Function : bal_interface_los_indication_cb * |
| 613 | * Description : This function will handle the indications for * |
| 614 | * Interface los Indication * |
| 615 | * * |
| 616 | ********************************************************************/ |
| 617 | bcmos_errno bal_interface_los_indication_cb(bcmbal_obj *obj) |
| 618 | { |
| 619 | bcmos_errno result = BCM_ERR_OK; |
| 620 | |
| 621 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
| 622 | bcmbal_interface_auto_id_los != obj->subgroup) |
| 623 | { |
| 624 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 625 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 626 | result = BCM_ERR_INTERNAL; |
| 627 | } |
| 628 | else |
| 629 | { |
| 630 | BalIndications balIndCfg; |
| 631 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 632 | bal_indications__init(&balIndCfg); |
| 633 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_LOS; |
| 634 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 635 | balIndCfg.objtype = obj->obj_type; |
| 636 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 637 | balIndCfg.sub_group = obj->subgroup; |
| 638 | balIndCfg.device_id = voltha_device_id; |
| 639 | |
| 640 | bcmbal_interface_los *int_los_ind = |
| 641 | (bcmbal_interface_los *)obj; |
| 642 | |
| 643 | BalInterfaceLos ifLos; |
| 644 | memset(&ifLos, 0, sizeof(BalInterfaceLos)); |
| 645 | bal_interface_los__init(&ifLos); |
| 646 | balIndCfg.interface_los = &ifLos; |
| 647 | |
| 648 | BalObj hdr; |
| 649 | memset(&hdr, 0, sizeof(BalObj)); |
| 650 | bal_obj__init(&hdr); |
| 651 | balIndCfg.interface_los->hdr = &hdr; |
| 652 | |
| 653 | BalInterfaceKey ifkey; |
| 654 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 655 | bal_interface_key__init(&ifkey); |
| 656 | balIndCfg.interface_los->key = &ifkey; |
| 657 | |
| 658 | balIndCfg.interface_los->key->has_intf_id = BAL_GRPC_PRES; |
| 659 | balIndCfg.interface_los->key->intf_id = int_los_ind->key.intf_id; |
| 660 | balIndCfg.interface_los->key->has_intf_type = BAL_GRPC_PRES; |
| 661 | balIndCfg.interface_los->key->intf_type = int_los_ind->key.intf_type; |
| 662 | |
| 663 | BalInterfaceLosData ifLosIndData; |
| 664 | memset(&ifLosIndData, 0, sizeof(BalInterfaceLosData)); |
| 665 | bal_interface_los_data__init(&ifLosIndData); |
| 666 | balIndCfg.interface_los->data = &ifLosIndData; |
| 667 | |
| 668 | balIndCfg.interface_los->data->has_status = BAL_GRPC_PRES; |
| 669 | balIndCfg.interface_los->data->status = int_los_ind->data.status; |
| 670 | |
| 671 | BalErr *output; |
| 672 | result = bal_ind__bal_iface_los(client, NULL, &balIndCfg, &output, NULL, 0); |
| 673 | } |
| 674 | |
| 675 | return result; |
| 676 | } |
| 677 | |
| 678 | /********************************************************************\ |
| 679 | * Function : bal_interface_indication_cb * |
| 680 | * Description : This function will handle the indications for * |
| 681 | * Interface Indication * |
| 682 | * * |
| 683 | ********************************************************************/ |
| 684 | bcmos_errno bal_interface_indication_cb(bcmbal_obj *obj) |
| 685 | { |
| 686 | bcmos_errno result = BCM_ERR_OK; |
| 687 | |
| 688 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
| 689 | bcmbal_interface_auto_id_ind != obj->subgroup) |
| 690 | { |
| 691 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 692 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 693 | result = BCM_ERR_INTERNAL; |
| 694 | } |
| 695 | else |
| 696 | { |
| 697 | BalIndications balIndCfg; |
| 698 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 699 | bal_indications__init(&balIndCfg); |
| 700 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_IND; |
| 701 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 702 | balIndCfg.objtype = obj->obj_type; |
| 703 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 704 | balIndCfg.sub_group = obj->subgroup; |
| 705 | balIndCfg.device_id = voltha_device_id; |
| 706 | |
| 707 | bcmbal_interface_ind *interface_ind = (bcmbal_interface_ind *)obj; |
| 708 | |
| 709 | BalInterfaceInd ifInd; |
| 710 | memset(&ifInd, 0, sizeof(BalInterfaceInd)); |
| 711 | bal_interface_ind__init(&ifInd); |
| 712 | balIndCfg.interface_ind = &ifInd; |
| 713 | |
| 714 | BalObj hdr; |
| 715 | memset(&hdr, 0, sizeof(BalObj)); |
| 716 | bal_obj__init(&hdr); |
| 717 | balIndCfg.interface_ind->hdr = &hdr; |
| 718 | |
| 719 | BalInterfaceKey ifkey; |
| 720 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 721 | bal_interface_key__init(&ifkey); |
| 722 | balIndCfg.interface_ind->key = &ifkey; |
| 723 | |
| 724 | balIndCfg.interface_ind->key->has_intf_id = BAL_GRPC_PRES; |
| 725 | balIndCfg.interface_ind->key->intf_id = interface_ind->key.intf_id; |
| 726 | balIndCfg.interface_ind->key->has_intf_type = BAL_GRPC_PRES; |
| 727 | balIndCfg.interface_ind->key->intf_type = interface_ind->key.intf_type; |
| 728 | |
| 729 | BalInterfaceIndData ifIndData; |
| 730 | memset(&ifIndData, 0, sizeof(BalInterfaceIndData)); |
| 731 | bal_interface_ind_data__init(&ifIndData); |
| 732 | balIndCfg.interface_ind->data = &ifIndData; |
| 733 | |
| 734 | balIndCfg.interface_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 735 | balIndCfg.interface_ind->data->admin_state = interface_ind->data.admin_state; |
| 736 | balIndCfg.interface_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 737 | balIndCfg.interface_ind->data->oper_status = interface_ind->data.oper_status; |
| 738 | balIndCfg.interface_ind->data->has_min_data_agg_port_id = BAL_GRPC_PRES; |
| 739 | balIndCfg.interface_ind->data->min_data_agg_port_id = interface_ind->data.min_data_agg_port_id; |
| 740 | balIndCfg.interface_ind->data->has_min_data_svc_port_id = BAL_GRPC_PRES; |
| 741 | balIndCfg.interface_ind->data->min_data_svc_port_id = interface_ind->data.min_data_svc_port_id; |
| 742 | balIndCfg.interface_ind->data->has_transceiver_type = BAL_GRPC_PRES; |
| 743 | balIndCfg.interface_ind->data->transceiver_type = interface_ind->data.transceiver_type; |
| 744 | balIndCfg.interface_ind->data->has_ds_miss_mode = BAL_GRPC_PRES; |
| 745 | balIndCfg.interface_ind->data->ds_miss_mode = interface_ind->data.ds_miss_mode; |
| 746 | balIndCfg.interface_ind->data->has_mtu = BAL_GRPC_PRES; |
| 747 | balIndCfg.interface_ind->data->mtu = interface_ind->data.mtu; |
| 748 | balIndCfg.interface_ind->data->has_flow_control = BAL_GRPC_PRES; |
| 749 | balIndCfg.interface_ind->data->flow_control = interface_ind->data.flow_control; |
| 750 | balIndCfg.interface_ind->data->has_ds_tm = BAL_GRPC_PRES; |
| 751 | balIndCfg.interface_ind->data->ds_tm = interface_ind->data.ds_tm; |
| 752 | balIndCfg.interface_ind->data->has_us_tm = BAL_GRPC_PRES; |
| 753 | balIndCfg.interface_ind->data->us_tm = interface_ind->data.us_tm; |
| 754 | |
| 755 | BalIdList balFlows; |
| 756 | memset(&balFlows, 0, sizeof(BalIdList)); |
| 757 | bal_id_list__init(&balFlows); |
| 758 | balIndCfg.interface_ind->data->sub_term_id_list = &balFlows; |
| 759 | |
| 760 | balIndCfg.interface_ind->data->sub_term_id_list->n_val = interface_ind->data.sub_term_id_list.len; |
| 761 | memcpy(balIndCfg.interface_ind->data->sub_term_id_list->val, interface_ind->data.sub_term_id_list.val, |
| 762 | balIndCfg.interface_ind->data->sub_term_id_list->n_val); |
| 763 | |
| 764 | BalErr *output; |
| 765 | result = bal_ind__bal_iface_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 766 | } |
| 767 | |
| 768 | return result; |
| 769 | } |
| 770 | |
| 771 | /********************************************************************\ |
| 772 | * Function : bal_sub_term_osc_indication_cb * |
| 773 | * Description : This function will handle the indications for * |
| 774 | * Subscriber term Operational State Change * |
| 775 | * * |
| 776 | ********************************************************************/ |
| 777 | bcmos_errno bal_sub_term_osc_indication_cb(bcmbal_obj *obj) |
| 778 | { |
| 779 | bcmos_errno result = BCM_ERR_OK; |
| 780 | |
| 781 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 782 | bcmbal_subscriber_terminal_auto_id_oper_status_change != obj->subgroup) |
| 783 | { |
| 784 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 785 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 786 | result = BCM_ERR_INTERNAL; |
| 787 | } |
| 788 | else |
| 789 | { |
| 790 | BalIndications balIndCfg; |
| 791 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 792 | bal_indications__init(&balIndCfg); |
| 793 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_OP_STATE; |
| 794 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 795 | balIndCfg.objtype = obj->obj_type; |
| 796 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 797 | balIndCfg.sub_group = obj->subgroup; |
| 798 | balIndCfg.device_id = voltha_device_id; |
| 799 | |
| 800 | bcmbal_subscriber_terminal_oper_status_change *sub_osc_ind = |
| 801 | (bcmbal_subscriber_terminal_oper_status_change *)obj; |
| 802 | |
| 803 | BalSubscriberTerminalOperStatusChange subOscInd; |
| 804 | memset(&subOscInd, 0, sizeof(BalSubscriberTerminalOperStatusChange)); |
| 805 | bal_subscriber_terminal_oper_status_change__init(&subOscInd); |
| 806 | balIndCfg.terminal_op_state = &subOscInd; |
| 807 | |
| 808 | BalSubscriberTerminalKey subkey; |
| 809 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 810 | bal_subscriber_terminal_key__init(&subkey); |
| 811 | balIndCfg.terminal_op_state->key = &subkey; |
| 812 | |
| 813 | balIndCfg.terminal_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 814 | balIndCfg.terminal_op_state->key->intf_id = sub_osc_ind->key.intf_id; |
| 815 | balIndCfg.terminal_op_state->key->has_sub_term_id = BAL_GRPC_PRES; |
| 816 | balIndCfg.terminal_op_state->key->sub_term_id = sub_osc_ind->key.sub_term_id; |
| 817 | |
| 818 | BalSubscriberTerminalOperStatusChangeData subOscIndData; |
| 819 | memset(&subOscIndData, 0, sizeof(BalSubscriberTerminalOperStatusChangeData)); |
| 820 | bal_subscriber_terminal_oper_status_change_data__init(&subOscIndData); |
| 821 | balIndCfg.terminal_op_state->data = &subOscIndData; |
| 822 | |
| 823 | balIndCfg.terminal_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 824 | balIndCfg.terminal_op_state->data->new_oper_status = |
| 825 | sub_osc_ind->data.new_oper_status; |
| 826 | balIndCfg.terminal_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 827 | balIndCfg.terminal_op_state->data->old_oper_status = |
| 828 | sub_osc_ind->data.old_oper_status; |
| 829 | balIndCfg.terminal_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 830 | balIndCfg.terminal_op_state->data->admin_state = |
| 831 | sub_osc_ind->data.admin_state; |
| 832 | |
| 833 | BalErr *output; |
| 834 | result = bal_ind__bal_subs_term_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 835 | } |
| 836 | |
| 837 | return result; |
| 838 | } |
| 839 | |
| 840 | /********************************************************************\ |
| 841 | * Function : bal_sub_term_disc_indication_cb * |
| 842 | * Description : This function will handle the indications for * |
| 843 | * Subscriber term disc indication * |
| 844 | * * |
| 845 | ********************************************************************/ |
| 846 | bcmos_errno bal_sub_term_disc_indication_cb(bcmbal_obj *obj) |
| 847 | { |
| 848 | bcmos_errno result = BCM_ERR_OK; |
| 849 | |
| 850 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 851 | bcmbal_subscriber_terminal_auto_id_sub_term_disc != obj->subgroup) |
| 852 | { |
| 853 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 854 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 855 | result = BCM_ERR_INTERNAL; |
| 856 | } |
| 857 | else |
| 858 | { |
| 859 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 860 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 861 | BalIndications balIndCfg; |
| 862 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 863 | bal_indications__init(&balIndCfg); |
| 864 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DISC; |
| 865 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 866 | balIndCfg.objtype = obj->obj_type; |
| 867 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 868 | balIndCfg.sub_group = obj->subgroup; |
| 869 | balIndCfg.device_id = voltha_device_id; |
| 870 | |
| 871 | bcmbal_subscriber_terminal_sub_term_disc *sub_disc_ind = |
| 872 | (bcmbal_subscriber_terminal_sub_term_disc *)obj; |
| 873 | |
| 874 | BalSubscriberTerminalSubTermDisc subDiscInd; |
| 875 | memset(&subDiscInd, 0, sizeof(BalSubscriberTerminalSubTermDisc)); |
| 876 | bal_subscriber_terminal_sub_term_disc__init(&subDiscInd); |
| 877 | balIndCfg.terminal_disc = &subDiscInd; |
| 878 | |
| 879 | BalObj hdr; |
| 880 | memset(&hdr, 0, sizeof(BalObj)); |
| 881 | bal_obj__init(&hdr); |
| 882 | balIndCfg.terminal_disc->hdr = &hdr; |
| 883 | |
| 884 | BalSubscriberTerminalKey subkey; |
| 885 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 886 | bal_subscriber_terminal_key__init(&subkey); |
| 887 | balIndCfg.terminal_disc->key = &subkey; |
| 888 | |
| 889 | balIndCfg.terminal_disc->key->has_intf_id = BAL_GRPC_PRES; |
| 890 | balIndCfg.terminal_disc->key->intf_id = sub_disc_ind->key.intf_id; |
| 891 | balIndCfg.terminal_disc->key->has_sub_term_id = BAL_GRPC_PRES; |
| 892 | balIndCfg.terminal_disc->key->sub_term_id = sub_disc_ind->key.sub_term_id; |
| 893 | |
| 894 | BalSubscriberTerminalSubTermDiscData subDiscIndData; |
| 895 | memset(&subDiscIndData, 0, sizeof(BalSubscriberTerminalSubTermDiscData)); |
| 896 | bal_subscriber_terminal_sub_term_disc_data__init(&subDiscIndData); |
| 897 | balIndCfg.terminal_disc->data = &subDiscIndData; |
| 898 | |
| 899 | BalSerialNumber serial_number; |
| 900 | memset(&serial_number, 0, sizeof(BalSerialNumber)); |
| 901 | bal_serial_number__init(&serial_number); |
| 902 | |
| 903 | balIndCfg.terminal_disc->data->serial_number = &serial_number; |
| 904 | |
| 905 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Discovered ONU serial number " |
| 906 | "%2X%2X%2X%2X%1X%1X%1X%1X%1X%1X%1X%1X ", |
| 907 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 908 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 909 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 910 | sub_disc_ind->data.serial_number.vendor_id[3], |
| 911 | sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 912 | sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 913 | sub_disc_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 914 | sub_disc_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 915 | sub_disc_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 916 | sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 917 | sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 918 | sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 919 | |
| 920 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor id is %s\n", sub_disc_ind->data.serial_number.vendor_id); |
| 921 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor specific is %s\n", sub_disc_ind->data.serial_number.vendor_specific); |
| 922 | |
| 923 | char vendor_id[MAX_CHAR_LENGTH]; |
| 924 | memset(&vendor_id, 0, MAX_CHAR_LENGTH); |
| 925 | sprintf(vendor_id,"%c%c%c%c", |
| 926 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 927 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 928 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 929 | sub_disc_ind->data.serial_number.vendor_id[3]); |
| 930 | balIndCfg.terminal_disc->data->serial_number->vendor_id = vendor_id; |
| 931 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor id is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_id); |
| 932 | char vendor_specific[MAX_CHAR_LENGTH]; |
| 933 | memset(&vendor_specific, 0, MAX_CHAR_LENGTH); |
| 934 | sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X", |
| 935 | sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 936 | sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 937 | sub_disc_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 938 | sub_disc_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 939 | sub_disc_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 940 | sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 941 | sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 942 | sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 943 | balIndCfg.terminal_disc->data->serial_number->vendor_specific = vendor_specific; |
| 944 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor specific is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_specific); |
| 945 | |
| 946 | BalErr *output; |
| 947 | result = bal_ind__bal_subs_term_discovery_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 948 | } |
| 949 | |
| 950 | return result; |
| 951 | } |
| 952 | |
| 953 | /********************************************************************\ |
| 954 | * Function : bal_sub_term_alarm_indication_cb * |
| 955 | * Description : This function will handle the indications for * |
| 956 | * Subscriber term alarm indication * |
| 957 | * * |
| 958 | ********************************************************************/ |
| 959 | bcmos_errno bal_sub_term_alarm_indication_cb(bcmbal_obj *obj) |
| 960 | { |
| 961 | bcmos_errno result = BCM_ERR_OK; |
| 962 | |
| 963 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 964 | bcmbal_subscriber_terminal_auto_id_sub_term_alarm != obj->subgroup) |
| 965 | { |
| 966 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 967 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 968 | result = BCM_ERR_INTERNAL; |
| 969 | } |
| 970 | else |
| 971 | { |
| 972 | BalIndications balIndCfg; |
| 973 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 974 | bal_indications__init(&balIndCfg); |
| 975 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_ALARM; |
| 976 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 977 | balIndCfg.objtype = obj->obj_type; |
| 978 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 979 | balIndCfg.sub_group = obj->subgroup; |
| 980 | balIndCfg.device_id = voltha_device_id; |
| 981 | |
| 982 | bcmbal_subscriber_terminal_sub_term_alarm *sub_term_alarm = |
| 983 | (bcmbal_subscriber_terminal_sub_term_alarm *)obj; |
| 984 | |
| 985 | BalSubscriberTerminalSubTermAlarm subTermAlarm; |
| 986 | memset(&subTermAlarm, 0, sizeof(BalSubscriberTerminalSubTermAlarm)); |
| 987 | bal_subscriber_terminal_sub_term_alarm__init(&subTermAlarm); |
| 988 | balIndCfg.terminal_alarm = &subTermAlarm; |
| 989 | |
| 990 | BalObj hdr; |
| 991 | memset(&hdr, 0, sizeof(BalObj)); |
| 992 | bal_obj__init(&hdr); |
| 993 | balIndCfg.terminal_alarm->hdr = &hdr; |
| 994 | |
| 995 | BalSubscriberTerminalKey subkey; |
| 996 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 997 | bal_subscriber_terminal_key__init(&subkey); |
| 998 | balIndCfg.terminal_alarm->key = &subkey; |
| 999 | |
| 1000 | balIndCfg.terminal_alarm->key->has_intf_id = BAL_GRPC_PRES; |
| 1001 | balIndCfg.terminal_alarm->key->intf_id = sub_term_alarm->key.intf_id; |
| 1002 | balIndCfg.terminal_alarm->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1003 | balIndCfg.terminal_alarm->key->sub_term_id = sub_term_alarm->key.sub_term_id; |
| 1004 | |
| 1005 | BalsubscriberTerminalSubTermAlarmData subTermAlarmData; |
| 1006 | memset(&subTermAlarmData, 0, sizeof(BalsubscriberTerminalSubTermAlarmData)); |
| 1007 | balsubscriber_terminal_sub_term_alarm_data__init(&subTermAlarmData); |
| 1008 | balIndCfg.terminal_alarm->data = &subTermAlarmData; |
| 1009 | |
| 1010 | BalSubscriberTerminalAlarms balSubAlarms; |
| 1011 | memset(&balSubAlarms, 0, sizeof(BalSubscriberTerminalAlarms)); |
| 1012 | bal_subscriber_terminal_alarms__init(&balSubAlarms); |
| 1013 | balIndCfg.terminal_alarm->data->alarm = &balSubAlarms; |
| 1014 | |
| 1015 | balIndCfg.terminal_alarm->data->alarm->has_los = BAL_GRPC_PRES; |
| 1016 | balIndCfg.terminal_alarm->data->alarm->los = sub_term_alarm->data.alarm.los; |
| 1017 | balIndCfg.terminal_alarm->data->alarm->has_lob = BAL_GRPC_PRES; |
| 1018 | balIndCfg.terminal_alarm->data->alarm->lob = sub_term_alarm->data.alarm.lob; |
| 1019 | balIndCfg.terminal_alarm->data->alarm->has_lopc_miss = BAL_GRPC_PRES; |
| 1020 | balIndCfg.terminal_alarm->data->alarm->lopc_miss = sub_term_alarm->data.alarm.lopc_miss; |
| 1021 | balIndCfg.terminal_alarm->data->alarm->has_lopc_mic_error = BAL_GRPC_PRES; |
| 1022 | balIndCfg.terminal_alarm->data->alarm->lopc_mic_error = sub_term_alarm->data.alarm.lopc_mic_error; |
| 1023 | |
| 1024 | BalErr *output; |
| 1025 | result = bal_ind__bal_subs_term_alarm_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1026 | } |
| 1027 | |
| 1028 | return result; |
| 1029 | } |
| 1030 | |
| 1031 | /********************************************************************\ |
| 1032 | * Function : bal_sub_term_dgi_indication_cb * |
| 1033 | * Description : This function will handle the indications for * |
| 1034 | * Subscriber term dgi indication * |
| 1035 | * * |
| 1036 | ********************************************************************/ |
| 1037 | bcmos_errno bal_sub_term_dgi_indication_cb(bcmbal_obj *obj) |
| 1038 | { |
| 1039 | bcmos_errno result = BCM_ERR_OK; |
| 1040 | |
| 1041 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1042 | bcmbal_subscriber_terminal_auto_id_dgi != obj->subgroup) |
| 1043 | { |
| 1044 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1045 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1046 | result = BCM_ERR_INTERNAL; |
| 1047 | } |
| 1048 | else |
| 1049 | { |
| 1050 | BalIndications balIndCfg; |
| 1051 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1052 | bal_indications__init(&balIndCfg); |
| 1053 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DGI; |
| 1054 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1055 | balIndCfg.objtype = obj->obj_type; |
| 1056 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1057 | balIndCfg.sub_group = obj->subgroup; |
| 1058 | balIndCfg.device_id = voltha_device_id; |
| 1059 | |
| 1060 | bcmbal_subscriber_terminal_dgi *sub_dgi_ind = |
| 1061 | (bcmbal_subscriber_terminal_dgi *)obj; |
| 1062 | |
| 1063 | BalSubscriberTerminalDgi subDgiInd; |
| 1064 | memset(&subDgiInd, 0, sizeof(BalSubscriberTerminalDgi)); |
| 1065 | bal_subscriber_terminal_dgi__init(&subDgiInd); |
| 1066 | balIndCfg.terminal_dgi= &subDgiInd; |
| 1067 | |
| 1068 | BalSubscriberTerminalKey subkey; |
| 1069 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1070 | bal_subscriber_terminal_key__init(&subkey); |
| 1071 | balIndCfg.terminal_disc->key = &subkey; |
| 1072 | |
| 1073 | balIndCfg.terminal_dgi->key->has_intf_id = BAL_GRPC_PRES; |
| 1074 | balIndCfg.terminal_dgi->key->intf_id = sub_dgi_ind->key.intf_id; |
| 1075 | balIndCfg.terminal_dgi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1076 | balIndCfg.terminal_dgi->key->sub_term_id = sub_dgi_ind->key.sub_term_id; |
| 1077 | |
| 1078 | BalSubscriberTerminalDgiData subDgiIndData; |
| 1079 | memset(&subDgiIndData, 0, sizeof(BalSubscriberTerminalDgiData)); |
| 1080 | bal_subscriber_terminal_dgi_data__init(&subDgiIndData); |
| 1081 | balIndCfg.terminal_dgi->data = &subDgiIndData; |
| 1082 | |
| 1083 | balIndCfg.terminal_dgi->data->has_dgi_status = BAL_GRPC_PRES; |
| 1084 | balIndCfg.terminal_dgi->data->dgi_status = sub_dgi_ind->data.dgi_status; |
| 1085 | |
| 1086 | BalErr *output; |
| 1087 | result = bal_ind__bal_subs_term_dgi_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1088 | } |
| 1089 | |
| 1090 | return result; |
| 1091 | } |
| 1092 | |
| 1093 | /********************************************************************\ |
| 1094 | * Function : bal_sub_term_indication_cb * |
| 1095 | * Description : This function will handle the indications for * |
| 1096 | * Subscriber term indication * |
| 1097 | * * |
| 1098 | ********************************************************************/ |
| 1099 | bcmos_errno bal_sub_term_indication_cb(bcmbal_obj *obj) |
| 1100 | { |
| 1101 | bcmos_errno result = BCM_ERR_OK; |
| 1102 | |
| 1103 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1104 | bcmbal_subscriber_terminal_auto_id_ind != obj->subgroup) |
| 1105 | { |
| 1106 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1107 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1108 | result = BCM_ERR_INTERNAL; |
| 1109 | } |
| 1110 | else |
| 1111 | { |
| 1112 | BalIndications balIndCfg; |
| 1113 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1114 | bal_indications__init(&balIndCfg); |
| 1115 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_IND; |
| 1116 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1117 | balIndCfg.objtype = obj->obj_type; |
| 1118 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1119 | balIndCfg.sub_group = obj->subgroup; |
| 1120 | balIndCfg.device_id = voltha_device_id; |
| 1121 | |
| 1122 | bcmbal_subscriber_terminal_ind *sub_ind = (bcmbal_subscriber_terminal_ind *)obj; |
| 1123 | |
| 1124 | BalSubscriberTerminalInd subInd; |
| 1125 | memset(&subInd, 0, sizeof(BalSubscriberTerminalInd)); |
| 1126 | bal_subscriber_terminal_ind__init(&subInd); |
| 1127 | balIndCfg.terminal_ind = &subInd; |
| 1128 | |
| 1129 | BalObj hdr; |
| 1130 | memset(&hdr, 0, sizeof(BalObj)); |
| 1131 | bal_obj__init(&hdr); |
| 1132 | balIndCfg.terminal_ind->hdr = &hdr; |
| 1133 | |
| 1134 | BalSubscriberTerminalKey subkey; |
| 1135 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1136 | bal_subscriber_terminal_key__init(&subkey); |
| 1137 | balIndCfg.terminal_ind->key = &subkey; |
| 1138 | |
| 1139 | balIndCfg.terminal_ind->key->has_intf_id = BAL_GRPC_PRES; |
| 1140 | balIndCfg.terminal_ind->key->intf_id = sub_ind->key.intf_id; |
| 1141 | balIndCfg.terminal_ind->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1142 | balIndCfg.terminal_ind->key->sub_term_id = sub_ind->key.sub_term_id; |
| 1143 | |
| 1144 | BalSubscriberTerminalIndData subIndData; |
| 1145 | memset(&subIndData, 0, sizeof(BalSubscriberTerminalIndData)); |
| 1146 | bal_subscriber_terminal_ind_data__init(&subIndData); |
| 1147 | balIndCfg.terminal_ind->data = &subIndData; |
| 1148 | |
| 1149 | balIndCfg.terminal_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 1150 | balIndCfg.terminal_ind->data->admin_state = sub_ind->data.admin_state; |
| 1151 | balIndCfg.terminal_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 1152 | balIndCfg.terminal_ind->data->oper_status = sub_ind->data.oper_status; |
| 1153 | balIndCfg.terminal_ind->data->has_svc_port_id = BAL_GRPC_PRES; |
| 1154 | balIndCfg.terminal_ind->data->svc_port_id = sub_ind->data.svc_port_id; |
| 1155 | balIndCfg.terminal_ind->data->has_ds_tm = BAL_GRPC_PRES; |
| 1156 | balIndCfg.terminal_ind->data->ds_tm = sub_ind->data.ds_tm; |
| 1157 | balIndCfg.terminal_ind->data->has_us_tm = BAL_GRPC_PRES; |
| 1158 | balIndCfg.terminal_ind->data->us_tm = sub_ind->data.us_tm; |
| 1159 | balIndCfg.terminal_ind->data->has_sub_term_rate = BAL_GRPC_PRES; |
| 1160 | balIndCfg.terminal_ind->data->sub_term_rate = sub_ind->data.sub_term_rate; |
| 1161 | char password[MAX_CHAR_LENGTH*2]; |
| 1162 | memset(&password, 0, MAX_CHAR_LENGTH*2); |
| 1163 | strcpy(password,(const char *)sub_ind->data.password.arr); |
| 1164 | balIndCfg.terminal_ind->data->password = password; |
| 1165 | char registration_id[MAX_CHAR_LENGTH*8]; |
| 1166 | memset(®istration_id, 0, MAX_CHAR_LENGTH*8); |
| 1167 | strcpy(registration_id,(const char *)sub_ind->data.registration_id.arr); |
| 1168 | balIndCfg.terminal_ind->data->registration_id = registration_id; |
| 1169 | |
| 1170 | #if 0 |
| 1171 | balIndCfg.terminal_ind->data->has_mac_address = BAL_GRPC_PRES; |
| 1172 | balIndCfg.terminal_ind->data->mac_address.len = |
| 1173 | (BCMOS_ETH_ALEN)*sizeof(sub_ind->data.mac_address.u8); |
| 1174 | uint8_t mac_address[balIndCfg.terminal_ind->data->mac_address.len]; |
| 1175 | memset(&mac_address, 0 ,balIndCfg.terminal_ind->data->mac_address.len); |
| 1176 | strcpy((char *)mac_address,(const char *)sub_ind->data.mac_address.u8); |
| 1177 | balIndCfg.terminal_ind->data->mac_address.data = mac_address; |
| 1178 | #endif |
| 1179 | |
| 1180 | BalSerialNumber serialNum; |
| 1181 | memset(&serialNum, 0, sizeof(BalSerialNumber)); |
| 1182 | bal_serial_number__init(&serialNum); |
| 1183 | balIndCfg.terminal_ind->data->serial_number = &serialNum; |
| 1184 | |
| 1185 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor id is %s\n", sub_ind->data.serial_number.vendor_id); |
| 1186 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor specific is %s\n", sub_ind->data.serial_number.vendor_specific); |
| 1187 | |
| 1188 | char vendor_id[MAX_CHAR_LENGTH]; |
| 1189 | memset(&vendor_id, 0, MAX_CHAR_LENGTH); |
| 1190 | sprintf(vendor_id,"%c%c%c%c", |
| 1191 | sub_ind->data.serial_number.vendor_id[0], |
| 1192 | sub_ind->data.serial_number.vendor_id[1], |
| 1193 | sub_ind->data.serial_number.vendor_id[2], |
| 1194 | sub_ind->data.serial_number.vendor_id[3]); |
| 1195 | balIndCfg.terminal_ind->data->serial_number->vendor_id = vendor_id; |
| 1196 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor id is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_id); |
| 1197 | char vendor_specific[MAX_CHAR_LENGTH]; |
| 1198 | memset(&vendor_specific, 0, MAX_CHAR_LENGTH); |
| 1199 | sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X", |
| 1200 | sub_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 1201 | sub_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 1202 | sub_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 1203 | sub_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 1204 | sub_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 1205 | sub_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 1206 | sub_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 1207 | sub_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 1208 | balIndCfg.terminal_ind->data->serial_number->vendor_specific = vendor_specific; |
| 1209 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor specific is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_specific); |
| 1210 | |
| 1211 | BalIdList balAggportList; |
| 1212 | memset(&balAggportList, 0, sizeof(BalIdList)); |
| 1213 | bal_id_list__init(&balAggportList); |
| 1214 | balIndCfg.terminal_ind->data->agg_port_id_list = &balAggportList; |
| 1215 | |
| 1216 | #if 0 |
| 1217 | balIndCfg.terminal_ind->data->agg_port_id_list->n_val = sub_ind->data.agg_port_id_list.len; |
| 1218 | uint32_t agg_port_id_list[balIndCfg.terminal_ind->data->agg_port_id_list->n_val]; |
| 1219 | memset(&agg_port_id_list, 0, balIndCfg.terminal_ind->data->agg_port_id_list->n_val); |
| 1220 | strcpy((char *)agg_port_id_list,(const char *)sub_ind->data.agg_port_id_list.val); |
| 1221 | balIndCfg.terminal_ind->data->agg_port_id_list->val = agg_port_id_list; |
| 1222 | #endif |
| 1223 | |
| 1224 | BalErr *output; |
| 1225 | result = bal_ind__bal_subs_term_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1226 | } |
| 1227 | |
| 1228 | return result; |
| 1229 | } |
| 1230 | |
| 1231 | /********************************************************************\ |
| 1232 | * Function : fill_bal_tm_red * |
| 1233 | * Description : This function will fill grpc-BalTmred struture * |
| 1234 | * from bal-bcmbal_tm_red structure * |
| 1235 | * * |
| 1236 | ********************************************************************/ |
| 1237 | void fill_bal_tm_red(BalTmred *grpc_red, bcmbal_tm_red *bal_red) |
| 1238 | { |
| 1239 | grpc_red->has_min_threshold = BAL_GRPC_PRES; |
| 1240 | grpc_red->min_threshold = bal_red->min_threshold; |
| 1241 | grpc_red->has_max_threshold = BAL_GRPC_PRES; |
| 1242 | grpc_red->max_threshold = bal_red->max_threshold; |
| 1243 | grpc_red->has_max_probability = BAL_GRPC_PRES; |
| 1244 | grpc_red->max_probability = bal_red->max_probability; |
| 1245 | return; |
| 1246 | } |
| 1247 | |
| 1248 | /********************************************************************\ |
| 1249 | * Function : bal_tm_queue_indication_cb * |
| 1250 | * Description : This function will handle the indications for * |
| 1251 | * TM Queue indication * |
| 1252 | * * |
| 1253 | ********************************************************************/ |
| 1254 | bcmos_errno bal_tm_queue_indication_cb(bcmbal_obj *obj) |
| 1255 | { |
| 1256 | bcmos_errno result = BCM_ERR_OK; |
| 1257 | |
| 1258 | if(BCMBAL_OBJ_ID_TM_QUEUE != obj->obj_type || |
| 1259 | bcmbal_tm_queue_auto_id_ind != obj->subgroup) |
| 1260 | { |
| 1261 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1262 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1263 | result = BCM_ERR_INTERNAL; |
| 1264 | } |
| 1265 | else |
| 1266 | { |
| 1267 | BalIndications balIndCfg; |
| 1268 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1269 | bal_indications__init(&balIndCfg); |
| 1270 | balIndCfg.u_case = BAL_INDICATIONS__U_TM_QUEUE__IND; |
| 1271 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1272 | balIndCfg.objtype = obj->obj_type; |
| 1273 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1274 | balIndCfg.sub_group = obj->subgroup; |
| 1275 | balIndCfg.device_id = voltha_device_id; |
| 1276 | |
| 1277 | bcmbal_tm_queue_ind *tm_que_ind = (bcmbal_tm_queue_ind *)obj; |
| 1278 | |
| 1279 | BalTmQueueInd tmQueInd; |
| 1280 | memset(&tmQueInd, 0, sizeof(BalTmQueueInd)); |
| 1281 | bal_tm_queue_ind__init(&tmQueInd); |
| 1282 | balIndCfg.tm_queue_ind = &tmQueInd; |
| 1283 | |
| 1284 | BalTmQueueKey tmQkey; |
| 1285 | memset(&tmQkey, 0, sizeof(BalTmQueueKey)); |
| 1286 | bal_tm_queue_key__init(&tmQkey); |
| 1287 | balIndCfg.tm_queue_ind->key = &tmQkey; |
| 1288 | |
| 1289 | balIndCfg.tm_queue_ind->key->has_sched_id = BAL_GRPC_PRES; |
| 1290 | balIndCfg.tm_queue_ind->key->sched_id = tm_que_ind->key.sched_id; |
| 1291 | balIndCfg.tm_queue_ind->key->has_sched_dir = BAL_GRPC_PRES; |
| 1292 | balIndCfg.tm_queue_ind->key->sched_dir = tm_que_ind->key.sched_dir; |
| 1293 | balIndCfg.tm_queue_ind->key->has_id = BAL_GRPC_PRES; |
| 1294 | balIndCfg.tm_queue_ind->key->id = tm_que_ind->key.id; |
| 1295 | |
| 1296 | BalTmQueueIndData tmQIndData; |
| 1297 | memset(&tmQIndData, 0, sizeof(BalTmQueueIndData)); |
| 1298 | bal_tm_queue_ind_data__init(&tmQIndData); |
| 1299 | balIndCfg.tm_queue_ind->data = &tmQIndData; |
| 1300 | |
| 1301 | balIndCfg.tm_queue_ind->data->has_priority = BAL_GRPC_PRES; |
| 1302 | balIndCfg.tm_queue_ind->data->priority = tm_que_ind->data.priority; |
| 1303 | balIndCfg.tm_queue_ind->data->has_weight = BAL_GRPC_PRES; |
| 1304 | balIndCfg.tm_queue_ind->data->weight = tm_que_ind->data.weight; |
| 1305 | balIndCfg.tm_queue_ind->data->has_create_mode = BAL_GRPC_PRES; |
| 1306 | balIndCfg.tm_queue_ind->data->create_mode = tm_que_ind->data.create_mode; |
| 1307 | balIndCfg.tm_queue_ind->data->has_ref_count = BAL_GRPC_PRES; |
| 1308 | balIndCfg.tm_queue_ind->data->ref_count = tm_que_ind->data.ref_count; |
| 1309 | |
| 1310 | BalTmShaping balShape; |
| 1311 | memset(&balShape, 0, sizeof(BalTmShaping)); |
| 1312 | bal_tm_shaping__init(&balShape); |
| 1313 | balIndCfg.tm_queue_ind->data->rate = &balShape; |
| 1314 | |
| 1315 | balIndCfg.tm_queue_ind->data->rate->has_presence_mask = BAL_GRPC_PRES; |
| 1316 | balIndCfg.tm_queue_ind->data->rate->presence_mask = tm_que_ind->data.rate.presence_mask; |
| 1317 | balIndCfg.tm_queue_ind->data->rate->has_cir = BAL_GRPC_PRES; |
| 1318 | balIndCfg.tm_queue_ind->data->rate->cir = tm_que_ind->data.rate.cir; |
| 1319 | balIndCfg.tm_queue_ind->data->rate->has_pir = BAL_GRPC_PRES; |
| 1320 | balIndCfg.tm_queue_ind->data->rate->pir = tm_que_ind->data.rate.pir; |
| 1321 | balIndCfg.tm_queue_ind->data->rate->has_burst = BAL_GRPC_PRES; |
| 1322 | balIndCfg.tm_queue_ind->data->rate->burst = tm_que_ind->data.rate.burst; |
| 1323 | |
| 1324 | BalTmBac balBac; |
| 1325 | memset(&balBac, 0, sizeof(BalTmBac)); |
| 1326 | bal_tm_bac__init(&balBac); |
| 1327 | balIndCfg.tm_queue_ind->data->bac = &balBac; |
| 1328 | |
| 1329 | balIndCfg.tm_queue_ind->data->bac->has_type = BAL_GRPC_PRES; |
| 1330 | balIndCfg.tm_queue_ind->data->bac->type = tm_que_ind->data.bac.type; |
| 1331 | switch(tm_que_ind->data.bac.type) |
| 1332 | { |
| 1333 | case BCMBAL_TM_BAC_TYPE_TAILDROP: |
| 1334 | { |
| 1335 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_TAILDROP; |
| 1336 | BalTMBacTaildrop balTaildrop; |
| 1337 | memset(&balTaildrop, 0, sizeof(BalTMBacTaildrop)); |
| 1338 | bal_tmbac_taildrop__init(&balTaildrop); |
| 1339 | balIndCfg.tm_queue_ind->data->bac->taildrop = &balTaildrop; |
| 1340 | |
| 1341 | balIndCfg.tm_queue_ind->data->bac->taildrop->has_max_size = BAL_GRPC_PRES; |
| 1342 | balIndCfg.tm_queue_ind->data->bac->taildrop->max_size = |
| 1343 | tm_que_ind->data.bac.u.taildrop.max_size; |
| 1344 | } |
| 1345 | break; |
| 1346 | case BCMBAL_TM_BAC_TYPE_WTAILDROP: |
| 1347 | { |
| 1348 | /* No bal/grpc structure was defined */ |
| 1349 | } |
| 1350 | break; |
| 1351 | case BCMBAL_TM_BAC_TYPE_RED: |
| 1352 | { |
| 1353 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_RED; |
| 1354 | BalTMBacRed balBacRed; |
| 1355 | memset(&balBacRed, 0, sizeof(BalTMBacRed)); |
| 1356 | bal_tmbac_red__init(&balBacRed); |
| 1357 | balIndCfg.tm_queue_ind->data->bac->red = &balBacRed; |
| 1358 | |
| 1359 | BalTmred balRed; |
| 1360 | memset(&balRed, 0, sizeof(BalTmred)); |
| 1361 | bal_tmred__init(&balRed); |
| 1362 | balIndCfg.tm_queue_ind->data->bac->red->red = &balRed; |
| 1363 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->red->red, &tm_que_ind->data.bac.u.red.red); |
| 1364 | } |
| 1365 | break; |
| 1366 | case BCMBAL_TM_BAC_TYPE_WRED: |
| 1367 | { |
| 1368 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_WRED; |
| 1369 | BalTMBacWred balBacWred; |
| 1370 | memset(&balBacWred, 0, sizeof(BalTMBacWred)); |
| 1371 | bal_tmbac_wred__init(&balBacWred); |
| 1372 | balIndCfg.tm_queue_ind->data->bac->wred = &balBacWred; |
| 1373 | |
| 1374 | BalTmred balGreen; |
| 1375 | memset(&balGreen, 0, sizeof(BalTmred)); |
| 1376 | bal_tmred__init(&balGreen); |
| 1377 | balIndCfg.tm_queue_ind->data->bac->wred->green = &balGreen; |
| 1378 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->green, &tm_que_ind->data.bac.u.wred.green); |
| 1379 | |
| 1380 | BalTmred balYellow; |
| 1381 | memset(&balYellow, 0, sizeof(BalTmred)); |
| 1382 | bal_tmred__init(&balYellow); |
| 1383 | balIndCfg.tm_queue_ind->data->bac->wred->yellow = &balYellow; |
| 1384 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->yellow, &tm_que_ind->data.bac.u.wred.yellow); |
| 1385 | |
| 1386 | BalTmred balRed; |
| 1387 | memset(&balRed, 0, sizeof(BalTmred)); |
| 1388 | bal_tmred__init(&balRed); |
| 1389 | balIndCfg.tm_queue_ind->data->bac->wred->red = &balRed; |
| 1390 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->red, &tm_que_ind->data.bac.u.wred.red); |
| 1391 | } |
| 1392 | break; |
| 1393 | default: |
| 1394 | { |
| 1395 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U__NOT_SET; |
| 1396 | } |
| 1397 | break; |
| 1398 | |
| 1399 | } |
| 1400 | |
| 1401 | BalErr *output; |
| 1402 | result = bal_ind__bal_tm_queue_ind_info(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1403 | } |
| 1404 | |
| 1405 | return result; |
| 1406 | } |
| 1407 | |
| 1408 | /********************************************************************\ |
| 1409 | * Function : bal_tm_sched_indication_cb * |
| 1410 | * Description : This function will handle the indications for * |
| 1411 | * TM Sched indication * |
| 1412 | * * |
| 1413 | ********************************************************************/ |
| 1414 | bcmos_errno bal_tm_sched_indication_cb(bcmbal_obj *obj) |
| 1415 | { |
| 1416 | bcmos_errno result = BCM_ERR_OK; |
| 1417 | |
| 1418 | if(BCMBAL_OBJ_ID_TM_SCHED != obj->obj_type || |
| 1419 | bcmbal_tm_sched_auto_id_ind != obj->subgroup) |
| 1420 | { |
| 1421 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1422 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1423 | result = BCM_ERR_INTERNAL; |
| 1424 | } |
| 1425 | else |
| 1426 | { |
| 1427 | BalIndications balIndCfg; |
| 1428 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1429 | bal_indications__init(&balIndCfg); |
| 1430 | balIndCfg.u_case = BAL_INDICATIONS__U_TM_SCHED__IND; |
| 1431 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1432 | balIndCfg.objtype = obj->obj_type; |
| 1433 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1434 | balIndCfg.sub_group = obj->subgroup; |
| 1435 | balIndCfg.device_id = voltha_device_id; |
| 1436 | |
| 1437 | bcmbal_tm_sched_ind *tm_sched_ind = (bcmbal_tm_sched_ind *)obj; |
| 1438 | |
| 1439 | BalTmSchedInd tmSchedInd; |
| 1440 | memset(&tmSchedInd, 0, sizeof(BalTmSchedInd)); |
| 1441 | bal_tm_sched_ind__init(&tmSchedInd); |
| 1442 | balIndCfg.tm_sched_ind = &tmSchedInd; |
| 1443 | |
| 1444 | BalTmSchedKey tmSchedkey; |
| 1445 | memset(&tmSchedkey, 0, sizeof(BalTmSchedKey)); |
| 1446 | bal_tm_sched_key__init(&tmSchedkey); |
| 1447 | balIndCfg.tm_sched_ind->key = &tmSchedkey; |
| 1448 | |
| 1449 | balIndCfg.tm_sched_ind->key->has_dir = BAL_GRPC_PRES; |
| 1450 | balIndCfg.tm_sched_ind->key->dir = tm_sched_ind->key.dir; |
| 1451 | balIndCfg.tm_sched_ind->key->has_id = BAL_GRPC_PRES; |
| 1452 | balIndCfg.tm_sched_ind->key->id = tm_sched_ind->key.id; |
| 1453 | |
| 1454 | BalTmSchedIndData tmSIndData; |
| 1455 | memset(&tmSIndData, 0, sizeof(BalTmSchedIndData)); |
| 1456 | bal_tm_sched_ind_data__init(&tmSIndData); |
| 1457 | balIndCfg.tm_sched_ind->data = &tmSIndData; |
| 1458 | /* TODO: data should be populate */ |
| 1459 | |
| 1460 | BalErr *output; |
| 1461 | result = bal_ind__bal_tm_sched_ind_info(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1462 | } |
| 1463 | |
| 1464 | return result; |
| 1465 | } |
| 1466 | |
| 1467 | /********************************************************************\ |
| 1468 | * Function : bal_packet_data_indication_cb * |
| 1469 | * Description : This function will handle the indications for * |
| 1470 | * Packet Data indication * |
| 1471 | * * |
| 1472 | ********************************************************************/ |
| 1473 | bcmos_errno bal_packet_data_indication_cb(bcmbal_obj *obj) |
| 1474 | { |
| 1475 | bcmos_errno result = BCM_ERR_OK; |
| 1476 | |
| 1477 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
| 1478 | bcmbal_packet_auto_id_bearer_channel_rx != obj->subgroup) |
| 1479 | { |
| 1480 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1481 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1482 | result = BCM_ERR_INTERNAL; |
| 1483 | } |
| 1484 | else |
| 1485 | { |
| 1486 | /*bcmos_mutex_lock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1487 | |
| 1488 | BalIndications balIndCfg; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 1489 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1490 | bal_indications__init(&balIndCfg); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1491 | balIndCfg.u_case = BAL_INDICATIONS__U_PKT_DATA; |
| 1492 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1493 | balIndCfg.objtype = obj->obj_type; |
| 1494 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1495 | balIndCfg.sub_group = obj->subgroup; |
| 1496 | balIndCfg.device_id = voltha_device_id; |
| 1497 | |
| 1498 | BalPacketBearerChannelRx rxChannel; |
| 1499 | memset(&rxChannel, 0, sizeof(BalPacketBearerChannelRx)); |
| 1500 | bal_packet_bearer_channel_rx__init(&rxChannel); |
| 1501 | balIndCfg.pktdata = &rxChannel; |
| 1502 | |
| 1503 | BalPacketKey packetkey; |
| 1504 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1505 | bal_packet_key__init(&packetkey); |
| 1506 | balIndCfg.pktdata->key = &packetkey; |
| 1507 | |
| 1508 | bcmbal_packet_bearer_channel_rx *rx_channel = |
| 1509 | (bcmbal_packet_bearer_channel_rx *)obj; |
| 1510 | |
| 1511 | balIndCfg.pktdata->key->has_reserved = BAL_GRPC_PRES; |
| 1512 | balIndCfg.pktdata->key->reserved = rx_channel->key.reserved; |
| 1513 | |
| 1514 | BalDest PktSndDest; |
| 1515 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1516 | bal_dest__init(&PktSndDest); |
| 1517 | balIndCfg.pktdata->key->packet_send_dest = &PktSndDest; |
| 1518 | |
| 1519 | balIndCfg.pktdata->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1520 | balIndCfg.pktdata->key->packet_send_dest->type = |
| 1521 | rx_channel->key.packet_send_dest.type; |
| 1522 | switch( rx_channel->key.packet_send_dest.type) |
| 1523 | { |
| 1524 | case BCMBAL_DEST_TYPE_NNI: |
| 1525 | { |
| 1526 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_NNI; |
| 1527 | BalDestNni balNni; |
| 1528 | memset(&balNni, 0, sizeof(BalDestNni)); |
| 1529 | bal_dest_nni__init(&balNni); |
| 1530 | balIndCfg.pktdata->key->packet_send_dest->nni = &balNni; |
| 1531 | balIndCfg.pktdata->key->packet_send_dest->nni->has_intf_id = BAL_GRPC_PRES; |
| 1532 | balIndCfg.pktdata->key->packet_send_dest->nni->intf_id = |
| 1533 | rx_channel->key.packet_send_dest.u.nni.intf_id; |
| 1534 | } |
| 1535 | break; |
| 1536 | case BCMBAL_DEST_TYPE_SUB_TERM: |
| 1537 | { |
| 1538 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SUB_TERM; |
| 1539 | BalDestSubTerm balSubTerm; |
| 1540 | memset(&balSubTerm, 0, sizeof(BalDestSubTerm)); |
| 1541 | bal_dest_sub_term__init(&balSubTerm); |
| 1542 | balIndCfg.pktdata->key->packet_send_dest->sub_term = &balSubTerm; |
| 1543 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_id = |
| 1544 | BAL_GRPC_PRES; |
| 1545 | balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_id = |
| 1546 | rx_channel->key.packet_send_dest.u.sub_term.sub_term_id; |
| 1547 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_uni = |
| 1548 | BAL_GRPC_PRES; |
| 1549 | balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_uni = |
| 1550 | rx_channel->key.packet_send_dest.u.sub_term.sub_term_uni; |
| 1551 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_intf_id = |
| 1552 | BAL_GRPC_PRES; |
| 1553 | balIndCfg.pktdata->key->packet_send_dest->sub_term->intf_id = |
| 1554 | rx_channel->key.packet_send_dest.u.sub_term.intf_id; |
| 1555 | } |
| 1556 | break; |
| 1557 | case BCMBAL_DEST_TYPE_SVC_PORT: |
| 1558 | { |
| 1559 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SVC_PORT; |
| 1560 | BalDestSvcPort balSvcPort; |
| 1561 | memset(&balSvcPort, 0, sizeof(BalDestSvcPort)); |
| 1562 | bal_dest_svc_port__init(&balSvcPort); |
| 1563 | balIndCfg.pktdata->key->packet_send_dest->svc_port = &balSvcPort; |
| 1564 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_svc_port_id = |
| 1565 | BAL_GRPC_PRES; |
| 1566 | balIndCfg.pktdata->key->packet_send_dest->svc_port->svc_port_id = |
| 1567 | rx_channel->key.packet_send_dest.u.svc_port.svc_port_id; |
| 1568 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id = |
| 1569 | BAL_GRPC_PRES; |
| 1570 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id = |
| 1571 | rx_channel->key.packet_send_dest.u.svc_port.intf_id; |
| 1572 | } |
| 1573 | break; |
| 1574 | default: |
| 1575 | { |
| 1576 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1577 | } |
| 1578 | break; |
| 1579 | } |
| 1580 | |
| 1581 | BalPacketBearerChannelRxData pkdData; |
| 1582 | memset(&pkdData, 0, sizeof(BalPacketBearerChannelRxData)); |
| 1583 | bal_packet_bearer_channel_rx_data__init(&pkdData); |
| 1584 | balIndCfg.pktdata->data = &pkdData; |
| 1585 | |
| 1586 | balIndCfg.pktdata->data->has_flow_id = BAL_GRPC_PRES; |
| 1587 | balIndCfg.pktdata->data->flow_id = rx_channel->data.flow_id; |
| 1588 | balIndCfg.pktdata->data->has_flow_type = BAL_GRPC_PRES; |
| 1589 | balIndCfg.pktdata->data->flow_type = rx_channel->data.flow_type; |
| 1590 | balIndCfg.pktdata->data->has_intf_id = BAL_GRPC_PRES; |
| 1591 | balIndCfg.pktdata->data->intf_id = rx_channel->data.intf_id; |
| 1592 | balIndCfg.pktdata->data->has_intf_type = BAL_GRPC_PRES; |
| 1593 | balIndCfg.pktdata->data->intf_type = rx_channel->data.intf_type; |
| 1594 | balIndCfg.pktdata->data->has_svc_port = BAL_GRPC_PRES; |
| 1595 | balIndCfg.pktdata->data->svc_port = rx_channel->data.svc_port; |
| 1596 | balIndCfg.pktdata->data->has_flow_cookie = BAL_GRPC_PRES; |
| 1597 | balIndCfg.pktdata->data->flow_cookie = rx_channel->data.flow_cookie; |
| 1598 | balIndCfg.pktdata->data->has_pkt = BAL_GRPC_PRES; |
| 1599 | balIndCfg.pktdata->data->pkt.len = rx_channel->data.pkt.len; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 1600 | balIndCfg.pktdata->data->pkt.data = (uint8_t *)malloc((balIndCfg.pktdata->data->pkt.len)*sizeof(uint8_t)); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1601 | memcpy(balIndCfg.pktdata->data->pkt.data, rx_channel->data.pkt.val, balIndCfg.pktdata->data->pkt.len); |
| 1602 | |
| 1603 | /*bcmos_mutex_unlock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1604 | |
| 1605 | BalErr *output; |
| 1606 | result = bal_ind__bal_pkt_bearer_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1607 | } |
| 1608 | |
| 1609 | return result; |
| 1610 | } |
| 1611 | |
| 1612 | /********************************************************************\ |
| 1613 | * Function : bal_omci_data_indication_cb * |
| 1614 | * Description : This function will handle the indications for * |
| 1615 | * OMCI Data Response * |
| 1616 | * * |
| 1617 | ********************************************************************/ |
| 1618 | bcmos_errno bal_omci_data_indication_cb(bcmbal_obj *obj) |
| 1619 | { |
| 1620 | bcmos_errno result = BCM_ERR_OK; |
| 1621 | |
| 1622 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
| 1623 | bcmbal_packet_auto_id_itu_omci_channel_rx != obj->subgroup) |
| 1624 | { |
| 1625 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1626 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1627 | result = BCM_ERR_INTERNAL; |
| 1628 | } |
| 1629 | else |
| 1630 | { |
| 1631 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Received OMCI response via BAL APIs\n"); |
| 1632 | BalIndications balIndCfg; |
| 1633 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1634 | bal_indications__init(&balIndCfg); |
| 1635 | balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OMCI_RESP; |
| 1636 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1637 | balIndCfg.objtype = obj->obj_type; |
| 1638 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1639 | balIndCfg.sub_group = obj->subgroup; |
| 1640 | balIndCfg.device_id = voltha_device_id; |
| 1641 | |
| 1642 | BalPacketItuOmciChannelRx omciChannel; |
| 1643 | memset(&omciChannel, 0, sizeof(BalPacketItuOmciChannelRx)); |
| 1644 | bal_packet_itu_omci_channel_rx__init(&omciChannel); |
| 1645 | balIndCfg.balomciresp = &omciChannel; |
| 1646 | |
| 1647 | BalPacketKey packetkey; |
| 1648 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1649 | bal_packet_key__init(&packetkey); |
| 1650 | balIndCfg.balomciresp->key = &packetkey; |
| 1651 | |
| 1652 | BalPacketItuOmciChannelRxData omciData; |
| 1653 | memset(&omciData, 0, sizeof(BalPacketItuOmciChannelRxData)); |
| 1654 | bal_packet_itu_omci_channel_rx_data__init(&omciData); |
| 1655 | balIndCfg.balomciresp->data = &omciData; |
| 1656 | |
| 1657 | bcmbal_packet_itu_omci_channel_rx *omci_channel = |
| 1658 | (bcmbal_packet_itu_omci_channel_rx *)obj; |
| 1659 | |
| 1660 | balIndCfg.balomciresp->data->has_pkt = BAL_GRPC_PRES; |
| 1661 | balIndCfg.balomciresp->data->pkt.len = omci_channel->data.pkt.len; |
| 1662 | balIndCfg.balomciresp->data->pkt.data = (uint8_t *)malloc((omci_channel->data.pkt.len)*sizeof(uint8_t)); |
| 1663 | memcpy(balIndCfg.balomciresp->data->pkt.data, omci_channel->data.pkt.val, |
| 1664 | balIndCfg.balomciresp->data->pkt.len); |
| 1665 | |
| 1666 | balIndCfg.balomciresp->key->has_reserved = BAL_GRPC_PRES; |
| 1667 | balIndCfg.balomciresp->key->reserved = omci_channel->key.reserved; |
| 1668 | |
| 1669 | BalDest PktSndDest; |
| 1670 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1671 | bal_dest__init(&PktSndDest); |
| 1672 | balIndCfg.balomciresp->key->packet_send_dest = &PktSndDest; |
| 1673 | |
| 1674 | balIndCfg.balomciresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1675 | balIndCfg.balomciresp->key->packet_send_dest->type = |
| 1676 | omci_channel->key.packet_send_dest.type; |
| 1677 | switch( omci_channel->key.packet_send_dest.type) |
| 1678 | { |
| 1679 | case BCMBAL_DEST_TYPE_ITU_OMCI_CHANNEL: |
| 1680 | { |
| 1681 | balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U_ITU_OMCI_CHANNEL; |
| 1682 | BalItuOmciChannel balOmci; |
| 1683 | memset(&balOmci, 0, sizeof(BalItuOmciChannel)); |
| 1684 | bal_itu_omci_channel__init(&balOmci); |
| 1685 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel = &balOmci; |
| 1686 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->has_sub_term_id = |
| 1687 | BAL_GRPC_PRES; |
| 1688 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id = |
| 1689 | omci_channel->key.packet_send_dest.u.itu_omci_channel.sub_term_id; |
| 1690 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->has_intf_id = |
| 1691 | BAL_GRPC_PRES; |
| 1692 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->intf_id = |
| 1693 | omci_channel->key.packet_send_dest.u.itu_omci_channel.intf_id; |
| 1694 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n", |
| 1695 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
| 1696 | } |
| 1697 | break; |
| 1698 | default: |
| 1699 | { |
| 1700 | balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1701 | } |
| 1702 | break; |
| 1703 | } |
| 1704 | |
| 1705 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is \n",balIndCfg.balomciresp->data->pkt.len); |
| 1706 | uint16_t idx; |
| 1707 | for(idx=0; idx<balIndCfg.balomciresp->data->pkt.len; idx++) |
| 1708 | { |
| 1709 | printf("%02x", balIndCfg.balomciresp->data->pkt.data[idx]); |
| 1710 | } |
| 1711 | printf("\n"); |
| 1712 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n", |
| 1713 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
| 1714 | BalErr *output; |
| 1715 | result = bal_ind__bal_pkt_omci_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1716 | } |
| 1717 | |
| 1718 | return result; |
| 1719 | } |
| 1720 | |
| 1721 | /********************************************************************\ |
| 1722 | * Function : bal_oam_data_indication_cb * |
| 1723 | * Description : This function will handle the indications for * |
| 1724 | * OAM Data Response * |
| 1725 | * * |
| 1726 | ********************************************************************/ |
| 1727 | bcmos_errno bal_oam_data_indication_cb(bcmbal_obj *obj) |
| 1728 | { |
| 1729 | bcmos_errno result = BCM_ERR_OK; |
| 1730 | |
| 1731 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
| 1732 | bcmbal_packet_auto_id_ieee_oam_channel_rx != obj->subgroup) |
| 1733 | { |
| 1734 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1735 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1736 | result = BCM_ERR_INTERNAL; |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | BalIndications balIndCfg; |
| 1741 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1742 | bal_indications__init(&balIndCfg); |
| 1743 | balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OAM_RESP; |
| 1744 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1745 | balIndCfg.objtype = obj->obj_type; |
| 1746 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1747 | balIndCfg.sub_group = obj->subgroup; |
| 1748 | balIndCfg.device_id = voltha_device_id; |
| 1749 | |
| 1750 | BalPacketIeeeOamChannelRx oamChannel; |
| 1751 | memset(&oamChannel, 0, sizeof(BalPacketIeeeOamChannelRx)); |
| 1752 | bal_packet_ieee_oam_channel_rx__init(&oamChannel); |
| 1753 | balIndCfg.baloamresp = &oamChannel; |
| 1754 | |
| 1755 | BalPacketKey packetkey; |
| 1756 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1757 | bal_packet_key__init(&packetkey); |
| 1758 | balIndCfg.baloamresp->key = &packetkey; |
| 1759 | |
| 1760 | bcmbal_packet_ieee_oam_channel_rx *oam_channel = |
| 1761 | (bcmbal_packet_ieee_oam_channel_rx *)obj; |
| 1762 | |
| 1763 | balIndCfg.baloamresp->key->has_reserved = BAL_GRPC_PRES; |
| 1764 | balIndCfg.baloamresp->key->reserved = oam_channel->key.reserved; |
| 1765 | |
| 1766 | BalDest PktSndDest; |
| 1767 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1768 | bal_dest__init(&PktSndDest); |
| 1769 | balIndCfg.baloamresp->key->packet_send_dest = &PktSndDest; |
| 1770 | |
| 1771 | balIndCfg.baloamresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1772 | balIndCfg.baloamresp->key->packet_send_dest->type = |
| 1773 | oam_channel->key.packet_send_dest.type; |
| 1774 | switch( oam_channel->key.packet_send_dest.type) |
| 1775 | { |
| 1776 | case BCMBAL_DEST_TYPE_IEEE_OAM_CHANNEL: |
| 1777 | { |
| 1778 | balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U_IEEE_OAM_CHANNEL; |
| 1779 | BalIeeeOamChannel balOam; |
| 1780 | memset(&balOam, 0, sizeof(BalIeeeOamChannel)); |
| 1781 | bal_ieee_oam_channel__init(&balOam); |
| 1782 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel = &balOam; |
| 1783 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_intf_id = |
| 1784 | BAL_GRPC_PRES; |
| 1785 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->intf_id = |
| 1786 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.intf_id; |
| 1787 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_mac_address = BAL_GRPC_PRES; |
| 1788 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len = |
| 1789 | (BCMOS_ETH_ALEN)*sizeof(oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8); |
| 1790 | memcpy(balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data, |
| 1791 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8, |
| 1792 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len); |
| 1793 | |
| 1794 | } |
| 1795 | break; |
| 1796 | default: |
| 1797 | { |
| 1798 | balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1799 | } |
| 1800 | break; |
| 1801 | } |
| 1802 | |
| 1803 | BalPacketIeeeOamChannelRxData oamData; |
| 1804 | memset(&oamData, 0, sizeof(BalPacketIeeeOamChannelRxData)); |
| 1805 | bal_packet_ieee_oam_channel_rx_data__init(&oamData); |
| 1806 | balIndCfg.baloamresp->data = &oamData; |
| 1807 | |
| 1808 | balIndCfg.baloamresp->data->pkt.len = oam_channel->data.pkt.len; |
| 1809 | memcpy(balIndCfg.baloamresp->data->pkt.data, oam_channel->data.pkt.val, |
| 1810 | balIndCfg.baloamresp->data->pkt.len); |
| 1811 | |
| 1812 | BalErr *output; |
| 1813 | result = bal_ind__bal_pkt_ieee_oam_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1814 | |
| 1815 | } |
| 1816 | |
| 1817 | return result; |
| 1818 | } |