anchor.diff:  			ipdr_log, get_range, get_last, auth_query, acct_query_radius,
   			acct_query_diameter, abmf_log_event, abmf_query, binary_tree_before,
   			binary_tree_after, binary_tree_backward, binary_tree_forward,
  -			binary_tree_last, binary_tree_first, binary_tree_half].
  +			binary_tree_last, binary_tree_first, binary_tree_half,
  +			diameter_scur].
   
   %%---------------------------------------------------------------------
   %%  Test cases
  
positive.code: %% Note: This directive should only be used in test suites.
  -compile(export_all).
  
  -include_lib("radius/include/radius.hrl").
  -include_lib("common_test/include/ct.hrl").
  -include_lib("diameter/include/diameter_gen_base_rfc6733.hrl").
  -include_lib("../include/diameter_gen_nas_application_rfc7155.hrl").
  -include_lib("../include/diameter_gen_3gpp_ro_application.hrl").
  
  %% support deprecated_time_unit()
  -define(MILLISECOND, milli_seconds).
  
negative.code: resp_attr(_) ->
  	{accept, [{?SessionTimeout, 3600}]}.
  
  %% @hidden
  price(Type, Units, Size, Amount) ->
  	#price{name = ocs:generate_identity(),
  			type = Type, units = Units,
  			size = Size, amount = Amount}.
  
  %% @hidden
  bucket(Units, RA) ->
  	#bucket{units = Units, remain_amount = RA,
  		start_date = erlang:system_time(?MILLISECOND),
  		end_date = erlang:system_time(?MILLISECOND) + 2592000000}.
  
  %% @hidden
  add_offer(Prices, Spec) when is_integer(Spec) ->
  	add_offer(Prices, integer_to_list(Spec));
  add_offer(Prices, Spec) ->
  	Offer = #offer{name = ocs:generate_identity(),
  	price = Prices, specification = Spec},
  	{ok, #offer{name = OfferId}} = ocs:add_offer(Offer),
  	OfferId.
  
  %% @hidden
  add_product(OfferId) ->
  	add_product(OfferId, []).
  add_product(OfferId, Chars) ->
  	{ok, #product{id = ProdRef}} = ocs:add_product(OfferId, Chars),
  	ProdRef.
  
  %% @hidden
  add_bucket(ProdRef, Bucket) ->
  	{ok, _, #bucket{id = BId}} = ocs:add_bucket(ProdRef, Bucket),
  	BId.
  
  %% @hidden
  diameter_scur_start(SId, Username, RequestNum, Requested) ->
  	Subscription_Id = #'3gpp_ro_Subscription-Id'{
  			'Subscription-Id-Type' = ?'3GPP_SUBSCRIPTION-ID-TYPE_END_USER_E164',
  			'Subscription-Id-Data' = Username},
  	RequestedUnits = #'3gpp_ro_Requested-Service-Unit' {
  			'CC-Total-Octets' = [Requested]},
  	MultiServices_CC = #'3gpp_ro_Multiple-Services-Credit-Control'{
  			'Requested-Service-Unit' = [RequestedUnits]},
  	ServiceInformation = #'3gpp_ro_Service-Information'{'PS-Information' =
  			[#'3gpp_ro_PS-Information'{
  					'3GPP-PDP-Type' = [3],
  					'Serving-Node-Type' = [2],
  					'SGSN-Address' = [{10,1,2,3}],
  					'GGSN-Address' = [{10,4,5,6}],
  					'3GPP-IMSI-MCC-MNC' = [<<"001001">>],
  					'3GPP-GGSN-MCC-MNC' = [<<"001001">>],
  					'3GPP-SGSN-MCC-MNC' = [<<"001001">>]}]},
  	CC_CCR = #'3gpp_ro_CCR'{'Session-Id' = SId,
  			'Auth-Application-Id' = ?RO_APPLICATION_ID,
  			'Service-Context-Id' = "32251@3gpp.org",
  			'User-Name' = [Username],
  			'CC-Request-Type' = ?'3GPP_CC-REQUEST-TYPE_INITIAL_REQUEST',
  			'CC-Request-Number' = RequestNum,
  			'Event-Timestamp' = [calendar:universal_time()],
  			'Subscription-Id' = [Subscription_Id],
  			'Multiple-Services-Credit-Control' = [MultiServices_CC],
  			'Service-Information' = [ServiceInformation]},
  	{ok, Answer} = diameter:call(?MODULE, cc_app_test, CC_CCR, []),
  	Answer.
  	
  %% @hidden
  diameter_scur_interim(SId, Username, RequestNum, Used, Requested) ->
  	Subscription_Id = #'3gpp_ro_Subscription-Id'{
  			'Subscription-Id-Type' = ?'3GPP_SUBSCRIPTION-ID-TYPE_END_USER_E164',
  			'Subscription-Id-Data' = Username},
  	UsedUnits = #'3gpp_ro_Used-Service-Unit'{'CC-Total-Octets' = [Used]},
  	RequestedUnits = #'3gpp_ro_Requested-Service-Unit' {
  			'CC-Total-Octets' = [Requested]},
  	MultiServices_CC = #'3gpp_ro_Multiple-Services-Credit-Control'{
  			'Used-Service-Unit' = [UsedUnits],
  			'Requested-Service-Unit' = [RequestedUnits]},
  	ServiceInformation = #'3gpp_ro_Service-Information'{'PS-Information' =
  			[#'3gpp_ro_PS-Information'{
  					'3GPP-PDP-Type' = [3],
  					'Serving-Node-Type' = [2],
  					'SGSN-Address' = [{10,1,2,3}],
  					'GGSN-Address' = [{10,4,5,6}],
  					'3GPP-IMSI-MCC-MNC' = [<<"001001">>],
  					'3GPP-GGSN-MCC-MNC' = [<<"001001">>],
  					'3GPP-SGSN-MCC-MNC' = [<<"001001">>]}]},
  	CC_CCR = #'3gpp_ro_CCR'{'Session-Id' = SId,
  			'Auth-Application-Id' = ?RO_APPLICATION_ID,
  			'Service-Context-Id' = "32251@3gpp.org" ,
  			'User-Name' = [Username],
  			'CC-Request-Type' = ?'3GPP_CC-REQUEST-TYPE_UPDATE_REQUEST',
  			'CC-Request-Number' = RequestNum,
  			'Event-Timestamp' = [calendar:universal_time()],
  			'Multiple-Services-Credit-Control' = [MultiServices_CC],
  			'Subscription-Id' = [Subscription_Id],
  			'Service-Information' = [ServiceInformation]},
  	{ok, Answer} = diameter:call(?MODULE, cc_app_test, CC_CCR, []),
  	Answer.
  	
  %% @hidden
  diameter_scur_stop(SId, Username, RequestNum, Used) ->
  	Subscription_Id = #'3gpp_ro_Subscription-Id'{
  			'Subscription-Id-Type' = ?'3GPP_SUBSCRIPTION-ID-TYPE_END_USER_E164',
  			'Subscription-Id-Data' = Username},
  	UsedUnits = #'3gpp_ro_Used-Service-Unit'{'CC-Total-Octets' = [Used]},
  	MultiServices_CC = #'3gpp_ro_Multiple-Services-Credit-Control'{
  			'Used-Service-Unit' = [UsedUnits]},
  	ServiceInformation = #'3gpp_ro_Service-Information'{'PS-Information' =
  			[#'3gpp_ro_PS-Information'{
  					'3GPP-PDP-Type' = [3],
  					'Serving-Node-Type' = [2],
  					'SGSN-Address' = [{10,1,2,3}],
  					'GGSN-Address' = [{10,4,5,6}],
  					'3GPP-IMSI-MCC-MNC' = [<<"001001">>],
  					'3GPP-GGSN-MCC-MNC' = [<<"001001">>],
  					'3GPP-SGSN-MCC-MNC' = [<<"001001">>]}]},
  	CC_CCR = #'3gpp_ro_CCR'{'Session-Id' = SId,
  			'Auth-Application-Id' = ?RO_APPLICATION_ID,
  			'Service-Context-Id' = "32251@3gpp.org" ,
  			'User-Name' = [Username],
  			'CC-Request-Type' = ?'3GPP_CC-REQUEST-TYPE_TERMINATION_REQUEST',
  			'CC-Request-Number' = RequestNum,
  			'Event-Timestamp' = [calendar:universal_time()],
  			'Multiple-Services-Credit-Control' = [MultiServices_CC],
  			'Subscription-Id' = [Subscription_Id],
  			'Service-Information' = [ServiceInformation]},
  	{ok, Answer} = diameter:call(?MODULE, cc_app_test, CC_CCR, []),
  	Answer.
  
  %% @hidden
  client_acct_service_opts(Config) ->
  	[{'Origin-Host', ?config(host, Config)},
  			{'Origin-Realm', ?config(realm, Config)},
  			{'Vendor-Id', ?IANA_PEN_SigScale},
  			{'Supported-Vendor-Id', [?IANA_PEN_3GPP]},
  			{'Product-Name', "SigScale Test Client (Acct)"},
  			{'Auth-Application-Id', [?RO_APPLICATION_ID]},
  			{string_decode, false},
  			{restrict_connections, false},
  			{application, [{alias, base_app_test},
  					{dictionary, diameter_gen_base_rfc6733},
  					{module, diameter_test_client_cb}]},
  			{application, [{alias, cc_app_test},
  					{dictionary, diameter_gen_3gpp_ro_application},
  					{module, diameter_test_client_cb}]}].
  
  %% @doc Add a transport capability to diameter service.
  %% @hidden
  connect(SvcName, Address, Port, Transport) when is_atom(Transport) ->
  	connect(SvcName, [{connect_timer, 30000} | transport_opts(Address, Port, Transport)]).
  
  %% @hidden
  connect(SvcName, Opts)->
  	diameter:add_transport(SvcName, {connect, Opts}).
  
  %% @hidden
  transport_opts(Address, Port, Trans) when is_atom(Trans) ->
  	transport_opts1({Trans, Address, Address, Port}).
  
  %% @hidden
  transport_opts1({Trans, LocalAddr, RemAddr, RemPort}) ->
  	[{transport_module, Trans}, {transport_config,
  			[{raddr, RemAddr}, {rport, RemPort},
  			{reuseaddr, true}, {ip, LocalAddr}]}].
  
  