forked from sonic-net/sonic-platform-common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfw_manage_base.py
More file actions
63 lines (54 loc) · 1.75 KB
/
Copy pathfw_manage_base.py
File metadata and controls
63 lines (54 loc) · 1.75 KB
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
#!/usr/bin/env python
#
# fw_manage_base.py
#
# Abstract base class for implementing platform-specific
# Firmware management functionality for SONiC
#
try:
import abc
except ImportError as e:
raise ImportError(str(e) + " - required module not found")
class FwBase(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def get_module_list(self):
"""
Retrieves the list of module that available on the device
:return: A list : the list of module that available on the device
"""
return []
@abc.abstractmethod
def get_fw_version(self, module_name):
"""
Retrieves the firmware version of module
:param module_name: A string, module name
:return: A Dict, firmware version object
- Example of return object of module that doesn't have sub modules
{
"module_name": "BIOS",
"fw_version": "1.0.0"
"has_submodule" = False
}
- Example of return object of module that have sub modules
{
"module_name": "CPLD",
"fw_version": {
"CPLD1" : "1.0.0",
"CPLD2" : "1.1.0"
}
"has_submodule" = True
}
"""
return {}
@abc.abstractmethod
def install(self, module_name, image_path):
"""
Install firmware to module
:param module_name: A string, name of module that need to install new firmware
:param image_path: A string, path to firmware image
:return: Boolean,
- True if install process is finished without error
- False if install process is failed
"""
return False