sonic-buildimage/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py

143 lines
4.7 KiB
Python
Raw Normal View History

try:
import os
import sys
import datetime
import re
sys.path.append(os.path.dirname(__file__))
[sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926) Submodule updates include the following commits: * src/sonic-utilities 9dc58ea...f9eb739 (18): > Remove unnecessary calls to str.encode() now that the package is Python 3; Fix deprecation warning (#1260) > [generate_dump] Ignoring file/directory not found Errors (#1201) > Fixed porstat rate and util issues (#1140) > fix error: interface counters is mismatch after warm-reboot (#1099) > Remove unnecessary calls to str.decode() now that the package is Python 3 (#1255) > [acl-loader] Make list sorting compliant with Python 3 (#1257) > Replace hard-coded fast-reboot with variable. And some typo corrections (#1254) > [configlet][portconfig] Remove calls to dict.has_key() which is not available in Python 3 (#1247) > Remove unnecessary conversions to list() and calls to dict.keys() (#1243) > Clean up LGTM alerts (#1239) > Add 'requests' as install dependency in setup.py (#1240) > Convert to Python 3 (#1128) > Fix mock SonicV2Connector in python3: use decode_responses mode so caller code will be the same as python2 (#1238) > [tests] Do not trim from PATH if we did not append to it; Clean up/fix shebangs in scripts (#1233) > Updates to bgp config and show commands with BGP_INTERNAL_NEIGHBOR table (#1224) > [cli]: NAT show commands newline issue after migrated to Python3 (#1204) > [doc]: Update Command-Reference.md (#1231) > Added 'import sys' in feature.py file (#1232) * src/sonic-py-swsssdk 9d9f0c6...1664be9 (2): > Fix: no need to decode() after redis client scan, so it will work for both python2 and python3 (#96) > FieldValueMap `contains`(`in`) will also work when migrated to libswsscommon(C++ with SWIG wrapper) (#94) - Also fix Python 3-related issues: - Use integer (floor) division in config_samples.py (sonic-config-engine) - Replace print statement with print function in eeprom.py plugin for x86_64-kvm_x86_64-r0 platform - Update all platform plugins to be compatible with both Python 2 and Python 3 - Remove shebangs from plugins files which are not intended to be executable - Replace tabs with spaces in Python plugin files and fix alignment, because Python 3 is more strict - Remove trailing whitespace from plugins files
2020-11-25 12:28:36 -06:00
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
from sonic_platform_base.sonic_eeprom import eeprom_base
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
[BFN] Fix exception when fwutil run without sudo (#10335) * [BFN] Fix for run fwutil without sudo SONiC has a concept of "platform components" this may include - CPLD, FPGA, BIOS, BMC, etc. These changes are needed to read the version of the BIOS and BMC component. What I did The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: ``` Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' ``` How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk tarasx.keryk@intel.com Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * rewrite a call of dmidecode, when run without sudo Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' The previous implementaion of eeprom.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/lib/python3.9/logging/config.py", line 564, in configure handler = self.configure_handler(handlers[name]) File "/usr/lib/python3.9/logging/config.py", line 745, in configure_handler result = factory(**kwargs) File "/usr/lib/python3.9/logging/handlers.py", line 153, in init BaseRotatingHandler.init(self, filename, mode, encoding=encoding, File "/usr/lib/python3.9/logging/handlers.py", line 58, in init logging.FileHandler.init(self, filename, mode=mode, File "/usr/lib/python3.9/logging/init.py", line 1142, in init StreamHandler.init(self, self._open()) File "/usr/lib/python3.9/logging/init.py", line 1171, in _open return open(self.baseFilename, self.mode, encoding=self.encoding, PermissionError: [Errno 13] Permission denied: '/var/log/platform.log' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/init.py", line 3, in from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 41, in pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 162, in init self.chassis_component_map = self.__get_chassis_component_map() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 168, in __get_chassis_component_map chassis_name = self.__chassis.get_name() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 146, in get_name return self._eeprom.modelstr() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 54, in _eeprom self.__eeprom = Eeprom() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/eeprom.py", line 50, in init logging.config.dictConfig(config_dict) File "/usr/lib/python3.9/logging/config.py", line 809, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.9/logging/config.py", line 571, in configure raise ValueError('Unable to configure handler ' ValueError: Unable to configure handler 'file' How I did it Modification call of dmidecode command. Added modification of log files access attributes before file open operations. How to verify it Run manually 'fwutil' (without sudo) New command output have no exception. Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added file_check for checking access to log files for eeprom.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Removed unused import * Added logfile_create to eeprom.py and chassis.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Created platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added interpreter string to platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com>
2022-04-05 13:33:51 -05:00
from platform_utils import file_create
from platform_thrift_client import thrift_try
[sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926) Submodule updates include the following commits: * src/sonic-utilities 9dc58ea...f9eb739 (18): > Remove unnecessary calls to str.encode() now that the package is Python 3; Fix deprecation warning (#1260) > [generate_dump] Ignoring file/directory not found Errors (#1201) > Fixed porstat rate and util issues (#1140) > fix error: interface counters is mismatch after warm-reboot (#1099) > Remove unnecessary calls to str.decode() now that the package is Python 3 (#1255) > [acl-loader] Make list sorting compliant with Python 3 (#1257) > Replace hard-coded fast-reboot with variable. And some typo corrections (#1254) > [configlet][portconfig] Remove calls to dict.has_key() which is not available in Python 3 (#1247) > Remove unnecessary conversions to list() and calls to dict.keys() (#1243) > Clean up LGTM alerts (#1239) > Add 'requests' as install dependency in setup.py (#1240) > Convert to Python 3 (#1128) > Fix mock SonicV2Connector in python3: use decode_responses mode so caller code will be the same as python2 (#1238) > [tests] Do not trim from PATH if we did not append to it; Clean up/fix shebangs in scripts (#1233) > Updates to bgp config and show commands with BGP_INTERNAL_NEIGHBOR table (#1224) > [cli]: NAT show commands newline issue after migrated to Python3 (#1204) > [doc]: Update Command-Reference.md (#1231) > Added 'import sys' in feature.py file (#1232) * src/sonic-py-swsssdk 9d9f0c6...1664be9 (2): > Fix: no need to decode() after redis client scan, so it will work for both python2 and python3 (#96) > FieldValueMap `contains`(`in`) will also work when migrated to libswsscommon(C++ with SWIG wrapper) (#94) - Also fix Python 3-related issues: - Use integer (floor) division in config_samples.py (sonic-config-engine) - Replace print statement with print function in eeprom.py plugin for x86_64-kvm_x86_64-r0 platform - Update all platform plugins to be compatible with both Python 2 and Python 3 - Remove shebangs from plugins files which are not intended to be executable - Replace tabs with spaces in Python plugin files and fix alignment, because Python 3 is more strict - Remove trailing whitespace from plugins files
2020-11-25 12:28:36 -06:00
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
_platform_eeprom_map = {
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
"prod_name" : ("Product Name", "0x21", 12),
"odm_pcba_part_num" : ("Part Number", "0x22", 13),
"prod_ser_num" : ("Serial Number", "0x23", 12),
"ext_mac_addr" : ("Extended MAC Address Base", "0x24", 12),
"sys_mfg_date" : ("System Manufacturing Date", "0x25", 4),
"prod_ver" : ("Product Version", "0x26", 1),
"ext_mac_addr_size" : ("Extende MAC Address Size", "0x2A", 2),
"sys_mfger" : ("Manufacturer", "0x2B", 8)
}
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
_product_dict = {
"Montara" : "Wedge100BF-32X-O-AC-F-BF",
"Lower MAV" : "Wedge100BF-65X-O-AC-F-BF",
"Upper MAV" : "Wedge100BF-65X-O-AC-F-BF"
}
_EEPROM_SYMLINK = "/var/run/platform/eeprom/syseeprom"
_EEPROM_STATUS = "/var/run/platform/eeprom/status"
class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self):
[BFN] Fix exception when fwutil run without sudo (#10335) * [BFN] Fix for run fwutil without sudo SONiC has a concept of "platform components" this may include - CPLD, FPGA, BIOS, BMC, etc. These changes are needed to read the version of the BIOS and BMC component. What I did The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: ``` Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' ``` How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk tarasx.keryk@intel.com Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * rewrite a call of dmidecode, when run without sudo Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' The previous implementaion of eeprom.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/lib/python3.9/logging/config.py", line 564, in configure handler = self.configure_handler(handlers[name]) File "/usr/lib/python3.9/logging/config.py", line 745, in configure_handler result = factory(**kwargs) File "/usr/lib/python3.9/logging/handlers.py", line 153, in init BaseRotatingHandler.init(self, filename, mode, encoding=encoding, File "/usr/lib/python3.9/logging/handlers.py", line 58, in init logging.FileHandler.init(self, filename, mode=mode, File "/usr/lib/python3.9/logging/init.py", line 1142, in init StreamHandler.init(self, self._open()) File "/usr/lib/python3.9/logging/init.py", line 1171, in _open return open(self.baseFilename, self.mode, encoding=self.encoding, PermissionError: [Errno 13] Permission denied: '/var/log/platform.log' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/init.py", line 3, in from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 41, in pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 162, in init self.chassis_component_map = self.__get_chassis_component_map() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 168, in __get_chassis_component_map chassis_name = self.__chassis.get_name() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 146, in get_name return self._eeprom.modelstr() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 54, in _eeprom self.__eeprom = Eeprom() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/eeprom.py", line 50, in init logging.config.dictConfig(config_dict) File "/usr/lib/python3.9/logging/config.py", line 809, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.9/logging/config.py", line 571, in configure raise ValueError('Unable to configure handler ' ValueError: Unable to configure handler 'file' How I did it Modification call of dmidecode command. Added modification of log files access attributes before file open operations. How to verify it Run manually 'fwutil' (without sudo) New command output have no exception. Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added file_check for checking access to log files for eeprom.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Removed unused import * Added logfile_create to eeprom.py and chassis.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Created platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added interpreter string to platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com>
2022-04-05 13:33:51 -05:00
file_create(_EEPROM_SYMLINK, '646')
file_create(_EEPROM_STATUS, '646')
with open(_EEPROM_STATUS, 'w') as f:
f.write("initializing..")
self.eeprom_path = _EEPROM_SYMLINK
super(Eeprom, self).__init__(self.eeprom_path, 0, _EEPROM_STATUS, True)
def sys_eeprom_get(client):
return client.pltfm_mgr.pltfm_mgr_sys_eeprom_get()
try:
platform_eeprom = thrift_try(sys_eeprom_get)
except Exception:
raise RuntimeError("eeprom.py: Initialization failed")
self.__eeprom_init(platform_eeprom)
def __eeprom_init(self, platform_eeprom):
with open(_EEPROM_STATUS, 'w') as f:
f.write("ok")
eeprom_params = ""
for attr, val in platform_eeprom.__dict__.items():
if val is None:
continue
elem = _platform_eeprom_map.get(attr)
if elem is None:
continue
if isinstance(val, str):
value = val.replace('\0', '')
else:
value = str(val)
if attr == "sys_mfg_date":
value = datetime.datetime.strptime(value, '%m-%d-%y').strftime('%m/%d/%Y 00:00:00')
product = _product_dict.get(value)
if product is not None:
value = product
if len(eeprom_params) > 0:
eeprom_params += ","
eeprom_params += "{0:s}={1:s}".format(elem[1], value)
orig_stdout = sys.stdout
sys.stdout = StringIO()
try:
eeprom_data = eeprom_tlvinfo.TlvInfoDecoder.set_eeprom(self, "", [eeprom_params])
finally:
decode_output = sys.stdout.getvalue()
sys.stdout = orig_stdout
eeprom_base.EepromDecoder.write_eeprom(self, eeprom_data)
self.__eeprom_tlv_dict = self.__parse_output(decode_output)
def __parse_output(self, decode_output):
EEPROM_DECODE_HEADLINES = 6
lines = decode_output.replace('\0', '').split('\n')
lines = lines[EEPROM_DECODE_HEADLINES:]
res = dict()
for line in lines:
try:
# match whitespace-separated tag hex, length and value (value is mathced with its whitespaces)
match = re.search('(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+[\s]*[\S]*)', line)
if match is not None:
code = match.group(1)
value = match.group(3).rstrip('\0')
res[code] = value
except Exception:
pass
return res
def __tlv_get(self, code):
return self.__eeprom_tlv_dict.get("0x{:X}".format(code), 'N/A')
def system_eeprom_info(self):
return self.__eeprom_tlv_dict
def serial_number_str(self):
return self.__tlv_get(self._TLV_CODE_SERIAL_NUMBER)
def serial_str(self):
return self.serial_number_str()
def base_mac_addr(self):
return self.__tlv_get(self._TLV_CODE_MAC_BASE)
def part_number_str(self):
return self.__tlv_get(self._TLV_CODE_PART_NUMBER)
def modelstr(self):
return self.__tlv_get(self._TLV_CODE_PRODUCT_NAME)
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
def revision_str(self):
return self.__tlv_get(self._TLV_CODE_LABEL_REVISION)
[BFN] Fix exception when fwutil run without sudo (#10335) * [BFN] Fix for run fwutil without sudo SONiC has a concept of "platform components" this may include - CPLD, FPGA, BIOS, BMC, etc. These changes are needed to read the version of the BIOS and BMC component. What I did The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: ``` Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' ``` How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' How I did it Modification of dmidecode command How to verify it Run manually 'fwutil' (without sudo) Previous command output had exception New command output: Root privileges are required Signed-off-by: Taras Keryk tarasx.keryk@intel.com Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * rewrite a call of dmidecode, when run without sudo Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Why I did it The previous implementaion of component.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in <module> from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/__init__.py", line 3, in <module> from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 40, in <module> pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 159, in __init__ self.__platform = Platform() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 48, in __init__ self.__initialize_components() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 136, in __initialize_components component = Components(index) File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 184, in __init__ self.version = get_bios_version() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/component.py", line 19, in get_bios_version return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'dmidecode' The previous implementaion of eeprom.py expect fwutil run with sudo. When fwutil run without sudo, there are an exception: Traceback (most recent call last): File "/usr/lib/python3.9/logging/config.py", line 564, in configure handler = self.configure_handler(handlers[name]) File "/usr/lib/python3.9/logging/config.py", line 745, in configure_handler result = factory(**kwargs) File "/usr/lib/python3.9/logging/handlers.py", line 153, in init BaseRotatingHandler.init(self, filename, mode, encoding=encoding, File "/usr/lib/python3.9/logging/handlers.py", line 58, in init logging.FileHandler.init(self, filename, mode=mode, File "/usr/lib/python3.9/logging/init.py", line 1142, in init StreamHandler.init(self, self._open()) File "/usr/lib/python3.9/logging/init.py", line 1171, in _open return open(self.baseFilename, self.mode, encoding=self.encoding, PermissionError: [Errno 13] Permission denied: '/var/log/platform.log' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/fwutil", line 5, in from fwutil.main import cli File "/usr/local/lib/python3.9/dist-packages/fwutil/init.py", line 3, in from . import main File "/usr/local/lib/python3.9/dist-packages/fwutil/main.py", line 41, in pdp = PlatformDataProvider() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 162, in init self.chassis_component_map = self.__get_chassis_component_map() File "/usr/local/lib/python3.9/dist-packages/fwutil/lib.py", line 168, in __get_chassis_component_map chassis_name = self.__chassis.get_name() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 146, in get_name return self._eeprom.modelstr() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 54, in _eeprom self.__eeprom = Eeprom() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/eeprom.py", line 50, in init logging.config.dictConfig(config_dict) File "/usr/lib/python3.9/logging/config.py", line 809, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.9/logging/config.py", line 571, in configure raise ValueError('Unable to configure handler ' ValueError: Unable to configure handler 'file' How I did it Modification call of dmidecode command. Added modification of log files access attributes before file open operations. How to verify it Run manually 'fwutil' (without sudo) New command output have no exception. Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added file_check for checking access to log files for eeprom.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Removed unused import * Added logfile_create to eeprom.py and chassis.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Created platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com> * Added interpreter string to platform_utils.py Signed-off-by: Taras Keryk <tarasx.keryk@intel.com>
2022-04-05 13:33:51 -05:00