pvl/verkko/dhcp.py
changeset 438 d45fc43c6073
parent 437 5100b359906c
child 439 6a8ea0d363c1
--- a/pvl/verkko/dhcp.py	Tue Feb 24 12:47:09 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-# encoding: utf-8
-import pvl.web
-import pvl.verkko.web
-
-from pvl.web import html, urls
-from pvl.verkko import hosts, leases
-
-import logging; log = logging.getLogger('pvl.verkko.dhcp')
-
-class Index (pvl.verkko.web.DatabaseHandler) :
-    TITLE = u"Päivölä Verkko"
-
-    CSS = pvl.verkko.web.DatabaseHandler.CSS + (
-            '/static/dhcp/forms.css',
-    )
-
-    def render_link (self, title, **opts) :
-        return html.a(href=self.url(hosts.ListHandler, **opts))(title)
-
-    def render_links (self, attr, titlevalues) :
-        for title, value in titlevalues :
-            yield html.li(
-                self.render_link(title, **{attr: value})
-            ) 
-
-    def render (self) :
-        return (
-            html.h2("Interval"),
-            html.ul(
-                self.render_links('seen', (
-                            ("Hour",    '1h'),
-                            ("Day",     '1d'),
-                            #("Month",   '30d'),
-                            #("Year",    '365d'),
-                )),
-                html.li(
-                    html.a(href=self.url(hosts.RealtimeHandler))("Realtime"),
-                ),
-            ),
-            html.h2("State"),
-            html.ul(
-                self.render_links('state', (
-                            ("Valid",       ('DHCPACK', 'DHCPRELEASE')),
-                            ("Incomplete",  ('DHCPDISCOVER', 'DHCPOFFER', 'DHCPREQUEST')),
-                            ("Invalid",     ('DHCPNAK', )),
-                )),
-            ),
-
-            html.h2("IP/MAC"),
-            html.form(action=self.url(hosts.ListHandler), method='get')(
-                html.fieldset(
-                    html.ul(
-                        html.li(
-                            html.label(for_='ip')("IP"),
-                            html.input(type='text', name='ip'),
-                        ),
-
-                        html.li(
-                            html.label(for_='mac')("MAC"),
-                            html.input(type='text', name='mac'),
-                        ),
-
-                        html.li(
-                            html.input(type='submit', value="Search"),
-                        ),
-                    )
-                )
-            ),
-        )
-
-class Application (pvl.verkko.web.Application) :
-    URLS = urls.Map((
-        urls.rule('/',                       Index),
-        urls.rule('/hosts/',                 hosts.ListHandler),
-        urls.rule('/hosts/<int:id>',         hosts.ItemHandler),
-        urls.rule('/hosts/realtime',         hosts.RealtimeHandler),
-        urls.rule('/leases/',                leases.ListHandler),
-    ))
-