String ip = NetUtils.getIp6FromRange("1234:5678::1-1234:5678::2");
assertTrue(ip.equals("1234:5678::1") || ip.equals("1234:5678::2"));
s_logger.info("IP is " + ip);
}
String ipString = null;
IPv6Address ipStart = IPv6Address.fromString("1234:5678::1");
IPv6Address ipEnd = IPv6Address.fromString("1234:5678::ffff:ffff:ffff:ffff");
for (int i = 0; i < 10; i ++) {
ipString = NetUtils.getIp6FromRange(ipStart.toString() + "-" + ipEnd.toString());
s_logger.info("IP is " + ipString);
IPv6Address ip = IPv6Address.fromString(ipString);
assertTrue(ip.compareTo(ipStart) >= 0);
assertTrue(ip.compareTo(ipEnd) <= 0);
}
//Test isIp6RangeOverlap
assertFalse(NetUtils.isIp6RangeOverlap("1234:5678::1-1234:5678::ffff", "1234:5678:1::1-1234:5678:1::ffff"));
assertTrue(NetUtils.isIp6RangeOverlap("1234:5678::1-1234:5678::ffff", "1234:5678::2-1234:5678::f"));
assertTrue(NetUtils.isIp6RangeOverlap("1234:5678::f-1234:5678::ffff", "1234:5678::2-1234:5678::f"));