Commit dd599e72 authored by Francis Dupont's avatar Francis Dupont
Browse files

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action...

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action-delete] Addressed comments
parent 7ad95788
......@@ -2941,7 +2941,7 @@ MySqlConfigBackendDHCPv4::deleteSharedNetworkSubnets4(const db::ServerSelector&
const std::string& shared_network_name) {
if (!server_selector.amAny()) {
isc_throw(InvalidOperation, "deleting all subnets from a shared "
"network is defined only using ANY server");
"network requires using ANY server selector");
}
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_DELETE_SHARED_NETWORK_SUBNETS4)
.arg(shared_network_name);
......
......@@ -3321,7 +3321,7 @@ MySqlConfigBackendDHCPv6::deleteSharedNetworkSubnets6(const db::ServerSelector&
const std::string& shared_network_name) {
if (!server_selector.amAny()) {
isc_throw(InvalidOperation, "deleting all subnets from a shared "
"network is defined only using ANY server");
"network requires using ANY server selector");
}
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_DELETE_SHARED_NETWORK_SUBNETS6)
.arg(shared_network_name);
......
......@@ -2231,6 +2231,19 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getAllSharedNetworks4) {
EXPECT_EQ(0, cbptr_->deleteAllSharedNetworks4(ServerSelector::ONE("server1")));
// Delete first shared network with it subnets and verify it is gone.
// It requires ANY so verifies that all other choices throw.
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ANY(),
......
......@@ -2246,6 +2246,19 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getAllSharedNetworks6) {
EXPECT_EQ(0, cbptr_->deleteAllSharedNetworks6(ServerSelector::ONE("server1")));
// Delete first shared network with it subnets and verify it is gone.
// It requires ANY so verifies that all other choices throw.
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ANY(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment