diff options
author | Harald Welte <laforge@osmocom.org> | 2024-02-10 15:11:21 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2024-02-10 16:07:06 +0100 |
commit | eae5eb498ab543ea502ddcfb169e510e463f0c25 (patch) | |
tree | 44b871bcb390381d0be0bfbb247216d0e202c9ee | |
parent | 8000b23106da8c6dc61582e8df238686f3e0ca0a (diff) |
Add new "cs7 instance <0-15> asp NAME disconnect" VTY command
This allows the user to administratively disconnect the current
transport connection of a given ASP.
If issued on the client side, the default layer manager will trigger
an automatic re-connect. If issued on the server side, we expect the
client will re-connect.
Change-Id: I2077121ab860fafb70951454d029c3afa9ee2818
-rw-r--r-- | src/osmo_ss7_vty.c | 26 | ||||
-rw-r--r-- | tests/vty/ss7_asp_test.vty | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 1483ac0..836b3fd 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -698,6 +698,31 @@ DEFUN(show_cs7_config, show_cs7_config_cmd, return CMD_SUCCESS; } +DEFUN(cs7_asp_disconnect, cs7_asp_disconnect_cmd, + "cs7 instance <0-15> asp NAME disconnect", + CS7_STR "Instance related commands\n" "SS7 Instance Number\n" + "ASP related commands\n" "Name of ASP\n" + "Disconnect the ASP (client will reconnect)\n") +{ + struct osmo_ss7_instance *inst; + struct osmo_ss7_asp *asp; + + inst = osmo_ss7_instance_find(atoi(argv[0])); + if (!inst) { + vty_out(vty, "unknown instance '%s'%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + + asp = osmo_ss7_asp_find_by_name(inst, argv[1]); + if (!asp) { + vty_out(vty, "unknown ASP '%s'%s", argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + + osmo_ss7_asp_disconnect(asp); + return CMD_SUCCESS; +} + /*********************************************************************** * Application Server Process @@ -2838,6 +2863,7 @@ static void vty_init_shared(void *ctx) install_lib_element_ve(&show_cs7_user_cmd); install_lib_element_ve(&show_cs7_xua_cmd); install_lib_element_ve(&show_cs7_config_cmd); + install_lib_element(ENABLE_NODE, &cs7_asp_disconnect_cmd); /* the mother of all VTY config nodes */ install_lib_element(CONFIG_NODE, &cs7_instance_cmd); diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty index 914d8d4..d91df24 100644 --- a/tests/vty/ss7_asp_test.vty +++ b/tests/vty/ss7_asp_test.vty @@ -24,6 +24,7 @@ ss7_asp_vty_test# list show cs7 instance <0-15> users show cs7 (sua|m3ua|ipa) [<0-65534>] show cs7 config + cs7 instance <0-15> asp NAME disconnect show cs7 instance <0-15> asp show cs7 instance <0-15> asp name ASP_NAME show cs7 instance <0-15> asp-remaddr |