Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | |
| 30 | #include <bcmolt_msg.h> |
| 31 | #include <bcmolt_api.h> |
| 32 | #include <bcmcli.h> |
| 33 | #include <bcm_api_cli.h> |
| 34 | #include <bcm_api_cli_helpers.h> |
| 35 | #include <bcm_dev_log.h> |
| 36 | #include "bcmolt_user_appl_ex_cli.h" |
| 37 | |
| 38 | #ifdef ENABLE_LOG |
| 39 | static dev_log_id user_appl_ex_log_id; |
| 40 | |
| 41 | static void user_appl_general_indication_cb(bcmolt_devid olt, bcmolt_msg *msg) |
| 42 | { |
| 43 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 44 | "[-- Dev %u: Indication Received --]\n", olt); |
| 45 | switch (msg->obj_type) |
| 46 | { |
| 47 | case BCMOLT_OBJ_ID_DEBUG: |
| 48 | break; |
| 49 | case BCMOLT_OBJ_ID_GPON_NI: |
| 50 | switch (msg->subgroup) |
| 51 | { |
| 52 | case BCMOLT_GPON_NI_AUTO_ID_LOS: |
| 53 | break; |
| 54 | case BCMOLT_GPON_NI_AUTO_ID_STATE_CHANGE_COMPLETED: |
| 55 | { |
| 56 | bcmolt_gpon_ni_state_change_completed *ind = (bcmolt_gpon_ni_state_change_completed*)msg; |
| 57 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 58 | "Dev %u: pon ni state changed new_state %d, prev state %d, result %d \n", |
| 59 | olt, ind->data.new_state, ind->data.previous_state, ind->data.result); |
| 60 | break; |
| 61 | } |
| 62 | |
| 63 | default: |
| 64 | break; |
| 65 | /* ... */ |
| 66 | } |
| 67 | break; |
| 68 | case BCMOLT_OBJ_ID_GPON_ONU: |
| 69 | break; |
| 70 | default: |
| 71 | break; |
| 72 | /* ... */ |
| 73 | } |
| 74 | bcmolt_msg_free(msg); |
| 75 | } |
| 76 | |
| 77 | static void user_appl_pon_ni_indication_cb(bcmolt_devid olt, bcmolt_msg *msg) |
| 78 | { |
| 79 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 80 | "[-- Dev %u: Pon NI Indication Received --]\n", olt); |
| 81 | switch (msg->obj_type) |
| 82 | { |
| 83 | case BCMOLT_OBJ_ID_GPON_NI: |
| 84 | switch (msg->subgroup) |
| 85 | { |
| 86 | case BCMOLT_GPON_NI_AUTO_ID_LOS: |
| 87 | break; |
| 88 | case BCMOLT_GPON_NI_AUTO_ID_STATE_CHANGE_COMPLETED: |
| 89 | { |
| 90 | bcmolt_gpon_ni_state_change_completed *ind = (bcmolt_gpon_ni_state_change_completed*)msg; |
| 91 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 92 | "Dev %u: pon ni state changed new_state %d, prev state %d, result %d \n", |
| 93 | olt, ind->data.new_state, ind->data.previous_state, ind->data.result); |
| 94 | break; |
| 95 | } |
| 96 | default: |
| 97 | break; |
| 98 | } |
| 99 | break; |
| 100 | default: |
| 101 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 102 | "[-- Dev %u: some other indication --]\n", olt); |
| 103 | break; |
| 104 | /* ... */ |
| 105 | } |
| 106 | bcmolt_msg_free(msg); |
| 107 | } |
| 108 | |
| 109 | static void user_appl_device_logger_indication_cb(bcmolt_devid olt, bcmolt_msg *msg) |
| 110 | { |
| 111 | if (msg->subgroup == BCMOLT_DEBUG_AUTO_ID_CLI_OUTPUT) |
| 112 | { |
| 113 | bcmolt_debug_cli_output *ind = (bcmolt_debug_cli_output *)msg; |
| 114 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 115 | "Dev %u: [device logger] %s\n", olt, ind->data.data.val); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | static bcmos_errno user_appl_indication_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 120 | { |
| 121 | bcmolt_rx_cfg rx_cfg; |
| 122 | bcmos_errno rc; |
| 123 | |
| 124 | rx_cfg.obj_type = BCMOLT_OBJ_ID_DEBUG; |
| 125 | rx_cfg.rx_cb =user_appl_device_logger_indication_cb; |
| 126 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 127 | rc = bcmolt_auto_rx_cb_set(current_device, &rx_cfg); |
| 128 | if (rc != BCM_ERR_OK) |
| 129 | { |
| 130 | return rc; |
| 131 | } |
| 132 | |
| 133 | rx_cfg.obj_type = BCMOLT_OBJ_ID_GPON_NI; |
| 134 | rx_cfg.rx_cb = user_appl_pon_ni_indication_cb; |
| 135 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 136 | rc = bcmolt_auto_rx_cb_set(current_device, &rx_cfg); |
| 137 | if (rc != BCM_ERR_OK) |
| 138 | { |
| 139 | return rc; |
| 140 | } |
| 141 | |
| 142 | rx_cfg.obj_type = BCMOLT_OBJECT_ANY; |
| 143 | rx_cfg.rx_cb = user_appl_general_indication_cb; |
| 144 | rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE; |
| 145 | return bcmolt_auto_rx_cb_set(current_device, &rx_cfg); |
| 146 | } |
| 147 | |
| 148 | static bcmos_errno user_appl_log_entry_set(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 149 | { |
| 150 | bcmos_errno err; |
| 151 | bcmolt_log_entry_cfg cfg; /**< declare main API struct */ |
| 152 | bcmolt_log_entry_key key = {.log_id= 0}; /**< declare key */ |
| 153 | |
| 154 | /* init the API struct */ |
| 155 | BCMOLT_CFG_INIT(&cfg, log_entry, key); |
| 156 | |
| 157 | BCMOLT_CFG_PROP_SET(&cfg, log_entry, log_level_print, BCMOLT_LOG_LEVEL_INFO); |
| 158 | BCMOLT_CFG_PROP_SET(&cfg, log_entry, log_level_save, BCMOLT_LOG_LEVEL_DEBUG); |
| 159 | /* call API */ |
| 160 | err = bcmolt_cfg_set(0, &cfg.hdr); |
| 161 | return err; |
| 162 | } |
| 163 | |
| 164 | static bcmos_errno user_appl_gpon_ni_disable_indication (bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 165 | { |
| 166 | bcmos_errno err; |
| 167 | bcmolt_gpon_ni_auto_cfg cfg; /**< declare main API struct */ |
| 168 | bcmolt_gpon_ni_key key = {.pon_ni= 0}; /**< declare key */ |
| 169 | |
| 170 | /* init the API struct */ |
| 171 | BCMOLT_AUTO_CFG_INIT(&cfg, gpon_ni, key); |
| 172 | |
| 173 | BCMOLT_AUTO_CFG_PROP_SET(&cfg, gpon_ni, serial_number_acquisition_cycle_start, BCMOS_FALSE); |
| 174 | BCMOLT_AUTO_CFG_PROP_SET(&cfg, gpon_ni, stat_alarm_cleared, BCMOS_FALSE); |
| 175 | /* call API */ |
| 176 | err = bcmolt_auto_cfg_set(0, &cfg.hdr); |
| 177 | return err; |
| 178 | } |
| 179 | |
| 180 | static bcmos_errno user_appl_redirect_device_logger (bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 181 | { |
| 182 | bcmolt_debug_cfg cfg; |
| 183 | bcmolt_debug_key key = {}; |
| 184 | |
| 185 | BCMOLT_CFG_INIT(&cfg, debug, key); |
| 186 | BCMOLT_CFG_PROP_SET(&cfg, debug, console_redirection, BCMOLT_CONSOLE_REDIRECTION_CLONE); |
| 187 | bcmolt_cfg_set(0, &cfg.hdr); |
| 188 | |
| 189 | return BCM_ERR_OK; |
| 190 | } |
| 191 | |
| 192 | static bcmos_errno user_appl_gpon_device_init(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 193 | { |
| 194 | bcmolt_device_cfg cfg; |
| 195 | bcmos_errno err; |
| 196 | bcmolt_device_key key = {.reserved = 0}; |
| 197 | bcmolt_device_nni_speed nni_speed = {}; /**< Device network interface speed configuration */ |
| 198 | bcmolt_device_connect oper; |
| 199 | |
| 200 | nni_speed.first_half = BCMOLT_NNI_SPEED_GBPS_1; |
| 201 | nni_speed.second_half = BCMOLT_NNI_SPEED_GBPS_1; |
| 202 | |
| 203 | BCMOLT_CFG_INIT(&cfg, device, key); |
| 204 | BCMOLT_CFG_PROP_SET(&cfg, device, system_mode, BCMOLT_SYSTEM_MODE_GPON__16_X); |
| 205 | BCMOLT_CFG_PROP_SET(&cfg, device, keepalive_interval, 5); |
| 206 | BCMOLT_CFG_PROP_SET(&cfg, device, keepalive_tolerance, 5); |
| 207 | BCMOLT_CFG_PROP_SET(&cfg, device, nni_speed, nni_speed); |
| 208 | err = bcmolt_cfg_set(0, &cfg.hdr); |
| 209 | if (err != BCM_ERR_OK) |
| 210 | { |
| 211 | return err; |
| 212 | } |
| 213 | |
| 214 | BCMOLT_OPER_INIT(&oper, device, connect, key); |
| 215 | err = bcmolt_oper_submit(0, &oper.hdr); |
| 216 | return err; |
| 217 | } |
| 218 | |
| 219 | static bcmos_errno user_appl_gpon_set_trx(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 220 | { |
| 221 | bcmolt_gpon_trx_cfg cfg; |
| 222 | bcmolt_gpon_trx_key key = {.pon_ni = 0}; |
| 223 | |
| 224 | BCMOLT_CFG_INIT(&cfg, gpon_trx, key); |
| 225 | BCMOLT_CFG_PROP_SET(&cfg, gpon_trx, transceiver_type, BCMOLT_TRX_TYPE_SOURCE_PHOTONICS); |
| 226 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 227 | } |
| 228 | |
| 229 | static bcmos_errno user_appl_gpon_set_interworking_mode(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 230 | { |
| 231 | bcmolt_gpon_iwf_cfg cfg; |
| 232 | bcmolt_gpon_iwf_key key = {.pon_ni = 0}; |
| 233 | |
| 234 | BCMOLT_CFG_INIT(&cfg, gpon_iwf, key); |
| 235 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf, iwf_mode, BCMOLT_IWF_MODE_PER_FLOW_MODE); |
| 236 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 237 | |
| 238 | } |
| 239 | |
| 240 | static bcmos_errno user_appl_gpon_set_mac_table_config(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 241 | { |
| 242 | bcmolt_gpon_iwf_cfg cfg_iwf; |
| 243 | bcmolt_gpon_iwf_key key_iwf = {.pon_ni = 0}; |
| 244 | bcmolt_mac_table_configuration mac_table_configuration; |
| 245 | mac_table_configuration.aging_time = 10000; |
| 246 | mac_table_configuration.automatic_mac_aging = BCMOLT_CONTROL_STATE_DISABLE; |
| 247 | mac_table_configuration.automatic_mac_learning = BCMOLT_CONTROL_STATE_DISABLE; |
| 248 | mac_table_configuration.automatic_mac_move = BCMOLT_CONTROL_STATE_DISABLE; |
| 249 | mac_table_configuration.automatic_static_mode = BCMOLT_CONTROL_STATE_DISABLE; |
| 250 | mac_table_configuration.default_flow_id = 600; |
| 251 | mac_table_configuration.learning_mode = BCMOLT_MAC_TABLE_LEARNING_MODE_NORMAL; |
| 252 | mac_table_configuration.miss_fallback = BCMOLT_MAC_TABLE_MISS_FALLBACK_DEFAULT_FLOW; |
| 253 | |
| 254 | BCMOLT_CFG_INIT(&cfg_iwf, gpon_iwf, key_iwf); |
| 255 | BCMOLT_CFG_PROP_SET(&cfg_iwf, gpon_iwf, mac_table_configuration, mac_table_configuration); |
| 256 | /* must set the IWF to per fow for mac table mapping to work */ |
| 257 | BCMOLT_CFG_PROP_SET(&cfg_iwf, gpon_iwf, iwf_mode, BCMOLT_IWF_MODE_PER_FLOW_MODE); |
| 258 | return bcmolt_cfg_set(0, &cfg_iwf.hdr); |
| 259 | } |
| 260 | |
| 261 | static bcmos_errno user_appl_gpon_activate_pon(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 262 | { |
| 263 | bcmolt_gpon_ni_set_pon_state oper_ni; |
| 264 | bcmolt_gpon_ni_key key_ni = {.pon_ni = 0}; |
| 265 | |
| 266 | BCMOLT_OPER_INIT(&oper_ni, gpon_ni, set_pon_state, key_ni); |
| 267 | BCMOLT_OPER_PROP_SET(&oper_ni, gpon_ni, set_pon_state, pon_state, BCMOLT_PON_OPERATION_ACTIVE_WORKING); |
| 268 | return bcmolt_oper_submit(0, &oper_ni.hdr); |
| 269 | } |
| 270 | |
| 271 | static bcmos_errno user_appl_gpon_start_sn_acquisition(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 272 | { |
| 273 | bcmolt_gpon_ni_cfg cfg_ni; |
| 274 | bcmolt_gpon_ni_key key_ni = {.pon_ni = 0}; |
| 275 | bcmolt_gpon_sn_acquisition sn_acquisition; |
| 276 | |
| 277 | sn_acquisition.control = BCMOLT_CONTROL_STATE_ENABLE; |
| 278 | sn_acquisition.interval = 77000; |
| 279 | sn_acquisition.onu_post_discovery_mode = BCMOLT_ONU_POST_DISCOVERY_MODE_DISABLE; |
| 280 | |
| 281 | BCMOLT_CFG_INIT(&cfg_ni, gpon_ni, key_ni); |
| 282 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, sn_acquisition, sn_acquisition); |
| 283 | return bcmolt_cfg_set(0, &cfg_ni.hdr); |
| 284 | } |
| 285 | |
| 286 | static bcmos_errno user_appl_gpon_ni_get_stats(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 287 | { |
| 288 | bcmolt_gpon_ni_stat stat; /**< declare main API struct */ |
| 289 | bcmolt_gpon_ni_key key = {}; /**< declare key */ |
| 290 | |
| 291 | /* init the API struct */ |
| 292 | BCMOLT_STAT_INIT(&stat, gpon_ni, key); |
| 293 | BCMOLT_STAT_PROP_GET(&stat, gpon_ni, all_properties); |
| 294 | return bcmolt_stat_get(0, &stat.hdr, BCMOS_TRUE); |
| 295 | } |
| 296 | |
| 297 | static bcmos_errno user_appl_gpon_onu_config(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 298 | { |
| 299 | bcmolt_gpon_onu_cfg cfg; |
| 300 | bcmolt_gpon_onu_key key = {.pon_ni = 0, .onu_id = 2}; |
| 301 | bcmolt_serial_number serial_number = {.vendor_id = {0x00,0x00,0x00, 0x00}, .vendor_specific = {0x00,0x00,0x00, 0x02}}; |
| 302 | bcmolt_arr_u8_10 password = {.arr = {0x00,0x00,0x00, 0x00, 0x00,0x00,0x00, 0x00, 0x00, 0x00}}; |
| 303 | |
| 304 | BCMOLT_CFG_INIT(&cfg, gpon_onu, key); |
| 305 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, serial_number, serial_number); |
| 306 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, password, password); |
| 307 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, auto_password_learning, BCMOS_TRUE); |
| 308 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, us_fec, BCMOS_FALSE); |
| 309 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, omci_port_id, 2); |
| 310 | BCMOLT_CFG_PROP_SET(&cfg, gpon_onu, ds_ber_reporting_interval, 5000); |
| 311 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 312 | } |
| 313 | |
| 314 | static bcmos_errno user_appl_gpon_activate_onu(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 315 | { |
| 316 | bcmolt_gpon_onu_set_onu_state oper; |
| 317 | bcmolt_gpon_onu_key key = {.pon_ni = 0, .onu_id = 2}; |
| 318 | |
| 319 | BCMOLT_OPER_INIT(&oper, gpon_onu, set_onu_state, key); |
| 320 | BCMOLT_OPER_PROP_SET(&oper, gpon_onu, set_onu_state, onu_state, BCMOLT_ONU_OPERATION_ACTIVE); |
| 321 | return bcmolt_oper_submit(0, &oper.hdr); |
| 322 | } |
| 323 | |
| 324 | static bcmos_errno user_appl_gpon_alloc_id_config(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 325 | { |
| 326 | bcmolt_gpon_alloc_cfg cfg; |
| 327 | bcmolt_gpon_alloc_key key = {.pon_ni = 0, .alloc_id = 320}; |
| 328 | |
| 329 | bcmolt_pon_alloc_sla sla; /**< Alloc ID SLA. */ |
| 330 | |
| 331 | sla.additional_bw_eligibility = BCMOLT_ADDITIONAL_BW_ELIGIBILITY_NON_ASSURED; |
| 332 | sla.cbr_rt_bw = 0; |
| 333 | sla.cbr_nrt_bw = 140000000; |
| 334 | sla.guaranteed_bw = 140000000; |
| 335 | sla.maximum_bw = 140000000; |
| 336 | sla.alloc_type = BCMOLT_ALLOC_TYPE_NSR; |
| 337 | sla.cbr_rt_compensation = BCMOS_FALSE; |
| 338 | sla.cbr_nrt_ap_index = 0; |
| 339 | sla.cbr_rt_ap_index = 0; |
| 340 | sla.weight = 0; |
| 341 | sla.priority = 0; |
| 342 | |
| 343 | BCMOLT_CFG_INIT(&cfg, gpon_alloc, key); |
| 344 | BCMOLT_CFG_PROP_SET(&cfg, gpon_alloc, onu_id, 2); |
| 345 | BCMOLT_CFG_PROP_SET(&cfg, gpon_alloc, sla, sla); |
| 346 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 347 | } |
| 348 | |
| 349 | /* Configure a GEM - for DS or bidirectional traffic */ |
| 350 | static bcmos_errno user_appl_gpon_gem_port_config(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 351 | { |
| 352 | bcmolt_gpon_gem_port_cfg cfg; |
| 353 | bcmolt_gpon_gem_port_key key = {.pon_ni = 0, .gem_port_id = 320}; |
| 354 | |
| 355 | bcmolt_gem_port_configuration configuration = {.direction = BCMOLT_GEM_PORT_DIRECTION_BIDIRECTIONAL, .type = BCMOLT_GEM_PORT_TYPE_UNICAST}; |
| 356 | BCMOLT_CFG_INIT(&cfg, gpon_gem_port, key); |
| 357 | BCMOLT_CFG_PROP_SET(&cfg, gpon_gem_port, onu_id, 2); |
| 358 | BCMOLT_CFG_PROP_SET(&cfg, gpon_gem_port, downstream_encryption_mode, BCMOLT_CONTROL_STATE_DISABLE); |
| 359 | BCMOLT_CFG_PROP_SET(&cfg, gpon_gem_port, configuration, configuration); |
| 360 | BCMOLT_CFG_PROP_SET(&cfg, gpon_gem_port, upstream_destination_queue, BCMOLT_US_GEM_PORT_DESTINATION_DATA); |
| 361 | BCMOLT_CFG_PROP_SET(&cfg, gpon_gem_port, control, BCMOLT_CONTROL_STATE_ENABLE); |
| 362 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 363 | } |
| 364 | |
| 365 | static bcmos_errno user_appl_gpon_ds_gem_port_modify(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 366 | { |
| 367 | /* this can only be called in PER flow mode */ |
| 368 | /* set DS port mapping initial GEM 300, final GEM 320 */ |
| 369 | bcmolt_gpon_iwf_ds_egress_flow_key key = {.pon_ni = 0, .flow_id = 300}; |
| 370 | bcmolt_gpon_iwf_ds_egress_flow_cfg cfg; |
| 371 | |
| 372 | BCMOLT_CFG_INIT(&cfg, gpon_iwf_ds_egress_flow, key); |
| 373 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_ds_egress_flow, gem_port, 320); |
| 374 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 375 | } |
| 376 | |
| 377 | static bcmos_errno user_appl_gpon_set_ds_per_vlan_mapping_method(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 378 | { |
| 379 | /* When working with per flow mode the user must add an entry for each VID (flow) this way */ |
| 380 | bcmolt_gpon_iwf_ds_ingress_flow_key key = {.pon_ni = 0, .vlan_id = 300}; |
| 381 | bcmolt_gpon_iwf_ds_ingress_flow_cfg cfg; |
| 382 | |
| 383 | BCMOLT_CFG_INIT(&cfg, gpon_iwf_ds_ingress_flow, key); |
| 384 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_ds_ingress_flow, mapping_method, BCMOLT_VLAN_TO_FLOW_MAPPING_METHOD_VID); |
| 385 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_ds_ingress_flow, mapping_tag, BCMOLT_MAPPING_TAG_METHOD_OUTER_VID); |
| 386 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_ds_ingress_flow, vlan_action, BCMOLT_DS_VLAN_ACTION_TRANSPARENT); |
| 387 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 388 | } |
| 389 | |
| 390 | static bcmos_errno user_appl_gpon_send_omci_packet(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 391 | { |
| 392 | bcmolt_gpon_onu_cpu_packets proxy; /**< declare main API struct */ |
| 393 | bcmolt_gpon_onu_key key = {.pon_ni = 0, .onu_id = 2}; /**< declare key */ |
| 394 | bcmolt_u8_list_u32_max_2048 buffer; |
| 395 | uint8_t cpu_buf[100]; |
| 396 | buffer.len = 48; |
| 397 | buffer.val = cpu_buf; |
| 398 | |
| 399 | /* init the API struct */ |
| 400 | BCMOLT_PROXY_INIT(&proxy, gpon_onu, cpu_packets, key); |
| 401 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_onu, cpu_packets, packet_type, BCMOLT_PACKET_TYPE_OMCI); |
| 402 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_onu, cpu_packets, calc_crc, BCMOS_TRUE); |
| 403 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_onu, cpu_packets, number_of_packets, 1); |
| 404 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_onu, cpu_packets, packet_size, 48); |
| 405 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_onu, cpu_packets, buffer, buffer); |
| 406 | |
| 407 | /* call API */ |
| 408 | return bcmolt_proxy_send(0, &proxy.hdr); |
| 409 | } |
| 410 | |
| 411 | static bcmos_errno user_appl_gpon_send_cpu_packets_over_gem_ports(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 412 | { |
| 413 | bcmolt_gpon_ni_cpu_packets proxy; /**< declare main API struct */ |
| 414 | bcmolt_gpon_ni_key key = {.pon_ni = 0}; /**< declare key */ |
| 415 | bcmolt_gpon_gem_id gem_port_id_array[10]; |
| 416 | bcmolt_gpon_gem_id_list_u8_max_16 gem_port_list; |
| 417 | bcmolt_u8_list_u32_max_2048 buffer; |
| 418 | uint8_t cpu_buf[100]; |
| 419 | buffer.len = 96; |
| 420 | buffer.val = cpu_buf; |
| 421 | |
| 422 | gem_port_list.len = 10; |
| 423 | gem_port_list.val = gem_port_id_array; |
| 424 | |
| 425 | /* init the API struct */ |
| 426 | BCMOLT_PROXY_INIT(&proxy, gpon_ni, cpu_packets, key); |
| 427 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_ni, cpu_packets, packet_type, BCMOLT_PACKET_TYPE_CPU); |
| 428 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_ni, cpu_packets, calc_crc, BCMOS_TRUE); |
| 429 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_ni, cpu_packets, gem_port_list, gem_port_list); |
| 430 | BCMOLT_PROXY_PROP_SET(&proxy, gpon_ni, cpu_packets, buffer, buffer); |
| 431 | |
| 432 | /* call API */ |
| 433 | return bcmolt_proxy_send(0, &proxy.hdr); |
| 434 | } |
| 435 | |
| 436 | static bcmos_errno user_appl_gpon_add_mac_entry(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 437 | { |
| 438 | /* this can only be called in per flow mode. */ |
| 439 | /* In order to pass traffic you must also add an entry to IWF ingress port as described in _gpon_set_per_vlan_mapping_method */ |
| 440 | bcmolt_gpon_iwf_mac_table_cfg cfg; |
| 441 | bcmolt_gpon_iwf_mac_table_key key = {.pon_ni = 0, .mac_address.u8 = {0x00,0x00,0x00, 0x00, 0x00,0x00}, .vlan = 320}; |
| 442 | |
| 443 | BCMOLT_CFG_INIT(&cfg, gpon_iwf_mac_table, key); |
| 444 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_mac_table, flow_id, 320); |
| 445 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 446 | } |
| 447 | |
| 448 | static bcmos_errno user_appl_gpon_dump_mac_table(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 449 | { |
| 450 | const uint16_t max_msgs_per_call = 10; |
| 451 | const bcmolt_devid device = 0; |
| 452 | const uint16_t pon = 0; |
| 453 | |
| 454 | bcmos_errno err; |
| 455 | bcmolt_msg_set *msg_set; |
| 456 | bcmolt_gpon_iwf_mac_table_cfg filter; |
| 457 | uint16_t i; |
| 458 | uint16_t count = 0; |
| 459 | |
| 460 | /* a key of all Fs means "start from the beginning" */ |
| 461 | bcmolt_gpon_iwf_mac_table_key wildcard_key = |
| 462 | { .pon_ni = pon, .mac_address.u8 = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, .vlan = 0xFFFF }; |
| 463 | |
| 464 | /* allocate space for the return values */ |
| 465 | err = bcmolt_msg_set_alloc(BCMOLT_OBJ_ID_GPON_IWF_MAC_TABLE, BCMOLT_MGT_GROUP_CFG, max_msgs_per_call, &msg_set); |
| 466 | if (err != BCM_ERR_OK) |
| 467 | { |
| 468 | return err; |
| 469 | } |
| 470 | |
| 471 | /* initialize the filter structure and ask to read the flow ID / static flag */ |
| 472 | BCMOLT_CFG_INIT(&filter, gpon_iwf_mac_table, wildcard_key); |
| 473 | BCMOLT_MSGSET_CFG_PROP_GET(msg_set, gpon_iwf_mac_table, flow_id); |
| 474 | BCMOLT_MSGSET_CFG_PROP_GET(msg_set, gpon_iwf_mac_table, stat); |
| 475 | |
| 476 | /* filter to only include non-static entries (you could also filter on flow ID, or omit this to include all) */ |
| 477 | BCMOLT_CFG_PROP_SET(&filter, gpon_iwf_mac_table, stat, BCMOS_FALSE); |
| 478 | |
| 479 | do |
| 480 | { |
| 481 | /* call get multiple objects API function */ |
| 482 | err = bcmolt_cfg_get_multi(device, &filter.hdr, BCMOLT_FILTER_FLAGS_NONE, msg_set); |
| 483 | if (err != BCM_ERR_OK) |
| 484 | { |
| 485 | bcmcli_session_print(session, "bcmolt_cfg_get_multi returned error: %s (%d)\n", bcmos_strerror(err), err); |
| 486 | break; |
| 487 | } |
| 488 | |
| 489 | /* print each key/config structure that was received */ |
| 490 | for (i = 0; i < msg_set->num_instances; i++) |
| 491 | { |
| 492 | bcmolt_gpon_iwf_mac_table_cfg *cfg = (bcmolt_gpon_iwf_mac_table_cfg *)msg_set->msg[i]; |
| 493 | bcmcli_session_print( |
| 494 | session, |
| 495 | "entry[%d] MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", |
| 496 | count, |
| 497 | cfg->key.mac_address.u8[0], |
| 498 | cfg->key.mac_address.u8[1], |
| 499 | cfg->key.mac_address.u8[2], |
| 500 | cfg->key.mac_address.u8[3], |
| 501 | cfg->key.mac_address.u8[4], |
| 502 | cfg->key.mac_address.u8[5]); |
| 503 | bcmcli_session_print(session, "entry[%d] VID: %d\n", count, cfg->key.vlan); |
| 504 | bcmcli_session_print(session, "entry[%d] flow ID: %d\n", count, cfg->data.flow_id); |
| 505 | bcmcli_session_print(session, "entry[%d] static: %s\n", count, cfg->data.stat ? "yes" : "no"); |
| 506 | count++; |
| 507 | } |
| 508 | |
| 509 | /* update the key for next call */ |
| 510 | filter.key = *((bcmolt_gpon_iwf_mac_table_key *)msg_set->next_key); |
| 511 | |
| 512 | /* keep calling the function until we have retrieved all entries */ |
| 513 | } while (msg_set->more); |
| 514 | |
| 515 | bcmolt_msg_set_free(msg_set); |
| 516 | return BCM_ERR_OK; |
| 517 | } |
| 518 | |
| 519 | static bcmos_errno user_appl_gpon_set_us_flow_configuration(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 520 | { |
| 521 | bcmolt_gpon_iwf_us_flow_cfg cfg; |
| 522 | bcmolt_gpon_iwf_us_flow_key key = {.pon_ni = 0, .gem_port_id = 320}; |
| 523 | bcmolt_vlan_tag vlan_tag; |
| 524 | |
| 525 | /* vlad tag parameters for the add vlan */ |
| 526 | vlan_tag.pbit = 9; |
| 527 | vlan_tag.vlan_id = 300; |
| 528 | |
| 529 | BCMOLT_CFG_INIT(&cfg, gpon_iwf_us_flow, key); |
| 530 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_us_flow, flow_id, 320); |
| 531 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_us_flow, mac_learning, BCMOS_FALSE); |
| 532 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_us_flow, vlan_action, BCMOLT_US_VLAN_ACTION_ADD); |
| 533 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_us_flow, vlan_tag, vlan_tag); |
| 534 | /* what is the tpid index */ |
| 535 | BCMOLT_CFG_PROP_SET(&cfg, gpon_iwf_us_flow, tpid_index, 0); |
| 536 | return bcmolt_cfg_set(0, &cfg.hdr); |
| 537 | } |
| 538 | |
| 539 | static bcmos_errno user_appl_gpon_configure_and_activate_pon(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 540 | { |
| 541 | /* TRX and PON Link configuration structures + PON control operation */ |
| 542 | bcmos_errno rc; |
| 543 | bcmolt_gpon_ni_key key_ni = {.pon_ni = 0}; |
| 544 | bcmolt_gpon_ni_cfg cfg_ni; |
| 545 | bcmolt_gpon_ni_set_pon_state oper_ni; |
| 546 | |
| 547 | bcmolt_gpon_sn_acquisition sn_acquisition = {.control = BCMOLT_CONTROL_STATE_ENABLE, .interval = 10000, .onu_post_discovery_mode = BCMOLT_ONU_POST_DISCOVERY_MODE_NONE}; |
| 548 | bcmolt_pon_drift_control drift_control = {.drift_interval = 1000, .drift_limit = 4, .transmission_control_limit = 8}; |
| 549 | bcmolt_ber_monitor_params ber_monitor = {.us_ber_interval = 1000, .sd_threshold = 5, .sf_threshold = 3}; |
| 550 | bcmolt_gpon_trx_key key_trx = {.pon_ni = 0}; |
| 551 | bcmolt_gpon_trx_cfg cfg_trx; |
| 552 | bcmolt_trx_delimiter delimiter = {}; |
| 553 | |
| 554 | /* overide only the relevant parameters */ |
| 555 | delimiter.pattern[0] = 0x0B; |
| 556 | delimiter.pattern[1] = 0x59; |
| 557 | delimiter.pattern[2] = 0x83; |
| 558 | delimiter.size = 3; |
| 559 | delimiter.window_size = 124; |
| 560 | |
| 561 | BCMOLT_CFG_INIT(&cfg_trx, gpon_trx, key_trx); |
| 562 | BCMOLT_CFG_PROP_SET(&cfg_trx, gpon_trx, transceiver_type, BCMOLT_TRX_TYPE_SOURCE_PHOTONICS); |
| 563 | BCMOLT_CFG_PROP_SET(&cfg_trx, gpon_trx, delimiter, delimiter); |
| 564 | rc = bcmolt_cfg_set(0, &cfg_trx.hdr); |
| 565 | if (rc != BCM_ERR_OK) |
| 566 | { |
| 567 | bcm_dev_log_log(user_appl_ex_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER, |
| 568 | "Error in set trx %d", rc); |
| 569 | } |
| 570 | |
| 571 | /* Initialize and configure PON */ |
| 572 | BCMOLT_CFG_INIT(&cfg_ni, gpon_ni, key_ni); |
| 573 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, sn_acquisition, sn_acquisition); |
| 574 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, drift_control, drift_control); |
| 575 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, ber_monitor, ber_monitor); |
| 576 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, ds_ber_reporting_interval, 1000); |
| 577 | BCMOLT_CFG_PROP_SET(&cfg_ni, gpon_ni, preassigned_equalization_delay, 0); |
| 578 | rc = bcmolt_cfg_set(0, &cfg_ni.hdr); |
| 579 | if (rc != BCM_ERR_OK) |
| 580 | { |
| 581 | return rc; |
| 582 | } |
| 583 | |
| 584 | BCMOLT_OPER_INIT(&oper_ni, gpon_ni, set_pon_state, key_ni); |
| 585 | BCMOLT_OPER_PROP_SET(&oper_ni, gpon_ni, set_pon_state, pon_state, BCMOLT_PON_OPERATION_ACTIVE_WORKING); |
| 586 | return bcmolt_oper_submit(0, &oper_ni.hdr); |
| 587 | } |
| 588 | |
| 589 | static bcmos_errno gpon_add_activate_onu (bcmolt_devid dev, bcmolt_gpon_ni pon_ni, bcmolt_gpon_onu_id onu_id, bcmolt_serial_number serial_number) |
| 590 | { |
| 591 | bcmolt_gpon_onu_cfg onu_cfg; |
| 592 | bcmolt_gpon_onu_key onu_key = {.pon_ni = pon_ni, .onu_id = onu_id}; |
| 593 | bcmolt_gpon_onu_set_onu_state onu_oper; |
| 594 | bcmolt_arr_u8_10 password = {.arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}; |
| 595 | bcmolt_gpon_gem_port_cfg gem_cfg; |
| 596 | bcmolt_gpon_gem_port_key gem_key = {.pon_ni = pon_ni, .gem_port_id = onu_id}; |
| 597 | bcmos_errno rc; |
| 598 | |
| 599 | BCMOLT_CFG_INIT(&onu_cfg, gpon_onu, onu_key); |
| 600 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, serial_number, serial_number); |
| 601 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, password, password); |
| 602 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, auto_password_learning, BCMOS_TRUE); |
| 603 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, us_fec, BCMOS_TRUE); |
| 604 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, omci_port_id, 2); |
| 605 | BCMOLT_CFG_PROP_SET(&onu_cfg, gpon_onu, ds_ber_reporting_interval, 5000); |
| 606 | rc = bcmolt_cfg_set(dev, &onu_cfg.hdr); |
| 607 | if (rc) |
| 608 | { |
| 609 | return rc; |
| 610 | } |
| 611 | |
| 612 | BCMOLT_CFG_INIT(&gem_cfg, gpon_gem_port, gem_key); |
| 613 | BCMOLT_CFG_PROP_SET(&gem_cfg, gpon_gem_port, downstream_encryption_mode, BCMOLT_CONTROL_STATE_ENABLE); |
| 614 | rc = bcmolt_cfg_set(dev, &gem_cfg.hdr); |
| 615 | if (rc) |
| 616 | { |
| 617 | return rc; |
| 618 | } |
| 619 | |
| 620 | BCMOLT_OPER_INIT(&onu_oper, gpon_onu, set_onu_state, onu_key); |
| 621 | BCMOLT_OPER_PROP_SET(&onu_oper, gpon_onu, set_onu_state, onu_state, BCMOLT_ONU_OPERATION_ACTIVE); |
| 622 | rc = bcmolt_oper_submit(dev, &onu_oper.hdr); |
| 623 | return rc; |
| 624 | } |
| 625 | |
| 626 | static bcmos_errno user_appl_gpon_config_and_activate_onu (bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms) |
| 627 | { |
| 628 | bcmolt_serial_number serial_number = {.vendor_id = {0x00,0x00,0x00, 0x00}, .vendor_specific = {0x00,0x00,0x00, 0x02}}; |
| 629 | return gpon_add_activate_onu(0, 0, 2, serial_number); |
| 630 | } |
| 631 | |
| 632 | static bcmos_errno user_appl_epon_get_all_link_alarms(bcmcli_session *session, |
| 633 | const bcmcli_cmd_parm parm[], |
| 634 | uint16_t nparms) |
| 635 | { |
| 636 | const uint16_t max_msgs_per_call = 10; |
| 637 | const bcmolt_devid device_id = 0; |
| 638 | const uint16_t pon = 0; |
| 639 | /* configure filter to select only links which do NOT have all alarms off */ |
| 640 | const bcmolt_filter_flags flags = BCMOLT_FILTER_FLAGS_INVERT_SELECTION; |
| 641 | const bcmolt_epon_link_alarm_state alarm_state_filter = |
| 642 | { |
| 643 | .invalid_mpcp_report_received = BCMOLT_STATUS_OFF, |
| 644 | .key_exchange_failure = BCMOLT_STATUS_OFF, |
| 645 | .mpcp_report_timeout = BCMOLT_STATUS_OFF, |
| 646 | .oam_keepalive_timeout = BCMOLT_STATUS_OFF, |
| 647 | }; |
| 648 | |
| 649 | bcmos_errno err = BCM_ERR_OK; |
| 650 | bcmolt_msg_set *msg_set; |
| 651 | bcmolt_epon_link_cfg filter; |
| 652 | bcmolt_epon_link_key wildcard_key; |
| 653 | uint16_t i; |
| 654 | |
| 655 | /* retrieve the EPON NI MAC address */ |
| 656 | bcmolt_epon_ni_cfg pon_cfg; |
| 657 | bcmolt_epon_ni_key pon_key = { .epon_ni = pon }; |
| 658 | |
| 659 | BCMOLT_CFG_INIT(&pon_cfg, epon_ni, pon_key); |
| 660 | BCMOLT_CFG_PROP_GET(&pon_cfg, epon_ni, mac_address); |
| 661 | err = bcmolt_cfg_get(device_id, &pon_cfg.hdr); |
| 662 | if (BCM_ERR_OK != err) |
| 663 | { |
| 664 | bcmcli_session_print(session, "Failed to retrieve EPON NI MAC address!\n"); |
| 665 | return err; |
| 666 | } |
| 667 | |
| 668 | /* a key with the EPON NI MAC address means "start from the beginning" */ |
| 669 | wildcard_key.epon_ni = pon; |
| 670 | wildcard_key.mac_address = pon_cfg.data.mac_address; |
| 671 | |
| 672 | /* allocate space for the return values */ |
| 673 | err = bcmolt_msg_set_alloc(BCMOLT_OBJ_ID_EPON_LINK, BCMOLT_MGT_GROUP_CFG, max_msgs_per_call, &msg_set); |
| 674 | if (BCM_ERR_OK != err) |
| 675 | { |
| 676 | bcmcli_session_print(session, "Failed to allocate space for return!\n"); |
| 677 | return err; |
| 678 | } |
| 679 | |
| 680 | /* initialize the filter structure and ask to read the alarm state */ |
| 681 | BCMOLT_CFG_INIT(&filter, epon_link, wildcard_key); |
| 682 | BCMOLT_MSGSET_CFG_PROP_GET(msg_set, epon_link, alarm_state); |
| 683 | |
| 684 | /* apply filter */ |
| 685 | BCMOLT_CFG_PROP_SET(&filter, epon_link, alarm_state, alarm_state_filter); |
| 686 | |
| 687 | do |
| 688 | { |
| 689 | /* call get multiple objects API function */ |
| 690 | err = bcmolt_cfg_get_multi(device_id, &filter.hdr, flags, msg_set); |
| 691 | if (BCM_ERR_OK != err) |
| 692 | { |
| 693 | bcmcli_session_print(session, "bcmolt_cfg_get_multi returned error: %s (%d)\n", bcmos_strerror(err), err); |
| 694 | break; |
| 695 | } |
| 696 | |
| 697 | /* print each key/config that was received */ |
| 698 | for (i = 0; i < msg_set->num_instances; i++) |
| 699 | { |
| 700 | bcmolt_epon_link_cfg *cfg = (bcmolt_epon_link_cfg*)msg_set->msg[i]; |
| 701 | bcmcli_session_print(session, "Link: NI %u, MAC %02x%02x%02x%02x%02x%02x\n", |
| 702 | cfg->key.epon_ni, |
| 703 | cfg->key.mac_address.u8[0], |
| 704 | cfg->key.mac_address.u8[1], |
| 705 | cfg->key.mac_address.u8[2], |
| 706 | cfg->key.mac_address.u8[3], |
| 707 | cfg->key.mac_address.u8[4], |
| 708 | cfg->key.mac_address.u8[5]); |
| 709 | bcmcli_session_print(session, "\tInvalid MPCP Report Received: %u\n", |
| 710 | cfg->data.alarm_state.invalid_mpcp_report_received); |
| 711 | bcmcli_session_print(session, "\tKey Exchange failure: %u\n", |
| 712 | cfg->data.alarm_state.key_exchange_failure); |
| 713 | bcmcli_session_print(session, "\tMPCP Report Timeout: %u\n", |
| 714 | cfg->data.alarm_state.mpcp_report_timeout); |
| 715 | bcmcli_session_print(session, "\tOAM Keepalive Timeout: %u\n", |
| 716 | cfg->data.alarm_state.oam_keepalive_timeout); |
| 717 | } |
| 718 | |
| 719 | /* update the key for next call */ |
| 720 | filter.key = *((bcmolt_epon_link_key*)msg_set->next_key); |
| 721 | |
| 722 | /* keep calling the function until we have retrieved all entries */ |
| 723 | } while (msg_set->more); |
| 724 | |
| 725 | bcmolt_msg_set_free(msg_set); |
| 726 | return err; |
| 727 | } |
| 728 | #endif |
| 729 | |
| 730 | bcmos_errno bcmolt_user_appl_ex_cli_init(void) |
| 731 | { |
| 732 | bcmcli_entry *parent = bcmcli_dir_find(NULL, "user"); |
| 733 | bcmcli_entry *dir; |
| 734 | |
| 735 | #ifdef ENABLE_LOG |
| 736 | user_appl_ex_log_id = bcm_dev_log_id_register("user_appl_ex", DEV_LOG_LEVEL_DEBUG, DEV_LOG_ID_TYPE_BOTH); |
| 737 | #endif |
| 738 | |
| 739 | dir = bcmcli_dir_add(parent, "example", "User application", BCMCLI_ACCESS_ADMIN, NULL); |
| 740 | BCMOS_CHECK_RETURN_ERROR(!dir, BCM_ERR_NOMEM); |
| 741 | #ifdef ENABLE_LOG |
| 742 | |
| 743 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_device_init", "gpon device init", user_appl_gpon_device_init); |
| 744 | BCMCLI_MAKE_CMD_NOPARM(dir, "indication_handler", "indication handler", user_appl_indication_handler); |
| 745 | BCMCLI_MAKE_CMD_NOPARM(dir, "log_entry_set", "log enrty set", user_appl_log_entry_set); |
| 746 | BCMCLI_MAKE_CMD_NOPARM(dir, "redirect_device_logger", "redirect device logger", user_appl_redirect_device_logger); |
| 747 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_ni_disable_indication", "gpon_ni_disable_indication", user_appl_gpon_ni_disable_indication); |
| 748 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_ni_get_stats", "gpon_ni_get_stats", user_appl_gpon_ni_get_stats); |
| 749 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_start_sn_acquisition", "gpon start sn acquisition", user_appl_gpon_start_sn_acquisition); |
| 750 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_set_mac_table_config", "gpon set mac table config", user_appl_gpon_set_mac_table_config); |
| 751 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_set_interworking_mode", "gpon set interworking mode", user_appl_gpon_set_interworking_mode); |
| 752 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_set_trx", "gpon set trx", user_appl_gpon_set_trx); |
| 753 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_activate_pon", "gpon activate pon", user_appl_gpon_activate_pon); |
| 754 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_onu_config", "gpon onu config", user_appl_gpon_onu_config); |
| 755 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_activate_onu", "gpon activate onu", user_appl_gpon_activate_onu); |
| 756 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_alloc_id_config", "gpon alloc config", user_appl_gpon_alloc_id_config); |
| 757 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_gem_port_config", "gpon gem port config", user_appl_gpon_gem_port_config); |
| 758 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_add_mac_entry", "gpon add mac entry", user_appl_gpon_add_mac_entry); |
| 759 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_dump_mac_table", "print entire GPON MAC table", user_appl_gpon_dump_mac_table); |
| 760 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_ds_gem_port_modify", " gpon ds gem port modify", user_appl_gpon_ds_gem_port_modify); |
| 761 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_set_per_vlan_mapping_method", "gpon set per vlan mapping method", user_appl_gpon_set_ds_per_vlan_mapping_method); |
| 762 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_set_us_flow_configuration", "gpon set us flow configuration", user_appl_gpon_set_us_flow_configuration); |
| 763 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_send_omci_packet", "appl gpon send omci packet", user_appl_gpon_send_omci_packet); |
| 764 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_send_cpu_packets_over_gem_ports", "gpon send cpu packets over gem ports", user_appl_gpon_send_cpu_packets_over_gem_ports); |
| 765 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_configure_and_activate_pon", "configure and activate pon", user_appl_gpon_configure_and_activate_pon); |
| 766 | BCMCLI_MAKE_CMD_NOPARM(dir, "gpon_config_and_activate_onu", "config and activate onu", user_appl_gpon_config_and_activate_onu); |
| 767 | BCMCLI_MAKE_CMD_NOPARM(dir, "epon_get_all_link_alarms", "retrieve all link alarms", user_appl_epon_get_all_link_alarms); |
| 768 | #endif |
| 769 | return BCM_ERR_OK; |
| 770 | } |
| 771 | |