File: attribute_registry.py

package info (click to toggle)
python-sushy 5.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,036 kB
  • sloc: python: 16,382; makefile: 24; sh: 2
file content (98 lines) | stat: -rw-r--r-- 3,430 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

# The Redfish standard schema that defines the AttributeRegistry is at:
# https://redfish.dmtf.org/schemas/v1/AttributeRegistry.v1_3_5.json

import logging

from sushy.resources import base

LOG = logging.getLogger(__name__)


class AttributeListField(base.ListField):

    name = base.Field('AttributeName', required=True)
    """The unique name for the attribute"""

    default_value = base.Field('DefaultValue')
    """The default value for the attribute"""

    attribute_type = base.Field('Type')
    """The attribute type"""

    unique = base.Field('IsSystemUniqueProperty', adapter=bool)
    """Indicates whether this attribute is unique for this system"""

    display_name = base.Field('DisplayName')
    """User-readable display string for attribute in the defined language"""

    immutable = base.Field('Immutable', adapter=bool)
    """An indication of whether this attribute is immutable"""

    read_only = base.Field('ReadOnly', adapter=bool)
    """An indication of whether this attribute is read-only"""

    reset_required = base.Field('ResetRequired', adapter=bool)
    """Whether a System reset is required to change this attribute"""

    lower_bound = base.Field('LowerBound')
    """The lower limit for an integer attribute"""

    max_length = base.Field('MaxLength')
    """The maximum character length of the string attribute"""

    min_length = base.Field('MinLength')
    """The minimum character length of the string attribute"""

    upper_bound = base.Field('UpperBound')
    """The upper limit for an integer attribute"""

    allowable_values = base.Field('Value')
    """An array of the possible values for enumerated attribute values"""


class AttributeRegistryEntryField(base.CompositeField):

    attributes = AttributeListField('Attributes')
    """List of attributes in this registry"""

    # Vendors may have additional items such as Dependencies, Menus, etc.
    # Only get the attributes.


class AttributeRegistry(base.ResourceBase):

    identity = base.Field('Id', required=True)
    """The Attribute registry identity string"""

    name = base.Field('Name', required=True)
    """The name of the attribute registry"""

    description = base.Field('Description')
    """Human-readable description of the registry"""

    language = base.Field('Language', required=True)
    """RFC 5646 compliant language code for the registry"""

    owning_entity = base.Field('OwningEntity', required=True)
    """Organization or company that publishes this registry"""

    registry_version = base.Field('RegistryVersion', required=True)
    """The version of this registry"""

    supported_systems = base.Field('SupportedSystems')
    """The system that this registry supports"""

    registry_entries = AttributeRegistryEntryField('RegistryEntries')
    """Field containing Attributes, Dependencies, Menus etc."""