Skip to content

Commit

Permalink
api: implementation of ChassisBase.get_port_or_cage_type
Browse files Browse the repository at this point in the history
This new API method was introduced by sonic-net/sonic-platform-common#288

Change-Id: Ic04496089c0d6767210ae86320ee4fee38fe17c0
  • Loading branch information
abdullahenesoncu committed Aug 21, 2022
1 parent 3c7489f commit 9f0a138
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions arista/utils/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

try:
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform_base.sfp_base import SfpBase
from arista.core import thermal_control
from arista.core.card import Card
from arista.core.cause import getReloadCauseManager
Expand Down Expand Up @@ -214,6 +215,34 @@ def get_thermal_manager(self):
def getThermalControl(self):
return thermal_control

def get_port_or_cage_type(self, index):
portLayout = self._platform.PORTS

if not hasattr( SfpBase, 'SFP_PORT_TYPE_BIT_RJ45' ):
raise NotImplementedError

if index in portLayout.ethernetRange:
return SfpBase.SFP_PORT_TYPE_BIT_RJ45

if index in portLayout.sfpRange:
return ( SfpBase.SFP_PORT_TYPE_BIT_SFP |
SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS |
SfpBase.SFP_PORT_TYPE_BIT_SFP28 |
SfpBase.SFP_PORT_TYPE_BIT_SFP_DD )

if index in portLayout.qsfpRange:
return ( SfpBase.SFP_PORT_TYPE_BIT_QSFP |
SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS |
SfpBase.SFP_PORT_TYPE_BIT_QSFP28 |
SfpBase.SFP_PORT_TYPE_BIT_QSFP56 |
SfpBase.SFP_PORT_TYPE_BIT_QSFPDD )

if index in portLayout.osfpRange:
return ( SfpBase.SFP_PORT_TYPE_BIT_OSFP |
SfpBase.SFP_PORT_TYPE_BIT_QSFPDD )

return 0x00000000

def get_position_in_parent(self):
return -1

Expand Down

0 comments on commit 9f0a138

Please sign in to comment.