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 | */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 16 | #include <signal.h> |
| 17 | #include <stdio.h> |
root | 85905d1 | 2018-03-21 16:18:51 +0530 | [diff] [blame^] | 18 | #include <string.h> |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 19 | #include <unistd.h> |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 20 | #include <string.h> |
| 21 | #include <stdlib.h> |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 22 | #include <sys/time.h> |
| 23 | #include "bal_msg_type.grpc-c.h" |
| 24 | #include "bal_osmsg.grpc-c.h" |
| 25 | #include "bal_model_ids.grpc-c.h" |
| 26 | #include "bal_obj.grpc-c.h" |
| 27 | #include "bal_model_types.grpc-c.h" |
| 28 | #include "bal_errno.grpc-c.h" |
| 29 | #include "bal.grpc-c.h" |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 30 | #include "asfvolt.grpc-c.h" |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 31 | |
| 32 | #ifdef BAL_STUB |
| 33 | #include "bal_stub.h" |
| 34 | #else |
| 35 | #include "asfvolt16_driver.h" |
| 36 | #endif |
| 37 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 38 | #include <sys/reboot.h> |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 39 | #include "bal_indications_queue.h" |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 40 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 41 | /* Global varibles */ |
| 42 | balCoreIpInfo coreIpPortInfo; |
| 43 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 44 | /* extern variables*/ |
| 45 | list_node *bal_ind_queue_tail = NULL; |
| 46 | list_node *bal_ind_queue_head = NULL; |
| 47 | pthread_mutex_t bal_ind_queue_lock; |
| 48 | unsigned int num_of_nodes = 0; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 49 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 50 | /* static variables*/ |
| 51 | static grpc_c_server_t *test_server; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 52 | static void sigint_handler (int x) { |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 53 | grpc_c_server_destroy(test_server); |
| 54 | exit(0); |
| 55 | } |
| 56 | |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 57 | /*MACRO Definitions*/ |
root | 85905d1 | 2018-03-21 16:18:51 +0530 | [diff] [blame^] | 58 | #define ASFVOLT_FIELD_LEN 200 |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 59 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 60 | void is_grpc_write_pending(int return_value) |
| 61 | { |
| 62 | if (return_value != GRPC_C_WRITE_OK) |
| 63 | { |
| 64 | if(return_value == GRPC_C_WRITE_PENDING) |
| 65 | { |
| 66 | /* TODO: Register call back with grpc-c which will give an indication whenever write was succussful */ |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 67 | ASFVOLT_LOG(ASFVOLT_INFO, "write(%d) is pending, sleep for 5 sec", return_value); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 68 | sleep(5); |
| 69 | } |
| 70 | else |
| 71 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 72 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write %d", return_value); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 73 | } |
| 74 | } |
| 75 | |
| 76 | } |
| 77 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 78 | /* |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 79 | * This functions gets invoked whenever bal Heartbeat RPC gets called |
| 80 | */ |
| 81 | void bal__bal_api_heartbeat_cb(grpc_c_context_t *context) |
| 82 | { |
| 83 | BalHeartbeat *bal_hb; |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 84 | BalRebootState bal_reboot; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 85 | int ret_val; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 86 | /* |
| 87 | * Read incoming message into set_cfg |
| 88 | */ |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 89 | if (context->gcc_payload) { |
| 90 | context->gcc_stream->read(context, (void **)&bal_hb, 0); |
| 91 | } |
| 92 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 93 | bal_reboot_state__init(&bal_reboot); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 94 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 95 | bal_reboot.has_is_reboot = 1; |
| 96 | #ifndef BAL_STUB |
| 97 | bal_reboot.is_reboot = is_reboot; |
| 98 | #else |
| 99 | bal_reboot.is_reboot = is_stub_reboot; |
| 100 | #endif |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 101 | |
| 102 | /* |
| 103 | * Write reply back to the client |
| 104 | */ |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 105 | ret_val = context->gcc_stream->write(context, &bal_reboot, -1); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 106 | is_grpc_write_pending(ret_val); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 107 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 108 | grpc_c_status_t status; |
| 109 | status.gcs_code = 0; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 110 | |
| 111 | /* |
| 112 | * Finish response for RPC |
| 113 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 114 | if (context->gcc_stream->finish(context, &status)) |
| 115 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 116 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 117 | } |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | /* |
| 121 | * This functions gets invoked whenever Bal reboot gets called |
| 122 | */ |
| 123 | void bal__bal_api_reboot_cb(grpc_c_context_t *context) |
| 124 | { |
| 125 | BalReboot *read_device; |
| 126 | BalErr bal_err; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 127 | int ret_val; |
| 128 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 129 | /* |
| 130 | * Read incoming message into get_cfg |
| 131 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 132 | if (context->gcc_payload) |
| 133 | { |
| 134 | context->gcc_stream->read(context, (void **)&read_device, 0); |
| 135 | } |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 136 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 137 | ASFVOLT_LOG(ASFVOLT_INFO, "Bal Server - Reboot : Device ID is %s",read_device->device_id); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 138 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 139 | /* |
| 140 | * send it to BAL |
| 141 | */ |
| 142 | |
| 143 | bal_err__init(&bal_err); |
| 144 | |
| 145 | bal_err.err= 0; |
| 146 | |
| 147 | /* |
| 148 | * Write reply back to the client |
| 149 | */ |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 150 | ret_val = context->gcc_stream->write(context, &bal_err, -1); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 151 | is_grpc_write_pending(ret_val); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 152 | |
| 153 | grpc_c_status_t status; |
| 154 | status.gcs_code = 0; |
| 155 | |
| 156 | /* |
| 157 | * Finish response for RPC |
| 158 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 159 | if (context->gcc_stream->finish(context, &status)) |
| 160 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 161 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 162 | } |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 163 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 164 | ret_val = system("shutdown -r now"); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 165 | sleep(30); /* allow system to shutdown gracefully */ |
| 166 | sync(); /* force shutdown if graceful did not work */ |
| 167 | reboot(RB_AUTOBOOT); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /* |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 171 | This function reads the specified field from the 'onldump -o' command. |
| 172 | If the field was successfully read, it returns the field value. |
| 173 | If it failed to read the field, then null charecter is returned |
| 174 | */ |
| 175 | char* asfvolt_read_sysinfo(char* field_name, char* field_val) |
| 176 | { |
| 177 | FILE *fp; |
| 178 | /* Prepare the command*/ |
| 179 | char command[150]; |
| 180 | |
| 181 | snprintf(command, sizeof command, "onlpdump -o | perl -ne 'print $1 if /%s: (\\S+)/'", field_name); |
| 182 | /* Open the command for reading. */ |
| 183 | fp = popen(command, "r"); |
| 184 | if (fp == NULL) { |
| 185 | /*The client has to check for a Null mac address in this case*/ |
| 186 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to query the mac address"); |
| 187 | return field_val; |
| 188 | } |
| 189 | |
| 190 | /*Read the field value*/ |
| 191 | if (fp) { |
| 192 | fread(field_val, ASFVOLT_FIELD_LEN, 1, fp); |
| 193 | pclose(fp); |
| 194 | } |
| 195 | return field_val; |
| 196 | } |
| 197 | |
| 198 | /* |
| 199 | * This functions gets invoked whenever AsfvoltGetSystemInfo RPC gets called |
| 200 | */ |
| 201 | void asfvolt__asfvolt_get_system_info_cb(grpc_c_context_t *context) |
| 202 | { |
| 203 | BalDefault *dummy; |
| 204 | AsfSystemInfo asf_system_info; |
| 205 | char product_name[ASFVOLT_FIELD_LEN] = "\0"; |
| 206 | char part_num[ASFVOLT_FIELD_LEN] = "\0"; |
| 207 | char serial_num[ASFVOLT_FIELD_LEN] = "\0"; |
| 208 | char mac_address[ASFVOLT_FIELD_LEN] = "\0"; |
| 209 | char mac_range[ASFVOLT_FIELD_LEN] = "\0"; |
| 210 | char manufacturer[ASFVOLT_FIELD_LEN] = "\0"; |
| 211 | char manufacturer_date[ASFVOLT_FIELD_LEN] = "\0"; |
| 212 | char vendor[ASFVOLT_FIELD_LEN] = "\0"; |
| 213 | char platform_name[ASFVOLT_FIELD_LEN] = "\0"; |
| 214 | char label_revision[ASFVOLT_FIELD_LEN] = "\0"; |
| 215 | char coutry_code[ASFVOLT_FIELD_LEN] = "\0"; |
| 216 | char diag_version[ASFVOLT_FIELD_LEN] = "\0"; |
| 217 | char onie_version[ASFVOLT_FIELD_LEN] = "\0"; |
| 218 | int ret_val; |
| 219 | |
| 220 | if (context->gcc_payload) { |
| 221 | context->gcc_stream->read(context, (void **)&dummy, 0); |
| 222 | } |
| 223 | |
| 224 | asf_system_info__init(&asf_system_info); |
| 225 | |
| 226 | asf_system_info.product_name = asfvolt_read_sysinfo("Product Name", product_name); |
| 227 | asf_system_info.part_num = asfvolt_read_sysinfo("Part Number", part_num); |
| 228 | asf_system_info.serial_num = asfvolt_read_sysinfo("Serial Number", serial_num); |
| 229 | asf_system_info.mac_address = asfvolt_read_sysinfo("MAC", mac_address); |
| 230 | asf_system_info.mac_range = asfvolt_read_sysinfo("MAC Range", mac_range); |
| 231 | asf_system_info.manufacturer = asfvolt_read_sysinfo("Manufacturer", manufacturer); |
| 232 | asf_system_info.manufacture_date = asfvolt_read_sysinfo("Manufacture Date", manufacturer_date); |
| 233 | asf_system_info.vendor = asfvolt_read_sysinfo("Vendor", vendor); |
| 234 | asf_system_info.platform_name = asfvolt_read_sysinfo("Platform Name", platform_name); |
| 235 | asf_system_info.label_revision = asfvolt_read_sysinfo("Label Revision", label_revision); |
| 236 | asf_system_info.country_code = asfvolt_read_sysinfo("Country Code", coutry_code); |
| 237 | asf_system_info.diag_version = asfvolt_read_sysinfo("Diag Version", diag_version); |
| 238 | asf_system_info.onie_version = asfvolt_read_sysinfo("ONIE Version", onie_version); |
| 239 | |
| 240 | /* |
| 241 | * Write reply back to the client |
| 242 | */ |
| 243 | ret_val = context->gcc_stream->write(context, &asf_system_info, -1); |
| 244 | is_grpc_write_pending(ret_val); |
| 245 | |
| 246 | grpc_c_status_t status; |
| 247 | status.gcs_code = 0; |
| 248 | |
| 249 | /* |
| 250 | * Finish response for RPC |
| 251 | */ |
| 252 | if (context->gcc_stream->finish(context, &status)) |
| 253 | { |
| 254 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | /* |
root | 85905d1 | 2018-03-21 16:18:51 +0530 | [diff] [blame^] | 259 | This function reads the SFP presence map information from 'onlpdump -p' system command |
| 260 | and returns a bitmap with the presence information. |
| 261 | */ |
| 262 | unsigned int asfvolt_read_sfp_presence_bitmap(void) |
| 263 | { |
| 264 | char command[150]; |
| 265 | char sfp_presence_output[ASFVOLT_FIELD_LEN]; |
| 266 | unsigned int sfp_presence_bitmap = 0; |
| 267 | char delim[2] = " "; |
| 268 | char *field = NULL; |
| 269 | FILE *fp; |
| 270 | snprintf(command, sizeof command, "onlpdump -p | perl -ne 'print $1 if /Presence: ([0-9 ]+)/'"); |
| 271 | /* Open the command for reading. */ |
| 272 | fp = popen(command, "r"); |
| 273 | if (fp == NULL) { |
| 274 | /*The client has to check for a Null mac address in this case*/ |
| 275 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to query the sfp presence map"); |
| 276 | return sfp_presence_bitmap; |
| 277 | } |
| 278 | |
| 279 | /*Read the field value*/ |
| 280 | fread(sfp_presence_output, ASFVOLT_FIELD_LEN, 1, fp); |
| 281 | pclose(fp); |
| 282 | |
| 283 | field = strtok(sfp_presence_output, delim); |
| 284 | while (field != NULL) { |
| 285 | sfp_presence_bitmap |= (1 << atoi(field)); |
| 286 | field = strtok(NULL, delim); |
| 287 | } |
| 288 | |
| 289 | return sfp_presence_bitmap; |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * This functions gets invoked whenever AsfvoltGetSfpPresenceBitmap RPC gets called |
| 294 | */ |
| 295 | void asfvolt__asfvolt_get_sfp_presence_bitmap_cb(grpc_c_context_t *context) |
| 296 | { |
| 297 | BalDefault *dummy; |
| 298 | AsfSfpPresenceBitmap sfp_presence_bitmap; |
| 299 | int ret_val; |
| 300 | |
| 301 | if (context->gcc_payload) { |
| 302 | context->gcc_stream->read(context, (void **)&dummy, 0); |
| 303 | } |
| 304 | |
| 305 | asf_sfp_presence_bitmap__init(&sfp_presence_bitmap); |
| 306 | |
| 307 | sfp_presence_bitmap.bitmap = asfvolt_read_sfp_presence_bitmap(); |
| 308 | sfp_presence_bitmap.has_bitmap = true; |
| 309 | |
| 310 | /* |
| 311 | * Write reply back to the client |
| 312 | */ |
| 313 | ret_val = context->gcc_stream->write(context, &sfp_presence_bitmap, -1); |
| 314 | is_grpc_write_pending(ret_val); |
| 315 | |
| 316 | grpc_c_status_t status; |
| 317 | status.gcs_code = 0; |
| 318 | |
| 319 | /* |
| 320 | * Finish response for RPC |
| 321 | */ |
| 322 | if (context->gcc_stream->finish(context, &status)) |
| 323 | { |
| 324 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | /* |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 329 | * This functions gets invoked whenever Bal Stats gets called |
| 330 | */ |
| 331 | void bal__bal_cfg_stat_get_cb(grpc_c_context_t *context) |
| 332 | { |
| 333 | BalInterfaceKey *read_stats; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 334 | int ret_val; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 335 | |
| 336 | /* |
| 337 | * Read incoming message into get_cfg |
| 338 | */ |
| 339 | if (context->gcc_payload) { |
| 340 | context->gcc_stream->read(context, (void **)&read_stats, 0); |
| 341 | } |
| 342 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 343 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Bal Server - Get Stats :NNI port is %d",read_stats->intf_id); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 344 | |
| 345 | BalInterfaceStat get_stats; |
| 346 | memset(&get_stats, 0, sizeof(BalInterfaceStat)); |
| 347 | bal_interface_stat__init(&get_stats); |
| 348 | |
| 349 | BalInterfaceStatData stat_data; |
| 350 | memset(&stat_data, 0, sizeof(BalInterfaceStatData)); |
| 351 | bal_interface_stat_data__init(&stat_data); |
| 352 | |
Rajeswara Rao | 92e3fd4 | 2017-10-26 10:47:03 +0530 | [diff] [blame] | 353 | BalInterfaceKey stat_key; |
| 354 | memset(&stat_key, 0, sizeof(BalInterfaceKey)); |
| 355 | bal_interface_key__init(&stat_key); |
| 356 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 357 | #ifndef BAL_STUB |
| 358 | /* Interface Type, Interface ID |
| 359 | stat_data - Statistics Data */ |
Rajeswara Rao | 92e3fd4 | 2017-10-26 10:47:03 +0530 | [diff] [blame] | 360 | asfvolt16_bal_stats_get(read_stats->intf_type, read_stats->intf_id, &stat_data, &stat_key); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 361 | #else |
| 362 | stub_bal_stats_get(&stat_data); |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 363 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Bal Server - Get Stats In BalStubs : Got all the statistics"); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 364 | #endif |
| 365 | |
| 366 | get_stats.data = &stat_data; |
Rajeswara Rao | 92e3fd4 | 2017-10-26 10:47:03 +0530 | [diff] [blame] | 367 | get_stats.key = &stat_key; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 368 | |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 369 | ret_val = context->gcc_stream->write(context, &get_stats, -1); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 370 | is_grpc_write_pending(ret_val); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 371 | |
| 372 | grpc_c_status_t status; |
| 373 | status.gcs_code = 0; |
| 374 | |
| 375 | /* |
| 376 | * Finish response for RPC |
| 377 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 378 | if (context->gcc_stream->finish(context, &status)) |
| 379 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 380 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 381 | } |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | /* |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 385 | * This functions gets invoked whenever bal RPC gets called |
| 386 | */ |
| 387 | void bal__bal_cfg_get_cb(grpc_c_context_t *context) |
| 388 | { |
| 389 | BalCfg *get_cfg; |
| 390 | |
| 391 | /* |
| 392 | * Read incoming message into get_cfg |
| 393 | */ |
| 394 | if (context->gcc_payload) { |
| 395 | context->gcc_stream->read(context, (void **)&get_cfg, 0); |
| 396 | } |
| 397 | |
| 398 | #ifndef BAL_STUB |
| 399 | //asfvolt16_bal_cfg_get(key, get_cfg); |
| 400 | #endif |
| 401 | } |
| 402 | |
| 403 | /* |
| 404 | * This functions gets invoked whenever bal RPC gets called |
| 405 | */ |
| 406 | void bal__bal_cfg_set_cb(grpc_c_context_t *context) |
| 407 | { |
| 408 | BalCfg *set_cfg; |
| 409 | BalErr bal_err; |
| 410 | int ret_val = 0; |
| 411 | |
| 412 | /* |
| 413 | * Read incoming message into set_cfg |
| 414 | */ |
| 415 | if (context->gcc_payload) { |
| 416 | context->gcc_stream->read(context, (void **)&set_cfg, 0); |
| 417 | } |
| 418 | |
| 419 | /* |
| 420 | * send it to BAL |
| 421 | */ |
| 422 | |
| 423 | bal_err__init(&bal_err); |
| 424 | |
| 425 | bal_err.err= 0; |
| 426 | |
| 427 | /* |
| 428 | * Write reply back to the client |
| 429 | */ |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 430 | |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 431 | ret_val = context->gcc_stream->write(context, &bal_err, -1); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 432 | is_grpc_write_pending(ret_val); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 433 | |
| 434 | grpc_c_status_t status; |
| 435 | status.gcs_code = 0; |
| 436 | |
| 437 | /* |
| 438 | * Finish response for RPC |
| 439 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 440 | if (context->gcc_stream->finish(context, &status)) |
| 441 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 442 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 443 | } |
| 444 | |
| 445 | #ifdef BAL_STUB |
| 446 | pthread_mutex_lock(&lock); |
| 447 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 448 | struct QNode *temp = newNode(set_cfg->hdr->obj_type, |
| 449 | BAL_ERRNO__BAL_ERR_OK, |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 450 | set_cfg->device_id); |
| 451 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 452 | switch(set_cfg->hdr->obj_type) |
| 453 | { |
| 454 | case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL: |
| 455 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 456 | ASFVOLT_LOG(ASFVOLT_INFO, "Received Access Terminal Configuration msg"); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 457 | } |
| 458 | break; |
| 459 | case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE: |
| 460 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 461 | ASFVOLT_LOG(ASFVOLT_INFO, "Received PON Interface Configuration msg"); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 462 | temp->intf_id = set_cfg->interface->key->intf_id; |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 463 | ASFVOLT_LOG(ASFVOLT_INFO, "Pon ID = %d", temp->intf_id); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 464 | } |
| 465 | break; |
| 466 | case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL: |
| 467 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 468 | ASFVOLT_LOG(ASFVOLT_INFO, "Received ONU Activation msg"); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 469 | temp->intf_id = set_cfg->terminal->key->intf_id; |
| 470 | temp->onu_id = set_cfg->terminal->key->sub_term_id; |
| 471 | memset(temp->vendor_id, 0, BAL_DEVICE_STR_LEN); |
| 472 | memcpy(temp->vendor_id, |
| 473 | set_cfg->terminal->data->serial_number->vendor_id, |
| 474 | strlen(set_cfg->terminal->data->serial_number->vendor_id)); |
| 475 | memset(temp->vendor_specific, 0, BAL_DEVICE_STR_LEN); |
| 476 | memcpy(temp->vendor_specific, |
| 477 | set_cfg->terminal->data->serial_number->vendor_specific, |
| 478 | strlen(set_cfg->terminal->data->serial_number->vendor_specific)); |
| 479 | } |
| 480 | break; |
| 481 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED: |
| 482 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 483 | ASFVOLT_LOG(ASFVOLT_INFO, "Received TM schedule msg"); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 484 | } |
| 485 | break; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 486 | case BAL_OBJ_ID__BAL_OBJ_ID_PACKET: |
| 487 | { |
| 488 | switch(set_cfg->packet->key->packet_send_dest->type) |
| 489 | { |
| 490 | case BAL_DEST_TYPE__BAL_DEST_TYPE_ITU_OMCI_CHANNEL: |
| 491 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 492 | ASFVOLT_LOG(ASFVOLT_INFO, "Received OMCI msg"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 493 | temp->intf_id = set_cfg->terminal->key->intf_id; |
| 494 | temp->onu_id = set_cfg->terminal->key->sub_term_id; |
| 495 | } |
| 496 | break; |
| 497 | default: |
| 498 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 499 | ASFVOLT_LOG(ASFVOLT_INFO, "Dest type invalid"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 500 | } |
| 501 | break; |
| 502 | } |
| 503 | } |
| 504 | break; |
| 505 | default: |
| 506 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 507 | ASFVOLT_LOG(ASFVOLT_INFO, "Received Invalid msg type === %d", set_cfg->hdr->obj_type); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 508 | pthread_mutex_unlock(&lock); |
| 509 | return; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 510 | } |
| 511 | break; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 512 | } |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 513 | enQueue(set_cfg->hdr->obj_type, temp); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 514 | pthread_mutex_unlock(&lock); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 515 | sleep(2); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 516 | pthread_cond_signal(&cv); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 517 | #else |
| 518 | if(BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL == set_cfg->hdr->obj_type) |
| 519 | { |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 520 | sleep(5); /* enable this if running with gdb */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 521 | } |
| 522 | asfvolt16_bal_cfg_set(set_cfg); |
| 523 | #endif |
| 524 | } |
| 525 | |
| 526 | |
| 527 | /* |
| 528 | * This functions gets invoked whenever bal clear RPC gets called |
| 529 | */ |
| 530 | void bal__bal_cfg_clear_cb(grpc_c_context_t *context) |
| 531 | { |
| 532 | BalKey *clear_key; |
Girish Gowdru | 50278de | 2017-11-23 12:35:41 +0530 | [diff] [blame] | 533 | BalErr bal_err; |
| 534 | int ret_val = 0; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 535 | |
| 536 | /* |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 537 | * Read incoming message into clear_key |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 538 | */ |
| 539 | if (context->gcc_payload) { |
| 540 | context->gcc_stream->read(context, (void **)&clear_key, 0); |
| 541 | } |
| 542 | |
Girish Gowdru | 50278de | 2017-11-23 12:35:41 +0530 | [diff] [blame] | 543 | /* |
| 544 | * send it to BAL |
| 545 | */ |
| 546 | |
| 547 | bal_err__init(&bal_err); |
| 548 | |
| 549 | bal_err.err= 0; |
| 550 | |
| 551 | /* |
| 552 | * Write reply back to the client |
| 553 | */ |
| 554 | |
| 555 | ret_val = context->gcc_stream->write(context, &bal_err, 0); |
| 556 | is_grpc_write_pending(ret_val); |
| 557 | |
| 558 | grpc_c_status_t status; |
| 559 | status.gcs_code = 0; |
| 560 | |
| 561 | /* |
| 562 | * Finish response for RPC |
| 563 | */ |
| 564 | if (context->gcc_stream->finish(context, &status)) |
| 565 | { |
| 566 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
| 567 | } |
| 568 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 569 | #ifndef BAL_STUB |
| 570 | asfvolt16_bal_cfg_clear(clear_key); |
| 571 | #endif |
| 572 | } |
| 573 | |
| 574 | |
| 575 | /* |
| 576 | * This functions gets invoked whenever bal Init RPC gets called |
| 577 | */ |
| 578 | void bal__bal_api_init_cb(grpc_c_context_t *context) |
| 579 | { |
| 580 | BalInit *bal_init; |
| 581 | BalErr bal_err; |
| 582 | int ret_val; |
| 583 | |
| 584 | /* |
| 585 | * Read incoming message into set_cfg |
| 586 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 587 | if (context->gcc_payload) |
| 588 | { |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 589 | context->gcc_stream->read(context, (void **)&bal_init, 0); |
| 590 | } |
| 591 | |
| 592 | /* |
| 593 | * send it to BAL |
| 594 | */ |
| 595 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 596 | ASFVOLT_LOG(ASFVOLT_INFO, "Received API Init msg"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 597 | |
| 598 | bal_err__init(&bal_err); |
| 599 | |
| 600 | bal_err.err= 0; |
| 601 | |
| 602 | /* |
| 603 | * Write reply back to the client |
| 604 | */ |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 605 | ret_val = context->gcc_stream->write(context, &bal_err, -1); |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 606 | is_grpc_write_pending(ret_val); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 607 | |
| 608 | grpc_c_status_t status; |
| 609 | status.gcs_code = 0; |
| 610 | |
| 611 | /* |
| 612 | * Finish response for RPC |
| 613 | */ |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 614 | if (context->gcc_stream->finish(context, &status)) |
| 615 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 616 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | #ifndef BAL_STUB |
| 620 | asfvolt16_bal_init(bal_init, &coreIpPortInfo); |
| 621 | #else |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 622 | ASFVOLT_LOG(ASFVOLT_INFO, "Received IP Address == %s", bal_init->voltha_adapter_ip_port); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 623 | stub_bal_init(bal_init); |
| 624 | #endif |
| 625 | |
| 626 | } |
| 627 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 628 | void bal_get_ind__free_mem_access_term_ind(BalIndications *balIndCfg) |
| 629 | { |
| 630 | free(balIndCfg->access_term_ind->data->sw_version); |
| 631 | free(balIndCfg->access_term_ind->data->topology); |
| 632 | free(balIndCfg->access_term_ind->data); |
| 633 | free(balIndCfg->access_term_ind->key); |
| 634 | free(balIndCfg->access_term_ind->hdr); |
| 635 | free(balIndCfg->access_term_ind); |
| 636 | free(balIndCfg); |
| 637 | } |
| 638 | |
| 639 | void bal_get_ind__free_mem_access_term_ind_op_state(BalIndications *balIndCfg) |
| 640 | { |
| 641 | free(balIndCfg->access_term_ind_op_state->data); |
| 642 | free(balIndCfg->access_term_ind_op_state->key); |
| 643 | free(balIndCfg->access_term_ind_op_state->hdr); |
| 644 | free(balIndCfg->access_term_ind_op_state); |
| 645 | free(balIndCfg); |
| 646 | } |
| 647 | |
| 648 | void bal_get_ind__free_mem_flow_op_state(BalIndications *balIndCfg) |
| 649 | { |
| 650 | free(balIndCfg->flow_op_state->data); |
| 651 | free(balIndCfg->flow_op_state->key); |
| 652 | free(balIndCfg->flow_op_state->hdr); |
| 653 | free(balIndCfg->flow_op_state); |
| 654 | free(balIndCfg); |
| 655 | } |
| 656 | |
| 657 | void bal_get_ind__free_mem_flow_ind(BalIndications *balIndCfg) |
| 658 | { |
| 659 | free(balIndCfg->flow_ind->data->action); |
| 660 | free(balIndCfg->flow_ind->data->classifier->src_mac.data); |
| 661 | free(balIndCfg->flow_ind->data->classifier->dst_mac.data); |
| 662 | free(balIndCfg->flow_ind->data->classifier); |
| 663 | free(balIndCfg->flow_ind->data); |
| 664 | free(balIndCfg->flow_ind->key); |
| 665 | free(balIndCfg->flow_ind->hdr); |
| 666 | free(balIndCfg->flow_ind); |
| 667 | free(balIndCfg); |
| 668 | } |
| 669 | |
| 670 | void bal_get_ind__free_mem_group_ind(BalIndications *balIndCfg) |
| 671 | { |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 672 | unsigned int i = 0; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 673 | free(balIndCfg->group_ind->data->flows->val); |
| 674 | free(balIndCfg->group_ind->data->flows); |
| 675 | for (i = 0; i < balIndCfg->group_ind->data->members->n_val; i++) |
| 676 | { |
| 677 | free(balIndCfg->group_ind->data->members->val[i]->queue); |
| 678 | free(balIndCfg->group_ind->data->members->val[i]->action); |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 679 | free(balIndCfg->group_ind->data->members->val[i]); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 680 | } |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 681 | free(balIndCfg->group_ind->data->members); |
| 682 | free(balIndCfg->group_ind->data); |
| 683 | free(balIndCfg->group_ind->key); |
| 684 | free(balIndCfg->group_ind->hdr); |
| 685 | free(balIndCfg->group_ind); |
| 686 | free(balIndCfg); |
| 687 | } |
| 688 | |
| 689 | void bal_get_ind__free_mem_interface_op_state(BalIndications *balIndCfg) |
| 690 | { |
| 691 | free(balIndCfg->interface_op_state->data); |
| 692 | free(balIndCfg->interface_op_state->key); |
| 693 | free(balIndCfg->interface_op_state->hdr); |
| 694 | free(balIndCfg->interface_op_state); |
| 695 | free(balIndCfg); |
| 696 | } |
| 697 | |
| 698 | void bal_get_ind__free_mem_interface_los(BalIndications *balIndCfg) |
| 699 | { |
| 700 | free(balIndCfg->interface_los->data); |
| 701 | free(balIndCfg->interface_los->hdr); |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 702 | free(balIndCfg->interface_los); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 703 | free(balIndCfg); |
| 704 | } |
| 705 | |
| 706 | void bal_get_ind__free_mem_interface_ind(BalIndications *balIndCfg) |
| 707 | { |
| 708 | free(balIndCfg->interface_ind->data->sub_term_id_list->val); |
| 709 | free(balIndCfg->interface_ind->data->sub_term_id_list); |
| 710 | free(balIndCfg->interface_ind->data); |
| 711 | free(balIndCfg->interface_ind->key); |
| 712 | free(balIndCfg->interface_ind->hdr); |
| 713 | free(balIndCfg->interface_ind); |
| 714 | free(balIndCfg); |
| 715 | } |
| 716 | |
| 717 | void bal_get_ind__free_mem_terminal_op_state(BalIndications *balIndCfg) |
| 718 | { |
| 719 | free(balIndCfg->terminal_op_state->data); |
| 720 | free(balIndCfg->terminal_op_state->key); |
| 721 | free(balIndCfg->terminal_op_state->hdr); |
| 722 | free(balIndCfg->terminal_op_state); |
| 723 | free(balIndCfg); |
| 724 | } |
| 725 | |
| 726 | void bal_get_ind__free_mem_terminal_disc(BalIndications *balIndCfg) |
| 727 | { |
| 728 | free(balIndCfg->terminal_disc->data->serial_number->vendor_specific); |
| 729 | free(balIndCfg->terminal_disc->data->serial_number->vendor_id); |
| 730 | free(balIndCfg->terminal_disc->data->serial_number); |
| 731 | free(balIndCfg->terminal_disc->data); |
| 732 | free(balIndCfg->terminal_disc->key); |
| 733 | free(balIndCfg->terminal_disc->hdr); |
| 734 | free(balIndCfg->terminal_disc); |
| 735 | free(balIndCfg); |
| 736 | } |
| 737 | |
| 738 | void bal_get_ind__free_mem_terminal_alarm(BalIndications *balIndCfg) |
| 739 | { |
| 740 | free(balIndCfg->terminal_alarm->data->alarm); |
| 741 | free(balIndCfg->terminal_alarm->data); |
| 742 | free(balIndCfg->terminal_alarm->key); |
| 743 | free(balIndCfg->terminal_alarm->hdr); |
| 744 | free(balIndCfg->terminal_alarm); |
| 745 | free(balIndCfg); |
| 746 | } |
| 747 | |
| 748 | void bal_get_ind__free_mem_terminal_dgi(BalIndications *balIndCfg) |
| 749 | { |
| 750 | free(balIndCfg->terminal_dgi->data); |
| 751 | free(balIndCfg->terminal_dgi->key); |
| 752 | free(balIndCfg->terminal_dgi->hdr); |
| 753 | free(balIndCfg->terminal_dgi); |
| 754 | free(balIndCfg); |
| 755 | } |
| 756 | |
| 757 | void bal_get_ind__free_mem_terminal_ind(BalIndications *balIndCfg) |
| 758 | { |
| 759 | free(balIndCfg->terminal_ind->data->agg_port_id_list); |
| 760 | free(balIndCfg->terminal_ind->data->serial_number->vendor_specific); |
| 761 | free(balIndCfg->terminal_ind->data->serial_number->vendor_id); |
| 762 | free(balIndCfg->terminal_ind->data->serial_number); |
| 763 | free(balIndCfg->terminal_ind->data->registration_id); |
| 764 | free(balIndCfg->terminal_ind->data->password); |
| 765 | free(balIndCfg->terminal_ind->data); |
| 766 | free(balIndCfg->terminal_ind->key); |
| 767 | free(balIndCfg->terminal_ind->hdr); |
| 768 | free(balIndCfg->terminal_ind); |
| 769 | free(balIndCfg); |
| 770 | } |
| 771 | |
| 772 | void bal_get_ind__free_mem_tm_queue_ind(BalIndications *balIndCfg) |
| 773 | { |
| 774 | switch (balIndCfg->tm_queue_ind->data->bac->type) |
| 775 | { |
| 776 | case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_TAILDROP: |
| 777 | free(balIndCfg->tm_queue_ind->data->bac->taildrop); |
| 778 | break; |
| 779 | case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_WTAILDROP: |
| 780 | /*Nothing to do*/ |
| 781 | break; |
| 782 | case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_RED: |
| 783 | free(balIndCfg->tm_queue_ind->data->bac->red->red); |
| 784 | free(balIndCfg->tm_queue_ind->data->bac->red); |
| 785 | break; |
| 786 | case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_WRED: |
| 787 | free(balIndCfg->tm_queue_ind->data->bac->wred->red); |
| 788 | free(balIndCfg->tm_queue_ind->data->bac->wred->yellow); |
| 789 | free(balIndCfg->tm_queue_ind->data->bac->wred->green); |
| 790 | free(balIndCfg->tm_queue_ind->data->bac->wred); |
| 791 | default: |
| 792 | /*Nothing to do*/ |
| 793 | break; |
| 794 | } |
| 795 | free(balIndCfg->tm_queue_ind->data->bac); |
| 796 | free(balIndCfg->tm_queue_ind->data->rate); |
| 797 | free(balIndCfg->tm_queue_ind->data); |
| 798 | free(balIndCfg->tm_queue_ind->key); |
| 799 | free(balIndCfg->tm_queue_ind); |
| 800 | free(balIndCfg); |
| 801 | } |
| 802 | |
| 803 | void bal_get_ind__free_mem_u_tm_sched_ind(BalIndications *balIndCfg) |
| 804 | { |
| 805 | free(balIndCfg->tm_sched_ind->data); |
| 806 | free(balIndCfg->tm_sched_ind->key); |
| 807 | free(balIndCfg->tm_sched_ind); |
| 808 | free(balIndCfg); |
| 809 | } |
| 810 | |
| 811 | void bal_get_ind__free_mem_u_pkt_data(BalIndications *balIndCfg) |
| 812 | { |
| 813 | free(balIndCfg->pktdata->data->pkt.data); |
| 814 | free(balIndCfg->pktdata->data); |
| 815 | switch(balIndCfg->pktdata->key->packet_send_dest->type) |
| 816 | { |
| 817 | case BAL_DEST_TYPE__BAL_DEST_TYPE_NNI: |
| 818 | free(balIndCfg->pktdata->key->packet_send_dest->nni); |
| 819 | break; |
| 820 | case BAL_DEST_TYPE__BAL_DEST_TYPE_SUB_TERM: |
| 821 | free(balIndCfg->pktdata->key->packet_send_dest->sub_term); |
| 822 | break; |
| 823 | case BAL_DEST_TYPE__BAL_DEST_TYPE_SVC_PORT: |
| 824 | free(balIndCfg->pktdata->key->packet_send_dest->svc_port); |
| 825 | break; |
| 826 | default: |
| 827 | /*Nothing to do*/ |
| 828 | break; |
| 829 | } |
| 830 | free(balIndCfg->pktdata->key->packet_send_dest); |
| 831 | free(balIndCfg->pktdata->key); |
| 832 | free(balIndCfg->pktdata->hdr); |
| 833 | free(balIndCfg->pktdata); |
| 834 | free(balIndCfg); |
| 835 | } |
| 836 | |
| 837 | void bal_get_ind__free_mem_u_bal_omci_resp(BalIndications *balIndCfg) |
| 838 | { |
| 839 | switch(balIndCfg->balomciresp->key->packet_send_dest->type) |
| 840 | { |
| 841 | case BAL_DEST_TYPE__BAL_DEST_TYPE_ITU_OMCI_CHANNEL: |
| 842 | free(balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel); |
| 843 | break; |
| 844 | default: |
| 845 | /*Nothing to do*/ |
| 846 | break; |
| 847 | } |
| 848 | free(balIndCfg->balomciresp->key->packet_send_dest); |
| 849 | free(balIndCfg->balomciresp->data->pkt.data); |
| 850 | free(balIndCfg->balomciresp->data); |
| 851 | free(balIndCfg->balomciresp->key); |
| 852 | free(balIndCfg->balomciresp->hdr); |
| 853 | free(balIndCfg->balomciresp); |
| 854 | free(balIndCfg); |
| 855 | } |
| 856 | |
| 857 | void bal_get_ind__free_mem_u_bal_oam_resp(BalIndications *balIndCfg) |
| 858 | { |
| 859 | free(balIndCfg->baloamresp->data->pkt.data); |
| 860 | free(balIndCfg->baloamresp->data); |
| 861 | switch(balIndCfg->baloamresp->key->packet_send_dest->type) |
| 862 | { |
| 863 | case BAL_DEST_TYPE__BAL_DEST_TYPE_IEEE_OAM_CHANNEL: |
| 864 | free(balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel); |
| 865 | break; |
| 866 | default: |
| 867 | /*Nothing to do*/ |
| 868 | break; |
| 869 | } |
| 870 | free(balIndCfg->baloamresp->key->packet_send_dest); |
| 871 | free(balIndCfg->baloamresp->key); |
| 872 | free(balIndCfg->baloamresp->hdr); |
| 873 | free(balIndCfg->baloamresp); |
| 874 | free(balIndCfg); |
| 875 | } |
| 876 | |
| 877 | void bal_get_ind__free_mem(BalIndications *balIndCfg) |
| 878 | { |
| 879 | switch (balIndCfg->u_case) |
| 880 | { |
| 881 | case BAL_INDICATIONS__U_ACCESS_TERM_IND: |
| 882 | bal_get_ind__free_mem_access_term_ind(balIndCfg); |
| 883 | break; |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 884 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 885 | case BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE: |
| 886 | bal_get_ind__free_mem_access_term_ind_op_state(balIndCfg); |
| 887 | break; |
| 888 | |
| 889 | case BAL_INDICATIONS__U_FLOW_OP_STATE: |
| 890 | bal_get_ind__free_mem_flow_op_state(balIndCfg); |
| 891 | break; |
| 892 | |
| 893 | case BAL_INDICATIONS__U_FLOW_IND: |
| 894 | bal_get_ind__free_mem_flow_ind(balIndCfg); |
| 895 | break; |
| 896 | |
| 897 | case BAL_INDICATIONS__U_GROUP_IND: |
| 898 | bal_get_ind__free_mem_group_ind(balIndCfg); |
| 899 | break; |
| 900 | |
| 901 | case BAL_INDICATIONS__U_INTERFACE_OP_STATE: |
| 902 | bal_get_ind__free_mem_interface_op_state(balIndCfg); |
| 903 | break; |
| 904 | |
| 905 | case BAL_INDICATIONS__U_INTERFACE_LOS: |
| 906 | bal_get_ind__free_mem_interface_los(balIndCfg); |
| 907 | break; |
| 908 | |
| 909 | case BAL_INDICATIONS__U_INTERFACE_IND: |
| 910 | bal_get_ind__free_mem_interface_ind(balIndCfg); |
| 911 | break; |
| 912 | |
| 913 | case BAL_INDICATIONS__U_TERMINAL_OP_STATE: |
| 914 | bal_get_ind__free_mem_terminal_op_state(balIndCfg); |
| 915 | break; |
| 916 | |
| 917 | case BAL_INDICATIONS__U_TERMINAL_DISC: |
| 918 | bal_get_ind__free_mem_terminal_disc(balIndCfg); |
| 919 | break; |
| 920 | |
| 921 | case BAL_INDICATIONS__U_TERMINAL_ALARM: |
| 922 | bal_get_ind__free_mem_terminal_alarm(balIndCfg); |
| 923 | break; |
| 924 | |
| 925 | case BAL_INDICATIONS__U_TERMINAL_DGI: |
| 926 | bal_get_ind__free_mem_terminal_dgi(balIndCfg); |
| 927 | break; |
| 928 | |
| 929 | case BAL_INDICATIONS__U_TERMINAL_IND: |
| 930 | bal_get_ind__free_mem_terminal_ind(balIndCfg); |
| 931 | break; |
| 932 | |
| 933 | case BAL_INDICATIONS__U_TM_QUEUE__IND: |
| 934 | bal_get_ind__free_mem_tm_queue_ind(balIndCfg); |
| 935 | break; |
| 936 | |
| 937 | case BAL_INDICATIONS__U_TM_SCHED__IND: |
| 938 | bal_get_ind__free_mem_u_tm_sched_ind(balIndCfg); |
| 939 | break; |
| 940 | |
| 941 | case BAL_INDICATIONS__U_PKT_DATA: |
| 942 | bal_get_ind__free_mem_u_pkt_data(balIndCfg); |
| 943 | break; |
| 944 | |
| 945 | case BAL_INDICATIONS__U_BAL_OMCI_RESP: |
| 946 | bal_get_ind__free_mem_u_bal_omci_resp(balIndCfg); |
| 947 | break; |
| 948 | |
| 949 | case BAL_INDICATIONS__U_BAL_OAM_RESP: |
| 950 | bal_get_ind__free_mem_u_bal_oam_resp(balIndCfg); |
| 951 | break; |
| 952 | |
| 953 | default: |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 954 | ASFVOLT_LOG(ASFVOLT_ERROR, "Unknown BAL indication %u", balIndCfg->u_case); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 955 | break; |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | void bal_get_ind__bal_get_ind_from_device_cb(grpc_c_context_t *context) |
| 960 | { |
| 961 | BalDefault *dummy; |
| 962 | BalIndications *bal_indication; |
| 963 | list_node *node = NULL; |
| 964 | int ret_val = 0; |
| 965 | |
| 966 | /* |
| 967 | * Read incoming message into set_cfg |
| 968 | */ |
| 969 | if (context->gcc_payload) { |
| 970 | context->gcc_stream->read(context, (void **)&dummy, 0); |
| 971 | } |
| 972 | |
| 973 | /* |
| 974 | * send it to BAL |
| 975 | */ |
| 976 | |
| 977 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 978 | node = get_bal_indication_node(); |
| 979 | pthread_mutex_unlock(&bal_ind_queue_lock); |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 980 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 981 | if(node != NULL) |
| 982 | { |
| 983 | bal_indication = node->bal_indication; |
| 984 | bal_indication->ind_present = true; |
| 985 | bal_indication->has_ind_present = true; |
| 986 | } |
| 987 | else |
| 988 | { |
| 989 | bal_indication = malloc(sizeof(BalIndications)); |
| 990 | memset(bal_indication, 0, sizeof(BalIndications)); |
| 991 | bal_indications__init(bal_indication); |
| 992 | bal_indication->ind_present = false; |
| 993 | bal_indication->has_ind_present = true; |
| 994 | } |
| 995 | |
| 996 | /* |
| 997 | * Write reply back to the client |
| 998 | */ |
| 999 | |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 1000 | ret_val = context->gcc_stream->write(context, bal_indication, -1); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1001 | is_grpc_write_pending(ret_val); |
| 1002 | |
| 1003 | grpc_c_status_t status; |
| 1004 | status.gcs_code = 0; |
| 1005 | |
| 1006 | /* |
| 1007 | * Finish response for RPC |
| 1008 | */ |
| 1009 | if (context->gcc_stream->finish(context, &status)) |
| 1010 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1011 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status"); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1012 | } |
root | 2ca2cc0 | 2017-11-03 19:51:57 +0530 | [diff] [blame] | 1013 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1014 | /*Free memory for 'bal_indication' and 'node'*/ |
| 1015 | if (bal_indication->ind_present) |
| 1016 | { |
| 1017 | bal_get_ind__free_mem(bal_indication); |
| 1018 | free(node); |
| 1019 | } |
| 1020 | else |
| 1021 | { |
| 1022 | free(bal_indication); |
| 1023 | } |
| 1024 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1025 | |
| 1026 | /* |
| 1027 | * This functions gets invoked whenever bal finish RPC gets called |
| 1028 | */ |
| 1029 | void bal__bal_api_finish_cb(grpc_c_context_t *context) |
| 1030 | { |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1031 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1032 | } |
| 1033 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1034 | void bal_ind__bal_acc_term_ind_cb(grpc_c_context_t *context) |
| 1035 | { |
| 1036 | } |
| 1037 | void bal_ind__bal_acc_term_oper_sts_cng_ind_cb(grpc_c_context_t *context) |
| 1038 | { |
| 1039 | } |
| 1040 | void bal_ind__bal_flow_oper_sts_cng_cb(grpc_c_context_t *context) |
| 1041 | { |
| 1042 | } |
| 1043 | void bal_ind__bal_flow_ind_cb(grpc_c_context_t *context) |
| 1044 | { |
| 1045 | } |
| 1046 | void bal_ind__bal_group_ind_cb(grpc_c_context_t *context) |
| 1047 | { |
| 1048 | } |
| 1049 | void bal_ind__bal_iface_oper_sts_cng_cb(grpc_c_context_t *context) |
| 1050 | { |
| 1051 | } |
| 1052 | void bal_ind__bal_iface_los_cb(grpc_c_context_t *context) |
| 1053 | { |
| 1054 | } |
| 1055 | void bal_ind__bal_iface_ind_cb(grpc_c_context_t *context) |
| 1056 | { |
| 1057 | } |
| 1058 | void bal_ind__bal_iface_stat_cb(grpc_c_context_t *context) |
| 1059 | { |
| 1060 | } |
| 1061 | void bal_ind__bal_subs_term_oper_sts_cng_cb(grpc_c_context_t *context) |
| 1062 | { |
| 1063 | } |
| 1064 | void bal_ind__bal_subs_term_discovery_ind_cb(grpc_c_context_t *context) |
| 1065 | { |
| 1066 | } |
| 1067 | void bal_ind__bal_subs_term_alarm_ind_cb(grpc_c_context_t *context) |
| 1068 | { |
| 1069 | } |
| 1070 | void bal_ind__bal_subs_term_dgi_ind_cb(grpc_c_context_t *context) |
| 1071 | { |
| 1072 | } |
| 1073 | void bal_ind__bal_subs_term_ind_cb(grpc_c_context_t *context) |
| 1074 | { |
| 1075 | } |
| 1076 | void bal_ind__bal_tm_queue_ind_info_cb(grpc_c_context_t *context) |
| 1077 | { |
| 1078 | } |
| 1079 | void bal_ind__bal_tm_sched_ind_info_cb(grpc_c_context_t *context) |
| 1080 | { |
| 1081 | } |
| 1082 | void bal_ind__bal_pkt_bearer_channel_rx_ind_cb(grpc_c_context_t *context) |
| 1083 | { |
| 1084 | } |
| 1085 | void bal_ind__bal_pkt_omci_channel_rx_ind_cb(grpc_c_context_t *context) |
| 1086 | { |
| 1087 | } |
| 1088 | void bal_ind__bal_pkt_ieee_oam_channel_rx_ind_cb(grpc_c_context_t *context) |
| 1089 | { |
| 1090 | } |
A R Karthick | 1d25103 | 2017-09-06 09:38:34 -0700 | [diff] [blame] | 1091 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1092 | /* |
| 1093 | ** ASFVOLT_HEX2LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is", |
| 1094 | ** balIndCfg.balomciresp->data->pkt.data, balIndCfg.balomciresp->data->pkt.len); |
| 1095 | */ |
| 1096 | #define SYSLOG_MAX_SIZE 1024 |
| 1097 | void asfvolt_hexlog2(int prio, const char *_file_loc, int _file_line, const char *pFormat, void* pData, size_t len) |
| 1098 | { |
| 1099 | unsigned char *inpPtr = pData; |
| 1100 | char tempBuf[SYSLOG_MAX_SIZE]; |
| 1101 | size_t idx = 0; |
| 1102 | |
| 1103 | idx += snprintf(tempBuf+idx, SYSLOG_MAX_SIZE-1, pFormat, len); |
| 1104 | while (len-- > 0 && idx < SYSLOG_MAX_SIZE) |
| 1105 | { |
| 1106 | idx += snprintf(tempBuf+idx, SYSLOG_MAX_SIZE-idx, "%02x", *inpPtr++); |
| 1107 | } |
| 1108 | ASFVOLT_LOG_LOC(prio, _file_loc, _file_line, "%s", tempBuf); |
| 1109 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1110 | |
| 1111 | /* |
| 1112 | * Takes socket path as argument |
| 1113 | */ |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 1114 | int main (int argc, char **argv) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1115 | { |
| 1116 | int i = 0; |
| 1117 | grpc_c_server_t *server = NULL; |
| 1118 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 1119 | if (argc < 6) |
| 1120 | { |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1121 | fprintf(stderr, "Missing socket path argument\n"); |
| 1122 | exit(1); |
| 1123 | } |
| 1124 | |
| 1125 | strcpy(coreIpPortInfo.bal_core_arg1, argv[2] /*, strlen(argv[2])*/); |
| 1126 | strcpy(coreIpPortInfo.bal_core_ip_port, argv[3]/*, strlen(argv[3])*/); |
| 1127 | strcpy(coreIpPortInfo.bal_core_arg2, argv[4]/*, strlen(argv[4])*/); |
| 1128 | strcpy(coreIpPortInfo.bal_shared_lib_ip_port, argv[5]/*, strlen(argv[5])*/); |
| 1129 | |
| 1130 | signal(SIGINT, sigint_handler); |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1131 | |
| 1132 | /* |
| 1133 | ** syslog initialization |
| 1134 | */ |
| 1135 | //setlogmask (LOG_UPTO (LOG_NOTICE)); |
| 1136 | |
| 1137 | openlog (ASFVOLT_SYSLOG_NAME, ASFVOLT_SYSLOG_MODE, LOG_LOCAL1); |
| 1138 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1139 | /* |
| 1140 | * Initialize grpc-c library to be used with vanilla gRPC |
| 1141 | */ |
| 1142 | grpc_c_init(GRPC_THREADS, NULL); |
| 1143 | |
| 1144 | /* |
| 1145 | * Create server object |
| 1146 | */ |
| 1147 | test_server = grpc_c_server_create(argv[1]); |
| 1148 | |
Rajeswara Rao | 9f1cea1 | 2017-10-10 18:25:29 +0530 | [diff] [blame] | 1149 | if (test_server == NULL) |
| 1150 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1151 | ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to create server"); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1152 | exit(1); |
| 1153 | } |
| 1154 | |
| 1155 | /* |
| 1156 | * Initialize greeter service |
| 1157 | */ |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1158 | ASFVOLT_LOG(ASFVOLT_INFO, "voltha_bal_driver running....."); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1159 | bal__service_init(test_server); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1160 | bal_get_ind__service_init(test_server); |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 1161 | asfvolt__service_init(test_server); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1162 | |
| 1163 | /* |
| 1164 | * Start server |
| 1165 | */ |
| 1166 | grpc_c_server_start(test_server); |
| 1167 | |
| 1168 | #ifdef BAL_STUB |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1169 | create_stub_thread(); |
| 1170 | #endif |
| 1171 | |
| 1172 | /* |
| 1173 | * Blocks server to wait to completion |
| 1174 | */ |
| 1175 | grpc_c_server_wait(test_server); |
| 1176 | |
| 1177 | /* code added for example Makefile to compile grpc-c along with edgecore driver */ |
| 1178 | bal__service_init(server); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1179 | bal_get_ind__service_init(server); |
root | 5be94e5 | 2018-02-15 22:30:14 +0530 | [diff] [blame] | 1180 | asfvolt__service_init(server); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1181 | } |