Skip to content

[Platform API] TestComponentApi.test_update_firmware fails when 'RuntimeError' is raised #4564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ArunSaravananBalachandran opened this issue Oct 26, 2021 · 1 comment
Assignees

Comments

@ArunSaravananBalachandran
Copy link
Contributor

ArunSaravananBalachandran commented Oct 26, 2021

Description

Currently, TestComponentApi.test_update_firmware invokes component API update_firmware with values 'current' and 'next' for image_path.

Since the provided image_path values are invalid and do not represent a firmware package path, in DellEMC Z9332f platform update_firmare fails and raises RuntimeError as in the base method definition and TestComponentApi.test_update_firmware reports failure for that raised RuntimeError.

    def update_firmware(self, image_path):
        """
        Updates firmware of the component
        This API performs firmware update: it assumes firmware installation and loading in a single call.
        In case platform component requires some extra steps (apart from calling Low Level Utility)
        to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically by API
        Args:
            image_path: A string, path to firmware image
        Raises:
            RuntimeError: update failed
        """

Steps to reproduce the issue:

  1. Execute "platform_tests/api/test_component.py::TestComponentApi::test_update_firmware" on DellEMC Z9332f platform

Describe the results you received:

____________________________________________________________________________ TestComponentApi.test_update_firmware[sonic-10431] ____________________________________________________________________________

self = <test_component.TestComponentApi object at 0x7fdf72f87790>, duthosts = <tests.common.devices.duthosts.DutHosts object at 0x7fdf75097f50>, enum_rand_one_per_hwsku_hostname = 'sonic-10431'
localhost = <tests.common.devices.local.Localhost object at 0x7fdf73bed750>, platform_api_conn = <httplib.HTTPConnection instance at 0x7fdf754cc1e0>

    def test_update_firmware(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
        if self.num_components == 0:
            pytest.skip("No components found on device")

        for i in range(self.num_components):
            for image in image_list:
>               update_status = component.update_firmware(platform_api_conn, i, image)

duthosts   = <tests.common.devices.duthosts.DutHosts object at 0x7fdf75097f50>
enum_rand_one_per_hwsku_hostname = 'sonic-10431'
i          = 0
image      = 'current'
localhost  = <tests.common.devices.local.Localhost object at 0x7fdf73bed750>
platform_api_conn = <httplib.HTTPConnection instance at 0x7fdf754cc1e0>
self       = <test_component.TestComponentApi object at 0x7fdf72f87790>

platform_tests/api/test_component.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
common/helpers/platform_api/component.py:79: in update_firmware
    return component_api(conn, comp_idx, 'update_firmware', [image_path])
common/helpers/platform_api/component.py:16: in component_api
    resp = conn.getresponse()
/usr/lib/python2.7/httplib.py:1178: in getresponse
    response.begin()
/usr/lib/python2.7/httplib.py:452: in begin
    version, status, reason = self._read_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <httplib.HTTPResponse instance at 0x7fdf72e91460>

    def _read_status(self):
        # Initialize with Simple-Response defaults
        line = self.fp.readline(_MAXLINE + 1)
        if len(line) > _MAXLINE:
            raise LineTooLong("header line")
        if self.debuglevel > 0:
            print "reply:", repr(line)
        if not line:
            # Presumably, the server closed the connection before
            # sending a valid response.
>           raise BadStatusLine("No status line received - the server has closed the connection")
E           BadStatusLine: No status line received - the server has closed the connection

line       = ''
self       = <httplib.HTTPResponse instance at 0x7fdf72e91460>

/usr/lib/python2.7/httplib.py:416: BadStatusLine

Describe the results you expected:

Test case to pass

Additional information you deem important:

Output of show version:

SONiC Software Version: SONiC.master.45732-dirty-20211024.145325
Distribution: Debian 10.11
Kernel: 4.19.0-12-2-amd64
Build commit: 8b5f33dbb
Build date: Sun Oct 24 15:08:21 UTC 2021
Built by: AzDevOps@sonic-build-workers-000TQZ

Platform: x86_64-dellemc_z9332f_d1508-r0
HwSKU: DellEMC-Z9332f-M-O16C64
ASIC: broadcom
ASIC Count: 1
Serial Number: 1SQXCW2
Model Number: 0J5HDG
Hardware Revision: A00
Uptime: 15:11:25 up 17 min,  1 user,  load average: 0.39, 0.41, 0.43

Docker images:
REPOSITORY                    TAG                                  IMAGE ID            SIZE
docker-dhcp-relay             latest                               d0dd8dd8299c        429MB
docker-fpm-frr                latest                               0c84537a683a        446MB
docker-fpm-frr                master.45732-dirty-20211024.145325   0c84537a683a        446MB
docker-macsec                 latest                               3ca7223464a8        431MB
docker-macsec                 master.45732-dirty-20211024.145325   3ca7223464a8        431MB
docker-platform-monitor       latest                               b4dda6dfd5c9        633MB
docker-platform-monitor       master.45732-dirty-20211024.145325   b4dda6dfd5c9        633MB
docker-gbsyncd-credo          latest                               68daa8d35ae4        463MB
docker-gbsyncd-credo          master.45732-dirty-20211024.145325   68daa8d35ae4        463MB
docker-sflow                  latest                               cfe5abe9abd9        428MB
docker-sflow                  master.45732-dirty-20211024.145325   cfe5abe9abd9        428MB
docker-syncd-brcm             latest                               dca83fea0ade        712MB
docker-syncd-brcm             master.45732-dirty-20211024.145325   dca83fea0ade        712MB
docker-teamd                  latest                               9470f4eb8dc6        428MB
docker-teamd                  master.45732-dirty-20211024.145325   9470f4eb8dc6        428MB
docker-nat                    latest                               5f68ddcc967f        430MB
docker-nat                    master.45732-dirty-20211024.145325   5f68ddcc967f        430MB
docker-sonic-mgmt-framework   latest                               ac82f2d72d85        570MB
docker-sonic-mgmt-framework   master.45732-dirty-20211024.145325   ac82f2d72d85        570MB
docker-snmp                   latest                               776b18c26052        457MB
docker-snmp                   master.45732-dirty-20211024.145325   776b18c26052        457MB
docker-orchagent              latest                               8adbbd203eea        446MB
docker-orchagent              master.45732-dirty-20211024.145325   8adbbd203eea        446MB
docker-database               latest                               bf33dd4d97e0        415MB
docker-database               master.45732-dirty-20211024.145325   bf33dd4d97e0        415MB
docker-router-advertiser      latest                               dba85252b2fc        415MB
docker-router-advertiser      master.45732-dirty-20211024.145325   dba85252b2fc        415MB
docker-lldp                   latest                               e421c254422f        455MB
docker-lldp                   master.45732-dirty-20211024.145325   e421c254422f        455MB
docker-sonic-telemetry        latest                               d9659f8eef12        504MB
docker-sonic-telemetry        master.45732-dirty-20211024.145325   d9659f8eef12        504MB
docker-mux                    latest                               a5a33d269c6c        468MB
docker-mux                    master.45732-dirty-20211024.145325   a5a33d269c6c        468MB
@sujinmkang sujinmkang self-assigned this Dec 7, 2021
@sujinmkang
Copy link
Contributor

Please implement the update_firmware to return FALSE if it doesn't support any firmware update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants