#  -*- text -*-
#
#
#  $Id: f55be4dae0c233ae91598377890a78be3fb0061b $

#######################################################################
#
#  = The Load Virtual Server
#
#  The `load` virtual server does load testing.
#
server load {
	namespace = radius

	#
	#  Use `listen load { ... }` in any virtual server to do load
	#  testing against that server.
	#
	listen load {
		#
		#  The main module is the proto module, even though we're
		#  operating in the RADIUS namespace.
		#
		proto = load

		#
		#  This is a valid Packet-Type for the current `namespace`
		#
		type = Access-Request

		#
		#  For now, only 'step' transport is available.
		#
		transport = step

		#
		#  Do load testing in increasing steps.
		#
		step {
			#
			#  Filename with input packet.  This is in the
			#  same format as used by `radclient`.
			#
			filename = ${confdir}/load.txt

			#
			#  Where the statistics file goes, in CSV format.
			#
			#  One line will be written to the file for each
			#  second of the load generation run.
			#
			#  Each line will contain the following columns:
			#  - time - since the test started running
			#  - last_packet - The last time we added a request
			#    to the backlog.
			#  - rtt - Round Trip Time i.e. the average delay
			#    between a request and response.  This is a
			#    moving average in nanoseconds.
			#  - rttvar - Round Trip Time variance.  Moving
			#    average of the range between the smallest RTT
			#    and largest RTT.  The value is in nanoseconds.
			#  - pps - Packets per second.  The maximum packet
			#    rate we're aiming for with this "step".  The
			#    load generator increases the load periodically
			#    in "steps".
			#  - pps_accepted - Packets per second. Rate of
			#    response packets received.
			#  - sent - How many packets have been generated
			#    by the load generation module from the start of
			#    the run.
			#  - received - How many packets received since the
			#    start of the run.
			#  - backlog - How many requests are awaiting
			#    responses.
			#  - backlog_max - The largest the backlog has been
			#    since the start of the run.
			#  - <usec - Absolute counter.  Responses received
			#    in less that a microsecond since the start
			#    of the run.
			#  - us - Responses received in >= 1us < 10us since
			#    the start of the run.
			#  - 100us, ms, 10ms, 100ms, s are all similar
			#    latency bins.
			#  - blocked - 1 = true, 0 = false.   We're refusing
			#    to enqueue more packets until we get responses
			#    to the outstanding requests.
			csv = ${confdir}/stats.csv

			#
			#  How many packets/s to start with.
			#
			start_pps	= 100

			#
			#  How many packet/s to end up at.
			#
			#  When the load generator reaches this rate,
			#  it prints the final statistics, and makes
			#  the server exit.
			#
			max_pps		= 2000

			#
			#  How long we send packets for (in seconds) at each step.
			#
			duration	= 10

			#
			#  How big of a packet/s step to jump after running each test.
			#
			step		= 200

			#
			#  We don't want to overload the server.  If
			#  the server cannot process packets quickly
			#  enough, we will get a backlog of
			#  unprocessed packets.  If the backlog gets
			#  too high, then the load generator will
			#  temporarily stop sending packets.  Once the
			#  backlog is low enough, it will continue.
			#
			max_backlog	= 1000

			#
			#  How many packets to send immediately in
			#  parallel, without waiting for a response.
			#  When a reply is received, a new request may
			#  be sent.
			#
			parallel	= 25
		}
	}

#
#  The rest of the recv/send sections are protocol specific, and are
#  taken from the `namespace`.
#
recv Access-Request {
	accept
}


authenticate pap {
	pap
}

send Access-Accept {
	ok
}

send Access-Reject {
	ok
}

}
