]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[897-add-infinite-valid-lifetime] Checkpoint: finished config, todo allocation
authorFrancis Dupont <fdupont@isc.org>
Wed, 11 Sep 2019 22:07:42 +0000 (00:07 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 11 Sep 2019 22:07:42 +0000 (00:07 +0200)
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc

index 55d9e6a227e3a9184cb3fabbc7effa1532d53a68..2a57bf5811cdfabeda312d67635d2bb4f76f63a9 100644 (file)
@@ -169,6 +169,7 @@ public:
         subnet->setCalculateTeeTimes(true);
         subnet->setT1Percent(0.345);
         subnet->setT2Percent(0.444);
+        subnet->setAllowStaticLeases(false);
 
         Pool4Ptr pool1(new Pool4(IOAddress("192.0.2.10"), IOAddress("192.0.2.20")));
         subnet->addPool(pool1);
@@ -263,6 +264,7 @@ public:
         shared_network->setSname("frog");
         shared_network->setFilename("/dev/null");
         shared_network->setAuthoritative(true);
+        shared_network->setAllowStaticLeases(false);
 
         // Add several options to the shared network.
         shared_network->getCfgOption()->add(test_options_[2]->option_,
@@ -1310,6 +1312,9 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSubnet4WithOptionalUnspecified) {
     EXPECT_TRUE(returned_subnet->getT2Percent().unspecified());
     EXPECT_EQ(0.0, returned_subnet->getT2Percent().get());
 
+    EXPECT_TRUE(returned_subnet->getAllowStaticLeases().unspecified());
+    EXPECT_FALSE(returned_subnet->getAllowStaticLeases().get());
+
     EXPECT_TRUE(returned_subnet->getMatchClientId().unspecified());
     EXPECT_TRUE(returned_subnet->getMatchClientId().get());
 
@@ -1926,6 +1931,7 @@ TEST_F(MySqlConfigBackendDHCPv4Test, subnetLifetime) {
 
     // Update the valid lifetime.
     subnet->setValid( Triplet<uint32_t>(100, 200, 300));
+    subnet->setAllowStaticLeases(true);
     cbptr_->createUpdateSubnet4(ServerSelector::ALL(), subnet);
 
     // Fetch and verify again.
@@ -2312,6 +2318,9 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSharedNetwork4WithOptionalUnspecified) {
 
     EXPECT_TRUE(returned_network->getAuthoritative().unspecified());
     EXPECT_FALSE(returned_network->getAuthoritative().get());
+
+    EXPECT_TRUE(returned_network->getAllowStaticLeases().unspecified());
+    EXPECT_FALSE(returned_network->getAllowStaticLeases().get());
 }
 
 // Test that deleteSharedNetworkSubnets4 with not ANY selector throw.
@@ -2835,6 +2844,7 @@ TEST_F(MySqlConfigBackendDHCPv4Test, sharedNetworkLifetime) {
 
     // Update the preferred and valid lifetime.
     network->setValid( Triplet<uint32_t>(100, 200, 300));
+    network->setAllowStaticLeases(true);
     cbptr_->createUpdateSharedNetwork4(ServerSelector::ALL(), network);
 
     // Fetch and verify again.
index b5a8e383587fdbd5ce6b085176c2c83cd165266c..b89725e96f4f17c48427b479f5abc67ea0a7857c 100644 (file)
@@ -164,6 +164,7 @@ public:
         subnet->setCalculateTeeTimes(true);
         subnet->setT1Percent(0.345);
         subnet->setT2Percent(0.444);
+        subnet->setAllowStaticLeases(false);
 
         Pool6Ptr pool1(new Pool6(Lease::TYPE_NA,
                                  IOAddress("2001:db8::10"),
@@ -307,6 +308,7 @@ public:
         shared_network->setCalculateTeeTimes(true);
         shared_network->setT1Percent(0.345);
         shared_network->setT2Percent(0.444);
+        shared_network->setAllowStaticLeases(false);
 
         // Add several options to the shared network.
         shared_network->getCfgOption()->add(test_options_[2]->option_,
@@ -1346,6 +1348,9 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getSubnet6WithOptionalUnspecified) {
     EXPECT_TRUE(returned_subnet->getT2().unspecified());
     EXPECT_EQ(0, returned_subnet->getT2().get());
 
+    EXPECT_TRUE(returned_subnet->getAllowStaticLeases().unspecified());
+    EXPECT_FALSE(returned_subnet->getAllowStaticLeases().get());
+
     EXPECT_TRUE(returned_subnet->getHostReservationMode().unspecified());
     EXPECT_EQ(Network::HR_ALL, returned_subnet->getHostReservationMode().get());
 
@@ -1956,6 +1961,7 @@ TEST_F(MySqlConfigBackendDHCPv6Test, subnetLifetime) {
     // Update the preferred and valid lifetime.
     subnet->setPreferred( Triplet<uint32_t>(100, 200, 300));
     subnet->setValid( Triplet<uint32_t>(200, 300, 400));
+    subnet->setAllowStaticLeases(true);
     cbptr_->createUpdateSubnet6(ServerSelector::ALL(), subnet);
 
     // Fetch and verify again.
@@ -2347,6 +2353,9 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getSharedNetwork6WithOptionalUnspecified) {
 
     EXPECT_TRUE(returned_network->getRapidCommit().unspecified());
     EXPECT_FALSE(returned_network->getRapidCommit().get());
+
+    EXPECT_TRUE(returned_network->getAllowStaticLeases().unspecified());
+    EXPECT_FALSE(returned_network->getAllowStaticLeases().get());
 }
 
 // Test that deleteSharedNetworkSubnets6 with not ANY selector throw.
@@ -2872,6 +2881,7 @@ TEST_F(MySqlConfigBackendDHCPv6Test, sharedNetworkLifetime) {
     // Update the preferred and valid lifetime.
     network->setPreferred( Triplet<uint32_t>(100, 200, 300));
     network->setValid( Triplet<uint32_t>(200, 300, 400));
+    network->setAllowStaticLeases(true);
     cbptr_->createUpdateSharedNetwork6(ServerSelector::ALL(), network);
 
     // Fetch and verify again.