osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd

Change-Id: I356d90642a500be6a70f60c8240ce1211fd0d934
This commit is contained in:
Vadim Yanitskiy 2019-11-07 02:52:29 +07:00 committed by laforge
parent 535e43268c
commit c19962e1e1
6 changed files with 20 additions and 9 deletions

View File

@ -346,6 +346,7 @@ int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
void osmo_ss7_as_destroy(struct osmo_ss7_as *as); void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as, bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as,
struct osmo_ss7_asp *asp); struct osmo_ss7_asp *asp);
bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt); bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp); void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);

View File

@ -1068,6 +1068,16 @@ bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as,
return false; return false;
} }
/*! Determine if given AS is in the active state.
* \param[in] as Application Server.
* \returns true in case as is active; false otherwise. */
bool osmo_ss7_as_active(const struct osmo_ss7_as *as)
{
if (!as->fi)
return false;
return as->fi->state == XUA_AS_S_ACTIVE;
}
/*********************************************************************** /***********************************************************************
* SS7 Application Server Process * SS7 Application Server Process
***********************************************************************/ ***********************************************************************/

View File

@ -1096,7 +1096,8 @@ DEFUN(show_cs7_as, show_cs7_as_cmd,
continue; continue;
if (filter && !strcmp(filter, "sua") && as->cfg.proto != OSMO_SS7_ASP_PROT_SUA) if (filter && !strcmp(filter, "sua") && as->cfg.proto != OSMO_SS7_ASP_PROT_SUA)
continue; continue;
/* FIXME: active filter */ if (filter && !strcmp(filter, "active") && !osmo_ss7_as_active(as))
continue;
vty_out(vty, "%-12s %-12s %-10u %-13s %4s %13s %3s %5s %4s %10s%s", vty_out(vty, "%-12s %-12s %-10u %-13s %4s %13s %3s %5s %4s %10s%s",
as->cfg.name, osmo_fsm_inst_state_name(as->fi), as->cfg.routing_key.context, as->cfg.name, osmo_fsm_inst_state_name(as->fi), as->cfg.routing_key.context,
osmo_ss7_pointcode_print(as->inst, as->cfg.routing_key.pc), osmo_ss7_pointcode_print(as->inst, as->cfg.routing_key.pc),

View File

@ -147,13 +147,6 @@ int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
#define MSEC_TO_S_US(x) (x/1000), ((x%1000)*10) #define MSEC_TO_S_US(x) (x/1000), ((x%1000)*10)
enum xua_as_state {
XUA_AS_S_DOWN,
XUA_AS_S_INACTIVE,
XUA_AS_S_ACTIVE,
XUA_AS_S_PENDING,
};
static const struct value_string xua_as_event_names[] = { static const struct value_string xua_as_event_names[] = {
{ XUA_ASPAS_ASP_INACTIVE_IND, "ASPAS-ASP_INACTIVE.ind" }, { XUA_ASPAS_ASP_INACTIVE_IND, "ASPAS-ASP_INACTIVE.ind" },
{ XUA_ASPAS_ASP_DOWN_IND, "ASPAS-ASP_DOWN.ind" }, { XUA_ASPAS_ASP_DOWN_IND, "ASPAS-ASP_DOWN.ind" },

View File

@ -2,6 +2,13 @@
struct osmo_ss7_as; struct osmo_ss7_as;
enum xua_as_state {
XUA_AS_S_DOWN,
XUA_AS_S_INACTIVE,
XUA_AS_S_ACTIVE,
XUA_AS_S_PENDING,
};
enum xua_as_event { enum xua_as_event {
XUA_ASPAS_ASP_INACTIVE_IND, XUA_ASPAS_ASP_INACTIVE_IND,
XUA_ASPAS_ASP_DOWN_IND, XUA_ASPAS_ASP_DOWN_IND,

View File

@ -280,7 +280,6 @@ ss7_asp_vty_test(config-cs7-as)# do show cs7 instance 0 as active
Routing Routing Key Cic Cic Traffic Routing Routing Key Cic Cic Traffic
AS Name State Context Dpc Si Opc Ssn Min Max Mode AS Name State Context Dpc Si Opc Ssn Min Max Mode
------------ ------------ ---------- ------------- ---- ------------- --- ----- ----- ------- ------------ ------------ ---------- ------------- ---- ------------- --- ----- ----- -------
my-ass AS_DOWN 0 0.0.0 override
ss7_asp_vty_test(config-cs7-as)# do show cs7 instance 0 as sua ss7_asp_vty_test(config-cs7-as)# do show cs7 instance 0 as sua
Routing Routing Key Cic Cic Traffic Routing Routing Key Cic Cic Traffic