test_dhcp.py
author Tero Marttila <terom@fixme.fi>
Sun, 12 Jul 2009 00:43:36 +0300
changeset 6 57e8168ba8c4
parent 4 8b633782f02d
permissions -rwxr-xr-x
use FQDN for zone hosts
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
     1
#!/usr/bin/env python2.5
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
"""
4
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
     3
    Test dhcp_conf
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
"""
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
4
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
     6
import dhcp_conf as dhcpc
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
     7
import test_conf, dhcp, addr
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
import unittest
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
4
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
    11
class TestDHCPConf (test_conf._TestConfBase) :
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
    def assert_stmt (self, stmt, line) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
        """
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    14
            Formats the given Statement, and compares the output against the given line.
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    15
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    16
            Note that the dhcpc.Statement doesn't have a working fmt_lines implementation.
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
        """
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
        
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
        self.assertEqual(stmt._fmt_data(), line)
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
    
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    21
    def test_comment (self) :
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    22
        self.assert_obj(dhcpc.Comment("foo bar"),                           [ "# foo bar" ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    23
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    24
    def test_section (self) :
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    25
        self.assert_obj(dhcpc.Section(comment="test"),                      [ "# test" ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    26
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    27
        self.assert_obj(dhcpc.Section(params=[
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    28
                dhcpc.Parameter("param0"), None
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    29
            ], comment="foo"), [
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    30
                "# foo",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    31
                "param0;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    32
            ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    33
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
    def test_statement (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
        self.assert_stmt(dhcpc.Statement("stmt0"),                           "stmt0")
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    36
        self.assert_stmt(dhcpc.Statement("stmt1", [ "this", "that" ]),       "stmt1 this, that")
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    37
        self.assert_stmt(dhcpc.Statement("stmt2", dhcpc.Literal("...")),     "stmt2 ...")
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    38
        self.assert_stmt(dhcpc.Statement("stmt3", u"quux"),                  "stmt3 quux")
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    39
        self.assert_stmt(dhcpc.Statement("stmt4", "bar"),                    "stmt4 bar")
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    40
        self.assert_stmt(dhcpc.Statement("stmt5", 1),                        "stmt5 1")
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    41
        self.assert_stmt(dhcpc.Statement("stmt6", 1, None, 2),               "stmt6 1 2")
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    42
   
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
    def test_literal (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
        self.assert_obj(dhcpc.Literal("///"),                               [ "///" ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
    def test_parameter (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
        self.assert_obj(dhcpc.Parameter("param0", "this", 13, "that"),      [ "param0 this 13 that;" ])
3
ff98fa9b84ce implement comments properly
Tero Marttila <terom@fixme.fi>
parents: 2
diff changeset
    48
        self.assert_obj(dhcpc.Parameter("param1", comment="testing"),       [ "# testing", "param1;" ])
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
    
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    50
    def test_declaration (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
        self.assert_obj(dhcpc.Declaration("decl0", ["arg0", "arg1"], [
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    52
            dhcpc.Parameter("param0"),
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents: 0
diff changeset
    53
            None
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    54
        ], [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    55
            dhcpc.Declaration("decl0.0", params=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    56
                dhcpc.Parameter("param0.0.1", "value")
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
            ])
3
ff98fa9b84ce implement comments properly
Tero Marttila <terom@fixme.fi>
parents: 2
diff changeset
    58
        ], comment="foo"),  [
ff98fa9b84ce implement comments properly
Tero Marttila <terom@fixme.fi>
parents: 2
diff changeset
    59
            "# foo",
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    60
            "decl0 arg0 arg1 {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
            "\tparam0;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
            "\tdecl0.0 {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
            "\t\tparam0.0.1 value;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
            "\t}",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    65
            "}",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    66
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    67
    
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    68
    def test_shared_network (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    69
        self.assert_obj(dhcpc.SharedNetwork("net0", params=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    70
            dhcpc.Parameter("param0")
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    71
        ]), [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    72
            "shared-network net0 {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
            "\tparam0;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    74
            "}"
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    75
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    76
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    77
    def test_subnet (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    78
        self.assert_obj(dhcpc.Subnet(addr.Network("194.197.235.0/24"), params=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    79
            dhcpc.Parameter("param0")
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    80
        ]), [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    81
            "subnet 194.197.235.0 netmask 255.255.255.0 {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    82
            "\tparam0;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    83
            "}"
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    84
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    85
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    86
    def test_group (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    87
        self.assert_obj(dhcpc.Group(decls=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    88
            dhcpc.Declaration("decl0.0", params=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    89
                dhcpc.Parameter("param0.0.1", "value")
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    90
            ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    91
        ]), [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    92
            "group {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    93
            "\tdecl0.0 {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    94
            "\t\tparam0.0.1 value;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    95
            "\t}",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    96
            "}"
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    97
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    98
    
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    99
    def test_host (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   100
        self.assert_obj(dhcpc.Host("test-hostname", params=[
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   101
            dhcpc.Parameter("param0")
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   102
        ]), [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   103
            "host test-hostname {",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   104
            "\tparam0;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   105
            "}"
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   106
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   107
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   108
    def test_option (self) :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   109
        self.assert_obj(dhcpc.Option("foo", "example.com"), [
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   110
            "option foo example.com;",
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   111
        ])
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   112
    
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   113
class TestDHCP (_TestConfObj) :
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   114
    def test_host (self) :
4
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
   115
        self.assert_obj(dhcp.Host("testhost", addr.MAC("12:34:56:78:90:ab"), addr.IP("1.2.3.4"), comment="foo"), [
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
   116
                "# foo",
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   117
                "host testhost {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   118
                "\thardware ethernet 12:34:56:78:90:ab;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   119
                "\tfixed-address 1.2.3.4;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   120
                "}"
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   121
            ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   122
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   123
    def test_subnet (self) :
4
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
   124
        self.assert_obj(dhcp.Subnet(addr.Network("1.2.3.0/24"), comment="bar"), [
8b633782f02d write bind_conf.py
Tero Marttila <terom@fixme.fi>
parents: 3
diff changeset
   125
                "# bar",
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   126
                "subnet 1.2.3.0 netmask 255.255.255.0 {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   127
                "\toption routers 1.2.3.1;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   128
                "}"
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   129
            ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   130
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   131
        self.assert_obj(dhcp.Subnet(addr.Network("1.2.3.0/24"), router_idx=10, range=(20, 30), unknown_clients='allow'), [
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   132
                "subnet 1.2.3.0 netmask 255.255.255.0 {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   133
                "\toption routers 1.2.3.10;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   134
                "\trange 1.2.3.20 1.2.3.30;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   135
                "\tallow unknown-clients;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   136
                "}"
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   137
            ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   138
    
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   139
    def test_config (self) :
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   140
        self.assert_obj(dhcp.Config(
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   141
                settings        = { 'foo-setting': 'someval' }, 
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   142
                options         = { 'bar-opt': ['one', 'two'] },
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   143
                shared_network  = "FOO-NET",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   144
                subnets         = [
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   145
                        dhcp.Subnet(addr.Network("1.2.3.0/24"))
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   146
                    ],
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   147
                hosts           = [
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   148
                        dhcp.Host("testhost", addr.MAC("12:34:56:78:90:ab"), addr.IP("1.2.3.4"))
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   149
                    ],
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   150
            ), [
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   151
                "foo-setting someval;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   152
                "option bar-opt one, two;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   153
                "shared-network FOO-NET {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   154
                "\tsubnet 1.2.3.0 netmask 255.255.255.0 {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   155
                "\t\toption routers 1.2.3.1;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   156
                "\t}",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   157
                "}",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   158
                "host testhost {",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   159
                "\thardware ethernet 12:34:56:78:90:ab;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   160
                "\tfixed-address 1.2.3.4;",
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   161
                "}"
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   162
            ])
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
   163
0
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   164
if __name__ == '__main__' :
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   165
    unittest.main()
257003279747 initial code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   166