Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
450
Issues
450
List
Boards
Labels
Service Desk
Milestones
Merge Requests
75
Merge Requests
75
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
12f3c6d9
Commit
12f3c6d9
authored
Sep 29, 2019
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[392-search-of-reservations-by-hostname] Checkpoint: updated shcemas, todo tests
parent
34ed1671
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
399 additions
and
69 deletions
+399
-69
configure.ac
configure.ac
+3
-0
src/bin/admin/tests/cql_tests.sh.in
src/bin/admin/tests/cql_tests.sh.in
+14
-13
src/bin/admin/tests/data/cql.hosts_data_test.csv
src/bin/admin/tests/data/cql.hosts_data_test.csv
+3
-3
src/bin/admin/tests/data/cql.hosts_data_test.reference.csv
src/bin/admin/tests/data/cql.hosts_data_test.reference.csv
+24
-24
src/bin/admin/tests/data/cql.subnet_id_test.reference.csv
src/bin/admin/tests/data/cql.subnet_id_test.reference.csv
+6
-6
src/bin/admin/tests/mysql_tests.sh.in
src/bin/admin/tests/mysql_tests.sh.in
+5
-5
src/bin/admin/tests/pgsql_tests.sh.in
src/bin/admin/tests/pgsql_tests.sh.in
+6
-6
src/lib/cql/cql_connection.h
src/lib/cql/cql_connection.h
+2
-2
src/lib/dhcpsrv/cql_host_data_source.cc
src/lib/dhcpsrv/cql_host_data_source.cc
+18
-4
src/lib/mysql/mysql_constants.h
src/lib/mysql/mysql_constants.h
+2
-2
src/lib/pgsql/pgsql_connection.h
src/lib/pgsql/pgsql_connection.h
+3
-3
src/share/database/scripts/cql/Makefile.am
src/share/database/scripts/cql/Makefile.am
+1
-0
src/share/database/scripts/cql/dhcpdb_create.cql
src/share/database/scripts/cql/dhcpdb_create.cql
+13
-0
src/share/database/scripts/cql/dhcpdb_drop.cql
src/share/database/scripts/cql/dhcpdb_drop.cql
+1
-0
src/share/database/scripts/cql/upgrade_4.0_to_5.0.sh.in
src/share/database/scripts/cql/upgrade_4.0_to_5.0.sh.in
+197
-0
src/share/database/scripts/mysql/Makefile.am
src/share/database/scripts/mysql/Makefile.am
+2
-0
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/dhcpdb_create.mysql
+9
-0
src/share/database/scripts/mysql/upgrade_8.2_to_9.0.sh.in
src/share/database/scripts/mysql/upgrade_8.2_to_9.0.sh.in
+34
-0
src/share/database/scripts/pgsql/Makefile.am
src/share/database/scripts/pgsql/Makefile.am
+2
-0
src/share/database/scripts/pgsql/dhcpdb_create.pgsql
src/share/database/scripts/pgsql/dhcpdb_create.pgsql
+15
-1
src/share/database/scripts/pgsql/upgrade_5.1_to_6.0.sh.in
src/share/database/scripts/pgsql/upgrade_5.1_to_6.0.sh.in
+39
-0
No files found.
configure.ac
View file @
12f3c6d9
...
@@ -1796,6 +1796,7 @@ AC_CONFIG_FILES([Makefile
...
@@ -1796,6 +1796,7 @@ AC_CONFIG_FILES([Makefile
src/share/database/scripts/cql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/cql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/cql/upgrade_2.0_to_3.0.sh
src/share/database/scripts/cql/upgrade_2.0_to_3.0.sh
src/share/database/scripts/cql/upgrade_3.0_to_4.0.sh
src/share/database/scripts/cql/upgrade_3.0_to_4.0.sh
src/share/database/scripts/cql/upgrade_4.0_to_5.0.sh
src/share/database/scripts/cql/wipe_data.sh
src/share/database/scripts/cql/wipe_data.sh
src/share/database/scripts/mysql/Makefile
src/share/database/scripts/mysql/Makefile
src/share/database/scripts/mysql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/mysql/upgrade_1.0_to_2.0.sh
...
@@ -1810,6 +1811,7 @@ AC_CONFIG_FILES([Makefile
...
@@ -1810,6 +1811,7 @@ AC_CONFIG_FILES([Makefile
src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh
src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh
src/share/database/scripts/mysql/upgrade_8.0_to_8.1.sh
src/share/database/scripts/mysql/upgrade_8.0_to_8.1.sh
src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh
src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh
src/share/database/scripts/mysql/upgrade_8.2_to_9.0.sh
src/share/database/scripts/mysql/wipe_data.sh
src/share/database/scripts/mysql/wipe_data.sh
src/share/database/scripts/pgsql/Makefile
src/share/database/scripts/pgsql/Makefile
src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh
...
@@ -1820,6 +1822,7 @@ AC_CONFIG_FILES([Makefile
...
@@ -1820,6 +1822,7 @@ AC_CONFIG_FILES([Makefile
src/share/database/scripts/pgsql/upgrade_3.3_to_4.0.sh
src/share/database/scripts/pgsql/upgrade_3.3_to_4.0.sh
src/share/database/scripts/pgsql/upgrade_4.0_to_5.0.sh
src/share/database/scripts/pgsql/upgrade_4.0_to_5.0.sh
src/share/database/scripts/pgsql/upgrade_5.0_to_5.1.sh
src/share/database/scripts/pgsql/upgrade_5.0_to_5.1.sh
src/share/database/scripts/pgsql/upgrade_5.1_to_6.0.sh
src/share/database/scripts/pgsql/wipe_data.sh
src/share/database/scripts/pgsql/wipe_data.sh
src/share/yang/Makefile
src/share/yang/Makefile
src/share/yang/modules/Makefile
src/share/yang/modules/Makefile
...
...
src/bin/admin/tests/cql_tests.sh.in
View file @
12f3c6d9
...
@@ -85,7 +85,7 @@ cql_db_version_test() {
...
@@ -85,7 +85,7 @@ cql_db_version_test() {
# Verify that kea-admin db-version returns the correct version.
# Verify that kea-admin db-version returns the correct version.
version
=
$(
$keaadmin
db-version cql
-u
$db_user
-p
$db_password
-n
$db_name
)
version
=
$(
$keaadmin
db-version cql
-u
$db_user
-p
$db_password
-n
$db_name
)
assert_str_eq
"
4
.0"
$version
"Expected kea-admin to return %s, returned value was %s"
assert_str_eq
"
5
.0"
$version
"Expected kea-admin to return %s, returned value was %s"
# Wipe the database.
# Wipe the database.
cql_wipe
cql_wipe
...
@@ -315,16 +315,16 @@ cql_unused_subnet_id_test() {
...
@@ -315,16 +315,16 @@ cql_unused_subnet_id_test() {
# Now we need insert some hosts to "migrate" for both v4 and v6
# Now we need insert some hosts to "migrate" for both v4 and v6
qry
=
"
\
qry
=
"
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id)
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname,
option_subnet_id)
\
VALUES (1, 0, textAsBlob('0123456'), 0, 0, 0);
\
VALUES (1, 0, textAsBlob('0123456'), 0, 0,
'host0',
0);
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id)
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname,
option_subnet_id)
\
VALUES (2, 0, textAsBlob('1123456'), 4, 0, 4);
\
VALUES (2, 0, textAsBlob('1123456'), 4, 0,
'Host1',
4);
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id)
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname,
option_subnet_id)
\
VALUES (3, 0, textAsBlob('2123456'), 0, 6, 6);
\
VALUES (3, 0, textAsBlob('2123456'), 0, 6,
'host2',
6);
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id)
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname,
option_subnet_id)
\
VALUES (4, 0, textAsBlob('3123456'), 4, 6, 0);
\
VALUES (4, 0, textAsBlob('3123456'), 4, 6,
'Host3',
0);
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id)
\
INSERT INTO host_reservations (id, host_identifier_type, host_identifier, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname,
option_subnet_id)
\
VALUES (5, 0, textAsBlob('3123456'), -1, 6, 6);"
VALUES (5, 0, textAsBlob('3123456'), -1, 6,
'host3',
6);"
cql_execute
"
$qry
"
cql_execute
"
$qry
"
assert_eq 0
$?
"insert hosts failed, expected exit code: %d, actual: %d"
assert_eq 0
$?
"insert hosts failed, expected exit code: %d, actual: %d"
...
@@ -347,7 +347,7 @@ cql_unused_subnet_id_test() {
...
@@ -347,7 +347,7 @@ cql_unused_subnet_id_test() {
echo
"Exporting host_reservation data to
$export_file
..."
echo
"Exporting host_reservation data to
$export_file
..."
qry
=
"
\
qry
=
"
\
SELECT id, host_ipv4_subnet_id, host_ipv6_subnet_id, option_subnet_id
\
SELECT id, host_ipv4_subnet_id, host_ipv6_subnet_id,
hostname, lower_case_hostname,
option_subnet_id
\
FROM hosts WHERE id IN (1,2,3,4,5) ALLOW FILTERING;"
FROM hosts WHERE id IN (1,2,3,4,5) ALLOW FILTERING;"
cql_execute
"
$qry
"
>
$export_file
cql_execute
"
$qry
"
>
$export_file
...
@@ -433,7 +433,8 @@ cql_upgrade_hosts_test() {
...
@@ -433,7 +433,8 @@ cql_upgrade_hosts_test() {
(id, key, host_identifier, host_identifier_type, host_ipv4_subnet_id,
\
(id, key, host_identifier, host_identifier_type, host_ipv4_subnet_id,
\
host_ipv6_subnet_id, host_ipv4_address, host_ipv4_next_server,
\
host_ipv6_subnet_id, host_ipv4_address, host_ipv4_next_server,
\
host_ipv4_server_hostname, host_ipv4_boot_file_name, hostname,
\
host_ipv4_server_hostname, host_ipv4_boot_file_name, hostname,
\
auth_key, user_context, host_ipv4_client_classes,
\
lower_case_hostname, auth_key, user_context,
\
host_ipv4_client_classes,
\
host_ipv6_client_classes, reserved_ipv6_prefix_address,
\
host_ipv6_client_classes, reserved_ipv6_prefix_address,
\
reserved_ipv6_prefix_length, reserved_ipv6_prefix_address_type,
\
reserved_ipv6_prefix_length, reserved_ipv6_prefix_address_type,
\
iaid, option_universe, option_code, option_value,
\
iaid, option_universe, option_code, option_value,
\
...
...
src/bin/admin/tests/data/cql.hosts_data_test.csv
View file @
12f3c6d9
1105657659805715115,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
1105657659805715115,0x4142434445464748494b,1,1,101,0,0,,,
host60
,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
2129388898029710264,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
2129388898029710264,0x414243444548,0,2,102,0,0,,,
Host61
,,,,,2001:db8::1,128,0,0,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
2370585748436022247,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,67,0x,my-boot-file,dhcp4,True,,0,,3
2370585748436022247,0x414243444548,0,2,102,0,0,,,
host62
,,,,,2001:db8::1,128,0,0,0,67,0x,my-boot-file,dhcp4,True,,0,,3
2459636980433777721,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,{ \"comment\": \"a host reservation\" },3
2459636980433777721,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,{ \"comment\": \"a host reservation\" },3
5403514763123047131,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
5403514763123047131,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
5501234819855171334,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
5501234819855171334,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
...
...
src/bin/admin/tests/data/cql.hosts_data_test.reference.csv
View file @
12f3c6d9
1105657659805715115,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
1105657659805715115,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,
host60,host60
,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
2129388898029710264,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
2129388898029710264,-4885955325122621964,0x414243444548,0,2,102,0,0,,,
Host61,host61
,,,,,2001:db8::1,128,0,0,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
2370585748436022247,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,67,0x,my-boot-file,dhcp4,True,,0,,3
2370585748436022247,-4885955325122621964,0x414243444548,0,2,102,0,0,,,
host62,host62
,,,,,2001:db8::1,128,0,0,0,67,0x,my-boot-file,dhcp4,True,,0,,3
2459636980433777721,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,{ \"comment\": \"a host reservation\" },3
2459636980433777721,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,{ \"comment\": \"a host reservation\" },3
5403514763123047131,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
5403514763123047131,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
5501234819855171334,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
5501234819855171334,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,17,0x,2495,dhcp6,False,,0,,3
5747907930644082856,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,1,0x,,isc2,True,,0,,3
5747907930644082856,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,1,0x,,isc2,True,,0,,3
5955003068494074400,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,,3
5955003068494074400,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,59,0x,my-boot-file,dhcp6,True,,0,,3
6399013866147252670,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,32,0x,3600,dhcp6,False,,0,,3
6399013866147252670,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,32,0x,3600,dhcp6,False,,0,,3
6783601303445960591,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,32,0x,3600,dhcp6,False,,0,,3
6783601303445960591,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,32,0x,3600,dhcp6,False,,0,,3
7821756928114620236,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,23,0x,64,dhcp4,False,,0,,3
7821756928114620236,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,23,0x,64,dhcp4,False,,0,,3
8973539074684426388,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,1,0x,,isc,True,,0,,3
8973539074684426388,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,0,1,0x,,isc,True,,0,,3
9211831388923168274,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,2,0x,"10.0.0.5,10.0.0.3,10.0.3.4",isc,False,,0,,3
9211831388923168274,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,2,0x,"10.0.0.5,10.0.0.3,10.0.3.4",isc,False,,0,,3
-650687214220680074,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,1024,0x,2001:db8:1::1,dhcp6,False,,0,,3
-650687214220680074,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,1024,0x,2001:db8:1::1,dhcp6,False,,0,,3
-1123502337428230752,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
-1123502337428230752,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,0,254,0x,192.0.2.3,dhcp4,False,,0,,3
-1210691761766369036,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,67,0x,my-boot-file,dhcp4,True,,0,{ \"comment\": \"a host reservation\" },3
-1210691761766369036,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,67,0x,my-boot-file,dhcp4,True,,0,{ \"comment\": \"a host reservation\" },3
-3907456719587717375,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,2,0x,"10.0.0.5,10.0.0.3,10.0.3.4",isc,False,,0,,3
-3907456719587717375,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,0,2,0x,"10.0.0.5,10.0.0.3,10.0.3.4",isc,False,,0,,3
-5169419091664697091,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,2001:db8::1,128,0,0,1,2,0x,"3000::1,3000::2,3000::3",isc2,False,,0,,3
-5169419091664697091,5367868710821401223,0x4142434445464748494b,1,1,101,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,2,0x,"3000::1,3000::2,3000::3",isc2,False,,0,,3
-6372549629773775261,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
-6372549629773775261,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,1,0x,312131,vendor-encapsulated-options,False,,0,,3
-6378104957663278797,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,::,0,-1,-1,0,1,0x,,isc,True,,0,,3
-6378104957663278797,4012104063077014549,0x414243444547,0,1,101,-1073741307,0,,,,,,,,
,
::,0,-1,-1,0,1,0x,,isc,True,,0,,3
-7724068518921719729,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,1024,0x,2001:db8:1::1,dhcp6,False,,0,,3
-7724068518921719729,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,1024,0x,2001:db8:1::1,dhcp6,False,,0,,3
-7804940982500935489,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,0,23,0x,64,dhcp4,False,,0,,3
-7804940982500935489,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,0,23,0x,64,dhcp4,False,,0,,3
-8100784457292204371,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,1,0x,,isc2,True,,0,,3
-8100784457292204371,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,1,0x,,isc2,True,,0,,3
-8306770918748488616,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,2001:db8::1,128,0,0,1,2,0x,"3000::1,3000::2,3000::3",isc2,False,,0,,3
-8306770918748488616,-4885955325122621964,0x414243444548,0,2,102,0,0,,,,,,,,
,
2001:db8::1,128,0,0,1,2,0x,"3000::1,3000::2,3000::3",isc2,False,,0,,3
src/bin/admin/tests/data/cql.subnet_id_test.reference.csv
View file @
12f3c6d9
id,host_ipv4_subnet_id,host_ipv6_subnet_id,option_subnet_id
id,host_ipv4_subnet_id,host_ipv6_subnet_id,
hostname,lower_case_hostname,
option_subnet_id
1,-1,-1,-1
1,-1,-1,
host0,host0,
-1
2,4,-1,4
2,4,-1,
Host1,host1,
4
3,-1,6,6
3,-1,6,
host2,host2,
6
4,4,6,-1
4,4,6,
Host3,host3,
-1
5,-1,6,6
5,-1,6,
host3,host3,
6
src/bin/admin/tests/mysql_tests.sh.in
View file @
12f3c6d9
...
@@ -258,7 +258,7 @@ mysql_upgrade_test() {
...
@@ -258,7 +258,7 @@ mysql_upgrade_test() {
assert_str_eq
"1.0"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
assert_str_eq
"1.0"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
# Ok, we have a 1.0 database. Let's upgrade it to
8.2
# Ok, we have a 1.0 database. Let's upgrade it to
9.0
${
keaadmin
}
db-upgrade mysql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
${
keaadmin
}
db-upgrade mysql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
ERRCODE
=
$?
ERRCODE
=
$?
...
@@ -721,10 +721,6 @@ EOF
...
@@ -721,10 +721,6 @@ EOF
qry
=
"select client_class, require_client_classes, user_context from dhcp6_pool"
qry
=
"select client_class, require_client_classes, user_context from dhcp6_pool"
run_statement
"dhcp6_pool"
"
$qry
"
run_statement
"dhcp6_pool"
"
$qry
"
# Verify upgraded schema reports version 8.2
version
=
$(
${
keaadmin
}
db-version mysql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
)
assert_str_eq
"8.2"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
# Verify that dhcp4_option_def column name is is_array
# Verify that dhcp4_option_def column name is is_array
qry
=
"select is_array from dhcp4_option_def"
qry
=
"select is_array from dhcp4_option_def"
run_statement
"dhcp4_option_def verify is_array column"
"
$qry
"
run_statement
"dhcp4_option_def verify is_array column"
"
$qry
"
...
@@ -733,6 +729,10 @@ EOF
...
@@ -733,6 +729,10 @@ EOF
qry
=
"select is_array from dhcp6_option_def"
qry
=
"select is_array from dhcp6_option_def"
run_statement
"dhcp6_option_def verify is_array column"
"
$qry
"
run_statement
"dhcp6_option_def verify is_array column"
"
$qry
"
# Verify upgraded schema reports version 9.0
version
=
$(
${
keaadmin
}
db-version mysql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
)
assert_str_eq
"9.0"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
# Let's wipe the whole database
mysql_wipe
mysql_wipe
...
...
src/bin/admin/tests/pgsql_tests.sh.in
View file @
12f3c6d9
...
@@ -120,7 +120,7 @@ pgsql_db_version_test() {
...
@@ -120,7 +120,7 @@ pgsql_db_version_test() {
# Verify that kea-admin db-version returns the correct version
# Verify that kea-admin db-version returns the correct version
version
=
$(
${
keaadmin
}
db-version pgsql
-u
$db_user
-p
$db_password
-n
$db_name
)
version
=
$(
${
keaadmin
}
db-version pgsql
-u
$db_user
-p
$db_password
-n
$db_name
)
assert_str_eq
"
5.1
"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
assert_str_eq
"
6.0
"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
# Let's wipe the whole database
pgsql_wipe
pgsql_wipe
...
@@ -230,10 +230,10 @@ pgsql_upgrade_2_0_to_3_0() {
...
@@ -230,10 +230,10 @@ pgsql_upgrade_2_0_to_3_0() {
assert_eq 1
"
$output
"
"lease_hwaddr_source does not contain entry for HWADDR_SOURCE_UNKNOWN. (record count %d, expected %d)"
assert_eq 1
"
$output
"
"lease_hwaddr_source does not contain entry for HWADDR_SOURCE_UNKNOWN. (record count %d, expected %d)"
}
}
pgsql_upgrade_3_0_to_
5_1
()
{
pgsql_upgrade_3_0_to_
6_0
()
{
# Verify upgraded schema reports version
5.1
.
# Verify upgraded schema reports version
6.0
.
version
=
$(
${
keaadmin
}
db-version pgsql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
)
version
=
$(
${
keaadmin
}
db-version pgsql
-u
$db_user
-p
$db_password
-n
$db_name
-d
$db_scripts_dir
)
assert_str_eq
"
5.1
"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
assert_str_eq
"
6.0
"
${
version
}
"Expected kea-admin to return %s, returned value was %s"
# Added user_context to lease4
# Added user_context to lease4
output
=
`
pgsql_execute
"select user_context from lease4;"
`
output
=
`
pgsql_execute
"select user_context from lease4;"
`
...
@@ -270,8 +270,8 @@ pgsql_upgrade_test() {
...
@@ -270,8 +270,8 @@ pgsql_upgrade_test() {
# Check 2.0 to 3.0 upgrade
# Check 2.0 to 3.0 upgrade
pgsql_upgrade_2_0_to_3_0
pgsql_upgrade_2_0_to_3_0
# Check 3.0 to
5.1
upgrade
# Check 3.0 to
6.0
upgrade
pgsql_upgrade_3_0_to_
5_1
pgsql_upgrade_3_0_to_
6_0
# Let's wipe the whole database
# Let's wipe the whole database
pgsql_wipe
pgsql_wipe
...
...
src/lib/cql/cql_connection.h
View file @
12f3c6d9
...
@@ -49,9 +49,9 @@ constexpr uint32_t CQL_DRIVER_VERSION_MAJOR = CASS_VERSION_MAJOR;
...
@@ -49,9 +49,9 @@ constexpr uint32_t CQL_DRIVER_VERSION_MAJOR = CASS_VERSION_MAJOR;
constexpr
uint32_t
CQL_DRIVER_VERSION_MINOR
=
CASS_VERSION_MINOR
;
constexpr
uint32_t
CQL_DRIVER_VERSION_MINOR
=
CASS_VERSION_MINOR
;
/// @}
/// @}
/// Define CQL schema version:
4
.0
/// Define CQL schema version:
5
.0
/// @{
/// @{
constexpr
uint32_t
CQL_SCHEMA_VERSION_MAJOR
=
4
u
;
constexpr
uint32_t
CQL_SCHEMA_VERSION_MAJOR
=
5
u
;
constexpr
uint32_t
CQL_SCHEMA_VERSION_MINOR
=
0u
;
constexpr
uint32_t
CQL_SCHEMA_VERSION_MINOR
=
0u
;
/// @}
/// @}
...
...
src/lib/dhcpsrv/cql_host_data_source.cc
View file @
12f3c6d9
...
@@ -419,6 +419,9 @@ private:
...
@@ -419,6 +419,9 @@ private:
/// @brief Name reserved for the host
/// @brief Name reserved for the host
std
::
string
hostname_
;
std
::
string
hostname_
;
/// @brief Lower case name reserved for the host
std
::
string
lower_case_hostname_
;
/// @brief User context
/// @brief User context
std
::
string
user_context_
;
std
::
string
user_context_
;
...
@@ -513,6 +516,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
...
@@ -513,6 +516,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
"host_ipv4_boot_file_name, "
"host_ipv4_boot_file_name, "
"auth_key, "
"auth_key, "
"hostname, "
"hostname, "
"lower_case_hostname, "
"user_context, "
"user_context, "
"host_ipv4_client_classes, "
"host_ipv4_client_classes, "
"host_ipv6_client_classes, "
"host_ipv6_client_classes, "
...
@@ -536,7 +540,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
...
@@ -536,7 +540,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
// id
// id
"?, "
"?, "
// host
// host
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?,
"
// denormalized reservation, option
// denormalized reservation, option
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
") "
") "
...
@@ -952,7 +956,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
...
@@ -952,7 +956,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
"option_user_context, "
"option_user_context, "
"option_scope_id "
"option_scope_id "
"FROM hosts "
"FROM hosts "
"WHERE hostname = ? "
"WHERE
lower_case_
hostname = ? "
"ALLOW FILTERING "
"ALLOW FILTERING "
}},
}},
...
@@ -989,7 +993,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
...
@@ -989,7 +993,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
"option_user_context, "
"option_user_context, "
"option_scope_id "
"option_scope_id "
"FROM hosts "
"FROM hosts "
"WHERE hostname = ? "
"WHERE
lower_case_
hostname = ? "
"AND host_ipv4_subnet_id = ? "
"AND host_ipv4_subnet_id = ? "
"ALLOW FILTERING "
"ALLOW FILTERING "
}},
}},
...
@@ -1027,7 +1031,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
...
@@ -1027,7 +1031,7 @@ StatementMap CqlHostExchange::tagged_statements_ = {
"option_user_context, "
"option_user_context, "
"option_scope_id "
"option_scope_id "
"FROM hosts "
"FROM hosts "
"WHERE hostname = ? "
"WHERE
lower_case_
hostname = ? "
"AND host_ipv6_subnet_id = ? "
"AND host_ipv6_subnet_id = ? "
"ALLOW FILTERING "
"ALLOW FILTERING "
}},
}},
...
@@ -1496,6 +1500,15 @@ CqlHostExchange::prepareExchange(const HostPtr& host,
...
@@ -1496,6 +1500,15 @@ CqlHostExchange::prepareExchange(const HostPtr& host,
<<
" is greater than allowed of "
<<
HOSTNAME_MAX_LEN
);
<<
" is greater than allowed of "
<<
HOSTNAME_MAX_LEN
);
}
}
// lower_case_hostname: text
lower_case_hostname_
=
host
->
getLowerHostname
();
if
(
lower_case_hostname_
.
size
()
>
HOSTNAME_MAX_LEN
)
{
isc_throw
(
BadValue
,
"CqlHostExchange::prepareExchange(): lower "
"case hostname "
<<
lower_case_hostname_
<<
" of length "
<<
lower_case_hostname_
.
size
()
<<
" is greater than allowed of "
<<
HOSTNAME_MAX_LEN
);
}
// user_context: text
// user_context: text
ConstElementPtr
ctx
=
host
->
getContext
();
ConstElementPtr
ctx
=
host
->
getContext
();
if
(
ctx
)
{
if
(
ctx
)
{
...
@@ -1656,6 +1669,7 @@ CqlHostExchange::createBindForMutation(const HostPtr& host,
...
@@ -1656,6 +1669,7 @@ CqlHostExchange::createBindForMutation(const HostPtr& host,
data
.
add
(
&
host_ipv4_boot_file_name_
);
data
.
add
(
&
host_ipv4_boot_file_name_
);
data
.
add
(
&
auth_key_
);
data
.
add
(
&
auth_key_
);
data
.
add
(
&
hostname_
);
data
.
add
(
&
hostname_
);
data
.
add
(
&
lower_case_hostname_
);
data
.
add
(
&
user_context_
);
data
.
add
(
&
user_context_
);
data
.
add
(
&
host_ipv4_client_classes_
);
data
.
add
(
&
host_ipv4_client_classes_
);
data
.
add
(
&
host_ipv6_client_classes_
);
data
.
add
(
&
host_ipv6_client_classes_
);
...
...
src/lib/mysql/mysql_constants.h
View file @
12f3c6d9
...
@@ -51,8 +51,8 @@ const int MLM_MYSQL_FETCH_FAILURE = 0;
...
@@ -51,8 +51,8 @@ const int MLM_MYSQL_FETCH_FAILURE = 0;
/// @name Current database schema version values.
/// @name Current database schema version values.
//@{
//@{
const
uint32_t
MYSQL_SCHEMA_VERSION_MAJOR
=
8
;
const
uint32_t
MYSQL_SCHEMA_VERSION_MAJOR
=
9
;
const
uint32_t
MYSQL_SCHEMA_VERSION_MINOR
=
2
;
const
uint32_t
MYSQL_SCHEMA_VERSION_MINOR
=
0
;
//@}
//@}
...
...
src/lib/pgsql/pgsql_connection.h
View file @
12f3c6d9
...
@@ -17,9 +17,9 @@
...
@@ -17,9 +17,9 @@
namespace
isc
{
namespace
isc
{
namespace
db
{
namespace
db
{
/// @brief Define PostgreSQL backend version:
5.1
/// @brief Define PostgreSQL backend version:
6.0
const
uint32_t
PG_SCHEMA_VERSION_MAJOR
=
5
;
const
uint32_t
PG_SCHEMA_VERSION_MAJOR
=
6
;
const
uint32_t
PG_SCHEMA_VERSION_MINOR
=
1
;
const
uint32_t
PG_SCHEMA_VERSION_MINOR
=
0
;
// Maximum number of parameters that can be used a statement
// Maximum number of parameters that can be used a statement
// @todo This allows us to use an initializer list (since we can't
// @todo This allows us to use an initializer list (since we can't
...
...
src/share/database/scripts/cql/Makefile.am
View file @
12f3c6d9
...
@@ -6,6 +6,7 @@ sqlscripts_DATA += dhcpdb_drop.cql
...
@@ -6,6 +6,7 @@ sqlscripts_DATA += dhcpdb_drop.cql
sqlscripts_DATA
+=
upgrade_1.0_to_2.0.sh
sqlscripts_DATA
+=
upgrade_1.0_to_2.0.sh
sqlscripts_DATA
+=
upgrade_2.0_to_3.0.sh
sqlscripts_DATA
+=
upgrade_2.0_to_3.0.sh
sqlscripts_DATA
+=
upgrade_3.0_to_4.0.sh
sqlscripts_DATA
+=
upgrade_3.0_to_4.0.sh
sqlscripts_DATA
+=
upgrade_4.0_to_5.0.sh
sqlscripts_DATA
+=
wipe_data.sh
sqlscripts_DATA
+=
wipe_data.sh
EXTRA_DIST
=
${sqlscripts_DATA}
EXTRA_DIST
=
${sqlscripts_DATA}
src/share/database/scripts/cql/dhcpdb_create.cql
View file @
12f3c6d9
...
@@ -365,3 +365,16 @@ DELETE FROM schema_version WHERE version=3;
...
@@ -365,3 +365,16 @@ DELETE FROM schema_version WHERE version=3;
INSERT INTO schema_version (version, minor) VALUES(4, 0);
INSERT INTO schema_version (version, minor) VALUES(4, 0);
-- This line concludes database upgrade to version 4.0
-- This line concludes database upgrade to version 4.0
-- This line starts database upgrade to version 5.0
-- Add the lower case hostname column to reservations.
ALTER TABLE hosts ADD lower_case_hostname VARCHAR;
-- Make the lower case hostname an index.
CREATE INDEX IF NOT EXISTS hostsindex8 ON hosts (lower_case_hostname);
DELETE FROM schema_version WHERE version=4;
INSERT INTO schema_version (version, minor) VALUES(5, 0);
-- This line concludes database upgrade to version 5.0
src/share/database/scripts/cql/dhcpdb_drop.cql
View file @
12f3c6d9
...
@@ -48,5 +48,6 @@ DROP INDEX IF EXISTS hostsindex4;
...
@@ -48,5 +48,6 @@ DROP INDEX IF EXISTS hostsindex4;
DROP INDEX IF EXISTS hostsindex5;
DROP INDEX IF EXISTS hostsindex5;
DROP INDEX IF EXISTS hostsindex6;
DROP INDEX IF EXISTS hostsindex6;
DROP INDEX IF EXISTS hostsindex7;
DROP INDEX IF EXISTS hostsindex7;
DROP INDEX IF EXISTS hostsindex8;
DROP INDEX IF EXISTS logsindex;
DROP INDEX IF EXISTS logsindex;
src/share/database/scripts/cql/upgrade_4.0_to_5.0.sh.in
0 → 100644
View file @
12f3c6d9
#!/bin/sh
prefix
=
@prefix@
# Include utilities. Use installed version if available and
# use build version if it isn't.
if
[
-e
"@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"
]
;
then
.
@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh
else
.
@abs_top_builddir@/src/bin/admin/admin-utils.sh
fi
# Need a path for temporary files created during data update
# Use the state directory in the install path directory if it exists, otherwise
# use the build tree
if
[
-e
"@localstatedir@/lib/@PACKAGE_NAME@"
]
;
then
temp_file_dir
=
"@localstatedir@/lib/@PACKAGE_NAME@"
else
temp_file_dir
=
"@abs_top_builddir@/src/share/database/scripts/cql"
fi
cqlargs
=
$@
# Ensures the current schema version is 4.0. If not it exits.
check_version
()
{
version
=
$(
cql_version
$cqlargs
)
if
[
"
${
version
}
"
!=
"4.0"
]
;
then
printf
"This script upgrades 4.0 to 5.0. Reported version is %s. Skipping upgrade.
\n
"
"
${
version
}
"
exit
0
fi
}
# Peforms the schema changes from 4.0 to 5.0
update_schema
()
{
cqlsh
$cqlargs
<<
EOF
-- This line starts database upgrade to version 5.0
-- Add the lower case hostname column to reservations.
ALTER TABLE hosts ADD lower_case_hostname VARCHAR;
-- Make the lower case hostname an index.
CREATE INDEX IF NOT EXISTS hostsindex8 ON hosts (lower_case_hostname);
DELETE FROM schema_version WHERE version=4;
INSERT INTO schema_version (version, minor) VALUES(5, 0);
-- This line concludes database upgrade to version 5.0
EOF
if
[
"
$?
"
-ne
0
]
then
echo
Schema udpate FAILED!
exit
1
fi
}
# Function to delete temporary update files
clean_up
()
{
# clean up the files
if
[
-e
"
$export_file
"
]
then
rm
$export_file
fi
if
[
-e
"
$update_file
"
]
then
rm
$update_file
fi
}
# Function to clean up and exit the script gracefully
#
# Called by update_host_data()
#
# Parameters:
# status - integer value to pass to sh:exit
# explanation - "quoted" text message to emit to stdout
exit_now
()
{
status
=
$1
;
shift
explanation
=
$1
clean_up
if
[
"
$status
"
-eq
0
]
then
echo
"Data Update SUCCESS!
$explanation
"
else
echo
"Data Update FAILURE!
$explanation
"
fi
exit
$status
}
# This function adds host 'lower_case_hostname' column.
#
# After exhausting the export file, the update file is submitted to
# cqlsh for execution.
#
# No parameters.
update_host_data
()
{
export_file
=
"
$temp_file_dir
/cql_export.csv"
update_file
=
"
$temp_file_dir
/cql_update.cql"
clean_up
# Fetch hosts data so we have primary key components and hostname.
echo
"Exporting hostnames to
$export_file
..."
query
=
"COPY hosts (key, id, hostname) TO '
$export_file
'"
cqlsh
$cqlargs
-e
"
$query
"
if
[
"
$?
"
-ne
0
]
then
exit_now 1
"Cassandra get hostname failed! Could not update data!"
fi
# Strip the carriage returns that CQL insists on adding.
if
[
-e
"
$export_file
"
]
then
cat
$export_file
|
tr
-d
'\015'
>
$export_file
.2
mv
$export_file
.2
$export_file
else
# Shouldn't happen but then again we're talking about CQL here
exit_now 1
"Cassandra export file
$export_file
is missing?"
fi
# Iterate through the exported data, accumulating update statements,
# one for each reservation that needs updating. We should have one
# host per line.
line_cnt
=
0
;
update_cnt
=
0
;
while
read
-r
line