pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39917?usp=email )
Change subject: vty: Introduce AS node cmd 'binding-table reset'
......................................................................
vty: Introduce AS node cmd 'binding-table reset'
This is useful when reconfiguring a deployed osmo-stp where new ASPs are
added/removed to the config, or when changing the binding seed
calculation to improve distribution based on current traffic.
This will also be used by tests validating loadshare feature, to start
with a clean state every time.
Change-Id: I56c34072a9ded42c13dbfc105a0ab3353ca353ec
---
M src/osmo_ss7_as.c
M src/osmo_ss7_vty.c
M src/ss7_as.h
M tests/vty/osmo_stp_test.vty
4 files changed, 24 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
diff --git a/src/osmo_ss7_as.c b/src/osmo_ss7_as.c
index 525f394..e84a36d 100644
--- a/src/osmo_ss7_as.c
+++ b/src/osmo_ss7_as.c
@@ -350,6 +350,15 @@
return asp;
}
+/* Reset loadshare bindings table. It will be filled in as needed.
+ * This is useful for instance when user changes the ASP set inside an AS, or
+ * changes the way the binding seed (eSLS) is calculated. */
+void ss7_as_loadshare_binding_table_reset(struct osmo_ss7_as *as)
+{
+ memset(&as->aesls_table[0], 0, sizeof(as->aesls_table));
+ as->cfg.last_asp_idx_assigned = 0;
+}
+
static as_ext_sls_t osmo_ss7_instance_calc_itu_as_ext_sls(const struct osmo_ss7_as *as,
uint32_t opc, uint8_t sls)
{
uint16_t opc12;
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index bcf3ffe..bf3bec2 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -2185,6 +2185,17 @@
return CMD_SUCCESS;
}
+DEFUN_ATTR(as_bindingtable_reset, as_bindingtable_reset_cmd,
+ "binding-table reset",
+ "AS Loadshare binding table operations\n"
+ "Reset loadshare binding table\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct osmo_ss7_as *as = vty->index;
+ ss7_as_loadshare_binding_table_reset(as);
+ return CMD_SUCCESS;
+}
+
DEFUN_ATTR(as_recov_tout, as_recov_tout_cmd,
"recovery-timeout <1-2000>",
"Specifies the recovery timeout value in milliseconds\n"
@@ -3440,6 +3451,7 @@
install_lib_element(L_CS7_AS_NODE, &as_traf_mode_loadshare_cmd);
install_lib_element(L_CS7_AS_NODE, &as_no_traf_mode_cmd);
install_lib_element(L_CS7_AS_NODE, &as_sls_shift_cmd);
+ install_lib_element(L_CS7_AS_NODE, &as_bindingtable_reset_cmd);
install_lib_element(L_CS7_AS_NODE, &as_recov_tout_cmd);
install_lib_element(L_CS7_AS_NODE, &as_qos_class_cmd);
install_lib_element(L_CS7_AS_NODE, &as_rout_key_cmd);
diff --git a/src/ss7_as.h b/src/ss7_as.h
index 13592e9..bc17726 100644
--- a/src/ss7_as.h
+++ b/src/ss7_as.h
@@ -131,6 +131,7 @@
unsigned int osmo_ss7_as_count_asp(const struct osmo_ss7_as *as);
int ss7_as_add_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp);
+void ss7_as_loadshare_binding_table_reset(struct osmo_ss7_as *as);
#define LOGPAS(as, subsys, level, fmt, args ...) \
_LOGSS7((as)->inst, subsys, level, "AS(%s) " fmt, (as)->cfg.name, ##
args)
diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty
index fbe69a8..e56e0ff 100644
--- a/tests/vty/osmo_stp_test.vty
+++ b/tests/vty/osmo_stp_test.vty
@@ -363,6 +363,7 @@
traffic-mode loadshare [bindings] [sls] [opc-sls] [opc-shift] [<0-2>]
no traffic-mode
sls-shift <0-3>
+ binding-table reset
recovery-timeout <1-2000>
qos-class <0-7>
routing-key RCONTEXT DPC
@@ -379,6 +380,7 @@
no Negate a command or set its defaults
traffic-mode Specifies traffic mode of operation of the ASP within the AS
sls-shift Shift SLS bits used during routing decision
+ binding-table AS Loadshare binding table operations
recovery-timeout Specifies the recovery timeout value in milliseconds
qos-class Specity QoS Class of AS
routing-key Define a routing key
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39917?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I56c34072a9ded42c13dbfc105a0ab3353ca353ec
Gerrit-Change-Number: 39917
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>