~lutostag/ubuntu/trusty/maas/1.5.2+packagefix

« back to all changes in this revision

Viewing changes to src/provisioningserver/enum.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2014-03-28 10:43:53 UTC
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20140328104353-ekpolg0pm5xnvq2s
Tags: upstream-1.5+bzr2204
ImportĀ upstreamĀ versionĀ 1.5+bzr2204

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012 Canonical Ltd.  This software is licensed under the
2
 
# GNU Affero General Public License version 3 (see the file LICENSE).
3
 
 
4
 
"""Enumerations meaningful to the provisioning server."""
5
 
 
6
 
from __future__ import (
7
 
    absolute_import,
8
 
    print_function,
9
 
    unicode_literals,
10
 
    )
11
 
 
12
 
str = None
13
 
 
14
 
__metaclass__ = type
15
 
__all__ = [
16
 
    'ARP_HTYPE',
17
 
    'IPMI_DRIVER',
18
 
    'IPMI_DRIVER_CHOICES',
19
 
    'POWER_TYPE',
20
 
    'POWER_TYPE_CHOICES',
21
 
    'UNKNOWN_POWER_TYPE',
22
 
    'get_power_types',
23
 
    ]
24
 
 
25
 
 
26
 
# We specifically declare this here so that a node not knowing its own
27
 
# powertype won't fail to enlist. However, we don't want it in the list
28
 
# of power types since setting a node's power type to "I don't know"
29
 
# from another type doens't make any sense.
30
 
UNKNOWN_POWER_TYPE = ''
31
 
 
32
 
 
33
 
def get_power_types():
34
 
    """Return the choice of mechanism to control a node's power.
35
 
 
36
 
    :return: Dictionary mapping power type to its description.
37
 
    """
38
 
    return {
39
 
        "virsh": "virsh (virtual systems)",
40
 
        "ether_wake": "Wake-on-LAN",
41
 
        "fence_cdu": "Sentry Switch CDU",
42
 
        "ipmi": "IPMI",
43
 
        "moonshot": "iLO4 Moonshot Chassis",
44
 
        "sm15k": "SeaMicro 15000",
45
 
        "amt": "Intel AMT",
46
 
        }
47
 
 
48
 
 
49
 
# FIXME: This enum is deprecated but left in place until the last
50
 
# vestiges of its use are removed (some JS uses it still).
51
 
class POWER_TYPE:
52
 
    """Choice of mechanism to control a node's power."""
53
 
 
54
 
    # The null value.  Set this to indicate that the value should be
55
 
    # taken from the configured default.
56
 
    # Django doesn't deal well with null strings, so we're forced to use
57
 
    # the empty string instead.  Hopefully this will be replaced with
58
 
    # None at some point.
59
 
    DEFAULT = ''
60
 
 
61
 
    # Use virsh (for virtual machines).
62
 
    VIRSH = 'virsh'
63
 
 
64
 
    # Network wake-up.
65
 
    WAKE_ON_LAN = 'ether_wake'
66
 
 
67
 
    # Sentry Switch CDU's.
68
 
    CDU = 'fence_cdu'
69
 
 
70
 
    # IPMI (Intelligent Platform Management Interface).
71
 
    IPMI = 'ipmi'
72
 
 
73
 
    # ILO4/bridging/IPMI
74
 
    MOONSHOT = 'moonshot'
75
 
 
76
 
    # The SeaMicro SM15000.
77
 
    # http://www.seamicro.com/sites/default/files/SM15000_Datasheet.pdf
78
 
    SEAMICRO15K = 'sm15k'
79
 
 
80
 
    # Intel Active Management Technology
81
 
    AMT = 'amt'
82
 
 
83
 
 
84
 
# Django 'Choices' format structure for its field selection mechanism.
85
 
POWER_TYPE_CHOICES = [
86
 
    (k, v) for (k, v) in get_power_types().items() if k != '']
87
 
 
88
 
 
89
 
class IPMI_DRIVER:
90
 
    DEFAULT = ''
91
 
    LAN = 'LAN'
92
 
    LAN_2_0 = 'LAN_2_0'
93
 
 
94
 
 
95
 
IPMI_DRIVER_CHOICES = [
96
 
    [IPMI_DRIVER.DEFAULT, "Auto-detect"],
97
 
    [IPMI_DRIVER.LAN, "LAN [IPMI 1.5]"],
98
 
    [IPMI_DRIVER.LAN_2_0, "LAN_2_0 [IPMI 2.0]"],
99
 
    ]
100
 
 
101
 
 
102
 
class ARP_HTYPE:
103
 
    """ARP Hardware Type codes."""
104
 
 
105
 
    ETHERNET = 0x01