2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[481-remote-subnet4-set-inconsistent-work-when-id-subnet-is-duplicated] Added tests and updated schema

This commit is contained in:
Francis Dupont
2019-03-01 23:55:36 +01:00
parent 9cd6012cc5
commit ecb27f49c3
3 changed files with 53 additions and 0 deletions

View File

@@ -633,6 +633,25 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSubnet4) {
AuditEntry::ModificationType::UPDATE,
"subnet set");
}
// Insert another subnet.
cbptr_->createUpdateSubnet4(ServerSelector::ALL(), test_subnets_[2]);
// Fetch this subnet by prefix and verify it matches.
returned_subnet = cbptr_->getSubnet4(ServerSelector::ALL(),
test_subnets_[2]->toText());
ASSERT_TRUE(returned_subnet);
EXPECT_EQ(test_subnets_[2]->toElement()->str(), returned_subnet->toElement()->str());
// Update the the subnet in the database (both use the same prefix).
subnet2.reset(new Subnet4(IOAddress("192.0.3.0"), 24, 30, 40, 60, 8192));
cbptr_->createUpdateSubnet4(ServerSelector::ALL(), subnet2);
// Fetch again and verify.
returned_subnet = cbptr_->getSubnet4(ServerSelector::ALL(),
test_subnets_[2]->toText());
ASSERT_TRUE(returned_subnet);
EXPECT_EQ(subnet2->toElement()->str(), returned_subnet->toElement()->str());
}
// Test that the information about unspecified optional parameters gets

View File

@@ -1908,6 +1908,23 @@ ALTER TABLE dhcp6_shared_network_server
REFERENCES dhcp6_shared_network (id)
ON DELETE CASCADE ON UPDATE NO ACTION;
-- Update dhcp4_subnet_server and dhcp6_subnet_server to allow update
-- on the prefix too.
ALTER TABLE dhcp4_subnet_server
DROP FOREIGN KEY fk_dhcp4_subnet_server_subnet_id;
ALTER TABLE dhcp4_subnet_server
ADD CONSTRAINT fk_dhcp4_subnet_server_subnet_id FOREIGN KEY (subnet_id)
REFERENCES dhcp4_subnet (subnet_id)
ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE dhcp6_subnet_server
DROP FOREIGN KEY fk_dhcp6_subnet_server_subnet_id;
ALTER TABLE dhcp6_subnet_server
ADD CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id)
REFERENCES dhcp6_subnet (subnet_id)
ON DELETE CASCADE ON UPDATE CASCADE;
-- -----------------------------------------------------
-- Table `dhcp6_audit_revision`
-- -----------------------------------------------------

View File

@@ -590,6 +590,23 @@ ALTER TABLE dhcp6_shared_network_server
REFERENCES dhcp6_shared_network (id)
ON DELETE CASCADE ON UPDATE NO ACTION;
-- Update dhcp4_subnet_server and dhcp6_subnet_server to allow update
-- on the prefix too.
ALTER TABLE dhcp4_subnet_server
DROP FOREIGN KEY fk_dhcp4_subnet_server_subnet_id;
ALTER TABLE dhcp4_subnet_server
ADD CONSTRAINT fk_dhcp4_subnet_server_subnet_id FOREIGN KEY (subnet_id)
REFERENCES dhcp4_subnet (subnet_id)
ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE dhcp6_subnet_server
DROP FOREIGN KEY fk_dhcp6_subnet_server_subnet_id;
ALTER TABLE dhcp6_subnet_server
ADD CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id)
REFERENCES dhcp6_subnet (subnet_id)
ON DELETE CASCADE ON UPDATE CASCADE;
-- -----------------------------------------------------
-- Table dhcp6_audit_revision
-- -----------------------------------------------------