diff --git a/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapRelationService.java b/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapRelationService.java index 0f06de0d4d..c3db254253 100644 --- a/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapRelationService.java +++ b/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapRelationService.java @@ -1,8 +1,6 @@ package net.ripe.db.whois.api.rdap; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import net.ripe.db.whois.api.rdap.domain.Ip; import net.ripe.db.whois.api.rdap.domain.RelationType; import net.ripe.db.whois.common.dao.RpslObjectDao; import net.ripe.db.whois.common.domain.CIString; @@ -21,10 +19,12 @@ import net.ripe.db.whois.common.rpsl.attrs.Domain; import net.ripe.db.whois.common.rpsl.attrs.Inet6numStatus; import net.ripe.db.whois.common.rpsl.attrs.InetnumStatus; -import net.ripe.db.whois.common.search.ManagedAttributeSearch; import org.eclipse.jetty.http.HttpStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import javax.annotation.Nullable; import java.util.List; import java.util.Objects; import java.util.Set; @@ -33,17 +33,17 @@ @Service public class RdapRelationService { - private final RdapQueryHandler rdapQueryHandler; + private static final Logger LOGGER = LoggerFactory.getLogger(RdapRelationService.class); + private final Ipv4Tree ip4Tree; private final Ipv6Tree ip6Tree; private final Ipv4DomainTree ipv4DomainTree; private final Ipv6DomainTree ipv6DomainTree; private final RpslObjectDao rpslObjectDao; - public RdapRelationService(final RdapQueryHandler rdapQueryHandler, final Ipv4Tree ip4Tree, final Ipv6Tree ip6Tree, + public RdapRelationService(final Ipv4Tree ip4Tree, final Ipv6Tree ip6Tree, final Ipv4DomainTree ipv4DomainTree, final Ipv6DomainTree ipv6DomainTree, final RpslObjectDao rpslObjectDao) { - this.rdapQueryHandler = rdapQueryHandler; this.ip4Tree = ip4Tree; this.ip6Tree = ip6Tree; this.ipv4DomainTree = ipv4DomainTree; @@ -54,17 +54,17 @@ public RdapRelationService(final RdapQueryHandler rdapQueryHandler, final Ipv4Tr public List getDomainRelationPkeys(final String pkey, final RelationType relationType){ final Domain domain = Domain.parse(pkey); final IpInterval reverseIp = domain.getReverseIp(); + final List ipEntries = getIpEntries(getIpDomainTree(reverseIp), relationType, reverseIp); - return getRelationPkeys(relationType, getIpDomainTree(reverseIp), reverseIp); + return ipEntries + .stream() + .map(ipEntry -> rpslObjectDao.getById(ipEntry.getObjectId()).getKey().toString()) + .toList(); } public List getInetnumRelationPkeys(final String pkey, final RelationType relationType){ final IpInterval ip = IpInterval.parse(pkey); - return getRelationPkeys(relationType, getIpTree(ip), ip); - } - - private List getRelationPkeys(RelationType relationType, IpTree ipTree, IpInterval ip) { - final List ipEntries = getIpEntries(ipTree, relationType, ip); + final List ipEntries = getIpEntries(getIpTree(ip), relationType, ip); return ipEntries.stream().map(ipEntry -> ipEntry.getKey().toString()).toList(); } @@ -127,39 +127,51 @@ private static boolean childrenCoverParentRange(final IpInterval firstResource, } private static List findSiblingsAndExact(final IpTree ipTree, final IpInterval parentResource) { - final IpEntry parent = (IpEntry)ipTree.findFirstLessSpecific(parentResource).getFirst(); - return ipTree.findFirstMoreSpecific(IpInterval.parse(parent.getKey().toString())); + final List parentList = ipTree.findFirstLessSpecific(parentResource); + if (parentList.isEmpty()){ + return ipTree.findExact(parentResource); + } + return ipTree.findFirstMoreSpecific(IpInterval.parse(parentList.getFirst().getKey().toString())); } private IpEntry searchFirstLessSpecificCoMntner(final IpTree ipTree, final IpInterval reverseIp){ - final IpEntry firstLessSpecific = (IpEntry) ipTree.findFirstLessSpecific(reverseIp).getFirst(); - final RpslObject rpslObject = rpslObjectDao.getById(firstLessSpecific.getObjectId()); - - if (!isOutOfRegionOrRoot(rpslObject)) { - return firstLessSpecific; + final List parentList = ipTree.findFirstLessSpecific(reverseIp); + if (parentList.isEmpty() || isOutOfRegionOrRoot(parentList.getFirst())){ + throw new RdapException("404 Not Found", "No up level object has been found for " + reverseIp.toString(), HttpStatus.NOT_FOUND_404); } - - throw new RdapException("404 Not Found", "No up level object has been found for " + reverseIp.toString(), HttpStatus.NOT_FOUND_404); + return parentList.getFirst(); } - private List searchCoMntnerTopLevel(final IpTree ipTree, final IpInterval reverseIp) { for (final Object parentEntry : ipTree.findAllLessSpecific(reverseIp)) { final IpEntry ipEntry = (IpEntry) parentEntry; - final RpslObject rpslObject = rpslObjectDao.getById(ipEntry.getObjectId()); - if (!isOutOfRegionOrRoot(rpslObject)){ + if (!isOutOfRegionOrRoot(ipEntry)){ return List.of(ipEntry); } } throw new RdapException("404 Not Found", "No top level object has been found for " + reverseIp.toString(), HttpStatus.NOT_FOUND_404); } - private static boolean isOutOfRegionOrRoot(final RpslObject rpslObject) { + private boolean isOutOfRegionOrRoot(final IpEntry firstLessSpecific) { + final RpslObject rpslObject = getResourceByKey(firstLessSpecific.getKey().toString()); + if (rpslObject == null) { + return true; + } final CIString status = rpslObject.getValueForAttribute(AttributeType.STATUS); return (rpslObject.getType().equals(ObjectType.INETNUM) && InetnumStatus.getStatusFor(status).isOutOfRegionOrRoot()) || (rpslObject.getType().equals(ObjectType.INET6NUM) && Inet6numStatus.getStatusFor(status).isOutOfRegionOrRoot()); } + @Nullable + private RpslObject getResourceByKey(final String key){ + final RpslObject rpslObject = rpslObjectDao.getByKeyOrNull(ObjectType.INET6NUM, key); + if (rpslObject == null){ + LOGGER.error("INET(6)NUM {} does not exist in RIPE Database ", key); + return rpslObjectDao.getByKeyOrNull(ObjectType.INETNUM, key); + } + return rpslObject; + } + private IpTree getIpTree(final IpInterval reverseIp) { if (reverseIp instanceof Ipv4Resource) { return ip4Tree; diff --git a/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapService.java b/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapService.java index 4a3b9dc941..14f378314a 100644 --- a/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapService.java +++ b/whois-api/src/main/java/net/ripe/db/whois/api/rdap/RdapService.java @@ -519,14 +519,14 @@ private List handleRelationQuery(final HttpServletRequest request, f final RelationType relationType, final String key) { final List rpslObjects; switch (requestType) { - case AUTNUM -> throw new RdapException("400 Bad Request", "Relation queries not allowed for autnum", HttpStatus.BAD_REQUEST_400); - case DOMAIN -> { + case AUTNUMS -> throw new RdapException("400 Bad Request", "Relation queries not allowed for autnum", HttpStatus.BAD_REQUEST_400); + case DOMAINS -> { rdapRequestValidator.validateDomain(key); final List relatedPkeys = rdapRelationService.getDomainRelationPkeys(key, relationType); rpslObjects = relatedPkeys .stream() - .flatMap(relatedPkey -> rdapQueryHandler.handleQueryStream(getQueryObject(ImmutableSet.of(DOMAIN), key), request)) + .flatMap(relatedPkey -> rdapQueryHandler.handleQueryStream(getQueryObject(ImmutableSet.of(DOMAIN), relatedPkey), request)) .toList(); } case IPS -> { diff --git a/whois-api/src/test/java/net/ripe/db/whois/api/rdap/RdapServiceTestIntegration.java b/whois-api/src/test/java/net/ripe/db/whois/api/rdap/RdapServiceTestIntegration.java index a1b7e36ab5..cf0c2bb060 100644 --- a/whois-api/src/test/java/net/ripe/db/whois/api/rdap/RdapServiceTestIntegration.java +++ b/whois-api/src/test/java/net/ripe/db/whois/api/rdap/RdapServiceTestIntegration.java @@ -185,7 +185,7 @@ public void setup() { "country: NL\n" + "tech-c: TP1-TEST\n" + "admin-c: TP1-TEST\n" + - "status: OTHER\n" + + "status: ALLOCATED-BY-RIR\n" + "mnt-by: OWNER-MNT\n" + "created: 2022-08-14T11:48:28Z\n" + "last-modified: 2022-10-25T12:22:39Z\n" + @@ -3130,6 +3130,18 @@ public void get_help_response() { /*RIR Search*/ + @Test + public void get_up_autnum_then_400(){ + final BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> { + createResource("autnums/rirSearch1/up/AS123") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + }); + + assertErrorTitle(badRequestException, "400 Bad Request"); + assertErrorStatus(badRequestException, HttpStatus.BAD_REQUEST_400); + assertErrorDescription(badRequestException, "Relation queries not allowed for autnum"); + } @Test public void get_up_then_parent(){ @@ -3144,6 +3156,49 @@ public void get_up_then_parent(){ assertThat(ipResults.getFirst().getHandle(), is("192.0.2.0 - 192.0.2.127")); // /26 } + @Test + public void get_ipv6_up_then_parent(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/up/2001:db8::/32") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(1)); + assertThat(ipResults.getFirst().getHandle(), is("2001::/16")); + } + + @Test + public void get_domain_up_then_parent(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/up/1.2.0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults.size(), is(1)); + assertThat(domainResults.getFirst().getHandle(), is("2.0.192.in-addr.arpa")); + } + + @Test + public void get_non_existing_domain_up_then_404(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final NotFoundException notFoundException = assertThrows(NotFoundException.class, () -> { + createResource("domains/rirSearch1/up/0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + }); + + assertErrorTitle(notFoundException, "404 Not Found"); + assertErrorStatus(notFoundException, HttpStatus.NOT_FOUND_404); + assertErrorDescription(notFoundException, "No up level object has been found for 192.0.0.0/16"); + } + @Test public void get_non_existing_up_then_404(){ loadIpv4RelationTreeExample(); @@ -3160,7 +3215,7 @@ public void get_non_existing_up_then_404(){ } @Test - public void get_top_then_less_specific_allocated_assigned_then_first_parent(){ + public void get_top_then_less_specific_allocated_assigned_first_parent(){ loadIpv4RelationTreeExample(); final SearchResult searchResult = createResource("ips/rirSearch1/top/192.0.2.0/28") @@ -3173,7 +3228,50 @@ public void get_top_then_less_specific_allocated_assigned_then_first_parent(){ } @Test - public void get_non_existing_top_then_less_specific_allocated_assigned_then_404(){ + public void get_ipv6_top_then_less_specific_allocated_assigned_first_parent(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/top/2001:db8::/32") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(1)); + assertThat(ipResults.getFirst().getHandle(), is("2000::/3")); + } + + @Test + public void get_domain_top_then_less_specific_allocated_assigned_first_parent(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/top/1.2.0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults.size(), is(1)); + assertThat(domainResults.getFirst().getHandle(), is("0.192.in-addr.arpa")); + } + + @Test + public void get_non_existing_domain_top_then_404(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final NotFoundException notFoundException = assertThrows(NotFoundException.class, () -> { + createResource("domains/rirSearch1/top/0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + }); + + assertErrorTitle(notFoundException, "404 Not Found"); + assertErrorStatus(notFoundException, HttpStatus.NOT_FOUND_404); + assertErrorDescription(notFoundException, "No top level object has been found for 192.0.0.0/16"); + } + + @Test + public void get_non_existing_top_then_404(){ loadIpv4RelationTreeExample(); final NotFoundException notFoundException = assertThrows(NotFoundException.class, () -> { @@ -3188,7 +3286,7 @@ public void get_non_existing_top_then_less_specific_allocated_assigned_then_404( } @Test - public void get_bottom_then_most_specific(){ + public void get_bottom_then_bottom(){ loadIpv4RelationTreeExample(); final SearchResult searchResult = createResource("ips/rirSearch1/bottom/192.0.2.0/24") @@ -3205,7 +3303,88 @@ public void get_bottom_then_most_specific(){ } @Test - public void get_no_more_specific_bottom_then_empty_response(){ + public void get_bottom_ipv6_then_bottom(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/bottom/2000::/3") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(6)); + assertThat(ipResults.getFirst().getHandle(), is("2001::/16")); + assertThat(ipResults.get(1).getHandle(), is("2001::/23")); + assertThat(ipResults.get(2).getHandle(), is("2001:db8::/32")); + assertThat(ipResults.get(3).getHandle(), is("2400::/12")); + assertThat(ipResults.get(4).getHandle(), is("2600::/12")); + assertThat(ipResults.get(5).getHandle(), is("2800::/12")); + } + + @Test + public void get_bottom_ipv6_cover_parent_then_bottom(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/bottom/FC00::/7") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(2)); + assertThat(ipResults.getFirst().getHandle(), is("FC00::/8")); + assertThat(ipResults.get(1).getHandle(), is("FD00::/8")); + } + + @Test + public void get_bottom_from_root_parent_then_bottom(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/bottom/::/0") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(9)); + assertThat(ipResults.getFirst().getHandle(), is("2001::/16")); + assertThat(ipResults.get(1).getHandle(), is("2001::/23")); + assertThat(ipResults.get(2).getHandle(), is("2000::/3")); + assertThat(ipResults.get(3).getHandle(), is("2001:db8::/32")); + assertThat(ipResults.get(4).getHandle(), is("2400::/12")); + assertThat(ipResults.get(5).getHandle(), is("2600::/12")); + assertThat(ipResults.get(6).getHandle(), is("2800::/12")); + assertThat(ipResults.get(7).getHandle(), is("FC00::/8")); + assertThat(ipResults.get(8).getHandle(), is("FD00::/8")); + } + + @Test + public void get_domain_bottom_then_bottom(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/bottom/0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults.size(), is(2)); + assertThat(domainResults.getFirst().getHandle(), is("1.2.0.192.in-addr.arpa")); + assertThat(domainResults.get(1).getHandle(), is("2.0.192.in-addr.arpa")); + } + + @Test + public void get_non_existing_domain_bottom_then_empty(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/bottom/1.2.0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults, is(nullValue())); + } + + @Test + public void get_non_existing_bottom_then_empty_response(){ loadIpv4RelationTreeExample(); final SearchResult searchResult = createResource("ips/rirSearch1/bottom/192.0.2.0/32") @@ -3217,7 +3396,7 @@ public void get_no_more_specific_bottom_then_empty_response(){ } @Test - public void get_most_specific_wrong_type_then_400(){ + public void get_bottom_wrong_type_then_400(){ final BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> { createResource("ip/rirSearch1/bottom/192.0.2.0/24") @@ -3243,6 +3422,49 @@ public void get_down_then_immediate_child(){ assertThat(ipResults.get(1).getHandle(), is("192.0.2.128 - 192.0.2.255")); } + @Test + public void get_down_ipv6_then_immediate_child(){ + loadIpv6RelationTreeExample(); + + final SearchResult searchResult = createResource("ips/rirSearch1/down/2000::/3") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List ipResults = searchResult.getIpSearchResults(); + assertThat(ipResults.size(), is(4)); + assertThat(ipResults.getFirst().getHandle(), is("2001::/16")); + assertThat(ipResults.get(1).getHandle(), is("2400::/12")); + assertThat(ipResults.get(2).getHandle(), is("2600::/12")); + assertThat(ipResults.get(3).getHandle(), is("2800::/12")); + } + + @Test + public void get_down_domain_then_immediate_child(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/down/0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults.size(), is(1)); + assertThat(domainResults.getFirst().getHandle(), is("2.0.192.in-addr.arpa")); + } + + @Test + public void get_down_domain_no_child_then_empty_response(){ + loadIpv4RelationTreeExample(); + loadIpv4RelationDomainExample(); + + final SearchResult searchResult = createResource("domains/rirSearch1/down/1.2.0.192.in-addr.arpa") + .request(MediaType.APPLICATION_JSON_TYPE) + .get(SearchResult.class); + + final List domainResults = searchResult.getDomainSearchResults(); + assertThat(domainResults, is(nullValue())); + } + @Test public void get_down_when_no_child_then_empty_response(){ loadIpv4RelationTreeExample(); @@ -3388,31 +3610,32 @@ private void loadIpv4RelationTreeExample(){ databaseHelper.addObject("" + - "inetnum: 192.0.2.0 - 192.0.2.15\n" + // /28 + "inetnum: 192.0.2.0 - 192.0.2.0\n" + // /32 "netname: TEST-NET-NAME\n" + "descr: TEST network\n" + "country: NL\n" + "language: en\n" + "tech-c: TP1-TEST\n" + - "status: ALLOCATED PA\n" + + "status: ASSIGNED PA\n" + "mnt-by: OWNER-MNT\n" + "created: 2022-08-14T11:48:28Z\n" + "last-modified: 2022-10-25T12:22:39Z\n" + "source: TEST"); databaseHelper.addObject("" + - "inetnum: 192.0.2.0 - 192.0.2.0\n" + // /32 + "inetnum: 192.0.2.0 - 192.0.2.15\n" + // /28 "netname: TEST-NET-NAME\n" + "descr: TEST network\n" + "country: NL\n" + "language: en\n" + "tech-c: TP1-TEST\n" + - "status: ASSIGNED PA\n" + + "status: ALLOCATED PA\n" + "mnt-by: OWNER-MNT\n" + "created: 2022-08-14T11:48:28Z\n" + "last-modified: 2022-10-25T12:22:39Z\n" + "source: TEST"); + //Another branch databaseHelper.addObject("" + @@ -3456,4 +3679,232 @@ private void loadIpv4RelationTreeExample(){ ipTreeUpdater.rebuild(); } + + + private void loadIpv4RelationDomainExample(){ + databaseHelper.addObject("" + + "inetnum: 192.0.0.0 - 192.0.255.255\n" + + "netname: TEST-NET-NAME\n" + + "descr: TEST network\n" + + "country: NL\n" + + "language: en\n" + + "tech-c: TP1-TEST\n" + + "status: ALLOCATED PA\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "domain: 0.192.in-addr.arpa\n" + + "descr: Test domain\n" + + "admin-c: TP1-TEST\n" + + "tech-c: TP1-TEST\n" + + "zone-c: TP1-TEST\n" + + "notify: notify@test.net.au\n" + + "nserver: ns1.test.com.au 10.0.0.1\n" + + "nserver: ns2.test.com.au 2001:10::2\n" + + "ds-rdata: 52151 1 1 13ee60f7499a70e5aadaf05828e7fc59e8e70bc1\n" + + "ds-rdata: 17881 5 1 2e58131e5fe28ec965a7b8e4efb52d0a028d7a78\n" + + "ds-rdata: 17881 5 2 8c6265733a73e5588bfac516a4fcfbe1103a544b95f254cb67a21e474079547e\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2011-07-28T00:35:42Z\n" + + "last-modified: 2019-02-28T10:14:46Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "domain: 2.0.192.in-addr.arpa\n" + + "descr: Test domain\n" + + "admin-c: TP1-TEST\n" + + "tech-c: TP1-TEST\n" + + "zone-c: TP1-TEST\n" + + "notify: notify@test.net.au\n" + + "nserver: ns1.test.com.au 10.0.0.1\n" + + "nserver: ns2.test.com.au 2001:10::2\n" + + "ds-rdata: 52151 1 1 13ee60f7499a70e5aadaf05828e7fc59e8e70bc1\n" + + "ds-rdata: 17881 5 1 2e58131e5fe28ec965a7b8e4efb52d0a028d7a78\n" + + "ds-rdata: 17881 5 2 8c6265733a73e5588bfac516a4fcfbe1103a544b95f254cb67a21e474079547e\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2011-07-28T00:35:42Z\n" + + "last-modified: 2019-02-28T10:14:46Z\n" + + "source: TEST"); + + + databaseHelper.addObject("" + + "domain: 1.2.0.192.in-addr.arpa\n" + + "descr: Test domain\n" + + "admin-c: TP1-TEST\n" + + "tech-c: TP1-TEST\n" + + "zone-c: TP1-TEST\n" + + "notify: notify@test.net.au\n" + + "nserver: ns1.test.com.au 10.0.0.1\n" + + "nserver: ns2.test.com.au 2001:10::2\n" + + "ds-rdata: 52151 1 1 13ee60f7499a70e5aadaf05828e7fc59e8e70bc1\n" + + "ds-rdata: 17881 5 1 2e58131e5fe28ec965a7b8e4efb52d0a028d7a78\n" + + "ds-rdata: 17881 5 2 8c6265733a73e5588bfac516a4fcfbe1103a544b95f254cb67a21e474079547e\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2011-07-28T00:35:42Z\n" + + "last-modified: 2019-02-28T10:14:46Z\n" + + "source: TEST"); + + ipTreeUpdater.rebuild(); + } + + private void loadIpv6RelationTreeExample(){ + /* + +--------------+ + | /0 | + +--------------+ + / \ + +--------------+ +----------------+ + | FC00::/7 | | 2000::/3 | + +--------------+ +----------------+ + / \ / | | \ + +-----------------+ +-------------------+ +------------+ +-----------+ +-----------+ +-----------+ + | FC00::/8 | | FD00::/8 | | 2001::/16 | | 2400::/12 | | 2600::/12 | | 2800::/12 | + +-----------------+ +-------------------+ +------------+ +-----------+ +-----------+ +-----------+ + / | + +--------------+ +--------------+ + | 2001:db8::/32 | | 2001::/23 | + +--------------+ +--------------+ + */ + + databaseHelper.addObject("" + + "inet6num: 2000::/3\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + + // One branch + databaseHelper.addObject("" + + "inet6num: 2001::/16\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + + databaseHelper.addObject("" + + "inet6num: 2001:db8::/32\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + + databaseHelper.addObject("" + + "inet6num: 2001::/23\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + + databaseHelper.addObject("" + + "inet6num: 2400::/12\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "inet6num: 2600::/12\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "inet6num: 2800::/12\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + + databaseHelper.addObject("" + + "inet6num: FC00::/7\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "inet6num: FC00::/8\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + databaseHelper.addObject("" + + "inet6num: FD00::/8\n" + + "netname: TEST\n" + + "descr: The whole IPv6 address space\n" + + "country: NL\n" + + "tech-c: TP1-TEST\n" + + "admin-c: TP1-TEST\n" + + "status: ALLOCATED-BY-LIR\n" + + "mnt-by: OWNER-MNT\n" + + "created: 2022-08-14T11:48:28Z\n" + + "last-modified: 2022-10-25T12:22:39Z\n" + + "source: TEST"); + + ipTreeUpdater.rebuild(); + } }