mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
[481-remote-subnet4-set-inconsistent-work-when-id-subnet-is-duplicated] Added tests and updated schema
This commit is contained in:
@@ -633,6 +633,25 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSubnet4) {
|
|||||||
AuditEntry::ModificationType::UPDATE,
|
AuditEntry::ModificationType::UPDATE,
|
||||||
"subnet set");
|
"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
|
// Test that the information about unspecified optional parameters gets
|
||||||
|
@@ -1908,6 +1908,23 @@ ALTER TABLE dhcp6_shared_network_server
|
|||||||
REFERENCES dhcp6_shared_network (id)
|
REFERENCES dhcp6_shared_network (id)
|
||||||
ON DELETE CASCADE ON UPDATE NO ACTION;
|
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`
|
-- Table `dhcp6_audit_revision`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@@ -590,6 +590,23 @@ ALTER TABLE dhcp6_shared_network_server
|
|||||||
REFERENCES dhcp6_shared_network (id)
|
REFERENCES dhcp6_shared_network (id)
|
||||||
ON DELETE CASCADE ON UPDATE NO ACTION;
|
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
|
-- Table dhcp6_audit_revision
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user