K2InformaticsGmbH / smpp_parser

A parser for SMPP protocol PDUs
Apache License 2.0
3 stars 1 forks source link

Expected TLV missing #42

Closed walter-weinmann closed 6 years ago

walter-weinmann commented 6 years ago
=== Reason: no match of right hand side value {error,
                                                    <<"Expected TLV missing">>}
  in function  smpp_test_utils:encode_decode/1 (d:/K2/smpp_parser_idea/smpp_parser/_build/test/lib/smpp_parser/test/src/smpp_test_utils.erl, line 41)
  in call from compacted_broadcast_sm_SUITE:test_compacted/1 (d:/K2/smpp_parser_idea/smpp_parser/_build/test/lib/smpp_parser/test/generated/ct/compacted_broadcast_sm_SUITE.erl, line 49)
  in call from test_server:ts_tc/3 (test_server.erl, line 1546)
  in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1062)
  in call from test_server:run_test_case_eval/9 (test_server.erl, line 994)

Example:

 {"broadcast_sm_issue_42",
  "00 00 00 A9 00 00 01 11 00 00 00 00 00 00 00 01 47 55 54 53 00 00 0E 31 39 "
  "32 2E 31 36 38 2E 31 2E 31 00 74 68 69 73 5F 63 6F 75 6C 64 5F 62 65 5F 61 "
  "5F 6D 65 73 73 61 67 65 5F 69 64 00 04 39 39 30 37 32 34 31 37 35 34 34 34 "
  "30 30 30 52 00 39 39 30 38 32 33 31 36 35 33 34 33 30 30 30 52 00 00 0F 3F "
  "06 06 00 23 01 6D 79 5F 62 72 6F 61 64 63 61 73 74 5F 61 72 65 61 5F 69 64 "
  "65 6E 74 69 66 69 65 72 5F 30 30 30 30 37 06 01 00 03 00 00 33 06 04 00 02 "
  "00 00 06 05 00 03 08 00 03 13 0C 00 01 03 03 02 00 01 0B"}
c-bik commented 6 years ago

@walter-weinmann Can you please add tests for such missing support as following? https://github.com/K2InformaticsGmbH/smpp_parser/blob/4f41e2be115162f0e86157c473b00c52e02b7b2d/src/smpp.erl#L890-L901

I suppose new issues isn't required as long as we have failing tests. Thanks 👍

walter-weinmann commented 6 years ago

Issue in test data generation.

c-bik commented 6 years ago

PDU structure analysis

00 00 00 A9 # command_length (169)
00 00 01 11 # command_id (broadcast_sm)
00 00 00 00 # command_status
00 00 00 01 # sequence_number
47 55 54 53 00 # service_type ("GUTS")
00 # source_addr_ton
0E # source_addr_npi
31 39 32 2E 31 36 38 2E 31 2E 31 00 # source_addr ("192.168.1.1")
# message_id ("this_could_be_a_message_id")
74 68 69 73 5F 63 6F 75 6C 64 5F 62 65 5F 61 5F 6D 65 73 73 61 67 65 5F 69 64 00
04 # priority_flag
39 39 30 37 32 34 31 37 35 34 34 34 30 30 30 52 00 # scheduled_delivery_time ("990724175444000R")
39 39 30 38 32 33 31 36 35 33 34 33 30 30 30 52 00 # validity_period
00 # replace_if_present_flag
0F # data_coding
3F # sm_default_msg_id

06 06 # broadcast_area_identifier TLV
00 23 # broadcast_area_identifier TLV length 35
# broadcast_area_identifier TLV body 35 bytes
01 6D 79 5F 62 72 6F 61 64 63 61 73 74 5F 61 72 65 61 5F 69 64 65 6E 74 69 66 69 65 72 5F 30 30 30 30 37

06 01 # broadcast_content_type TLV
00 03 # broadcast_content_type TLV length 3
# broadcast_content_type TLV body 3 bytes
00 00 33

06 04 # broadcast_rep_num TLV
00 02 # broadcast_rep_num TLV length 2
# broadcast_rep_num TLV 2 bytes
00 00

06 05 # broadcast_frequency_interval TLV
00 03 # broadcast_frequency_interval TLV length 3
# broadcast_frequency_interval TLV 3 bytes
08 00 03

13 0C 00 01 03 # alert_on_message_delivery TLV length 1, value 3
03 02 00 01 0B # callback_num_pres_ind TLV length 1, value 0x0B

Everything looks to be in order. Continuing further investigation...