Skip to content

Commit

Permalink
Add sfp_type to Sfp class objects
Browse files Browse the repository at this point in the history
Authored-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
Origin: #28
Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
Change-Id: Ie5d5d23d672bc6a3549a554c8b998cf7dea76453
  • Loading branch information
Staphylo committed Aug 5, 2020
1 parent 1da40ae commit 99e5e07
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arista/accessors/xcvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def __init__(self, driver=None, interruptLine=None, reset=None, leds=None,
self.name = '%s%s' % (typeStr, kwargs['xcvrId'])
self.__dict__.update(kwargs)

def getType(self):
return Xcvr.typeStr(self.xcvrType)

def getName(self):
return self.name

Expand Down
3 changes: 3 additions & 0 deletions arista/inventory/xcvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Xcvr(InventoryInterface):
def typeStr(cls, typeIndex):
return ['sfp', 'qsfp', 'osfp'][typeIndex]

def getType(self):
raise NotImplementedError()

def getName(self):
raise NotImplementedError()

Expand Down
1 change: 1 addition & 0 deletions arista/utils/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, index, sfp):
self._index = index
self._sfp = sfp
self._sfputil = None
self.sfp_type = sfp.getType().upper()

def get_id(self):
return self._index
Expand Down

0 comments on commit 99e5e07

Please sign in to comment.