Skip to content

Commit be9faa8

Browse files
author
Razvan Becheriu
committed
[#4014] addressed review comments
1 parent 836db67 commit be9faa8

17 files changed

+62
-55
lines changed

doc/sphinx/arm/hooks-cb-cmds.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ The ``remote-option4-network-del``, ``remote-option6-network-del`` Commands
13431343

13441344
These commands are used to delete a shared-network-specific DHCP
13451345
option from the database. The option is identified by an option code
1346-
and option space and as of Kea 3.1.1, an optional ``client-classes``
1346+
and option space, and as of Kea 3.1.1, an optional ``client-classes``
13471347
parameter may also be specified (see :ref:`cb-cmds-option-class-tags-as-keys`).
13481348
These parameters are passed within the ``options`` list.
13491349
Another list, ``shared-networks``, contains a map
@@ -1438,8 +1438,10 @@ The ``remote-option6-pd-pool-del`` Command
14381438
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14391439

14401440
This command is used to delete a prefix delegation pool-specific DHCPv6
1441-
option from the database. The option is identified by an option code
1442-
and option space. These two parameters are passed within the ``options`` list.
1441+
option from the database. The option is identified by an option code and
1442+
option space, and as of Kea 3.1.1, an optional ``client-classes`` parameter
1443+
may also be specified (see :ref:`cb-cmds-option-class-tags-as-keys`).
1444+
These parameters are passed within the ``options`` list.
14431445
Another list, ``pd-pools``, contains a map with the
14441446
prefix-delegation-pool prefix and length identifying the pool. If the
14451447
option is not explicitly specified for this pool, no option is deleted.

src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3517,7 +3517,8 @@ TaggedStatementArray tagged_statements = { {
35173517

35183518
// Update existing global option.
35193519
{ MySqlConfigBackendDHCPv4Impl::UPDATE_OPTION4,
3520-
MYSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = ? AND o.space = ? AND o.client_classes = ?)
3520+
MYSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = ? AND o.space = ?
3521+
AND o.client_classes = ?)
35213522
},
35223523

35233524
// Update existing subnet level option.

src/hooks/dhcp/mysql/mysql_cb_dhcp4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ class MySqlConfigBackendDHCPv4 : public ConfigBackendDHCPv4 {
487487
/// @param space Option space of the deleted option.
488488
/// @param client_classes Optional client classes list of the option to be deleted.
489489
/// Defaults to an empty pointer.
490+
/// @return Number of deleted options.
490491
/// @throw NotImplemented if server selector is "unassigned".
491492
virtual uint64_t
492493
deleteOption4(const db::ServerSelector& server_selector,

src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,14 +3950,14 @@ TaggedStatementArray tagged_statements = { {
39503950

39513951
// Update existing shared network level option.
39523952
{ MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_SHARED_NETWORK,
3953-
MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ?
3954-
AND o.space = ? AND o.client_classes = ?)
3953+
MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
3954+
AND o.client_classes = ?)
39553955
},
39563956

39573957
// Update existing client class level option.
39583958
{ MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_CLIENT_CLASS,
3959-
MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = ? AND o.code = ?
3960-
AND o.space = ? AND o.client_classes = ?)
3959+
MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = ? AND o.code = ? AND o.space = ?
3960+
AND o.client_classes = ?)
39613961
},
39623962

39633963
// Update existing client class with specifying its position.
@@ -4099,8 +4099,8 @@ TaggedStatementArray tagged_statements = { {
40994099
// Delete single option from a subnet.
41004100
{ MySqlConfigBackendDHCPv6Impl::DELETE_OPTION6_SUBNET_ID,
41014101
MYSQL_DELETE_OPTION_NO_TAG(dhcp6,
4102-
WHERE o.scope_id = 1 AND o.dhcp6_subnet_id = ? AND o.code = ? AND o.space = ?
4103-
AND o.client_classes LIKE ?)
4102+
WHERE (o.scope_id = 1 AND o.dhcp6_subnet_id = ? AND o.code = ? AND o.space = ?
4103+
AND o.client_classes LIKE ?))
41044104
},
41054105

41064106
// Delete single option from a pool.
@@ -4118,8 +4118,8 @@ TaggedStatementArray tagged_statements = { {
41184118
// Delete single option from a shared network.
41194119
{ MySqlConfigBackendDHCPv6Impl::DELETE_OPTION6_SHARED_NETWORK,
41204120
MYSQL_DELETE_OPTION_NO_TAG(dhcp6,
4121-
WHERE o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
4122-
AND o.client_classes LIKE ?)
4121+
WHERE (o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
4122+
AND o.client_classes LIKE ?))
41234123
},
41244124

41254125
// Delete options belonging to a subnet.

src/hooks/dhcp/mysql/mysql_cb_dhcp6.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,8 @@ class MySqlConfigBackendDHCPv6 : public ConfigBackendDHCPv6 {
523523
/// @return Number of deleted options.
524524
/// @throw NotImplemented if server selector is "unassigned".
525525
virtual uint64_t
526-
deleteOption6(const db::ServerSelector& server_selector,
527-
const SubnetID& subnet_id,
528-
const uint16_t code,
529-
const std::string& space,
526+
deleteOption6(const db::ServerSelector& server_selector, const SubnetID& subnet_id,
527+
const uint16_t code, const std::string& space,
530528
const ClientClassesPtr client_classes = ClientClassesPtr());
531529

532530
/// @brief Deletes pool level option.

src/hooks/dhcp/mysql/mysql_cb_impl.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ MySqlConfigBackendImpl::getOption(const int index,
587587
OptionDescriptor::create(*options.begin()));
588588
}
589589

590-
591590
OptionContainer
592591
MySqlConfigBackendImpl::getAllOptions(const int index,
593592
const Option::Universe& universe,

src/hooks/dhcp/pgsql/pgsql_cb_dhcp4.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4054,7 +4054,8 @@ TaggedStatementArray tagged_statements = { {
40544054
OID_TEXT // 18 client_classes (of option to update)
40554055
},
40564056
"UPDATE_OPTION4",
4057-
PGSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
4057+
PGSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = $16 AND o.space = $17
4058+
AND o.client_classes = $18)
40584059
},
40594060

40604061
// Update existing subnet level option.
@@ -4082,7 +4083,8 @@ TaggedStatementArray tagged_statements = { {
40824083
OID_TEXT // 18 client_classes (of option to update)
40834084
},
40844085
"UPDATE_OPTION4_SUBNET_ID",
4085-
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 1 AND o.dhcp4_subnet_id = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
4086+
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 1 AND o.dhcp4_subnet_id = $15 AND o.code = $16 AND o.space = $17
4087+
AND o.client_classes = $18)
40864088
},
40874089

40884090
// Update existing pool level option.
@@ -4110,7 +4112,8 @@ TaggedStatementArray tagged_statements = { {
41104112
OID_TEXT // 18 client_classes (of option to update)
41114113
},
41124114
"UPDATE_OPTION4_POOL_ID",
4113-
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 5 AND o.pool_id = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
4115+
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 5 AND o.pool_id = $15 AND o.code = $16 AND o.space = $17
4116+
AND o.client_classes = $18)
41144117
},
41154118

41164119
// Update existing shared network level option.
@@ -4138,7 +4141,8 @@ TaggedStatementArray tagged_statements = { {
41384141
OID_TEXT, // 18 client_classes (of option to update)
41394142
},
41404143
"UPDATE_OPTION4_SHARED_NETWORK",
4141-
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
4144+
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $15 AND o.code = $16 AND o.space = $17
4145+
AND o.client_classes = $18)
41424146
},
41434147

41444148
// Update existing client class level option.
@@ -4166,7 +4170,8 @@ TaggedStatementArray tagged_statements = { {
41664170
OID_TEXT // 18 client_classes (of option to update)
41674171
},
41684172
"UPDATE_OPTION4_CLIENT_CLASS",
4169-
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
4173+
PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $15 AND o.code = $16 AND o.space = $17
4174+
AND o.client_classes = $18)
41704175
},
41714176

