pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40685?usp=email )
Change subject: vty: Introduce cmd 'cs7 instance <0-15> asp NAME audit point-code POINT_CODE' ......................................................................
vty: Introduce cmd 'cs7 instance <0-15> asp NAME audit point-code POINT_CODE'
This command is useful to debug state of a given route on a remote SG. It can also be used to manually update local state when response arrive in case we run under some sort of misalignment with peer.
Change-Id: I607df3d84562e56d329bea1a730e26c8cdaae591 --- M src/ss7_asp_vty.c M tests/vty/osmo_stp_test.vty 2 files changed, 59 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/85/40685/1
diff --git a/src/ss7_asp_vty.c b/src/ss7_asp_vty.c index c69b66b..346b316 100644 --- a/src/ss7_asp_vty.c +++ b/src/ss7_asp_vty.c @@ -99,6 +99,62 @@ { 0, NULL } };
+static void tx_daud_pc(struct osmo_ss7_asp *asp, uint32_t pc) +{ + uint32_t rctx[OSMO_SS7_MAX_RCTX_COUNT]; + unsigned int num_rctx; + char buf_pc[MAX_PC_STR_LEN]; + uint32_t aff_pc; + + LOGPASP(asp, DLSS7, LOGL_NOTICE, "VTY: Tx DAUD pc=%u=%s\n", + pc, osmo_ss7_pointcode_print_buf(buf_pc, sizeof(buf_pc), asp->inst, pc)); + + aff_pc = htonl(pc); /* mask = 0 */ + num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), NULL); + xua_tx_snm_daud(asp, rctx, num_rctx, &aff_pc, 1, "VTY"); +} + +DEFUN_ATTR(cs7_asp_audit, cs7_asp_audit_cmd, + "cs7 instance <0-15> asp NAME audit point-code POINT_CODE", + CS7_STR "Instance related commands\n" "SS7 Instance Number\n" + "ASP related commands\n" "Name of ASP\n" + "Audit destination Point Code (xUA DAUD)\n" + "Destination Point Code to audit\n" + "Destination Point Code value\n", + CMD_ATTR_IMMEDIATE) +{ + struct osmo_ss7_instance *inst; + struct osmo_ss7_asp *asp; + int pc; + + 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; + } + + if (asp->cfg.role != OSMO_SS7_ASP_ROLE_ASP) { + vty_out(vty, "ASP audit (DAUD) can't be sent in role '%s'%s", + get_value_string(osmo_ss7_asp_role_names, asp->cfg.role), VTY_NEWLINE); + return CMD_WARNING; + } + + pc = osmo_ss7_pointcode_parse(asp->inst, argv[2]); + if (pc < 0) { + vty_out(vty, "Invalid point code (%s)%s", argv[2], VTY_NEWLINE); + return CMD_WARNING; + } + + tx_daud_pc(asp, pc); + return CMD_SUCCESS; +} + DEFUN_ATTR(cs7_asp, cs7_asp_cmd, "asp NAME <0-65535> <0-65535> " XUA_VAR_STR, "Configure Application Server Process\n" @@ -1356,6 +1412,8 @@ NO_STR "Disable quirk to work around interop issues\n", "\n", "\n", 0);
+ install_lib_element(ENABLE_NODE, &cs7_asp_audit_cmd); + install_node(&asp_node, NULL); install_lib_element_ve(&show_cs7_asp_cmd); install_lib_element_ve(&show_cs7_asp_name_cmd); diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty index 0d6ffff..3f8dfaf 100644 --- a/tests/vty/osmo_stp_test.vty +++ b/tests/vty/osmo_stp_test.vty @@ -31,6 +31,7 @@ show cs7 (sua|m3ua|ipa) (sctp|tcp) [<0-65534>] show cs7 config cs7 instance <0-15> asp NAME disconnect + cs7 instance <0-15> asp NAME audit point-code POINT_CODE show cs7 instance <0-15> asp show cs7 instance <0-15> asp name ASP_NAME show cs7 instance <0-15> asp-remaddr