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),
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
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.