~ubuntu-branches/ubuntu/utopic/maas/utopic-security

1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
1
# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
"""Enumerations meaningful to the maasserver application."""
5
6
from __future__ import (
7
    absolute_import,
8
    print_function,
9
    unicode_literals,
10
    )
11
1.2.16 by Andres Rodriguez
Import upstream version 1.4+bzr1693+dfsg
12
str = None
13
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
14
__metaclass__ = type
15
__all__ = [
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
16
    'COMPONENT',
1.2.34 by Julian Edwards
Import upstream version 1.6.1+bzr2550
17
    'IPADDRESS_TYPE',
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
18
    'NODEGROUP_STATUS',
19
    'NODEGROUP_STATUS_CHOICES',
20
    'NODEGROUPINTERFACE_MANAGEMENT',
21
    'NODEGROUPINTERFACE_MANAGEMENT_CHOICES',
22
    'NODEGROUPINTERFACE_MANAGEMENT_CHOICES_DICT',
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
23
    'NODE_PERMISSION',
24
    'NODE_STATUS',
25
    'NODE_STATUS_CHOICES',
26
    'NODE_STATUS_CHOICES_DICT',
27
    'PRESEED_TYPE',
1.2.14 by Andres Rodriguez
Import upstream version 1.4+bzr1655+dfsg
28
    'USERDATA_TYPE',
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
29
    ]
30
31
from collections import OrderedDict
32
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
33
# *** IMPORTANT ***
34
# Note to all ye who enter here: comments beginning with #: are special
35
# to Sphinx. They are extracted and form part of the documentation of
36
# the field they directly precede.
37
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
38
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
39
class COMPONENT:
40
    """Major moving parts of the application that may have failure states."""
41
    PSERV = 'provisioning server'
42
    IMPORT_PXE_FILES = 'maas-import-pxe-files script'
43
44
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
45
class NODE_STATUS:
46
    """The vocabulary of a `Node`'s possible statuses."""
47
    # A node starts out as READY.
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
48
    DEFAULT = 0
1.1.13 by Andres Rodriguez
Import upstream version 0.1+bzr709+dfsg
49
50
    #: The node has been created and has a system ID assigned to it.
51
    DECLARED = 0
52
    #: Testing and other commissioning steps are taking place.
53
    COMMISSIONING = 1
54
    #: Smoke or burn-in testing has a found a problem.
55
    FAILED_TESTS = 2
56
    #: The node can't be contacted.
57
    MISSING = 3
58
    #: The node is in the general pool ready to be deployed.
59
    READY = 4
60
    #: The node is ready for named deployment.
61
    RESERVED = 5
62
    #: The node is powering a service from a charm or is ready for use with
63
    #: a fresh Ubuntu install.
64
    ALLOCATED = 6
65
    #: The node has been removed from service manually until an admin
66
    #: overrides the retirement.
67
    RETIRED = 7
68
69
70
# Django choices for NODE_STATUS: sequence of tuples (key, UI
71
# representation).
72
NODE_STATUS_CHOICES = (
73
    (NODE_STATUS.DECLARED, "Declared"),
74
    (NODE_STATUS.COMMISSIONING, "Commissioning"),
75
    (NODE_STATUS.FAILED_TESTS, "Failed tests"),
76
    (NODE_STATUS.MISSING, "Missing"),
77
    (NODE_STATUS.READY, "Ready"),
78
    (NODE_STATUS.RESERVED, "Reserved"),
79
    (NODE_STATUS.ALLOCATED, "Allocated"),
80
    (NODE_STATUS.RETIRED, "Retired"),
81
)
82
83
84
NODE_STATUS_CHOICES_DICT = OrderedDict(NODE_STATUS_CHOICES)
85
86
87
class NODE_PERMISSION:
88
    """Permissions relating to nodes."""
89
    VIEW = 'view_node'
90
    EDIT = 'edit_node'
91
    ADMIN = 'admin_node'
92
93
94
class PRESEED_TYPE:
95
    """Types of preseed documents that can be generated."""
96
    DEFAULT = ''
97
    COMMISSIONING = 'commissioning'
98
    ENLIST = 'enlist'
1.2.14 by Andres Rodriguez
Import upstream version 1.4+bzr1655+dfsg
99
    CURTIN = 'curtin'
100
101
102
class USERDATA_TYPE:
103
    """Types of user-data documents that can be generated."""
104
    ENLIST = 'enlist_userdata'
105
    CURTIN = 'curtin_userdata'
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
106
107
108
class NODEGROUP_STATUS:
109
    """The vocabulary of a `NodeGroup`'s possible statuses."""
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
110
    #: A nodegroup starts out as ``PENDING``.
111
    DEFAULT = 0
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
112
113
    #: The nodegroup has been created and awaits approval.
114
    PENDING = 0
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
115
    #:
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
116
    ACCEPTED = 1
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
117
    #:
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
118
    REJECTED = 2
119
120
121
# Django choices for NODEGROUP_STATUS: sequence of tuples (key, UI
122
# representation).
123
NODEGROUP_STATUS_CHOICES = (
124
    (NODEGROUP_STATUS.PENDING, "Pending"),
125
    (NODEGROUP_STATUS.ACCEPTED, "Accepted"),
126
    (NODEGROUP_STATUS.REJECTED, "Rejected"),
127
    )
128
129
130
class NODEGROUPINTERFACE_MANAGEMENT:
131
    """The vocabulary of a `NodeGroupInterface`'s possible statuses."""
132
    # A nodegroupinterface starts out as UNMANAGED.
133
    DEFAULT = 0
134
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
135
    #: Do not manage DHCP or DNS for this interface.
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
136
    UNMANAGED = 0
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
137
    #: Manage DHCP for this interface.
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
138
    DHCP = 1
1.2.26 by Andres Rodriguez
Import upstream version 1.5+bzr2204
139
    #: Manage DHCP and DNS for this interface.
1.1.18 by Andres Rodriguez
Import upstream version 0.1+bzr1223+dfsg
140
    DHCP_AND_DNS = 2
141
142
143
# Django choices for NODEGROUP_STATUS: sequence of tuples (key, UI
144
# representation).
145
NODEGROUPINTERFACE_MANAGEMENT_CHOICES = (
146
    (NODEGROUPINTERFACE_MANAGEMENT.UNMANAGED, "Unmanaged"),
147
    (NODEGROUPINTERFACE_MANAGEMENT.DHCP, "Manage DHCP"),
148
    (NODEGROUPINTERFACE_MANAGEMENT.DHCP_AND_DNS, "Manage DHCP and DNS"),
149
    )
150
151
152
NODEGROUPINTERFACE_MANAGEMENT_CHOICES_DICT = (
153
    OrderedDict(NODEGROUPINTERFACE_MANAGEMENT_CHOICES))
1.2.34 by Julian Edwards
Import upstream version 1.6.1+bzr2550
154
155
156
class IPADDRESS_TYPE:
157
    """The vocabulary of possible types of `StaticIPAddress`."""
158
    # Automatically assigned.
159
    AUTO = 0
160
161
    # Pre-assigned and permanent until removed.
162
    STICKY = 1
163
164
    # Not associated to hardware managed by MAAS.
165
    UNMANAGED = 2
166
167
    # Additional IP requested by a user for a node.
168
    EXTRA = 3
169
170
    # Reserved by a user, no DHCP map required in MAAS.
171
    USER_RESERVED = 4