[erlang-questions] Question about basic use of diameter

Tim Watson watson.timothy@REDACTED
Fri Sep 13 15:43:12 CEST 2013


Hi Ferenc,

Thanks for the quick reply.

On 13 Sep 2013, at 11:41, Ferenc Holzhauser wrote:
> For {error, no_service} of your own code: what does diameter:services() say? 
> If diameter:start_service(...) worked then you should have something in that list that is called ?NAME.
> If it is not the case then check if you called start_service with the correct data. 
> If you certainly did then I'm guessing rb is going to help out with some errors to debug.
> 
> Generally diameter:service_info(yourservicenamehere, all) gives good information for troubleshooting when your service is running.
> 

Except that I can't tell what I'm supposed to be looking for. I'm guessing some AVP isn't set right, but I'm not sure which. Both the client and the server nodes seem to contain the relevant [client] and [XX_service] entries when the tests execute, but I still get no_service when attempting to call. The test suite is executing this:

    Sid = diameter:session_id(atom_to_list(client)),
    ACR = #diameter_base_ACR{ 'Session-Id' = Sid,
                              'Accounting-Record-Type' = ?'DIAMETER_BASE_ACCOUNTING-RECORD-TYPE_EVENT_RECORD',
                              'Accounting-Record-Number' = 1 },
    {ok, #diameter_base_ACA{}} = diameter:call(demo_diameter_test_client, client, ACR, []),

The client has the following callback enabled:

prepare_request(#diameter_packet{ msg = Req }, _,
                {_, #diameter_caps{ origin_host = {OH, DH},
                                    origin_realm = {OR, DR} }}) ->
  {send, Req#diameter_base_ACR{ 'Origin-Host' = OH,
                                'Origin-Realm' = OR,
                                'Destination-Realm' = DR }}.

If I start the server and client manually, instead of the no_service error, I get {error, no_connection}:

