GTPv2: Fix match of 15-digit IMSIs
15-digit IMSIs are len(imsi)=15, but decoded messages are
octet-aligned, hence the hexstring in messages is len(imsi)=16,
where the last hex char is a padding 'F'H.
* Make sure IMSIs stored in GTPv2_Emulation are padded to 16 digits (8
octets) to process matches easily.
* Update tr_ template to transparently adapt passed hexstrings to match
the octet-aligned value received from the wire.
Change-Id: Ie2f316ccb5bc69ec15e861616de4fd5babc4004e
diff --git a/library/GTPv2_Emulation.ttcn b/library/GTPv2_Emulation.ttcn
index 571da4e..736dd03 100644
--- a/library/GTPv2_Emulation.ttcn
+++ b/library/GTPv2_Emulation.ttcn
@@ -602,6 +602,10 @@
};
function f_gtp2_register_imsi(hexstring imsi) runs on GTP2_ConnHdlr {
+ /* 15-digit IMSIs are len(imsi)=15, but decoded messages are
+ * octet-aligned, hence the hexstring in messages is len(imsi)=16, where
+ * the last hex char is a padding 'F'H */
+ imsi := f_pad_bcd_number(imsi);
GTP2_PROC.call(GTP2EM_register_imsi:{imsi}) {
[] GTP2_PROC.getreply(GTP2EM_register_imsi:{imsi});
}