]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Fixed merge error
authorFrancis Dupont <fdupont@isc.org>
Wed, 11 Apr 2018 15:34:08 +0000 (17:34 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 11 Apr 2018 15:34:08 +0000 (17:34 +0200)
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/lib/dhcpsrv/tests/pool_unittest.cc

index 02eda7cd73156661a3203d4de35ed175d93c1fae..99789e1cf5fccbaa1a479749f36224eebcb8a49b 100644 (file)
@@ -2464,75 +2464,6 @@ TEST_F(Dhcpv4SrvTest, clientPoolClassify) {
     EXPECT_FALSE(offer->getYiaddr().isV4Zero());
 }
 
-// Checks if the client-class field is indeed used for pool selection.
-TEST_F(Dhcpv4SrvTest, clientPoolClassify) {
-    IfaceMgrTestConfig test_config(true);
-    IfaceMgr::instance().openSockets4();
-
-    NakedDhcpv4Srv srv(0);
-
-    // This test configures 2 pools.
-    // The second pool does not play any role here. The client's
-    // IP address belongs to the first pool, so only that first
-    // pool is being tested.
-    string config = "{ \"interfaces-config\": {"
-        "    \"interfaces\": [ \"*\" ]"
-        "},"
-        "\"rebind-timer\": 2000, "
-        "\"renew-timer\": 1000, "
-        "\"subnet4\": [ "
-        "{   \"pools\": [ { "
-        "      \"pool\": \"192.0.2.1 - 192.0.2.100\", "
-        "      \"client-class\": \"foo\" }, "
-        "    { \"pool\": \"192.0.3.1 - 192.0.3.100\", "
-        "      \"client-class\": \"xyzzy\" } ], "
-        "    \"subnet\": \"192.0.0.0/16\" } "
-        "],"
-        "\"valid-lifetime\": 4000 }";
-
-    ConstElementPtr json;
-    ASSERT_NO_THROW(json = parseDHCP4(config, true));
-
-    ConstElementPtr status;
-    EXPECT_NO_THROW(status = configureDhcp4Server(srv, json));
-
-    CfgMgr::instance().commit();
-
-    // check if returned status is OK
-    ASSERT_TRUE(status);
-    comment_ = config::parseAnswer(rcode_, status);
-    ASSERT_EQ(0, rcode_);
-
-    // Create a simple packet that we'll use for classification
-    Pkt4Ptr dis = Pkt4Ptr(new Pkt4(DHCPDISCOVER, 1234));
-    dis->setRemoteAddr(IOAddress("192.0.2.1"));
-    dis->setCiaddr(IOAddress("192.0.2.1"));
-    dis->setIface("eth0");
-    OptionPtr clientid = generateClientId();
-    dis->addOption(clientid);
-
-    // This discover does not belong to foo class, so it will not
-    // be serviced
-    Pkt4Ptr offer = srv.processDiscover(dis);
-    EXPECT_FALSE(offer);
-
-    // Let's add the packet to bar class and try again.
-    dis->addClass("bar");
-
-    // Still not supported, because it belongs to wrong class.
-    offer = srv.processDiscover(dis);
-    EXPECT_FALSE(offer);
-
-    // Let's add it to matching class.
-    dis->addClass("foo");
-
-    // This time it should work
-    offer = srv.processDiscover(dis);
-    ASSERT_TRUE(offer);
-    EXPECT_EQ(DHCPOFFER, offer->getType());
-    EXPECT_FALSE(offer->getYiaddr().isV4Zero());
-}
-
 // Verifies last resort option 43 is backward compatible
 TEST_F(Dhcpv4SrvTest, option43LastResort) {
     IfaceMgrTestConfig test_config(true);
index acf5b690d2ffd02920b1aabbad7c3b33f2b867a1..494e40663b80e3495baf8a62fc116719d19212f4 100644 (file)
@@ -230,44 +230,6 @@ TEST(Pool4Test, clientClass) {
     EXPECT_TRUE(pool->clientSupported(three_classes));
 }
 
-// This test checks that handling for multiple client-classes is valid.
-TEST(Pool4Test, clientClasses) {    
-    // Create a pool.
-    Pool4Ptr pool(new Pool4(IOAddress("192.0.2.0"),
-                            IOAddress("192.0.2.255")));
-
-    // This client does not belong to any class.
-    isc::dhcp::ClientClasses no_class;
-
-    // This client belongs to foo only.
-    isc::dhcp::ClientClasses foo_class;
-    foo_class.insert("foo");
-
-    // This client belongs to bar only. I like that client.
-    isc::dhcp::ClientClasses bar_class;
-    bar_class.insert("bar");
-
-    // No class restrictions defined, any client should be supported
-    EXPECT_EQ(0, pool->getClientClasses().size());
-    EXPECT_TRUE(pool->clientSupported(no_class));
-    EXPECT_TRUE(pool->clientSupported(foo_class));
-    EXPECT_TRUE(pool->clientSupported(bar_class));
-
-    // Let's allow clients belonging to "bar" or "foo" class.
-    pool->allowClientClass("bar");
-    pool->allowClientClass("foo");
-    EXPECT_EQ(2, pool->getClientClasses().size());
-
-    // Class-less clients are to be rejected.
-    EXPECT_FALSE(pool->clientSupported(no_class));
-
-    // Clients in foo class should be accepted.
-    EXPECT_TRUE(pool->clientSupported(foo_class));
-
-    // Clients in bar class should be accepted as well.
-    EXPECT_TRUE(pool->clientSupported(bar_class));
-}
-
 // This test checks that handling for require-client-classes is valid.
 TEST(Pool4Test, requiredClasses) {
     // Create a pool.
@@ -663,44 +625,6 @@ TEST(Pool6Test, clientClass) {
     EXPECT_TRUE(pool.clientSupported(three_classes));
 }
 
-// This test checks that handling for multiple client-classes is valid.
-TEST(Pool6Test, clientClasses) {    
-    // Create a pool.
-    Pool6 pool(Lease::TYPE_NA, IOAddress("2001:db8::1"),
-               IOAddress("2001:db8::2"));
-
-    // This client does not belong to any class.
-    isc::dhcp::ClientClasses no_class;
-
-    // This client belongs to foo only.
-    isc::dhcp::ClientClasses foo_class;
-    foo_class.insert("foo");
-
-    // This client belongs to bar only. I like that client.
-    isc::dhcp::ClientClasses bar_class;
-    bar_class.insert("bar");
-
-    // No class restrictions defined, any client should be supported
-    EXPECT_EQ(0, pool.getClientClasses().size());
-    EXPECT_TRUE(pool.clientSupported(no_class));
-    EXPECT_TRUE(pool.clientSupported(foo_class));
-    EXPECT_TRUE(pool.clientSupported(bar_class));
-
-    // Let's allow clients belonging to "bar" or "foo" class.
-    pool.allowClientClass("bar");
-    pool.allowClientClass("foo");
-    EXPECT_EQ(2, pool.getClientClasses().size());
-
-    // Class-less clients are to be rejected.
-    EXPECT_FALSE(pool.clientSupported(no_class));
-
-    // Clients in foo class should be accepted.
-    EXPECT_TRUE(pool.clientSupported(foo_class));
-
-    // Clients in bar class should be accepted as well.
-    EXPECT_TRUE(pool.clientSupported(bar_class));
-}
-
 // This test checks that handling for require-client-classes is valid.
 TEST(Pool6Test, requiredClasses) {
     // Create a pool.