dhcpkit.ipv6.server.extensions.static_assignments package

An extension to get static assignments from CSV files, Shelves or an SQLite database

class dhcpkit.ipv6.server.extensions.static_assignments.Assignment(address, prefix)

Bases: tuple

address

Alias for field number 0

prefix

Alias for field number 1

class dhcpkit.ipv6.server.extensions.static_assignments.StaticAssignmentHandler(address_preferred_lifetime: int, address_valid_lifetime: int, prefix_preferred_lifetime: int, prefix_valid_lifetime: int)[source]

Bases: dhcpkit.ipv6.server.handlers.Handler

An option handler that gives a static address and/or prefix to clients

static find_iana_option_for_address(options: Iterable, address: ipaddress.IPv6Address) → Union[source]

Find an IANAOption that contains the given address

Parameters:
  • options – The list of options to search
  • address – The address to look for
Returns:

The matching option, if any

static find_iapd_option_for_prefix(options: Iterable, prefix: ipaddress.IPv6Network) → Union[source]

Find an IAPDOption that contains the given prefix

Parameters:
  • options – The list of options to search
  • prefix – The prefix to look for
Returns:

The matching option, if any

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

Subclasses override this method to determine the assignment for the request in the bundle. This MUST return an Assignment object, even if no addresses are provided in it.

Parameters:bundle – The transaction bundle
Returns:The assignment
handle(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

The handling is so complex that we just delegate the implementation to separate methods.

Parameters:bundle – The transaction bundle
handle_confirm(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Handle a client requesting confirmation

Parameters:bundle – The request bundle
handle_release_decline(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Handle a client releasing or declining resources. Doesn’t really need to do anything because assignments are static. Just mark the right options as handled.

Parameters:bundle – The request bundle
handle_renew_rebind(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Handle a client renewing/rebinding addresses

Parameters:bundle – The request bundle
handle_request(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Handle a client requesting addresses (also handles SolicitMessage)

Parameters:bundle – The request bundle