K2InformaticsGmbH / smpp_parser

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

`alert_on_message_delivery` TLV implied default 0 (through Length = 0) is not supported #100

Closed c-bik closed 6 years ago

c-bik commented 6 years ago
*** User 2018-06-21 10:56:13.721 ***
smpp_test_utils:decode_encode_decode:40 ===> Start
Command: broadcast_sm
PDU: "00 00 00 D7 00 00 01 11 00 00 00 00 00 00 00 01 56 4D 4E 00 00 04 31 39 32 2E 31 2E 31 2E
 31 30 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 00 39
 39 30 31 30 31 30 30 30 30 30 30 30 30 30 52 00 00 01 1F 7F 06 06 00 23 00 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 36 06 01 00 03 02
 00 38 06 04 00 02 00 00 06 05 00 03 0E 00 0D 02 04 00 02 A3 91 04 24 00 18 6D 79 5F 6D 65 73
 73 61 67 65 5F 70 61 79 6C 6F 61 64 5F 30 30 30 32 30 06 0A 00 20 6D 79 5F 62 72 6F 61 64 63
 61 73 74 5F 73 65 72 76 69 63 65 5F 67 72 6F 75 70 5F 30 30 30 30 35 13 0C 00 00"

*** User 2018-06-21 10:56:13.723 ***
smpp_test_utils:decode_encode_decode:45 ===> 
Expected : #{alert_on_message_delivery => 0,
             broadcast_area_identifier =>
                 [#{details => <<"my_broadcast_area_identifier_00006">>,
                    format => 0}],
             broadcast_content_type => #{network_type => 2,service => 56},
             broadcast_frequency_interval => #{number => 13,time_unit => 14},
             broadcast_rep_num => 0,
             broadcast_service_group => <<"my_broadcast_service_group_00005">>,
             command_id => <<"broadcast_sm">>,command_length => 215,
             command_status => <<"ESME_ROK">>,data_coding => <<"31">>,
             message_id => <<"this_could_be_a_message_id">>,
             message_payload => <<"my_message_payload_00020">>,
             priority_flag => 0,replace_if_present_flag => 1,
             schedule_delivery_time => <<"990101000000000R">>,
             sequence_number => 1,service_type => <<"VMN">>,
             sm_default_msg_id => 127,source_addr => <<"192.1.1.10">>,
             source_addr_npi => <<"Telex (F.69)">>,
             source_addr_ton => <<"Unknown">>,user_message_reference => 41873,
             validity_period => <<>>}
Got      : #{alert_on_message_delivery => 0,
             broadcast_area_identifier =>
                 [#{details => <<"my_broadcast_area_identifier_00006">>,
                    format => 0}],
             broadcast_content_type => #{network_type => 2,service => 56},
             broadcast_frequency_interval => #{number => 13,time_unit => 14},
             broadcast_rep_num => 0,
             broadcast_service_group => <<"my_broadcast_service_group_00005">>,
             command_id => <<"broadcast_sm">>,command_length => 216,
             command_status => <<"ESME_ROK">>,data_coding => <<"31">>,
             message_id => <<"this_could_be_a_message_id">>,
             message_payload => <<"my_message_payload_00020">>,
             priority_flag => 0,replace_if_present_flag => 1,
             schedule_delivery_time => <<"990101000000000R">>,
             sequence_number => 1,service_type => <<"VMN">>,
             sm_default_msg_id => 127,source_addr => <<"192.1.1.10">>,
             source_addr_npi => <<"Telex (F.69)">>,
             source_addr_ton => <<"Unknown">>,user_message_reference => 41873,
             validity_period => <<>>}

ONLY Different Command Length expected 215 got 216

> length(string:tokens(PDU," ")).                  
215

    {ok, Map1} = smpp:decode(PDU),
    {ok, PDU2} = smpp:encode(jsx:decode(jsx:encode(Map1), [return_maps])),

> length(string:tokens(binary_to_list(PDU2), " ")).
216

    {ok, Map2} = smpp:decode(PDU2),
PDU:
00 00 00 D7 command_length (215)
00 00 01 11 command_id
00 00 00 00 command_status
00 00 00 01 sequence_number
56 4D 4E 00 service_type (VMN)
00 source_addr_ton
04 source_addr_npi
31 39 32 2E 31 2E 31 2E 31 30 00 source_addr ("192.1.1.10")
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
00 priority_flag
schedule_delivery_time("990101000000000R") - 16
39 39 30 31 30 31 30 30 30 30 30 30 30 30 30 52 00
00 validity_period
01 replace_if_present_flag
1F data_coding
7F sm_default_msg_id

06 06 broadcast_area_identifier TLV
00 23 broadcast_area_identifier TLV length (35 bytes)
00 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 36

06 01 broadcast_content_type TLV
00 03 broadcast_content_type TLV length (3 bytes)
02 00 38

06 04 broadcast_rep_num TLV
00 02 broadcast_rep_num TLV length (2 bytes)
00 00

06 05 broadcast_frequency_interval TLV
00 03 broadcast_frequency_interval TLV length (3 bytes)
0E 00 0D

02 04 user_message_reference TLV
00 02 user_message_reference TLV length (2 bytes)
A3 91

04 24 message_payload TLV
00 18 message_payload TLV length (24 bytes)
message_payload TLV value "my_message_payload_00020"
6D 79 5F 6D 65 73 73 61 67 65 5F 70 61 79 6C 6F 61 64 5F 30 30 30 32 30

06 0A broadcast_service_group TLV
00 20 broadcast_service_group TLV length (32 bytes)
broadcast_service_group TLV value "my_broadcast_service_group_00005"
6D 79 5F 62 72 6F 61 64 63 61 73 74 5F 73 65 72 76 69 63 65 5F 67 72 6F 75 70 5F 30 30 30 30 35

13 0C alert_on_message_delivery TLV
00 00 alert_on_message_delivery TLV length (0 bytes)
PDU2 (differences):
00 00 00 D8 command_length (216)
...
13 0C alert_on_message_delivery TLV
00 01 alert_on_message_delivery TLV length (1 bytes)
00  alert_on_message_delivery TLV length (1 bytes)
00

Conclusion

The both are valid PDUs and the only difference is how alert_on_message_delivery is used. According to spec... image

Parser doesn't support the two different ways to provide value 0 it does the same way as for any other TLV values. So it seems Len=0 to choose Value=0(Default) is a optimization offered by SMPP 5.0 spec for alert_on_message_delivery TLV.

@walter-weinmann Can you please correct / disbale this in load test generation?

c-bik commented 6 years ago

@walter-weinmann I will close this after vefrification

shamis commented 6 years ago

this has been fixed in the test cases as tests run without errors