Skip to content

Commit

Permalink
[BFN] Implementation API for platform component (sonic-net#10180)
Browse files Browse the repository at this point in the history
* [BFN] Implementation API for platform component
	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
		Create components.py module
		Add funcion for reading componet version to thrift interface
	How I did it
		The previous implementaion didn't have platform components API, so fwutil return an empty list.
		After implementation of the platform component API, we have actual list of platform components and firmware versions

	How to verify it
		Run manually 'fwutil show status' or run unit tests

	Previous command output
		Chassis                   Module    Component    Version    Description
		------------------------  --------  -----------  ---------  -------------

	New command output
		Chassis                   Module    Component    Version    Description
                ------------------------  --------  -----------  ---------  -------------
                Chassis1		  N/A       BIOS         1.2.3	   Chassis BIOS
                                                    BMC          5.1	   Chassis BMC
Signed-off-by: Taras Keryk <[email protected]>

* [BFN] Implementation API for platform component
            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
                    Create components.py module
                    Add funcion for reading componet version to thrift interface
            How I did it
                    The previous implementaion didn't have platform components API, so fwutil return an empty list.
                    After implementation of the platform component API, we have actual list of platform components and firmware versions

            How to verify it
                    Run manually 'fwutil show status' or run unit tests

            Previous command output
                    Chassis                   Module    Component    Version    Description
                    ------------------------  --------  -----------  ---------  -------------

            New command output
                    Chassis                   Module    Component    Version    Description
                    ------------------------  --------  -----------  ---------  -------------
                    Chassis1                  N/A       BIOS         1.2.3     Chassis BIOS
                                                        BMC          5.1       Chassis BMC

Signed-off-by: Taras Keryk <[email protected]>

* [BFN] Implementation API for platform component
    get chassis name from json

* [BFN] Implementation API for platform component
      Updated platform and platrom_components json

* [BFN] Implementation API for platform component
      Fixed spaces in component.py

* [BFN] Implementation API for platform component
      Fixed exception in component.py

* Update chassis.py

* [BFN] Implementation API for platform component
      Fixed spaces in component.py, chassis.py

* [BFN] Implementation API for platform component: Fixed spaces in component.py, chassis.py

* Fixed exception in get_bios_version
  • Loading branch information
Taras Keryk authored Mar 10, 2022
1 parent c8db7a2 commit a89f294
Show file tree
Hide file tree
Showing 8 changed files with 1,172 additions and 191 deletions.
8 changes: 8 additions & 0 deletions device/barefoot/x86_64-accton_as9516_32d-r0/platform.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"chassis": {
"name": "Newport",
"components": [
{
"name": "BIOS"
},
{
"name": "BMC"
}
],
"fans": [
{
"name": "counter-rotating-fan-1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"chassis": {
"Newport": {
"component": {
}
}
}
{
"chassis": {
"Newport": {
"component": {
"BIOS": { },
"BMC": { }
}
}
}
}
8 changes: 8 additions & 0 deletions device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"chassis": {
"name": "Wedge100BF-32X-O-AC-F-BF",
"components": [
{
"name": "BIOS"
},
{
"name": "BMC"
}
],
"fans": [
{
"name": "counter-rotating-fan-1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"chassis": {
"Wedge100BF-32X-O-AC-F-BF": {
"component": {
}
}
}
{
"chassis": {
"Wedge100BF-32X-O-AC-F-BF": {
"component": {
"BIOS": { },
"BMC": { }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

NUM_COMPONENT = 2
class Chassis(ChassisBase):
"""
Platform-specific Chassis class
Expand All @@ -44,6 +45,7 @@ def __init__(self):
self.ready = False
self.phy_port_cur_state = {}
self.qsfp_interval = self.QSFP_CHECK_INTERVAL
self.__initialize_components()

@property
def _eeprom(self):
Expand Down Expand Up @@ -128,6 +130,12 @@ def qsfp_max_port_get(client):
self.PORT_END = self.QSFP_PORT_END
self.PORTS_IN_BLOCK = self.QSFP_PORT_END

def __initialize_components(self):
from sonic_platform.component import Components
for index in range(0, NUM_COMPONENT):
component = Components(index)
self._component_list.append(component)

def get_name(self):
"""
Retrieves the name of the chassis
Expand Down
Loading

0 comments on commit a89f294

Please sign in to comment.