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

test_oamp.h (5676B)


      1 /* 
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5  */ 
      6 #ifdef _ERR_MSG_MODULE_NAME
      7   #error "_ERR_MSG_MODULE_NAME redefined"
      8 #endif
      9 
     10 /* Defines */
     11 #define _ERR_MSG_MODULE_NAME BSL_BCM_OAM
     12 #define TEST_BFD_VLAN                       10          /* VID = 10 */
     13 #define TEST_BFD_DETEC_MULT_3               3           /* Detect Multiplier = 3 */
     14 #define TEST_BFD_DETECTION_TIME_10MS        100000      /* Detection time = 10ms */
     15 #define TEST_BFD_REMOTE_IP                  0x09010164  /* Destination IP*/
     16 #define TEST_BFD_MAX_NUM_PERIODS            7           /* Maximum number of allowed periods*/
     17 #define TEST_BFD_NUM_DEF_PERIODS            6           /* Number of predifined values for EP periods*/
     18 #define TEST_BFD_MAX_NUM_INTERVALS          8           /* Maximum number of values for Required Min RX and Desire Min TX Interval */
     19 #define TEST_BFD_NUM_IP                     16          /* Maximum number of IPs */
     20 
     21 #define NUMBER_OF_COUNTERS_PER_COUNTER_SOURCE SOC_DPP_DEFS_GET(unit,counters_per_counter_processor) * 2
     22 #define OAMP_TEST_DEF_PORT_1                13          /* Default value for port_1 */
     23 #define OAMP_TEST_DEF_PORT_2                14          /* Default value for port_2*/
     24 #define OAMP_TEST_DEF_SHORT_MAID            0           /* Default value for maid*/
     25 #define OAMP_TEST_DEF_NUM_EP_PAIRS          1024        /* Default value for number pairs of endpoint*/
     26 #define OAMP_TEST_DEF_SEED                  0           /* Default value for seed number */
     27 #define OAMP_TEST_MAX_NUM_DEVICES           2           
     28 #define OAMP_TEST_DEF_NUM_STATES            0           /* Default value for number of states to be changed */
     29 #define OAMP_TEST_DEF_NUM_UPDATE            0           /* Default value for number update of period */
     30 #define OAMP_TEST_DEF_NORMAL                0           /* Default value for BFD time-test flag */
     31 #define OAMP_TEST_TIME                      1
     32 #define TEST_OAM_NUM_LIFS                   1024
     33 
     34 typedef struct oamp_test_init_param_s {
     35     char *option;                                       /* Test type (BFD/OAM) */
     36     int port1;                                          /* port on which endpoints will be defined*/
     37     int port2;                                          /* port on which endpoints will be defined*/
     38     int numEndpoints;                                   /* Number of endpoints to be created*/
     39     int seed;                                           /* Seed of the test*/
     40     int numStates;                                      /* The number of times that the state will be change */
     41     int numUpdate;                                      /* The number of random MEPS to be updated */
     42     int testSLM;
     43     int EndpointCreationTimeTest;                       /* BFD time test flag*/
     44     int timeoutEventsTest;                              /* BFD time out events test*/
     45     int is_Maid48;                                         /* Create MEPs with MAID48 */
     46 } oamp_test_init_param_t;
     47 
     48 typedef struct _bcm_dpp_oam_bfd_sw_db_lock_s {
     49     sal_mutex_t lock;
     50     int is_init;
     51 } test_bfd_lock_t;
     52 
     53 typedef struct endpoint_create_info_s {
     54     int id;
     55     int vlan;
     56     bcm_gport_t vlan_port_id;
     57     int name;
     58     int level;
     59     int port;
     60     int counter_base_id;
     61     unsigned int is_rdi;
     62 	int mac;
     63 } endpoint_create_info_t;
     64 
     65 #define TEST_BFD_INFO_LOCK \
     66     if (sal_mutex_take(test_bfd_info_lock.lock, sal_mutex_FOREVER)) { \
     67         BCMDNX_ERR_EXIT_MSG(BCM_E_INTERNAL, (_BSL_BCM_MSG("%s: sal_mutex_take failed for unit %d."), FUNCTION_NAME(), unit)); \
     68     }
     69 
     70 #define TEST_BFD_INFO_UNLOCK  \
     71    if (sal_mutex_give(test_bfd_info_lock.lock)) { \
     72         BCMDNX_ERR_EXIT_MSG(BCM_E_INTERNAL, (_BSL_BCM_MSG("%s: sal_mutex_take failed for unit %d."), FUNCTION_NAME(), unit)); \
     73     }
     74 extern int oamp_usage_parse(int unit, args_t *a, oamp_test_init_param_t *init_param);
     75 
     76 extern int test_run_oam(int unit, int port_1, int port_2, int numEndpoints, int seed, int numUpdate, int testSLM, int is_maid48);
     77 extern int test_oam_create_vlan_gport(int unit, int port, int vlan, int * vlan_port_id);
     78 extern int test_oam_create_endpoint_with_rmep(int unit, endpoint_create_info_t *ep1, endpoint_create_info_t *ep2, int mep_index, int group, int set_slm);
     79 extern int test_oam_updateLMEP(int unit,int index,int *event_index);
     80 extern int test_oam_updateRMEP(int unit,int index);
     81 extern int test_oam_init_and_surroundings(int unit, int * group_id1);
     82 extern int test_oam_init_and_surroundings_48maid(int unit, int is_maid48, int * group_id1, int * group_id2);
     83 extern int test_oam_register_events(int unit);
     84 
     85 extern int test_run_bfd(int unit, int port_1, int port_2, int numEndpoints, int seed, int numStates, int BFDTimeTest, int timeoutEventsTest);
     86 extern int test_bfd_Multithreding(int unit, int endpoint_id);
     87 extern int test_bfd_update_state(int unit, int endpoint_id);
     88 extern int test_bfd_createEndpoint(int unit,int local_port, int encap_id, int src_ip,int remote_ip, int local_discr, int remote_discr);
     89 extern int test_bfd_updateEndpoint(int unit, int endpoint_1_id, int endpoint_2_id );
     90 extern int test_bfd_preDefinedUpdate(int unit, int endpoint_1_id, int endpoint_2_id);
     91 extern int test_bfd_changeState(int unit, int endpoint_id);
     92 extern int test_bfd_add_host(int unit, int addr, int vrf, int intf);
     93 extern int test_bfd_register_events(int unit);
     94 extern int test_bfd_init_ports(int unit,int local_port, int remote_port, int vlan) ;
     95 extern int test_mpls_init_ports(int unit,int local_port, int remote_port, int vlan, int vlan2) ;
     96 extern void test_bfd_set_global_values(void);