(demo@REDACTED)1> 
(demo@REDACTED)1> diameter:service_info(demo_diameter_service, all).
[{capabilities,[{'Origin-Host',"service.example.com"},
                {'Origin-Realm',"example.com"},
                {'Vendor-Id',193},
                {'Product-Name',"Server"},
                {'Origin-State-Id',[]},
                {'Host-IP-Address',[]},
                {'Supported-Vendor-Id',[]},
                {'Auth-Application-Id',[0]},
                {'Inband-Security-Id',[]},
                {'Acct-Application-Id',[]},
                {'Vendor-Specific-Application-Id',[]},
                {'Firmware-Revision',[]}]},
 {applications,[[{alias,demo_diameter_service},
                 {dictionary,diameter_gen_base_rfc3588},
                 {module,[diameter_callback,
                          {diameter_callback,undefined,undefined,undefined,undefined,
                                             undefined,undefined,undefined,undefined,undefined,[]}]},
                 {init_state,demo_diameter_service},
                 {id,0},
                 {mutable,false},
                 {options,[{answer_errors,report},
                           {request_errors,answer_3xxx}]}]]},
 {transport,[[{ref,#Ref<0.0.0.769>},
              {type,listen},
              {options,[{transport_module,diameter_tcp},
                        {transport_config,[{reuseaddr,true},
                                           {ip,{127,0,0,1}},
                                           {port,3868}]}]},
              {accept,[[{watchdog,{<0.245.0>,
                                   {1379,78445,351797},
                                   initial}}]]},
              {statistics,[]}]]},
 {pending,[]},
 {options,[{sequence,{0,32}},
           {share_peers,false},
           {use_shared_peers,false},
           {restrict_connections,nodes}]}]
(demo@REDACTED)2> code:add_patha("/Users/t4/work/spikes/diameter-demo/test/ebin").
true
(demo@REDACTED)3> demo_diameter_test_client:start().        
ok
(demo@REDACTED)4> diameter:services().
[demo_diameter_service,client]
(demo@REDACTED)5> diameter:service_info(client, all).                                                          
[{capabilities,[{'Origin-Host',"client.example.com"},
                {'Origin-Realm',"example.com"},
                {'Vendor-Id',0},
                {'Product-Name',"Client"},
                {'Origin-State-Id',[]},
                {'Host-IP-Address',[]},
                {'Supported-Vendor-Id',[]},
                {'Auth-Application-Id',[0]},
                {'Inband-Security-Id',[]},
                {'Acct-Application-Id',[]},
                {'Vendor-Specific-Application-Id',[]},
                {'Firmware-Revision',[]}]},
 {applications,[[{alias,client},
                 {dictionary,diameter_gen_base_rfc3588},
                 {module,[demo_diameter_test_client]},
                 {init_state,client},
                 {id,0},
                 {mutable,false},
                 {options,[{answer_errors,report},
                           {request_errors,answer_3xxx}]}]]},
 {transport,[]},
 {pending,[]},
 {options,[{sequence,{0,32}},
           {share_peers,false},
           {use_shared_peers,false},
           {restrict_connections,nodes}]}]
(demo@REDACTED)6 demo_diameter_test_client:connect().
{ok,#Ref<0.0.0.1340>}
(demo@REDACTED)7> diameter:service_info(client, all).   
[{capabilities,[{'Origin-Host',"client.example.com"},
                {'Origin-Realm',"example.com"},
                {'Vendor-Id',0},
                {'Product-Name',"Client"},
                {'Origin-State-Id',[]},
                {'Host-IP-Address',[]},
                {'Supported-Vendor-Id',[]},
                {'Auth-Application-Id',[0]},
                {'Inband-Security-Id',[]},
                {'Acct-Application-Id',[]},
                {'Vendor-Specific-Application-Id',[]},
                {'Firmware-Revision',[]}]},
 {applications,[[{alias,client},
                 {dictionary,diameter_gen_base_rfc3588},
                 {module,[demo_diameter_test_client]},
                 {init_state,client},
                 {id,0},
                 {mutable,false},
                 {options,[{answer_errors,report},
                           {request_errors,answer_3xxx}]}]]},
 {transport,[[{ref,#Ref<0.0.0.1340>},
              {type,connect},
              {options,[{reconnect_timer,5000},
                        {transport_module,diameter_tcp},
                        {transport_config,[{raddr,{127,0,0,1}},
                                           {rport,3868},
                                           {reuseaddr,true},
                                           {ip,{127,0,0,1}}]}]},
              {watchdog,{<0.303.0>,{1379,78639,682458},okay}},
              {peer,{<0.304.0>,{1379,78639,686181}}},
              {apps,[{0,client}]},
              {caps,[{origin_host,{"client.example.com",
                                   "service.example.com"}},
                     {origin_realm,{"example.com","example.com"}},
                     {host_ip_address,{[{127,0,0,1}],[{127,0,0,1}]}},
                     {vendor_id,{0,193}},
                     {product_name,{"Client","Server"}},
                     {origin_state_id,{[],[]}},
                     {supported_vendor_id,{[],[]}},
                     {auth_application_id,{[0],[0]}},
                     {inband_security_id,{[],[]}},
                     {acct_application_id,{[],[]}},
                     {vendor_specific_application_id,{[],...}},
                     {firmware_revision,{...}},
                     {avp,...}]},
              {port,[{owner,<0.306.0>},
                     {module,diameter_tcp},
                     {socket,{{127,0,0,1},53123}},
                     {peer,{{127,0,0,1},3868}},
                     {statistics,[{recv_oct,136},
                                  {recv_cnt,1},
                                  {recv_max,136},
                                  {recv_avg,136},
                                  {recv_dvi,...},
                                  {...}|...]}]},
              {statistics,[{{{0,257,0},recv},1},{{{0,257,1},send},1}]}]]},
 {pending,[]},
 {options,[{sequence,{0,32}},
           {share_peers,false},
           {use_shared_peers,false},
           {restrict_connections,nodes}]}]
(demo@REDACTED> diameter:service_info(demo_diameter_service, all).                                         
[{capabilities,[{'Origin-Host',"service.example.com"},
                {'Origin-Realm',"example.com"},
                {'Vendor-Id',193},
                {'Product-Name',"Server"},
                {'Origin-State-Id',[]},
                {'Host-IP-Address',[]},
                {'Supported-Vendor-Id',[]},
                {'Auth-Application-Id',[0]},
                {'Inband-Security-Id',[]},
                {'Acct-Application-Id',[]},
                {'Vendor-Specific-Application-Id',[]},
                {'Firmware-Revision',[]}]},
 {applications,[[{alias,demo_diameter_service},
                 {dictionary,diameter_gen_base_rfc3588},
                 {module,[diameter_callback,
                          {diameter_callback,undefined,undefined,undefined,undefined,
                                             undefined,undefined,undefined,undefined,undefined,[]}]},
                 {init_state,demo_diameter_service},
                 {id,0},
                 {mutable,false},
                 {options,[{answer_errors,report},
                           {request_errors,answer_3xxx}]}]]},
 {transport,[[{ref,#Ref<0.0.0.769>},
              {type,listen},
              {options,[{transport_module,diameter_tcp},
                        {transport_config,[{reuseaddr,true},
                                           {ip,{127,0,0,1}},
                                           {port,3868}]}]},
              {accept,[[{watchdog,{<0.308.0>,
                                   {1379,78639,684566},
                                   initial}}],
                       [{watchdog,{<0.245.0>,{1379,78445,351797},okay}},
                        {peer,{<0.246.0>,{1379,78639,685678}}},
                        {apps,[{0,demo_diameter_service}]},
                        {caps,[{origin_host,{"service.example.com",
                                             "client.example.com"}},
                               {origin_realm,{"example.com","example.com"}},
                               {host_ip_address,{[{127,0,...}],[{127,...}]}},
                               {vendor_id,{193,0}},
                               {product_name,{"Server",[...]}},
                               {origin_state_id,{[],...}},
                               {supported_vendor_id,{...}},
                               {auth_application_id,...},
                               {...}|...]},
                        {port,[{owner,<0.255.0>},
                               {module,diameter_tcp},
                               {socket,{{127,0,...},3868}},
                               {peer,{{127,...},53123}},
                               {statistics,[{...}|...]}]}]]},
              {statistics,[{{{0,257,0},send},1},{{{0,257,1},recv},1}]}]]},
 {pending,[]},
 {options,[{sequence,{0,32}},
           {share_peers,false},
           {use_shared_peers,false},
           {restrict_connections,nodes}]}]
(demo@REDACTED)9> demo_diameter_test_client:call().                 
{error,no_connection}





More information about the erlang-questions mailing list