#  -*- text -*-
#
#
#  $Id: d578994792a917fc5b2bb2c534d04b01fa840723 $

#######################################################################
#
#  = The Load Test Virtual Server
#
#  The load test virtual server generates test load, without using a
#  client program.

#  ## Virtual Server
#
#
server load {
	#
	#  For now, only "namespace = radius" is supported.
	#
	namespace = radius

	#
	#  Listen
	#
	listen {
		#
		#  Any packet types are supported.
		#
		#  However, only one packet type should be specified.
		#
		type = Access-Request

		#
		#  The load generator uses the "load" transport.
		#
		transport = load

		#
		#  load:: Configuration for load testing.
		#
		load {
			#
			#  filename:: File which contains one test packet.
			#
			#  The contents of the file are the same as
			#  used by "radclient".
			#
			#  For now, the secret is hard-coded to
			#  "testing123".
			#
			#  The Packet-Type attribute is also ignored.
			#
			filename = ${confdir}/input.txt

			#
			#  csv:: Where the output statistics are printed,
			#  in CSV format.
			#
			#  The first line of the output file contains a header
			#  which describes the columns.
			#
			csv = ${logdir}/stats.csv

			#
			#  start_pps:: What packet/s rate to start at.
			#
			start_pps	= 600

			#
			#  max_pps:: What maximum packet/s rate to end at.
			#
			max_pps		= 1000

			#
			#  duration:: How long in seconds to run each test.
			#
			duration	= 5

			#
			#  step:: Once `duration` is done, increase
			#  the PPS by this rate.
			#
			#  The tests are run repeatedly for `duration`
			#  seconds, increasing the PPS by `step` each
			#  time, until `max_pps` is reached.  At that
			#  point, the test stops, and no more packets
			#  are generated.
			#
			step		= 20

			#
			#  parallel: How many packets to send at once.
			#
			#  The "interrupt" rate of the load generator
			#  is "pps / parallel".  The server can
			#  generally process 5K "interrupts" per
			#  second.  So to send 50K pps, set "pps =
			#  50K" and "parallel = 10".
			#
			parallel	= 1

			#
			#  max_backlog:: The maximum allowed backlog
			#  in milliseconds, not packets.
			#
			#  The backlog is "packets sent without a
			#  reply".
			#
			#  If we are sending at 2K PPS, and
			#  "max_backlog = 1000", then the maximum
			#  number of packets allowed in the backlog
			#  will be 2K.
			#
			#  Using a time-based backlog seems to be more
			#  flexible than a counter-based backlog.
			#
			#  Once the backlog is hit, the load generator
			#  will stop sending packets on timed
			#  intervals.  Instead, it will send one new
			#  packet when it receives a reply.  If the
			#  backlog falls below the "max_backlog"
			#  limit, then the load generator switches
			#  back to sending at the "pps" rate.
			#
			max_backlog	= 1000


			#
			#  repeat:: whether or not to start again after
			#  we reach max_pps
			#
			repeat = no
		}
	}

#
#  Put any logic here.
#
recv Access-Request {
	accept
}


authenticate pap {
	pap
}

send Access-Accept {
	ok
}

send Access-Reject {
	ok
}
}
