Change in libosmo-sccp[master]: osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Nov 14 22:31:41 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15995 )

Change subject: osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd
......................................................................

osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd

Change-Id: I356d90642a500be6a70f60c8240ce1211fd0d934
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
M src/xua_as_fsm.c
M src/xua_as_fsm.h
M tests/vty/ss7_asp_test.vty
6 files changed, 20 insertions(+), 9 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index d0aa9a1..6778409 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -346,6 +346,7 @@
 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
 bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as,
 			 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);
 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
 
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 0d49d1a..d74f8f9 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1068,6 +1068,16 @@
 	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
  ***********************************************************************/
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 1a246db..84f616a 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1096,7 +1096,8 @@
 			continue;
 		if (filter && !strcmp(filter, "sua") && as->cfg.proto != OSMO_SS7_ASP_PROT_SUA)
 			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",
 			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),
diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index 394061b..602c433 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -147,13 +147,6 @@
 
 #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[] = {
 	{ XUA_ASPAS_ASP_INACTIVE_IND, 	"ASPAS-ASP_INACTIVE.ind" },
 	{ XUA_ASPAS_ASP_DOWN_IND,	"ASPAS-ASP_DOWN.ind" },
diff --git a/src/xua_as_fsm.h b/src/xua_as_fsm.h
index 0128919..0e71350 100644
--- a/src/xua_as_fsm.h
+++ b/src/xua_as_fsm.h
@@ -2,6 +2,13 @@
 
 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 {
 	XUA_ASPAS_ASP_INACTIVE_IND,
 	XUA_ASPAS_ASP_DOWN_IND,
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index eeda4c8..a7fe492 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -280,7 +280,6 @@
                           Routing    Routing Key                          Cic   Cic   Traffic
 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
                           Routing    Routing Key                          Cic   Cic   Traffic

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/15995
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I356d90642a500be6a70f60c8240ce1211fd0d934
Gerrit-Change-Number: 15995
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191114/531acacc/attachment.htm>


More information about the gerrit-log mailing list