From: Marcin Siodelski Date: Wed, 29 Oct 2014 16:45:58 +0000 (+0100) Subject: [master] Merge branch 'trac3587' X-Git-Tag: trac3629a_base~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8744ddaee9d3be8e7933cde3a2d9f4b84a4807c2;p=thirdparty%2Fkea.git [master] Merge branch 'trac3587' --- 8744ddaee9d3be8e7933cde3a2d9f4b84a4807c2 diff --cc src/bin/dhcp4/tests/direct_client_unittest.cc index ee439905a9,e9f12e18f7..7e8ff4d692 --- a/src/bin/dhcp4/tests/direct_client_unittest.cc +++ b/src/bin/dhcp4/tests/direct_client_unittest.cc @@@ -361,13 -363,12 +364,13 @@@ TEST_F(DirectClientTest, rebind) ASSERT_NO_FATAL_FAILURE(configureSubnet("10.0.0.0")); // Make sure that the subnet has been really added. Also, the subnet // will be needed to create a lease for a client. - Subnet4Ptr subnet = CfgMgr::instance().getSubnet4(IOAddress("10.0.0.10"), - classify_); + Subnet4Ptr subnet = CfgMgr::instance().getCurrentCfg()-> + getCfgSubnets4()->selectSubnet(IOAddress("10.0.0.10")); // Create a lease, which will be later renewed. By explicitly creating a // lease we will know the lease parameters, such as leased address etc. - const uint8_t hwaddr[] = { 1, 2, 3, 4, 5, 6 }; - Lease4Ptr lease(new Lease4(IOAddress("10.0.0.10"), hwaddr, sizeof(hwaddr), + const uint8_t hwaddr_data[] = { 1, 2, 3, 4, 5, 6 }; + HWAddrPtr hwaddr(new HWAddr(hwaddr_data, sizeof(hwaddr_data), HTYPE_ETHER)); + Lease4Ptr lease(new Lease4(IOAddress("10.0.0.10"), hwaddr, &generateClientId()->getData()[0], generateClientId()->getData().size(), 100, 50, 75, time(NULL), diff --cc src/lib/dhcpsrv/tests/alloc_engine_unittest.cc index e808f64c57,56a0c15aab..5f41663897 --- a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc @@@ -1375,14 -1372,13 +1379,14 @@@ TEST_F(AllocEngine4Test, outOfAddresses subnet_ = Subnet4Ptr(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3)); pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address subnet_->addPool(pool_); - cfg_mgr.addSubnet4(subnet_); + cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_); // Just a different hw/client-id for the second client - uint8_t hwaddr2[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER)); uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 }; time_t now = time(NULL); - Lease4Ptr lease(new Lease4(addr, hwaddr2, sizeof(hwaddr2), clientid2, + Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2), 501, 502, 503, now, subnet_->getID())); lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago @@@ -1415,14 -1412,14 +1420,14 @@@ TEST_F(AllocEngine4Test, discoverReuseE subnet_ = Subnet4Ptr(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3)); pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address subnet_->addPool(pool_); - cfg_mgr.addSubnet4(subnet_); + cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_); // Just a different hw/client-id for the second client - uint8_t hwaddr2[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER)); uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 }; time_t now = time(NULL) - 500; // Allocated 500 seconds ago - Lease4Ptr lease(new Lease4(addr, clientid2, sizeof(clientid2), - hwaddr2, sizeof(hwaddr2), + Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2), 495, 100, 200, now, subnet_->getID())); // Copy the lease, so as it can be compared with the old lease returned // by the allocation engine.