ability to migrate database leases to memfile leases
kea-admin does have the lease-dump action which generates a very similar CSV to the one generated and read by kea-dhcp[46] when configured to work with memfile, but it's not quite there yet. Here are differences:
kea-admin lease-dump mysql
:
address,hwaddr,client_id,valid_lifetime,expire,subnet_id,fqdn_fwd,fqdn_rev,hostname,state,
10.0.0.0,000C01020334,01000C01020334,7200,2021-08-17 19:00:20,1,0,0,,default,
Leases saved by kea-dhcp4:
address,hwaddr,client_id,valid_lifetime,expire,subnet_id,fqdn_fwd,fqdn_rev,hostname,state,user_context
10.0.0.0,00:0c:01:02:03:04,01:00:0c:01:02:03:04,7200,1629215965,1,0,0,,0,
Required format changes:
- hwaddr: blob "000C01020334" to colon-separated "00:0c:01:02:03:04"
- client_id: blob "01000C01020334" to colon-separated "01:00:0c:01:02:03:04"
- expire: human-readable "2021-08-17 19:00:20" to unix "1629215965"
- state: human-readable "default" to numeric "0"
And for v6:
kea-admin lease-dump mysql
:
address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,hwtype,hwaddr_source,state,user_context
2001:db8:1:0:1::,0001000128AE81F5000C01020304,7200,2021-08-17 19:19:33,1,3600,IA_NA,1,128,0,0,,000C01020304,1,HWADDR_SOURCE_IPV6_LINK_LOCAL,default,
Leases saved by kea-dhcp6:
address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,state,user_context
2001:db8:1:0:1::,00:01:00:01:28:ae:81:f5:00:0c:01:02:03:3f,7200,1629217233,1,3600,0,1,128,0,0,,00:0c:01:02:03:3f,0,
Required format changes:
- duid: blob "0001000128AE81F5000C01020304" to colon-separated "00:01:00:01:28:ae:81:f5:00:0c:01:02:03:3f"
- expire: human-readable "2021-08-17 19:19:33" to unix "1629217233"
- lease-type: human-readable "IA_NA" to numeric "1"
- hwaddr: blob "000C01020304" to colon-separated "00:0c:01:02:03:3f"
- state: human-readable "default" to numeric "0"
And there are two extra columns in the case of lease-dump. What's up with those:
- hwtype
- hwaddr_source
user-context needs to be looked at too in both cases.
The output of kea-admin lease-dump
might differ for PostgreSQL than for MySQL.