@@ -17,6 +17,39 @@ class ModuleBase(device_base.DeviceBase):
17
17
# Device type definition. Note, this is a constant.
18
18
DEVICE_TYPE = "module"
19
19
20
+ # Possible card types for modular chassis
21
+ MODULE_TYPE_SUPERVISOR = "SUPERVISOR"
22
+ MODULE_TYPE_LINE = "LINE-CARD"
23
+ MODULE_TYPE_FABRIC = "FABRIC-CARD"
24
+
25
+ # Possible card status for modular chassis
26
+ # Module state is Empty if no module is inserted in the slot
27
+ MODULE_STATUS_EMPTY = "Empty"
28
+ # Module state if Offline. This is also the admin-down state.
29
+ MODULE_STATUS_OFFLINE = "Offline"
30
+ # Module state if power down was triggered. Example, this could be a
31
+ # policy action from sensors reaching a critical state triggering the
32
+ # module to be powered-down.
33
+ MODULE_STATUS_POWERED_DOWN = "PoweredDown"
34
+ # Module state is Present when it is powered up, but not fully functional.
35
+ MODULE_STATUS_PRESENT = "Present"
36
+ # Module state is Present when it is powered up, but entered a fault state.
37
+ # Module is not able to go Online.
38
+ MODULE_STATUS_FAULT = "Fault"
39
+ # Module state is Online when fully operational
40
+ MODULE_STATUS_ONLINE = "Online"
41
+
42
+ # Invalid slot for modular chassis
43
+ MODULE_INVALID_SLOT = - 1
44
+
45
+ # Possible reboot types for modular chassis
46
+ # Module reboot type to reboot entire card
47
+ MODULE_REBOOT_DEFAULT = "Default"
48
+ # Module reboot type to reboot CPU complex
49
+ MODULE_REBOOT_CPU_COMPLEX = "CPU"
50
+ # Module reboot type to reboot FPGA complex
51
+ MODULE_REBOOT_FPGA_COMPLEX = "FPGA"
52
+
20
53
# List of ComponentBase-derived objects representing all components
21
54
# available on the module
22
55
_component_list = None
@@ -68,6 +101,91 @@ def get_system_eeprom_info(self):
68
101
"""
69
102
raise NotImplementedError
70
103
104
+ def get_name (self ):
105
+ """
106
+ Retrieves the name of the module prefixed by SUPERVISOR, LINE-CARD,
107
+ FABRIC-CARD
108
+
109
+ Returns:
110
+ A string, the module name prefixed by one of MODULE_TYPE_SUPERVISOR,
111
+ MODULE_TYPE_LINE or MODULE_TYPE_FABRIC and followed by a 0-based index
112
+
113
+ Ex. A Chassis having 1 supervisor, 4 line-cards and 6 fabric-cards
114
+ can provide names SUPERVISOR0, LINE-CARD0 to LINE-CARD3,
115
+ FABRIC-CARD0 to FABRIC-CARD5
116
+ """
117
+ raise NotImplementedError
118
+
119
+ def get_description (self ):
120
+ """
121
+ Retrieves the platform vendor's product description of the module
122
+
123
+ Returns:
124
+ A string, providing the vendor's product description of the module.
125
+ """
126
+ raise NotImplementedError
127
+
128
+ def get_slot (self ):
129
+ """
130
+ Retrieves the platform vendor's slot number of the module
131
+
132
+ Returns:
133
+ An integer, indicating the slot number in the chassis
134
+ """
135
+ raise NotImplementedError
136
+
137
+ def get_type (self ):
138
+ """
139
+ Retrieves the type of the module.
140
+
141
+ Returns:
142
+ A string, the module-type from one of the predefined types:
143
+ MODULE_TYPE_SUPERVISOR, MODULE_TYPE_LINE or MODULE_TYPE_FABRIC
144
+ """
145
+ raise NotImplementedError
146
+
147
+ def get_oper_status (self ):
148
+ """
149
+ Retrieves the operational status of the module
150
+
151
+ Returns:
152
+ A string, the operational status of the module from one of the
153
+ predefined status values: MODULE_STATUS_EMPTY, MODULE_STATUS_OFFLINE,
154
+ MODULE_STATUS_FAULT, MODULE_STATUS_PRESENT or MODULE_STATUS_ONLINE
155
+ """
156
+ raise NotImplementedError
157
+
158
+ def reboot (self , reboot_type ):
159
+ """
160
+ Request to reboot the module
161
+
162
+ Args:
163
+ reboot_type: A string, the type of reboot requested from one of the
164
+ predefined reboot types: MODULE_REBOOT_DEFAULT, MODULE_REBOOT_CPU_COMPLEX,
165
+ or MODULE_REBOOT_FPGA_COMPLEX
166
+
167
+ Returns:
168
+ bool: True if the request has been issued successfully, False if not
169
+ """
170
+ raise NotImplementedError
171
+
172
+ def set_admin_state (self , up ):
173
+ """
174
+ Request to keep the card in administratively up/down state.
175
+ The down state will power down the module and the status should show
176
+ MODULE_STATUS_OFFLINE.
177
+ The up state will take the module to MODULE_STATUS_FAULT or
178
+ MODULE_STAUS_ONLINE states.
179
+
180
+ Args:
181
+ up: A boolean, True to set the admin-state to UP. False to set the
182
+ admin-state to DOWN.
183
+
184
+ Returns:
185
+ bool: True if the request has been issued successfully, False if not
186
+ """
187
+ raise NotImplementedError
188
+
71
189
##############################################
72
190
# Component methods
73
191
##############################################
0 commit comments