## root
.:53 {
    bind 127.16.1.27               # ns1
    bind fda1:b2:c3:0:127:16:1:27  # ns1
    bind 127.16.1.28               # ns2
    bind fda1:b2:c3:0:127:16:1:28  # ns2
    log
    file Delegation-TP/delegation01/root-zone.zone .
}

# Resolver using test case local root
. {
    bind 127.16.1.53
    unbound {
       option root-hints Delegation-TP/delegation01/hintfile.zone
    }
    log
}

delegation01.xb:53 { # xb
    bind 127.16.1.25               # ns1
    bind fda1:b2:c3:0:127:16:1:25  # ns1
    bind 127.16.1.26               # ns2
    bind fda1:b2:c3:0:127:16:1:26  # ns2
    log
    file Delegation-TP/delegation01/delegation01.xb.zone delegation01.xb
}

delegation01.xa:53 { # xa
    bind 127.16.1.21               # ns1
    bind fda1:b2:c3:0:127:16:1:21  # ns1
    bind 127.16.1.22               # ns2
    bind fda1:b2:c3:0:127:16:1:22  # ns2
    log
    file Delegation-TP/delegation01/delegation01.xa.zone delegation01.xa
}

### Child zones

enough-1.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/enough-1.delegation01.xa.zone enough-1.delegation01.xa
}

enough-2.delegation01.xa:53 {
    bind 127.16.1.33               # ns1.enough-2.delegation01.xb
    bind fda1:b2:c3:0:127:16:1:33  # ns1.enough-2.delegation01.xb
    bind 127.16.1.34               # ns2.enough-2.delegation01.xb
    bind fda1:b2:c3:0:127:16:1:34  # ns2.enough-2.delegation01.xb
    log
    file Delegation-TP/delegation01/enough-2.delegation01.xa.zone enough-2.delegation01.xa
}

enough-3.delegation01.xa:53 { # Force sibling glue in referral from parent
    bind 127.16.1.21               # ns1 (parent)
    bind fda1:b2:c3:0:127:16:1:21  # ns1 (parent)
    bind 127.16.1.22               # ns2 (parent)
    bind fda1:b2:c3:0:127:16:1:22  # ns2 (parent)
    log
    template IN ANY enough-3.delegation01.xa {
        authority  "enough-3.delegation01.xa.    3600 IN NS   ns1.enough-3.sibling.delegation01.xa."
        authority  "enough-3.delegation01.xa.    3600 IN NS   ns2.enough-3.sibling.delegation01.xa."
        additional "ns1.enough-3.sibling.delegation01.xa 3600 IN A    127.16.1.31"
        additional "ns1.enough-3.sibling.delegation01.xa 3600 IN AAAA fda1:b2:c3:0:127:16:1:31"
        additional "ns2.enough-3.sibling.delegation01.xa 3600 IN A    127.16.1.32"
        additional "ns2.enough-3.sibling.delegation01.xa 3600 IN AAAA fda1:b2:c3:0:127:16:1:32"
    }
    header {
        response clear aa
    }
} 
enough-3.delegation01.xa:53 {
    bind 127.16.1.31               # ns1.enough-3.sibling.delegation01.xa
    bind fda1:b2:c3:0:127:16:1:31  # ns1.enough-3.sibling.delegation01.xa
    bind 127.16.1.32               # ns2.enough-3.sibling.delegation01.xa
    bind fda1:b2:c3:0:127:16:1:32  # ns2.enough-3.sibling.delegation01.xa
    log
    file Delegation-TP/delegation01/enough-3.delegation01.xa.zone enough-3.delegation01.xa
}

enough-del-not-child.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/enough-del-not-child.delegation01.xa.zone enough-del-not-child.delegation01.xa
}

enough-child-not-del.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/enough-child-not-del.delegation01.xa.zone enough-child-not-del.delegation01.xa
}

ipv6-and-del-ok-no-ipv4-child.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/ipv6-and-del-ok-no-ipv4-child.delegation01.xa.zone ipv6-and-del-ok-no-ipv4-child.delegation01.xa
}

ipv4-and-del-ok-no-ipv6-child.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/ipv4-and-del-ok-no-ipv6-child.delegation01.xa.zone ipv4-and-del-ok-no-ipv6-child.delegation01.xa
}

no-ipv4-1.delegation01.xa:53 {
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/no-ipv4-1.delegation01.xa.zone no-ipv4-1.delegation01.xa
}

