openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

ctest_dnxc_utils.h (4036B)


      1 /*
      2  * ! \file ctest_dnxc_util.h Contains common dnxc ctest utilities
      3  */
      4 /*
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      8  */
      9 #ifndef CTEST_DNXC_UTILS_H_INCLUDED
     10 #define CTEST_DNXC_UTILS_H_INCLUDED
     11 
     12 #include <appl/diag/sand/diag_sand_framework.h>
     13 #include <shared/utilex/utilex_rhlist.h>
     14 
     15 shr_error_e ctest_dnxc_init_deinit(
     16     int unit,
     17     char *command);
     18 
     19 /**
     20  * \brief Control structure for command keyword definition, provided by framework
     21  */
     22 typedef struct
     23 {
     24     char *property;
     25     char *value;
     26 } ctest_soc_property_t;
     27 
     28 typedef struct
     29 {
     30     rhentry_t entry;
     31     char *value;
     32 } ctest_soc_entry_t;
     33 
     34 typedef struct
     35 {
     36     sal_field_type_e type;
     37     union
     38     {
     39         int32 value_int32;
     40         uint32 value_uint32;
     41         char *value_str_ptr;
     42     } value;
     43 } ctest_cint_argument_t;
     44 
     45 /**
     46  * \brief Modify soc properties according to provided list of names/values and perform deinit/init to bring them into
     47  *              action
     48  * \param [in] unit - device ID
     49  * \param [in] ctest_soc_property_a - pointer to the list of properties - name/value pair,
     50  *                                                                              last one name should be NULL or empty
     51  * \param [out] ctest_soc_set_h - place where handle to be used in restore will be put, if the handle is NULL,
     52  *                                                                              no changes in soc properties happened
     53  * \return
     54  *   usual shr_error_e
     55  * \remark
     56  *   ctest_dnxc_restore_soc_properties should always be called if the handle is not NULL, it restore the previous state
     57  *   and frees the resources, it may be called even if it is NULL, nothing bad will happen
     58  * \see
     59  *   ctest_dnxc_restore_soc_properties
     60  */
     61 shr_error_e ctest_dnxc_set_soc_properties(
     62     int unit,
     63     ctest_soc_property_t * ctest_soc_property_a,
     64     rhhandle_t * ctest_soc_set_h);
     65 
     66 /**
     67  * \brief Return soc properties to the state previous to ctest_dnxc_set_soc_properties and invoke deinit/init
     68  * \param [in] unit - device ID
     69  * \param [out] ctest_soc_set_h - handle that points to the structure keeping record of previous so property state
     70  * \return
     71  *   usual shr_error_e
     72  * \remark
     73  * \see
     74  *   ctest_dnxc_set_soc_properties
     75  */
     76 shr_error_e ctest_dnxc_restore_soc_properties(
     77     int unit,
     78     rhhandle_t ctest_soc_set_h);
     79 
     80 /**
     81  * \brief Load cint source file either from under $SDK/src/examples or as SA file
     82  *
     83  * \param [in] unit - device ID
     84  * \param [in] cint_filename - file name should either include path from $SDK/src/examples
     85  *                              or to be available as is (absolute or relative to local)
     86  * \return
     87  *   usual shr_error_e
     88  * \remark
     89  */
     90 shr_error_e ctest_dnxc_cint_load(
     91     int unit,
     92     char *cint_filename);
     93 
     94 /**
     95  * \brief Load cint source file either from under $SDK/src/examples or as SA file
     96  *
     97  * \param [in] unit - device ID
     98  * \param [in] main_name - ctest routine to be invoked
     99  * \param [in] cint_arguments - pointer to array of cint arguments, with type and value per argument, assumption s that
    100  *                              unit is always the first parameter, so start array from the parameter following unit
    101  * \param [in] nof_arguments - number of arguments in the array
    102  * \return
    103  *   usual shr_error_e
    104  * \remark
    105  */
    106 shr_error_e ctest_dnxc_cint_run(
    107     int unit,
    108     char *main_name,
    109     ctest_cint_argument_t * cint_arguments,
    110     int nof_arguments);
    111 
    112 /**
    113  * \brief Reset cint - actually run cint_reset();
    114  *
    115  * \param [in] unit - device ID
    116 
    117  * \return
    118  *   usual shr_error_e
    119  * \remark
    120  */
    121 shr_error_e ctest_dnxc_cint_reset(
    122     int unit);
    123 
    124 /**
    125  * \brief Perform arbitrary command that can be run inside cint interpreter
    126  *
    127  * \param [in] command - command to perform by cint interpreter
    128 
    129  * \return
    130  *   According to regular shr_error
    131  * \remark
    132  */
    133 shr_error_e ctest_dnxc_cint_cmd(
    134     char *command);
    135 
    136 #endif /* CTEST_DNXC_UTILS_H_INCLUDED */