@@ -2619,6 +2619,62 @@ GenericHostDataSourceTest::testDeleteById6Options() {
2619
2619
EXPECT_FALSE (result);
2620
2620
}
2621
2621
2622
+ void
2623
+ GenericHostDataSourceTest::testDelete2ForIPv6 () {
2624
+ // Make sure we have a pointer to the host data source.
2625
+ ASSERT_TRUE (hdsptr_);
2626
+
2627
+ // Let's create a v6 host...
2628
+ IOAddress address1 (" 2001:db8:1::1" );
2629
+ IOAddress address2 (" 2001:db8:2::2" );
2630
+ SubnetID subnet_id (42 );
2631
+ auto ident = HostDataSourceUtils::generateIdentifier (Host::IDENT_DUID);
2632
+ HostPtr host = HostPtr (new Host (&ident[0 ], ident.size (), Host::IDENT_DUID,
2633
+ SUBNET_ID_UNUSED, subnet_id,
2634
+ IOAddress::IPV4_ZERO_ADDRESS ()));
2635
+ host->addReservation (IPv6Resrv (IPv6Resrv::TYPE_NA, address1));
2636
+ host->addReservation (IPv6Resrv (IPv6Resrv::TYPE_NA, address2));
2637
+ // ... and add it to the data source.
2638
+ ASSERT_NO_THROW (hdsptr_->add (host));
2639
+ EXPECT_EQ (2 , countDBReservations6 ());
2640
+
2641
+ // Delete the host using its first address.
2642
+ EXPECT_TRUE (hdsptr_->del (subnet_id, address1));
2643
+
2644
+ // Check if all addresses were removed.
2645
+ EXPECT_EQ (0 , countDBReservations6 ());
2646
+ EXPECT_FALSE (hdsptr_->get6 (subnet_id, address2));
2647
+ EXPECT_FALSE (hdsptr_->del (subnet_id, address2));
2648
+ }
2649
+
2650
+ void
2651
+ GenericHostDataSourceTest::testDeleteBothForIPv6 () {
2652
+ // Make sure we have a pointer to the host data source.
2653
+ ASSERT_TRUE (hdsptr_);
2654
+
2655
+ // Let's create a v6 host...
2656
+ IOAddress address1 (" 2001:db8:1::1" );
2657
+ IOAddress address2 (" 2001:db8:2::" );
2658
+ SubnetID subnet_id (42 );
2659
+ auto ident = HostDataSourceUtils::generateIdentifier (Host::IDENT_DUID);
2660
+ HostPtr host = HostPtr (new Host (&ident[0 ], ident.size (), Host::IDENT_DUID,
2661
+ SUBNET_ID_UNUSED, subnet_id,
2662
+ IOAddress::IPV4_ZERO_ADDRESS ()));
2663
+ host->addReservation (IPv6Resrv (IPv6Resrv::TYPE_NA, address1));
2664
+ host->addReservation (IPv6Resrv (IPv6Resrv::TYPE_PD, address2, 64 ));
2665
+ // ... and add it to the data source.
2666
+ ASSERT_NO_THROW (hdsptr_->add (host));
2667
+ EXPECT_EQ (2 , countDBReservations6 ());
2668
+
2669
+ // Delete the host using its address.
2670
+ EXPECT_TRUE (hdsptr_->del (subnet_id, address1));
2671
+
2672
+ // Check if all reservations were removed.
2673
+ EXPECT_EQ (0 , countDBReservations6 ());
2674
+ EXPECT_FALSE (hdsptr_->get6 (subnet_id, address2));
2675
+ EXPECT_FALSE (hdsptr_->del (subnet_id, address2));
2676
+ }
2677
+
2622
2678
void
2623
2679
GenericHostDataSourceTest::testMultipleHostsNoAddress4 () {
2624
2680
// Make sure we have a pointer to the host data source.
0 commit comments