mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[master] Merge branch 'github30'
This commit is contained in:
@@ -30,7 +30,7 @@ mysql_execute() {
|
||||
}
|
||||
|
||||
mysql_version() {
|
||||
mysql_execute "SELECT CONCAT(version,\".\",minor) FROM schema_version" "$@"
|
||||
mysql_execute "SELECT CONCAT_WS('.', version, minor) FROM schema_version" "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
@@ -77,15 +77,15 @@ CREATE TABLE lease6_types (
|
||||
name VARCHAR(5) # Name of the lease type
|
||||
) ENGINE = INNODB;
|
||||
START TRANSACTION;
|
||||
INSERT INTO lease6_types VALUES (0, "IA_NA"); # Non-temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (1, "IA_TA"); # Temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (2, "IA_PD"); # Prefix delegations
|
||||
INSERT INTO lease6_types VALUES (0, 'IA_NA'); # Non-temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (1, 'IA_TA'); # Temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (2, 'IA_PD'); # Prefix delegations
|
||||
COMMIT;
|
||||
|
||||
# Finally, the version of the schema. We start at 0.1 during development.
|
||||
# This table is only modified during schema upgrades. For historical reasons
|
||||
# (related to the names of the columns in the BIND 10 DNS database file), the
|
||||
# first column is called "version" and not "major".
|
||||
# first column is called 'version' and not 'major'.
|
||||
# Note: This MUST be kept in step with src/share/database/scripts/mysql/dhcpdb_create.mysql,
|
||||
# which defines the schema for the unit tests.
|
||||
CREATE TABLE schema_version (
|
||||
|
@@ -394,9 +394,9 @@ mysql_lease4_dump_test() {
|
||||
|
||||
# Insert the reference record
|
||||
insert_sql="\
|
||||
insert into lease4 values(10,20,30,40,\"2015-01-01 01:15:30\",50,1,1,\"one.example.com\", 0);\
|
||||
insert into lease4 values(11,NULL,123,40,\"2015-02-02 02:30:45\",50,1,1,\"\", 1);\
|
||||
insert into lease4 values(12,22,NULL,40,\"2015-03-03 11:01:07\",50,1,1,\"three.example.com\", 2);"
|
||||
insert into lease4 values(10,20,30,40,'2015-01-01 01:15:30',50,1,1,'one.example.com', 0);\
|
||||
insert into lease4 values(11,NULL,123,40,'2015-02-02 02:30:45',50,1,1,'', 1);\
|
||||
insert into lease4 values(12,22,NULL,40,'2015-03-03 11:01:07',50,1,1,'three.example.com', 2);"
|
||||
|
||||
mysql_execute "$insert_sql"
|
||||
ERRCODE=$?
|
||||
@@ -454,9 +454,9 @@ mysql_lease6_dump_test() {
|
||||
|
||||
# Insert the reference record
|
||||
insert_sql="\
|
||||
insert into lease6 values(10,20,30,\"2015-04-04 01:15:30\",40,50,1,60,70,1,1,\"one.example.com\",80,90,16,0);\
|
||||
insert into lease6 values(11,NULL,30,\"2015-05-05 02:30:45\",40,50,1,60,70,1,1,\"\",80,90,1,1);\
|
||||
insert into lease6 values(12,21,30,\"2015-06-06 11:01:07\",40,50,1,60,70,1,1,\"three.example.com\",80,90,4,2);"
|
||||
insert into lease6 values(10,20,30,'2015-04-04 01:15:30',40,50,1,60,70,1,1,'one.example.com',80,90,16,0);\
|
||||
insert into lease6 values(11,NULL,30,'2015-05-05 02:30:45',40,50,1,60,70,1,1,'',80,90,1,1);\
|
||||
insert into lease6 values(12,21,30,'2015-06-06 11:01:07',40,50,1,60,70,1,1,'three.example.com',80,90,4,2);"
|
||||
|
||||
mysql_execute "$insert_sql"
|
||||
ERRCODE=$?
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# mysql -u <user> -p <password> <database> < dhcpdb_create.mysql
|
||||
#
|
||||
# ... at the command prompt, or log in to the MySQL database and at the "mysql>"
|
||||
# ... at the command prompt, or log in to the MySQL database and at the 'mysql>'
|
||||
# prompt, issue the command:
|
||||
#
|
||||
# source dhcpdb_create.mysql
|
||||
@@ -86,15 +86,15 @@ CREATE TABLE lease6_types (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO lease6_types VALUES (0, "IA_NA"); # Non-temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (1, "IA_TA"); # Temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (2, "IA_PD"); # Prefix delegations
|
||||
INSERT INTO lease6_types VALUES (0, 'IA_NA'); # Non-temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (1, 'IA_TA'); # Temporary v6 addresses
|
||||
INSERT INTO lease6_types VALUES (2, 'IA_PD'); # Prefix delegations
|
||||
COMMIT;
|
||||
|
||||
# Finally, the version of the schema. We start at 1.0 during development.
|
||||
# This table is only modified during schema upgrades. For historical reasons
|
||||
# (related to the names of the columns in the BIND 10 DNS database file), the
|
||||
# first column is called "version" and not "major".
|
||||
# first column is called 'version' and not 'major'.
|
||||
CREATE TABLE schema_version (
|
||||
version INT PRIMARY KEY NOT NULL, # Major version number
|
||||
minor INT # Minor version number
|
||||
@@ -126,27 +126,27 @@ CREATE TABLE lease_hwaddr_source (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
# Hardware address obtained from raw sockets
|
||||
INSERT INTO lease_hwaddr_source VALUES (1, "HWADDR_SOURCE_RAW");
|
||||
INSERT INTO lease_hwaddr_source VALUES (1, 'HWADDR_SOURCE_RAW');
|
||||
|
||||
# Hardware address converted from IPv6 link-local address with EUI-64
|
||||
INSERT INTO lease_hwaddr_source VALUES (2, "HWADDR_SOURCE_IPV6_LINK_LOCAL");
|
||||
INSERT INTO lease_hwaddr_source VALUES (2, 'HWADDR_SOURCE_IPV6_LINK_LOCAL');
|
||||
|
||||
# Hardware address extracted from client-id (duid)
|
||||
INSERT INTO lease_hwaddr_source VALUES (4, "HWADDR_SOURCE_DUID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (4, 'HWADDR_SOURCE_DUID');
|
||||
|
||||
# Hardware address extracted from client address relay option (RFC6939)
|
||||
INSERT INTO lease_hwaddr_source VALUES (8, "HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION");
|
||||
INSERT INTO lease_hwaddr_source VALUES (8, 'HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION');
|
||||
|
||||
# Hardware address extracted from remote-id option (RFC4649)
|
||||
INSERT INTO lease_hwaddr_source VALUES (16, "HWADDR_SOURCE_REMOTE_ID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (16, 'HWADDR_SOURCE_REMOTE_ID');
|
||||
|
||||
# Hardware address extracted from subscriber-id option (RFC4580)
|
||||
INSERT INTO lease_hwaddr_source VALUES (32, "HWADDR_SOURCE_SUBSCRIBER_ID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (32, 'HWADDR_SOURCE_SUBSCRIBER_ID');
|
||||
|
||||
# Hardware address extracted from docsis options
|
||||
INSERT INTO lease_hwaddr_source VALUES (64, "HWADDR_SOURCE_DOCSIS");
|
||||
INSERT INTO lease_hwaddr_source VALUES (64, 'HWADDR_SOURCE_DOCSIS');
|
||||
|
||||
UPDATE schema_version SET version="2", minor="0";
|
||||
UPDATE schema_version SET version='2', minor='0';
|
||||
|
||||
# This line concludes database upgrade to version 2.0.
|
||||
|
||||
@@ -264,9 +264,9 @@ CREATE TABLE IF NOT EXISTS lease_state (
|
||||
) ENGINE=INNODB;
|
||||
|
||||
# Insert currently defined state names.
|
||||
INSERT INTO lease_state VALUES (0, "default");
|
||||
INSERT INTO lease_state VALUES (1, "declined");
|
||||
INSERT INTO lease_state VALUES (2, "expired-reclaimed");
|
||||
INSERT INTO lease_state VALUES (0, 'default');
|
||||
INSERT INTO lease_state VALUES (1, 'declined');
|
||||
INSERT INTO lease_state VALUES (2, 'expired-reclaimed');
|
||||
|
||||
# Add a constraint that any state value added to the lease4 must
|
||||
# map to a value in the lease_state table.
|
||||
@@ -382,7 +382,7 @@ SET version = '4', minor = '0';
|
||||
|
||||
# In the event hardware address cannot be determined, we need to satisfy
|
||||
# foreign key constraint between lease6 and lease_hardware_source
|
||||
INSERT INTO lease_hwaddr_source VALUES (0, "HWADDR_SOURCE_UNKNOWN");
|
||||
INSERT INTO lease_hwaddr_source VALUES (0, 'HWADDR_SOURCE_UNKNOWN');
|
||||
|
||||
# Update the schema version number
|
||||
UPDATE schema_version
|
||||
@@ -420,9 +420,9 @@ CREATE TABLE IF NOT EXISTS host_identifier_type (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO host_identifier_type VALUES (0, "hw-address"); # Non-temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (1, "duid"); # Temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (2, "circuit-id"); # Prefix delegations
|
||||
INSERT INTO host_identifier_type VALUES (0, 'hw-address'); # Non-temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (1, 'duid'); # Temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (2, 'circuit-id'); # Prefix delegations
|
||||
COMMIT;
|
||||
|
||||
# Add a constraint that any identifier type value added to the hosts
|
||||
@@ -447,10 +447,10 @@ CREATE TABLE IF NOT EXISTS dhcp_option_scope (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO dhcp_option_scope VALUES (0, "global");
|
||||
INSERT INTO dhcp_option_scope VALUES (1, "subnet");
|
||||
INSERT INTO dhcp_option_scope VALUES (2, "client-class");
|
||||
INSERT INTO dhcp_option_scope VALUES (3, "host");
|
||||
INSERT INTO dhcp_option_scope VALUES (0, 'global');
|
||||
INSERT INTO dhcp_option_scope VALUES (1, 'subnet');
|
||||
INSERT INTO dhcp_option_scope VALUES (2, 'client-class');
|
||||
INSERT INTO dhcp_option_scope VALUES (3, 'host');
|
||||
COMMIT;
|
||||
|
||||
# Add scopes into table holding DHCPv4 options
|
||||
@@ -504,7 +504,7 @@ SET version = '5', minor = '0';
|
||||
#
|
||||
# Portability
|
||||
# ===========
|
||||
# The "ENGINE = INNODB" on some tables is not portable to another database
|
||||
# The 'ENGINE = INNODB' on some tables is not portable to another database
|
||||
# and will need to be removed.
|
||||
#
|
||||
# Some columns contain binary data so are stored as VARBINARY instead of
|
||||
|
@@ -27,15 +27,15 @@ CREATE TABLE lease_hwaddr_source (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
-- See src/lib/dhcp/dhcp/pkt.h for detailed explanation
|
||||
INSERT INTO lease_hwaddr_source VALUES (1, "HWADDR_SOURCE_RAW");
|
||||
INSERT INTO lease_hwaddr_source VALUES (2, "HWADDR_SOURCE_IPV6_LINK_LOCAL");
|
||||
INSERT INTO lease_hwaddr_source VALUES (4, "HWADDR_SOURCE_DUID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (8, "HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION");
|
||||
INSERT INTO lease_hwaddr_source VALUES (16, "HWADDR_SOURCE_REMOTE_ID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (32, "HWADDR_SOURCE_SUBSCRIBER_ID");
|
||||
INSERT INTO lease_hwaddr_source VALUES (64, "HWADDR_SOURCE_DOCSIS");
|
||||
INSERT INTO lease_hwaddr_source VALUES (1, 'HWADDR_SOURCE_RAW');
|
||||
INSERT INTO lease_hwaddr_source VALUES (2, 'HWADDR_SOURCE_IPV6_LINK_LOCAL');
|
||||
INSERT INTO lease_hwaddr_source VALUES (4, 'HWADDR_SOURCE_DUID');
|
||||
INSERT INTO lease_hwaddr_source VALUES (8, 'HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION');
|
||||
INSERT INTO lease_hwaddr_source VALUES (16, 'HWADDR_SOURCE_REMOTE_ID');
|
||||
INSERT INTO lease_hwaddr_source VALUES (32, 'HWADDR_SOURCE_SUBSCRIBER_ID');
|
||||
INSERT INTO lease_hwaddr_source VALUES (64, 'HWADDR_SOURCE_DOCSIS');
|
||||
|
||||
UPDATE schema_version SET version="2", minor="0";
|
||||
UPDATE schema_version SET version='2', minor='0';
|
||||
EOF
|
||||
|
||||
RESULT=$?
|
||||
|
@@ -96,7 +96,7 @@ END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
UPDATE schema_version SET version="3", minor="0";
|
||||
UPDATE schema_version SET version='3', minor='0';
|
||||
EOF
|
||||
|
||||
RESULT=$?
|
||||
|
@@ -40,9 +40,9 @@ CREATE TABLE IF NOT EXISTS lease_state (
|
||||
) ENGINE=INNODB;
|
||||
|
||||
# Insert currently defined state names.
|
||||
INSERT INTO lease_state VALUES (0, "default");
|
||||
INSERT INTO lease_state VALUES (1, "declined");
|
||||
INSERT INTO lease_state VALUES (2, "expired-reclaimed");
|
||||
INSERT INTO lease_state VALUES (0, 'default');
|
||||
INSERT INTO lease_state VALUES (1, 'declined');
|
||||
INSERT INTO lease_state VALUES (2, 'expired-reclaimed');
|
||||
|
||||
# Add a constraint that any state value added to the lease4 must
|
||||
# map to a value in the lease_state table.
|
||||
|
@@ -19,7 +19,7 @@ mysql "$@" <<EOF
|
||||
|
||||
# In the event hardware address cannot be determined, we need to satisfy
|
||||
# foreign key constraint between lease6 and lease_hardware_source
|
||||
INSERT INTO lease_hwaddr_source VALUES (0, "HWADDR_SOURCE_UNKNOWN");
|
||||
INSERT INTO lease_hwaddr_source VALUES (0, 'HWADDR_SOURCE_UNKNOWN');
|
||||
|
||||
#
|
||||
# Add order by lease address to lease4DumpData
|
||||
|
@@ -47,9 +47,9 @@ CREATE TABLE IF NOT EXISTS host_identifier_type (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO host_identifier_type VALUES (0, "hw-address"); # Non-temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (1, "duid"); # Temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (2, "circuit-id"); # Prefix delegations
|
||||
INSERT INTO host_identifier_type VALUES (0, 'hw-address'); # Non-temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (1, 'duid'); # Temporary v6 addresses
|
||||
INSERT INTO host_identifier_type VALUES (2, 'circuit-id'); # Prefix delegations
|
||||
COMMIT;
|
||||
|
||||
# Add a constraint that any identifier type value added to the hosts
|
||||
@@ -74,10 +74,10 @@ CREATE TABLE IF NOT EXISTS dhcp_option_scope (
|
||||
) ENGINE = INNODB;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO dhcp_option_scope VALUES (0, "global");
|
||||
INSERT INTO dhcp_option_scope VALUES (1, "subnet");
|
||||
INSERT INTO dhcp_option_scope VALUES (2, "client-class");
|
||||
INSERT INTO dhcp_option_scope VALUES (3, "host");
|
||||
INSERT INTO dhcp_option_scope VALUES (0, 'global');
|
||||
INSERT INTO dhcp_option_scope VALUES (1, 'subnet');
|
||||
INSERT INTO dhcp_option_scope VALUES (2, 'client-class');
|
||||
INSERT INTO dhcp_option_scope VALUES (3, 'host');
|
||||
COMMIT;
|
||||
|
||||
# Add scopes into table holding DHCPv4 options
|
||||
|
Reference in New Issue
Block a user