dhcpkit.ipv6.server.extensions.static_assignments.csv module

An option handler that assigns addresses based on DUID from a CSV file

class dhcpkit.ipv6.server.extensions.static_assignments.csv.CSVStaticAssignmentHandler(filename: str, address_preferred_lifetime: int, address_valid_lifetime: int, prefix_preferred_lifetime: int, prefix_valid_lifetime: int)[source]

Bases: dhcpkit.ipv6.server.extensions.static_assignments.StaticAssignmentHandler

Assign addresses and/or prefixes based on the contents of a CSV file

get_assignment(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle) → dhcpkit.ipv6.server.extensions.static_assignments.Assignment[source]

Look up the assignment based on DUID, Interface-ID of the relay closest to the client and Remote-ID of the relay closest to the client, in that order.

Parameters:bundle – The transaction bundle
Returns:The assignment, if any
static parse_csv_file(csv_filename: str) → List[source]

Read the assignments from the file specified in the configuration

Parameters:csv_filename – The filename of the CSV file
Returns:An list of identifiers and their assignment
read_csv_file(csv_filename: str) → Mapping[source]

Read the assignments from the file specified in the configuration

Parameters:csv_filename – The filename of the CSV file
Returns:A dictionary mapping identifiers to assignments