pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38027?usp=email )
Change subject: hss: Initial validation of Prometheus metrics
......................................................................
hss: Initial validation of Prometheus metrics
Requires open5gs b2f56b964133bbe2f6ab07ead4cb62524528fcf7 for HSS
diameter metrics.
Change-Id: I507537c66a031b67518294daa8338f3836a90d6b
---
M hss/HSS_Tests.default
M hss/HSS_Tests.ttcn
M hss/gen_links.sh
M hss/open5gs-hss.yaml
M hss/regen_makefile.sh
5 files changed, 42 insertions(+), 4 deletions(-)
Approvals:
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/hss/HSS_Tests.default b/hss/HSS_Tests.default
index 4c0b502..3a78848 100644
--- a/hss/HSS_Tests.default
+++ b/hss/HSS_Tests.default
@@ -1,6 +1,8 @@
[LOGGING]
[TESTPORT_PARAMETERS]
+*.TCP.noDelay := "yes" // turn off nagle
+*.HTTP.use_notification_ASPs := "yes"
[MODULE_PARAMETERS]
diff --git a/hss/HSS_Tests.ttcn b/hss/HSS_Tests.ttcn
index a5503a7..5c4f765 100644
--- a/hss/HSS_Tests.ttcn
+++ b/hss/HSS_Tests.ttcn
@@ -10,11 +10,15 @@
import from DIAMETER_ts29_272_Templates all;
import from DIAMETER_Emulation all;
+import from Prometheus_Checker all;
+
type record of hexstring SubscriberConfigs;
modulepar {
charstring mp_hss_hostname := "127.0.0.4";
integer mp_hss_port := 3868;
+ charstring mp_hss_prometheus_hostname := "127.0.0.5";
+ integer mp_hss_prometheus_port := c_prometheus_default_http_port;
charstring mp_diam_local_hostname := "127.0.0.1";
integer mp_diam_local_port := 3868;
charstring mp_diam_orig_realm := "localdomain";
@@ -78,11 +82,12 @@
}
/* per-session component; we typically have 1..N per testcase */
-type component Cli_Session_CT {
+type component Cli_Session_CT extends Prometheus_Checker_CT {
var SessionPars g_pars;
port DIAMETER_Conn_PT S6a;
port DIAMETEREM_PROC_PT S6a_PROC;
+
}
function f_diam_connhldr_expect_eteid(UINT32 ete_id) runs on Cli_Session_CT {
S6a_PROC.call(DIAMETEREM_register_eteid:{ete_id, null}) {
@@ -181,6 +186,7 @@
private function f_handler_init(void_fn fn, SessionPars pars)
runs on Cli_Session_CT {
g_pars := valueof(pars);
+ f_prometheus_init(mp_hss_prometheus_hostname, mp_hss_prometheus_port);
fn.apply();
}
@@ -216,6 +222,12 @@
/* create a session, expect it to succeed */
private function f_TC_ulr_ula() runs on Cli_Session_CT {
+ var PrometheusExpects expects := valueof({
+ ts_PrometheusExpect("s6a_rx_ulr", COUNTER, min := 1, max := 1),
+ ts_PrometheusExpect("s6a_tx_ula", COUNTER, min := 1, max := 1)
+ });
+ var PrometheusMetrics prom_snapshot :=
f_prometheus_snapshot(f_prometheus_keys_from_expect(expects));
+
var template (present) AVP_list sub_data := superset(
tr_AVP_3GPP_SubscriberStatus(SERVICE_GRANTED),
tr_AVP_3GPP_SubscrRauTauTmr(?),
@@ -226,8 +238,9 @@
tr_AVP_3GPP_ApnConfig(?, ?, ?)
))
);
-
f_dia_ulr_ula(sub_data);
+
+ f_prometheus_expect_from_snapshot(expects, wait_converge := true, snapshot :=
prom_snapshot);
setverdict(pass);
}
testcase TC_ulr_ula() runs on MTC_CT {
@@ -242,6 +255,12 @@
Subscriber-Status=1 (OPERATOR_DETERMINED_BARRING) and
Operator-Determined-Barring=7. */
private function f_TC_ulr_ula_subscr_op_det_barring_7() runs on Cli_Session_CT {
+ var PrometheusExpects expects := valueof({
+ ts_PrometheusExpect("s6a_rx_ulr", COUNTER, min := 1, max := 1),
+ ts_PrometheusExpect("s6a_tx_ula", COUNTER, min := 1, max := 1)
+ });
+ var PrometheusMetrics prom_snapshot :=
f_prometheus_snapshot(f_prometheus_keys_from_expect(expects));
+
var template (present) AVP_list sub_data := superset(
tr_AVP_3GPP_SubscriberStatus(OPERATOR_DETERMINED_BARRING),
tr_AVP_3GPP_OperatorDeterminedBarring(7),
@@ -253,8 +272,9 @@
tr_AVP_3GPP_ApnConfig(?, ?, ?)
))
);
-
f_dia_ulr_ula(sub_data);
+
+ f_prometheus_expect_from_snapshot(expects, wait_converge := true, snapshot :=
prom_snapshot);
setverdict(pass);
}
testcase TC_ulr_ula_subscr_op_det_barring_7() runs on MTC_CT {
diff --git a/hss/gen_links.sh b/hss/gen_links.sh
index 276eb1e..d06175a 100755
--- a/hss/gen_links.sh
+++ b/hss/gen_links.sh
@@ -21,11 +21,20 @@
FILES="DIAMETER_EncDec.cc"
gen_links $DIR $FILES
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Abstract_Socket/src
+FILES="Abstract_Socket.cc Abstract_Socket.hh "
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.HTTPmsg/src
+FILES="HTTPmsg_MessageLen.ttcn HTTPmsg_MessageLen_Function.cc HTTPmsg_PT.cc
HTTPmsg_PT.hh HTTPmsg_PortType.ttcn HTTPmsg_Types.ttcn "
+gen_links $DIR $FILES
+
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn
Native_FunctionDefs.cc "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn
DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc
DIAMETER_Emulation.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn "
FILES+="SCTP_Templates.ttcn "
+FILES+="HTTP_Adapter.ttcn Prometheus_Checker.ttcn "
gen_links $DIR $FILES
ignore_pp_results
diff --git a/hss/open5gs-hss.yaml b/hss/open5gs-hss.yaml
index 6b90bdc..c536cd8 100644
--- a/hss/open5gs-hss.yaml
+++ b/hss/open5gs-hss.yaml
@@ -11,7 +11,11 @@
hss:
freeDiameter: freediameter.conf
-
+ diameter_stats_interval: 1
+ metrics:
+ server:
+ - address: 127.0.0.5
+ port: 9090
parameter:
max:
diff --git a/hss/regen_makefile.sh b/hss/regen_makefile.sh
index 23fbd73..ac05766 100755
--- a/hss/regen_makefile.sh
+++ b/hss/regen_makefile.sh
@@ -4,8 +4,11 @@
FILES="
*.ttcn
+ Abstract_Socket.cc
DIAMETER_CodecPort_CtrlFunctDef.cc
DIAMETER_EncDec.cc
+ HTTPmsg_MessageLen_Function.cc
+ HTTPmsg_PT.cc
IPL4asp_PT.cc
IPL4asp_discovery.cc
Native_FunctionDefs.cc
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38027?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I507537c66a031b67518294daa8338f3836a90d6b
Gerrit-Change-Number: 38027
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>