summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-02-24 10:03:29 +0100
committerHarald Welte <laforge@gnumonks.org>2014-08-28 17:15:58 +0200
commit0b437e53e23890e43db505dec5a72337ce42f452 (patch)
tree19931dba5e8831e8a97d8a0959e2489edfd79371
parentbc81b6e3f866d7bab187a02849175a4dbc2ee340 (diff)
nitb: Add a test command to generate IMM.ASS.REJ messagezecke/hacks/stress-testing
Add a VTY command to send up to 1000 IMM.ASS.REJ messages to a BTS. This can be used to check the AGCH queue handling. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/libbsc/abis_rsl.c8
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c39
2 files changed, 42 insertions, 5 deletions
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index d9fe92c..c59f01d 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -1347,10 +1347,10 @@ static void t3109_expired(void *data)
#define GSM48_LEN2PLEN(a) (((a) << 2) | 1)
/* Format an IMM ASS REJ according to 04.08 Chapter 9.1.20 */
-static int rsl_send_imm_ass_rej(struct gsm_bts *bts,
- unsigned int num_req_refs,
- struct gsm48_req_ref *rqd_refs,
- uint8_t wait_ind)
+int rsl_send_imm_ass_rej(struct gsm_bts *bts,
+ unsigned int num_req_refs,
+ struct gsm48_req_ref *rqd_refs,
+ uint8_t wait_ind)
{
uint8_t buf[GSM_MACBLOCK_LEN];
struct gsm48_imm_ass_rej *iar = (struct gsm48_imm_ass_rej *)buf;
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 4b971d1..0f67f36 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -980,7 +980,7 @@ DEFUN(allocate_all_channels, allocate_all_channels_cmd,
if (!lchan)
break;
- rc = rsl_chan_activate_lchan(lchan, 0, 0, 0);
+ rc = rsl_chan_activate_lchan(lchan, 0, 0);
if (rc < 0) {
lchan_free(lchan);
break;
@@ -993,6 +993,42 @@ DEFUN(allocate_all_channels, allocate_all_channels_cmd,
return CMD_SUCCESS;
}
+int rsl_send_imm_ass_rej(struct gsm_bts *bts,
+ unsigned int num_req_refs,
+ struct gsm48_req_ref *rqd_refs,
+ uint8_t wait_ind);
+
+DEFUN(flood_imm_ass_rej, flood_imm_ass_rej_cmd,
+ "flood-imm-ass-rej <0-65536> <1-1000>",
+ "Flood BTS with IMMEDIATE ASSING REJECT messages\n"
+ "BTS number\n"
+ "Number of messages\n")
+{
+ struct gsm_bts *bts;
+ int reps = atoi(argv[1]);
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ struct gsm48_req_ref req_ref = {0x25, 0};
+ int i;
+ int rc = 0;
+
+ bts = gsm_bts_num(gsmnet, atoi(argv[0]));
+ if (!bts) {
+ vty_out(vty, "%% BTS with number(%d) could not be found.%s",
+ atoi(argv[0]), VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ for (i = 1; i <= reps && rc >= 0; i++) {
+ req_ref.t1++;
+ rc = rsl_send_imm_ass_rej(bts, 1, &req_ref, 10);
+ }
+ vty_out(vty, "%% Stopped after %d/%d iterations: %s (%d).%s",
+ i-1, reps, rc >= 0 ? "OK" : strerror(-rc), rc,
+ VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
int bsc_vty_init_extra(void)
{
osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL);
@@ -1027,6 +1063,7 @@ int bsc_vty_init_extra(void)
install_element(ENABLE_NODE, &smsqueue_fail_cmd);
install_element(ENABLE_NODE, &subscriber_send_pending_sms_cmd);
install_element(ENABLE_NODE, &allocate_all_channels_cmd);
+ install_element(ENABLE_NODE, &flood_imm_ass_rej_cmd);
install_element(CONFIG_NODE, &cfg_mncc_int_cmd);
install_node(&mncc_int_node, config_write_mncc_int);