Index: doc/test_app.conf.sample
===================================================================
--- doc/test_app.conf.sample	(revision 1197)
+++ doc/test_app.conf.sample	(revision 1214)
@@ -28,4 +28,11 @@
 # The AVP id for the test.
 # avp-id = 345678;
+
+# Another AVP id for long payload test. default to value 0, meaning this is not used.
+# long-avp-id = 0;
+
+# Define the payload length of the long-avp. Default 5000 bytes.
+# long-avp-len = 5000;
+
 
 #######################
Index: extensions/test_app/ta_cli.c
===================================================================
--- extensions/test_app/ta_cli.c	(revision 1088)
+++ extensions/test_app/ta_cli.c	(revision 1214)
@@ -182,5 +182,5 @@
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
 	
-	/* Create the request from template */
+	/* Create the request */
 	CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
 	
@@ -239,4 +239,17 @@
 	}
 	
+	/* Set the Test-Payload-AVP AVP */
+	if (ta_conf->long_avp_id) {
+		int l;
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_avp_long, 0, &avp ), goto out  );
+		CHECK_MALLOC_DO( val.os.data = malloc(ta_conf->long_avp_len), goto out);
+		val.os.len = ta_conf->long_avp_len;
+		for (l=0; l < ta_conf->long_avp_len; l++)
+			val.os.data[l]=l;
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
+		free(val.os.data);
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
+	}
+	
 	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
 	
Index: extensions/test_app/ta_conf.l
===================================================================
--- extensions/test_app/ta_conf.l	(revision 1127)
+++ extensions/test_app/ta_conf.l	(revision 1214)
@@ -118,4 +118,12 @@
 			}
 
+(?i:"long-avp-id")	{
+				return LONG_AVP_ID;
+			}
+
+(?i:"long-avp-len")	{
+				return LONG_AVP_LEN;
+			}
+
 (?i:"mode")		{
 				return MODE;
Index: extensions/test_app/ta_conf.y
===================================================================
--- extensions/test_app/ta_conf.y	(revision 1127)
+++ extensions/test_app/ta_conf.y	(revision 1214)
@@ -121,4 +121,6 @@
 %token 		CMD_ID
 %token 		AVP_ID
+%token 		LONG_AVP_ID
+%token 		LONG_AVP_LEN
 %token 		MODE
 %token 		DEST_REALM
@@ -146,4 +148,6 @@
 			| conffile cmd
 			| conffile avp
+			| conffile long_avp_id
+			| conffile long_avp_len
 			| conffile mode
 			| conffile dstrealm
@@ -178,4 +182,16 @@
 			;
 
+long_avp_id:		LONG_AVP_ID '=' INTEGER ';'
+			{
+				ta_conf->long_avp_id = $3;
+			}
+			;
+
+long_avp_len:		LONG_AVP_LEN '=' INTEGER ';'
+			{
+				ta_conf->long_avp_len = $3;
+			}
+			;
+
 mode:			MODE '=' INTEGER ';'
 			{
Index: extensions/test_app/ta_dict.c
===================================================================
--- extensions/test_app/ta_dict.c	(revision 741)
+++ extensions/test_app/ta_dict.c	(revision 1214)
@@ -43,4 +43,5 @@
 struct dict_object * ta_cmd_a = NULL;
 struct dict_object * ta_avp = NULL;
+struct dict_object * ta_avp_long = NULL;
 
 struct dict_object * ta_sess_id = NULL;
@@ -95,4 +96,16 @@
 		data.avp_basetype = AVP_TYPE_INTEGER32;
 		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp));
+	}
+	
+	/* Create the Test Payload AVP */
+	if (ta_conf->long_avp_id) {
+		struct dict_avp_data data;
+		data.avp_code = ta_conf->long_avp_id;
+		data.avp_vendor = ta_conf->vendor_id;
+		data.avp_name = "Test-Payload-AVP";
+		data.avp_flag_mask = AVP_FLAG_VENDOR;
+		data.avp_flag_val = AVP_FLAG_VENDOR;
+		data.avp_basetype = AVP_TYPE_OCTETSTRING;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp_long));
 	}
 	
Index: extensions/test_app/ta_serv.c
===================================================================
--- extensions/test_app/ta_serv.c	(revision 1127)
+++ extensions/test_app/ta_serv.c	(revision 1214)
@@ -95,4 +95,18 @@
 	}
 	
+	/* Set the Test-Payload-AVP AVP */
+	if (ta_conf->long_avp_id) {
+		struct avp * src = NULL;
+		struct avp_hdr * hdr = NULL;
+		
+		CHECK_FCT( fd_msg_search_avp ( qry, ta_avp_long, &src) );
+		CHECK_FCT( fd_msg_avp_hdr( src, &hdr )  );
+		
+		CHECK_FCT( fd_msg_avp_new ( ta_avp_long, 0, &avp ) );
+		CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) );
+		CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) );
+	}
+	
+	
 	/* Set the Origin-Host, Origin-Realm, Result-Code AVPs */
 	CHECK_FCT( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ) );
Index: extensions/test_app/test_app.c
===================================================================
--- extensions/test_app/test_app.c	(revision 1199)
+++ extensions/test_app/test_app.c	(revision 1214)
@@ -55,4 +55,5 @@
 	ta_conf->cmd_id     = 0xfffffe;	/* Experimental */
 	ta_conf->avp_id     = 0xffffff;	/* dummy value */
+	ta_conf->long_avp_len = 5000;
 	ta_conf->mode       = MODE_SERV | MODE_CLI;
 	ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
@@ -77,4 +78,6 @@
 	fd_log_debug( " Command Id ......... : %u", ta_conf->cmd_id);
 	fd_log_debug( " AVP Id ............. : %u", ta_conf->avp_id);
+	fd_log_debug( " Long AVP Id ........ : %u", ta_conf->long_avp_id);
+	fd_log_debug( " Long AVP len ....... : %zu", ta_conf->long_avp_len);
 	fd_log_debug( " Mode ............... : %s%s%s", ta_conf->mode & MODE_SERV ? "Serv" : "", ta_conf->mode & MODE_CLI ? "Cli" : "",  ta_conf->mode & MODE_BENCH ? " (Benchmark)" : "");
 	fd_log_debug( " Destination Realm .. : %s", ta_conf->dest_realm ?: "- none -");
Index: extensions/test_app/test_app.h
===================================================================
--- extensions/test_app/test_app.h	(revision 741)
+++ extensions/test_app/test_app.h	(revision 1214)
@@ -60,4 +60,6 @@
 	uint32_t	cmd_id;		/* default 234567 */
 	uint32_t	avp_id;		/* default 345678 */
+	uint32_t	long_avp_id;	/* default 0 */
+	size_t		long_avp_len;	/* default 5000 */
 	int		mode;		/* default MODE_SERV | MODE_CLI */
 	char 	*	dest_realm;	/* default local realm */
@@ -105,4 +107,5 @@
 extern struct dict_object * ta_cmd_a;
 extern struct dict_object * ta_avp;
+extern struct dict_object * ta_avp_long;
 
 extern struct dict_object * ta_sess_id;
