1 # vim: set encoding=utf-8 et sw=4 sts=4 :
4 import logging ; log = logging.getLogger('pymin.services.dhcp')
6 from pymin.validation import Item, Field, Any, IPAddress, MACAddress, \
7 HostName, FullyQualifiedHostName
8 from pymin.service.util import DictSubHandler
10 __all__ = ('HostHandler',)
14 r"""Host(name, ip, mac) -> Host instance :: Class representing a host.
16 name - Host name, should be a fully qualified name, but no checks are done.
17 ip - IP assigned to the hostname.
18 mac - MAC address to associate to the hostname.
20 name = Field(Any(HostName(not_empty=True),
21 FullyQualifiedHostName(not_empty=True)))
22 ip = Field(IPAddress(not_empty=True))
23 mac = Field(MACAddress(add_colons=True, not_empty=True))
25 class HostHandler(DictSubHandler):
26 r"""HostHandler(parent) -> HostHandler instance :: Handle a list of hosts.
28 This class is a helper for DhcpHandler to do all the work related to hosts
32 handler_help = u"Manage DHCP hosts"
34 _cont_subhandler_attr = 'hosts'
35 _cont_subhandler_class = Host