diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-08-15 11:54:24 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-08-15 13:36:25 +0200 |
commit | 368e549a92258052840be2ce5e08b925bb7781cb (patch) | |
tree | 70821a723f0ec7e717264b6eca5f840fc85c4f6c /src | |
parent | b1d46b4488d5e08f5d75b0cfa09ae43d5fc997d7 (diff) |
tests/vty: Add VTY tests to the osmo-stp
There seems to be issues with the write handling of the osmo-stp
and so far we did not enable vty tests here. Make it possible to
enable the tests, fix the VTY strings, change string to OsmoSTP.
Change-Id: I547fd4840d86ce16e8589fb63802dd7099781194
Diffstat (limited to 'src')
-rw-r--r-- | src/sctp_m3ua_client.c | 4 | ||||
-rw-r--r-- | src/vty_interface.c | 39 | ||||
-rw-r--r-- | src/vty_interface_cmds.c | 4 |
3 files changed, 26 insertions, 21 deletions
diff --git a/src/sctp_m3ua_client.c b/src/sctp_m3ua_client.c index 3726dab..bf9204a 100644 --- a/src/sctp_m3ua_client.c +++ b/src/sctp_m3ua_client.c @@ -388,6 +388,10 @@ struct mtp_m3ua_client_link *mtp_m3ua_client_link_init(struct mtp_link *blnk) lnk->queue.bfd.fd = -1; lnk->traffic_mode = 2; lnk->aspac_ack_timeout = 10; + + /* default ports */ + lnk->local.sin_port = lnk->remote.sin_port = htons(2905); + return lnk; } diff --git a/src/vty_interface.c b/src/vty_interface.c index 6c6d30f..3a654c0 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -103,7 +103,7 @@ DEFUN(node_end, node_end_cmd, } static struct vty_app_info vty_info = { - .name = "Cellmgr-ng", + .name = "OsmoSTP", .version = VERSION, .go_parent_cb = ss7_go_parent, }; @@ -155,13 +155,13 @@ static int config_write_ss7(struct vty *vty) static void write_link(struct vty *vty, struct mtp_link *link) { - const char *name = link->name ? link->name : ""; struct mtp_udp_link *ulnk; struct mtp_m2ua_link *m2ua; struct mtp_m3ua_client_link *m3ua_client; vty_out(vty, " link %d%s", link->nr, VTY_NEWLINE); - vty_out(vty, " description %s%s", name, VTY_NEWLINE); + if (link->name && strlen(link->name) > 0) + vty_out(vty, " description %s%s", link->name, VTY_NEWLINE); switch (link->type) { case SS7_LTYPE_UDP: @@ -214,12 +214,12 @@ static void write_link(struct vty *vty, struct mtp_link *link) static void write_linkset(struct vty *vty, struct mtp_link_set *set) { - const char *name = set->name ? set->name : ""; struct mtp_link *link; int i; vty_out(vty, " linkset %d%s", set->nr, VTY_NEWLINE); - vty_out(vty, " description %s%s", name, VTY_NEWLINE); + if (set->name && strlen(set->name) > 0) + vty_out(vty, " description %s%s", set->name, VTY_NEWLINE); vty_out(vty, " mtp3 dpc %d%s", set->dpc, VTY_NEWLINE); vty_out(vty, " mtp3 opc %d%s", set->opc, VTY_NEWLINE); vty_out(vty, " mtp3 ni %d%s", set->ni, VTY_NEWLINE); @@ -260,18 +260,20 @@ static int config_write_linkset(struct vty *vty) static void write_msc(struct vty *vty, struct msc_connection *msc) { - const char *name = msc->name ? msc->name : ""; vty_out(vty, " msc %d%s", msc->nr, VTY_NEWLINE); - vty_out(vty, " description %s%s", name, VTY_NEWLINE); + if (msc->name && strlen(msc->name) > 0) + vty_out(vty, " description %s%s", msc->name, VTY_NEWLINE); vty_out(vty, " mode %s%s", msc_mode(msc), VTY_NEWLINE); if (msc->ip) vty_out(vty, " ip %s%s", msc->ip, VTY_NEWLINE); vty_out(vty, " port %d%s", msc->port, VTY_NEWLINE); vty_out(vty, " token %s%s", msc->token, VTY_NEWLINE); vty_out(vty, " dscp %d%s", msc->dscp, VTY_NEWLINE); - vty_out(vty, " timeout ping %d%s", msc->ping_time, VTY_NEWLINE); - vty_out(vty, " timeout pong %d%s", msc->pong_time, VTY_NEWLINE); + if (msc->ping_time > 0) { + vty_out(vty, " timeout ping %d%s", msc->ping_time, VTY_NEWLINE); + vty_out(vty, " timeout pong %d%s", msc->pong_time, VTY_NEWLINE); + } vty_out(vty, " timeout restart %d%s", msc->msc_time, VTY_NEWLINE); } @@ -316,10 +318,9 @@ static const char *link_type(enum ss7_set_type type) static void write_application(struct vty *vty, struct ss7_application *app) { - const char *name = app->name ? app->name : ""; - vty_out(vty, " application %d%s", app->nr, VTY_NEWLINE); - vty_out(vty, " description %s%s", name, VTY_NEWLINE); + if (app->name && strlen(app->name) > 0) + vty_out(vty, " description %s%s", app->name, VTY_NEWLINE); vty_out(vty, " type %s%s", app_type(app->type), VTY_NEWLINE); if (app->fixed_ass_cmpl_reply) @@ -463,7 +464,7 @@ DEFUN(cfg_linkset_mtp3_ssn, cfg_linkset_mtp3_ssn_cmd, DEFUN(cfg_linkset_no_mtp3_ssn, cfg_linkset_no_mtp3_ssn_cmd, "no mtp3 ssn <0-255>", - "MTP Level3\n" "SSN supported\n" "SSN\n") + NO_STR "MTP Level3\n" "SSN supported\n" "SSN\n") { struct mtp_link_set *set = vty->index; set->supported_ssn[atoi(argv[0])] = 0; @@ -604,7 +605,7 @@ DEFUN(cfg_linkset_link, cfg_linkset_link_cmd, DEFUN(cfg_link_ss7_transport, cfg_link_ss7_transport_cmd, "ss7-transport (none|udp|m2ua|m3ua-client)", "SS7 transport for the link\n" - "No transport\n" "MTP over UDP\n" "SCTP M2UA\n") + "No transport\n" "MTP over UDP\n" "SCTP M2UA server\n" "SCTP M3UA client\n") { int wanted = SS7_LTYPE_NONE; struct mtp_link *link; @@ -648,7 +649,7 @@ DEFUN(cfg_link_ss7_transport, cfg_link_ss7_transport_cmd, DEFUN(cfg_link_udp_dest_ip, cfg_link_udp_dest_ip_cmd, "udp dest ip HOST_NAME", - "UDP Transport\n" "IP\n" "Hostname\n") + "UDP Transport\n" "Destination\n" "IP\n" "Hostname\n") { struct hostent *hosts; @@ -684,7 +685,7 @@ DEFUN(cfg_link_udp_dest_ip, cfg_link_udp_dest_ip_cmd, DEFUN(cfg_link_udp_dest_port, cfg_link_udp_dest_port_cmd, "udp dest port <1-65535>", - "UDP Transport\n" "Set the port number\n" "Port\n") + "UDP Transport\n" "Destination\n" "Set the port number\n" "Port\n") { struct mtp_link *link = vty->index; struct mtp_udp_link *ulnk; @@ -896,7 +897,7 @@ DEFUN(cfg_link_m3ua_client_routing_ctx, cfg_link_m3ua_client_routing_ctx_cmd, DEFUN(cfg_link_m3ua_client_traffic_mode, cfg_link_m3ua_client_traffic_mode_cmd, "m3ua-client traffic-mode (override|loadshare|broadcast)", - "M3UA Client\n" "Traffic Mode\n" "Override" "Loadshare\n" "Broadcast\n") + "M3UA Client\n" "Traffic Mode\n" "Override\n" "Loadshare\n" "Broadcast\n") { struct mtp_link *link = vty->index; struct mtp_m3ua_client_link *m3ua_link; @@ -1047,7 +1048,7 @@ DEFUN(cfg_msc_timeout_pong, cfg_msc_timeout_pong_cmd, } DEFUN(cfg_msc_timeout_restart, cfg_msc_timeout_restart_cmd, - "timeout restart <1-65535>", + "timeout restart <0-65535>", "Timeout commands\n" "Time between restarts\n" "Seconds\n") { struct msc_connection *msc = vty->index; @@ -1306,7 +1307,7 @@ DEFUN(cfg_app_hardcode_ass, cfg_app_hardcode_ass_cmd, DEFUN(cfg_app_no_hardcode_ass, cfg_app_no_hardcode_ass_cmd, "no hardcode-assignment-complete", - "Hardcode the assignment complete message to HR3\n") + NO_STR "Hardcode the assignment complete message to HR3\n") { struct ss7_application *app = vty->index; app->fixed_ass_cmpl_reply = 0; diff --git a/src/vty_interface_cmds.c b/src/vty_interface_cmds.c index 78e67c0..7c634c0 100644 --- a/src/vty_interface_cmds.c +++ b/src/vty_interface_cmds.c @@ -280,7 +280,7 @@ DEFUN(allow_inject, allow_inject_cmd, DEFUN(show_sctp_count, show_sctp_count_cmd, "show sctp-connections count", - SHOW_STR "Number of SCTP connections\n") + SHOW_STR "SCTP connections\n" "Number of connections\n") { int count = sctp_m2ua_conn_count(bsc->m2ua_trans); vty_out(vty, "Active SCTP connections are: %d.%s", count, VTY_NEWLINE); @@ -289,7 +289,7 @@ DEFUN(show_sctp_count, show_sctp_count_cmd, DEFUN(show_sctp_details, show_sctp_details_cmd, "show sctp-connections details", - SHOW_STR "Details of SCTP connections\n") + SHOW_STR "SCTP connections\n" "Details\n") { struct sctp_m2ua_conn *conn; |