; config options
server:
	target-fetch-policy: "3 2 1 0 0"

stub-zone:
	name: "."
	stub-addr: 193.0.14.129 	# K.ROOT-SERVERS.NET.
CONFIG_END

SCENARIO_BEGIN Test locate of NS records for DS and with detached queries
; the additional targets looked up cause detached queries.
; hence the target fetch policy is increased above.

; K.ROOT-SERVERS.NET.
RANGE_BEGIN 0 100
	ADDRESS 193.0.14.129 
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
. IN NS
SECTION ANSWER
. IN NS	K.ROOT-SERVERS.NET.
SECTION ADDITIONAL
K.ROOT-SERVERS.NET.	IN	A	193.0.14.129
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id 
REPLY QR AA NOERROR
SECTION QUESTION
k.root-servers.net. IN A
SECTION ANSWER
K.ROOT-SERVERS.NET.	IN	A	193.0.14.129
SECTION AUTHORITY
root-servers.net. IN NS	K.ROOT-SERVERS.NET.
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id 
REPLY QR AA NOERROR
SECTION QUESTION
k.root-servers.net. IN AAAA
SECTION ANSWER
SECTION AUTHORITY
root-servers.net. IN SOA	K.ROOT-SERVERS.NET. hostmaster. 1 2 3 4 5
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id 
REPLY QR AA NOERROR
SECTION QUESTION
net. IN DS
SECTION ANSWER
SECTION AUTHORITY
. IN SOA	K.ROOT-SERVERS.NET. hostmaster. 1 2 3 4 5
ENTRY_END

ENTRY_BEGIN
MATCH opcode subdomain
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
net. IN A
SECTION AUTHORITY
net.	IN NS	a.server.net.
net.	IN NS	b.server.net.
net.	IN NS	c.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END
RANGE_END

; a.server.net.
; The b.server.net and c.server.net servers are here to cause
; extra lookups to be generated (to create detached queries in the
; iterator), there is no IP address that answers for them set up.
; force DSNSFind, we host a grandchild zone.
; also, this range of steps is without responses for b and c, so that
; they can be force to happen later (after the DSNS is activated).
RANGE_BEGIN 0 20
	ADDRESS 192.5.6.30
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
net. IN NS
SECTION ANSWER
net.	IN NS	a.server.net.
net.	IN NS	b.server.net.
net.	IN NS	c.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
a.server.net. IN A
SECTION ANSWER
a.server.net. IN A 192.5.6.30
SECTION AUTHORITY
net.	IN NS	a.server.net.
net.	IN NS	b.server.net.
net.	IN NS	c.server.net.
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
a.sub.example.net. IN DS
SECTION AUTHORITY
sub.example.net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
sub.example.net. IN NS
SECTION ANSWER
sub.example.net. IN NS	a.server.net.
sub.example.net. IN NS	b.server.net.
sub.example.net. IN NS	c.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode subdomain
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
a.sub.example.net. IN A
SECTION AUTHORITY
sub.example.net. IN NS	a.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END
RANGE_END

; a.server.net range with all the answers (to finish the test).
RANGE_BEGIN 30 100
	ADDRESS 192.5.6.30
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
net. IN NS
SECTION ANSWER
net.	IN NS	a.server.net.
net.	IN NS	b.server.net.
net.	IN NS	c.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
a.server.net. IN A
SECTION ANSWER
a.server.net. IN A 192.5.6.30
SECTION AUTHORITY
net.	IN NS	a.server.net.
net.	IN NS	b.server.net.
net.	IN NS	c.server.net.
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
a.server.net. IN AAAA
SECTION AUTHORITY
net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
b.server.net. IN A
SECTION AUTHORITY
net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
b.server.net. IN AAAA
SECTION AUTHORITY
net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
c.server.net. IN A
SECTION AUTHORITY
net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
c.server.net. IN AAAA
SECTION AUTHORITY
net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
a.sub.example.net. IN DS
SECTION AUTHORITY
sub.example.net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
sub.example.net. IN NS
SECTION ANSWER
sub.example.net. IN NS	a.server.net.
sub.example.net. IN NS	b.server.net.
sub.example.net. IN NS	c.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode subdomain
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
a.sub.example.net. IN A
SECTION AUTHORITY
sub.example.net. IN NS	a.server.net.
SECTION ADDITIONAL
a.server.net. IN A 192.5.6.30
ENTRY_END
RANGE_END

STEP 1 QUERY
ENTRY_BEGIN
REPLY RD
SECTION QUESTION
a.sub.example.net. IN DS
ENTRY_END

; make traffic flow at this time
STEP 15 TRAFFIC

STEP 20 TRAFFIC

STEP 40 CHECK_ANSWER
ENTRY_BEGIN
MATCH all
REPLY QR RD RA NOERROR
SECTION QUESTION
a.sub.example.net. IN DS
SECTION ANSWER
SECTION AUTHORITY
sub.example.net. IN SOA a.gtld-servers.net. hostmaster. 2 3 4 5 6
SECTION ADDITIONAL
ENTRY_END

STEP 50 TRAFFIC

SCENARIO_END
