Unit Testing in Z9100 --------------------- 1) Temperorarily Implemented the show command to retrieve data from sonic_platform library show reboot-cause sonic-2: /home2/sravindran/Sonic_Second_Codebase/sonic-buildimage/src/sonic-utilities>git diff diff --git a/show/main.py b/show/main.py index a11a20c..3a58ff4 100755 --- a/show/main.py +++ b/show/main.py @@ -19,6 +19,7 @@ from swsssdk import ConfigDBConnector from swsssdk import SonicV2Connector import mlnx +#import sonic_platform.chassis SONIC_CFGGEN_PATH = '/usr/local/bin/sonic-cfggen' @@ -1710,6 +1711,10 @@ def reboot_cause(): # the contents of the 'reboot cause' file as it was left when the device # went down for reboot. This file should always be created at boot, # but check first just in case it's not present. + #chassis = sonic_platform.chassis.Chassis() + #reboot_cause = [] + #reboot_cause = chassis.get_reboot_cause() + #click.echo ("REBOOT REASON : %s" % reboot_cause) if not os.path.isfile(PREVIOUS_REBOOT_CAUSE_FILE): click.echo("Unable to determine cause of previous reboot\n") else: When reset_reason and poweron_reason are invalid values, return empty tuple root@sonic:/home/admin# show reboot-cause REBOOT REASON : () <<<<<<<<<<<<<<<<<<<<<<<<<<<<< User issued 'reboot' command [User: admin, Time: Thu Jun 20 16:41:57 UTC 2019] When normal reload, return default value root@sonic:/home/admin# timed out waiting for input: auto-logout admin@sonic:~$ admin@sonic:~$ sudo -s root@sonic:/home/admin# show reboot-cause REBOOT REASON : ['non_hardware'] <<<<<<<<<<<<<<<<<<<<<<<<<<<<< User issued 'reboot' command [User: admin, Time: Thu Jun 20 16:41:57 UTC 2019] 2) Pip installation in host file root@sonic:/home/admin# pip list DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after th at date. A future version of pip will drop support for Python 2.7. Package Version --------------------- --------------- argcomplete 1.8.1 bitarray 0.8.1 certifi 2019.6.16 chardet 3.0.4 click 6.7 click-default-group 1.2 colorama 0.3.7 docker-py 1.6.0 idna 2.8 ipaddr 2.1.11 ipaddress 1.0.22 Jinja2 2.10.1 lxml 3.7.1 MarkupSafe 1.1.1 natsort 4.0.3 netaddr 0.7.19 netifaces 0.10.7 pexpect 4.7.0 pip 19.1.1 ptyprocess 0.6.0 pyang 2.0.1 pyangbind 0.6.0 python-apt 1.4.0b3 PyYAML 3.12 redis 2.10.6 redis-dump-load 1.1 requests 2.22.0 scapy unknown.version setuptools 33.1.1 six 1.12.0 sonic-config-engine 1.0 sonic-platform 1.0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< sonic-platform-common 1.0 sonic-utilities 1.2 swsssdk 2.0.1 tabulate 0.8.2 urllib3 1.25.3 websocket-client 0.56.0 root@sonic:/home/admin# root@sonic:/home/admin# 3) Check for sonic_platform package inside pmon docker root@sonic:/home/admin# docker exec -it pmon bash root@sonic:/# pip list DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after th at date. A future version of pip will drop support for Python 2.7. Package Version --------------------- ------- bitarray 0.8.1 ipaddr 2.2.0 Jinja2 2.10.1 lxml 3.7.1 MarkupSafe 1.1.1 meld3 1.0.2 natsort 4.0.3 netaddr 0.7.19 pip 19.1.1 pyang 2.0.1 pyangbind 0.6.0 PyYAML 3.12 redis 2.10.6 setuptools 33.1.1 six 1.12.0 sonic-config-engine 1.0 sonic-daemon-base 1.0 sonic-ledd 1.1 sonic-platform 1.0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< sonic-platform-common 1.0 sonic-psud 1.0 sonic-xcvrd 1.0 supervisor 3.3.3 swsssdk 2.0.1 root@sonic:/#