41724177
// Update existing client class with specifying its position.

src/hooks/dhcp/pgsql/pgsql_cb_dhcp4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ class PgSqlConfigBackendDHCPv4 : public ConfigBackendDHCPv4 {
487487
/// @param space Option space of the deleted option.
488488
/// @param client_classes Optional client classes list of the option to be deleted.
489489
/// Defaults to an empty pointer.
490+
/// @return Number of deleted options.
490491
/// @throw NotImplemented if server selector is "unassigned".
491492
virtual uint64_t
492493
deleteOption4(const db::ServerSelector& server_selector,

src/hooks/dhcp/pgsql/pgsql_cb_dhcp6.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4492,8 +4492,8 @@ TaggedStatementArray tagged_statements = { {
44924492
OID_TEXT // 19 client_classes (of option to update)
44934493
},
44944494
"UPDATE_OPTION6_SUBNET_ID",
4495-
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 1 AND o.dhcp6_subnet_id = $16 AND o.code = $17
4496-
AND o.space = $18 AND o.client_classes = $19)
4495+
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 1 AND o.dhcp6_subnet_id = $16 AND o.code = $17 AND o.space = $18
4496+
AND o.client_classes = $19)
44974497
},
44984498

44994499
// Update existing pool level option.
@@ -4522,8 +4522,8 @@ TaggedStatementArray tagged_statements = { {
45224522
OID_TEXT // 19 client_classes (of option to update)
45234523
},
45244524
"UPDATE_OPTION6_POOL_ID",
4525-
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 5 AND o.pool_id = $16 AND o.code = $17
4526-
AND o.space = $18 AND o.client_classes = $19)
4525+
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 5 AND o.pool_id = $16 AND o.code = $17 AND o.space = $18
4526+
AND o.client_classes = $19)
45274527
},
45284528

