From: Ruben Undheim Date: Sun, 18 Nov 2018 09:16:41 +0100 Subject: Separate expected response big endian --- tests/testsuite.at | 7 +- tests/xua/xua_test.ok.bigendian | 208 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 tests/xua/xua_test.ok.bigendian Index: libosmo-sigtran-2.1.0/tests/testsuite.at =================================================================== --- libosmo-sigtran-2.1.0.orig/tests/testsuite.at 2025-03-09 23:29:13.503996692 +0100 +++ libosmo-sigtran-2.1.0/tests/testsuite.at 2025-03-09 23:29:13.499996696 +0100 @@ -9,7 +9,12 @@ AT_SETUP([xua]) AT_KEYWORDS([xua]) -cat $abs_srcdir/xua/xua_test.ok > expout +perl -MConfig -e 'print "$Config{byteorder}\n";' | grep 12345678 +if [[ "$?" = "0" ]] ; then + cat $abs_srcdir/xua/xua_test.ok > expout +else + cat $abs_srcdir/xua/xua_test.ok.bigendian > expout +fi cat $abs_srcdir/xua/xua_test.err > experr AT_CHECK([$abs_top_builddir/tests/xua/xua_test], [], [expout], [experr]) AT_CLEANUP Index: libosmo-sigtran-2.1.0/tests/xua/xua_test.ok.bigendian =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libosmo-sigtran-2.1.0/tests/xua/xua_test.ok.bigendian 2025-03-09 23:29:13.503996692 +0100 @@ -0,0 +1,208 @@ +digits='01234567' (8) +digits='0123456' (7) +sccp_addr_parse test case 0 +expected: RI=1,SSN=6,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919969679389) +parsed: RI=1,SSN=6,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919969679389) +sccp_addr_parse test case 1 +expected: RI=1,SSN=8,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919869299992) +parsed: RI=1,SSN=8,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919869299992) +sccp_addr_parse test case 2 +expected: RI=2,SSN=254 +parsed: RI=2,SSN=254 +Testing Decoded GT -> SUA encoding +IN: TT=0,NPL=1,NAI=4,DIG=919969679389 + 0400000000000001000000043931393936393637393338390000000000000000000000000000000000000000 +OUT:TT=0,NPL=1,NAI=4,DIG=919969679389 + 0400000000000001000000043931393936393637393338390000000000000000000000000000000000000000 + +=> BSSMAP-RESET +SCCP Input: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 06 00 04 30 04 01 20 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CL:CLDT,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000000), + PART(T=Destination Address,L=12,D=0002000180030008000000fe), + PART(T=Source Address,L=12,D=0002000180030008000000fe), + PART(T=Data,L=6,D=000430040120) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 06 00 04 30 04 01 20 + +=> BSSMAP-RESET-ACK +SCCP Input: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 03 00 01 31 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CL:CLDT,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000000), + PART(T=Destination Address,L=20,D=00020003800200080000000180030008000000fe), + PART(T=Source Address,L=20,D=00020003800200080000005c80030008000000fe), + PART(T=Data,L=3,D=000131) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 03 00 01 31 + +=> BSSMAP-PAGING +SCCP Input: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CL:CLDT,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000000), + PART(T=Destination Address,L=20,D=00020003800200080000000180030008000000fe), + PART(T=Source Address,L=20,D=00020003800200080000005c80030008000000fe), + PART(T=Data,L=16,D=000e52080829471002013197611a0106) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 + +=> BSSMAP-UDT +SCCP Input: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CL:CLDT,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000000), + PART(T=Destination Address,L=12,D=0002000180030008000000fe), + PART(T=Source Address,L=12,D=0002000180030008000000fe), + PART(T=Data,L=16,D=000e52080829471002013197611a0106) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 + +=> BSSMAP-CR +SCCP Input: [L2]> 01 01 02 03 02 02 04 02 42 fe 0f 1f 00 1d 57 05 08 00 72 f4 80 20 12 c3 50 17 10 05 24 11 03 33 19 a2 08 29 47 10 02 01 31 97 61 00 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:CORE,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000002), + PART(T=Source Reference,L=4,D=00010203), + PART(T=Destination Address,L=12,D=0002000180030008000000fe), + PART(T=Data,L=31,D=001d5705080072f4802012c3501710052411033319a2082947100201319761) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 01 01 02 03 02 02 04 02 42 fe 0f 1f 00 1d 57 05 08 00 72 f4 80 20 12 c3 50 17 10 05 24 11 03 33 19 a2 08 29 47 10 02 01 31 97 61 00 + +=> BSSMAP-CC +SCCP Input: [L2]> 02 01 02 03 00 00 03 02 01 00 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:COAK,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000002), + PART(T=Destination Reference,L=4,D=00010203), + PART(T=Source Reference,L=4,D=00000003) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 02 01 02 03 00 00 03 02 01 00 + +=> BSSMAP-DTAP +SCCP Input: [L2]> 06 00 00 03 00 01 0f 01 00 0c 03 05 5c 08 11 81 33 66 02 13 45 f4 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:CODT,V=0,LEN=0), + PART(T=Destination Reference,L=4,D=00000003), + PART(T=Segmentation,L=4,D=00000000), + PART(T=Data,L=15,D=01000c03055c0811813366021345f4) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 06 00 00 03 00 01 0f 01 00 0c 03 05 5c 08 11 81 33 66 02 13 45 f4 + +=> BSSMAP-CLEAR +SCCP Input: [L2]> 06 00 00 03 00 01 06 00 04 20 04 01 09 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:CODT,V=0,LEN=0), + PART(T=Destination Reference,L=4,D=00000003), + PART(T=Segmentation,L=4,D=00000000), + PART(T=Data,L=6,D=000420040109) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 06 00 00 03 00 01 06 00 04 20 04 01 09 + +=> BSSMAP-RELEASED +SCCP Input: [L2]> 04 00 00 03 01 02 03 00 01 0f 02 23 42 00 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:RELRE,V=0,LEN=0), + PART(T=Destination Reference,L=4,D=00000003), + PART(T=Source Reference,L=4,D=00010203), + PART(T=Cause,L=4,D=00000300), + PART(T=Data,L=2,D=2342) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 04 00 00 03 01 02 03 00 01 0f 02 23 42 00 + +=> BSSMAP-RELEASE_COMPLETE +SCCP Input: [L2]> 05 01 02 03 00 00 03 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CO:RELCO,V=0,LEN=0), + PART(T=Destination Reference,L=4,D=00010203), + PART(T=Source Reference,L=4,D=00000003) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 05 01 02 03 00 00 03 + +=> TCAP +SCCP Input: [L2]> 09 81 03 0d 18 0a 12 07 00 12 04 53 84 09 00 17 0b 12 06 00 12 04 44 87 20 00 20 65 9a 65 81 97 48 04 26 00 01 98 49 04 51 01 03 df 6c 81 88 a1 81 85 02 01 44 02 01 07 30 80 a7 80 a0 80 04 01 2b 30 80 30 12 83 01 10 84 01 07 85 07 91 44 57 76 67 16 97 86 01 20 30 06 82 01 18 84 01 04 00 00 00 00 a3 06 04 01 42 84 01 05 a3 06 04 01 51 84 01 05 a3 06 04 01 31 84 01 05 a3 09 04 01 12 84 01 05 82 01 02 a3 09 04 01 11 84 01 05 81 01 01 a3 06 04 01 14 84 01 00 a3 0b 04 01 41 84 01 04 30 03 83 01 10 a3 0b 04 01 41 84 01 04 30 03 82 01 18 00 00 00 00 +Transcoding message SCCP -> XUA +Decoded SUA: HDR=(CL:CLDT,V=0,LEN=0), + PART(T=Protocol Class,L=4,D=00000081), + PART(T=Destination Address,L=32,D=0001000580010014000000040a00010453840900170000008003000800000007), + PART(T=Source Address,L=32,D=0001000580010014000000040c00010444872000206500008003000800000006), + PART(T=Data,L=154,D=6581974804260001984904510103df6c8188a181850201440201073080a780a08004012b30803012830110840107850791445776671697860120300682011884010400000000a306040142840105a306040151840105a306040131840105a309040112840105820102a309040111840105810101a306040114840100a30b0401418401043003830110a30b040141840104300382011800000000) +Re-Encoding decoded SUA to SCCP +SCCP Output: [L2]> 09 81 03 0d 18 0a 12 07 00 12 04 53 84 09 00 17 0b 12 06 00 12 04 44 87 20 00 20 65 9a 65 81 97 48 04 26 00 01 98 49 04 51 01 03 df 6c 81 88 a1 81 85 02 01 44 02 01 07 30 80 a7 80 a0 80 04 01 2b 30 80 30 12 83 01 10 84 01 07 85 07 91 44 57 76 67 16 97 86 01 20 30 06 82 01 18 84 01 04 00 00 00 00 a3 06 04 01 42 84 01 05 a3 06 04 01 51 84 01 05 a3 06 04 01 31 84 01 05 a3 09 04 01 12 84 01 05 82 01 02 a3 09 04 01 11 84 01 05 81 01 01 a3 06 04 01 14 84 01 00 a3 0b 04 01 41 84 01 04 30 03 83 01 10 a3 0b 04 01 41 84 01 04 30 03 82 01 18 00 00 00 00 +Parsing M3UA Message +Parsing Nested M3UA Routing Key IE +Testing SCCP Address Encode/Decode + +=> NOGT-PC1024 +input addr: RI=2,PC=1024 +rc=3, expected rc=3 +encoded addr: 410004 +expected addr: 410004 +decod addr: RI=2,PC=1024 + +=> NOGT-PC16383 +input addr: RI=2,PC=16383 +rc=3, expected rc=3 +encoded addr: 41ff3f +expected addr: 41ff3f +decod addr: RI=2,PC=16383 + +=> NOGT-PC16383-SSN90 +input addr: RI=2,PC=16383,SSN=90 +rc=4, expected rc=4 +encoded addr: 43ff3f5a +expected addr: 43ff3f5a +decod addr: RI=2,PC=16383,SSN=90 + +=> GT-PC16383-NAIONLY +input addr: RI=2,PC=16383,GTI=1,GT=() +rc=4, expected rc=4 +encoded addr: 45ff3f7f +expected addr: 45ff3f7f +decod addr: RI=2,PC=16383,GTI=1,GT=() + +=> GT-NOPC-NAIONLY +input addr: RI=1,GTI=1,GT=() +rc=2, expected rc=2 +encoded addr: 0403 +expected addr: 0403 +decod addr: RI=1,GTI=1,GT=() + +=> GT-NOPC-TTONLY +input addr: RI=1,GTI=2,GT=(TT=3,DIG=) +rc=-22, expected rc=-22 + +=> GT-NOPC-TT_NPL_ENC-ODD +input addr: RI=1,GTI=3,GT=(TT=3,NPL=1,DIG=123) +rc=5, expected rc=5 +encoded addr: 0c03112103 +expected addr: 0c03112103 +decod addr: RI=1,GTI=3,GT=(TT=3,NPL=1,DIG=123) + +=> GT-NOPC-TT_NPL_ENC-EVEN +input addr: RI=1,GTI=3,GT=(TT=3,NPL=1,DIG=1234) +rc=5, expected rc=5 +encoded addr: 0c03122143 +expected addr: 0c03122143 +decod addr: RI=1,GTI=3,GT=(TT=3,NPL=1,DIG=1234) + +=> GT-NOPC-TT_NPL_ENC_NAI-EVEN +input addr: RI=1,GTI=4,GT=(TT=3,NPL=1,NAI=4,DIG=1234) +rc=6, expected rc=6 +encoded addr: 100312042143 +expected addr: 100312042143 +decod addr: RI=1,GTI=4,GT=(TT=3,NPL=1,NAI=4,DIG=1234) + +=> GT-NOPC-GTI_INVALID +input addr: RI=1,GTI=23,GT=(DIG=1234) +rc=-22, expected rc=-22 + +=> GT-NOPC-TT_NPL_ENC_NAI-EVEN-NONNUM +input addr: RI=1,GTI=4,GT=(TT=3,NPL=1,NAI=4,DIG=1ABF) +rc=6, expected rc=6 +encoded addr: 10031204a1fb +expected addr: 10031204a1fb +decod addr: RI=1,GTI=4,GT=(TT=3,NPL=1,NAI=4,DIG=1ABF) + +All tests passed.