no-ipv4-2.delegation01.xa:53 {
    bind fda1:b2:c3:0:127:16:1:33  # ns1.no-ipv4-2.delegation01.xb
    bind fda1:b2:c3:0:127:16:1:34  # ns2.no-ipv4-2.delegation01.xb
    log
    file Delegation-TP/delegation01/no-ipv4-2.delegation01.xa.zone no-ipv4-2.delegation01.xa
}

no-ipv4-3.delegation01.xa:53 { # Force sibling glue in referral from parent
    bind 127.16.1.21               # ns1 (parent)
    bind fda1:b2:c3:0:127:16:1:21  # ns1 (parent)
    bind 127.16.1.22               # ns2 (parent)
    bind fda1:b2:c3:0:127:16:1:22  # ns2 (parent)
    log
    template IN ANY no-ipv4-3.delegation01.xa {
        authority  "no-ipv4-3.delegation01.xa.    3600 IN NS   ns1.no-ipv4-3.sibling.delegation01.xa."
        authority  "no-ipv4-3.delegation01.xa.    3600 IN NS   ns2.no-ipv4-3.sibling.delegation01.xa."
        additional "ns1.no-ipv4-3.sibling.delegation01.xa 3600 IN AAAA fda1:b2:c3:0:127:16:1:31"
        additional "ns1.no-ipv4-3.sibling.delegation01.xa 3600 IN AAAA fda1:b2:c3:0:127:16:1:32"
    }
    header {
        response clear aa
    }
} 
no-ipv4-3.delegation01.xa:53 {
    bind fda1:b2:c3:0:127:16:1:31  # ns1.no-ipv4-3.sibling.delegation01.xa
    bind fda1:b2:c3:0:127:16:1:32  # ns2.no-ipv4-3.sibling.delegation01.xa
    log
    file Delegation-TP/delegation01/no-ipv4-3.delegation01.xa.zone no-ipv4-3.delegation01.xa
}

no-ipv6-1.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind 127.16.1.32               # ns2
    log
    file Delegation-TP/delegation01/no-ipv6-1.delegation01.xa.zone no-ipv6-1.delegation01.xa
}

no-ipv6-2.delegation01.xa:53 {
    bind 127.16.1.33               # ns1.no-ipv6-2.delegation01.xb
    bind 127.16.1.34               # ns2.no-ipv6-2.delegation01.xb
    log
    file Delegation-TP/delegation01/no-ipv6-2.delegation01.xa.zone no-ipv6-2.delegation01.xa
}

no-ipv6-3.delegation01.xa:53 { # Force sibling glue in referral from parent
    bind 127.16.1.21               # ns1 (parent)
    bind fda1:b2:c3:0:127:16:1:21  # ns1 (parent)
    bind 127.16.1.22               # ns2 (parent)
    bind fda1:b2:c3:0:127:16:1:22  # ns2 (parent)
    log
    template IN ANY no-ipv6-3.delegation01.xa {
        authority  "no-ipv6-3.delegation01.xa.    3600 IN NS   ns1.no-ipv6-3.sibling.delegation01.xa."
        authority  "no-ipv6-3.delegation01.xa.    3600 IN NS   ns2.no-ipv6-3.sibling.delegation01.xa."
        additional "ns1.no-ipv6-3.sibling.delegation01.xa 3600 IN A 127.16.1.31"
        additional "ns1.no-ipv6-3.sibling.delegation01.xa 3600 IN A 127.16.1.32"
    }
    header {
        response clear aa
    }
} 
no-ipv6-3.delegation01.xa:53 {
    bind 127.16.1.31               # ns1.no-ipv6-3.sibling.delegation01.xa
    bind 127.16.1.32               # ns2.no-ipv6-3.sibling.delegation01.xa
    log
    file Delegation-TP/delegation01/no-ipv6-3.delegation01.xa.zone no-ipv6-3.delegation01.xa
}

mismatch-delegation-child-1.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/mismatch-delegation-child-1.delegation01.xa.zone mismatch-delegation-child-1.delegation01.xa
}

mismatch-delegation-child-2.delegation01.xa:53 {
    bind 127.16.1.31               # ns1
    bind fda1:b2:c3:0:127:16:1:31  # ns1
    bind 127.16.1.32               # ns2
    bind fda1:b2:c3:0:127:16:1:32  # ns2
    log
    file Delegation-TP/delegation01/mismatch-delegation-child-2.delegation01.xa.zone mismatch-delegation-child-2.delegation01.xa
}