45294529
// Update existing pd pool level option.
@@ -4552,8 +4552,8 @@ TaggedStatementArray tagged_statements = { {
45524552
OID_TEXT // 19 client_classes (of option to update)
45534553
},
45544554
"UPDATE_OPTION6_PD_POOL_ID",
4555-
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 6 AND o.pd_pool_id = $16 AND o.code = $17
4556-
AND o.space = $18 AND o.client_classes = $19)
4555+
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 6 AND o.pd_pool_id = $16 AND o.code = $17 AND o.space = $18
4556+
AND o.client_classes = $19)
45574557
},
45584558

45594559
// Update existing shared network level option.
@@ -4582,8 +4582,8 @@ TaggedStatementArray tagged_statements = { {
45824582
OID_TEXT // 19 client_classes (of option to update)
45834583
},
45844584
"UPDATE_OPTION6_SHARED_NETWORK",
4585-
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $16 AND o.code = $17
4586-
AND o.space = $18 AND o.client_classes = $19)
4585+
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $16 AND o.code = $17 AND o.space = $18
4586+
AND o.client_classes = $19)
45874587
},
45884588

45894589
// Update existing client class level option.
@@ -4612,8 +4612,8 @@ TaggedStatementArray tagged_statements = { {
46124612
OID_TEXT // 19 client_classes (of option to update)
46134613
},
46144614
"UPDATE_OPTION6_CLIENT_CLASS",
4615-
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $16 AND o.code = $17
4616-
AND o.space = $18 AND o.client_classes = $19)
4615+
PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $16 AND o.code = $17 AND o.space = $18
4616+
AND o.client_classes = $19)
46174617
},
46184618

46194619
// Update existing client class with specifying its position.
@@ -5015,7 +5015,7 @@ TaggedStatementArray tagged_statements = { {
50155015
"DELETE_OPTION6_SHARED_NETWORK",
50165016
PGSQL_DELETE_OPTION_NO_TAG(dhcp6,
50175017
WHERE o.scope_id = 4 AND o.shared_network_name = $1 AND o.code = $2 AND o.space = $3
5018-
AND o.client_classes LIKE $4)
5018+
AND o.client_classes LIKE $4)
50195019
},
50205020

50215021
// Delete options belonging to a subnet.

src/hooks/dhcp/pgsql/tests/pgsql_cb_dhcp6_unittest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ TEST_F(PgSqlConfigBackendDHCPv6Test, getModifiedOptions6Test) {
349349
getModifiedOptions6Test();
350350
}
351351

352-
353352
TEST_F(PgSqlConfigBackendDHCPv6Test, globalOption6WithClientClassesTest) {
354353
globalOption6WithClientClassesTest();
355354
}

0 commit comments

Comments
 (0)