diff --git a/arista/accessors/xcvr.py b/arista/accessors/xcvr.py index 53e058b5..377baab9 100644 --- a/arista/accessors/xcvr.py +++ b/arista/accessors/xcvr.py @@ -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 diff --git a/arista/inventory/xcvr.py b/arista/inventory/xcvr.py index a70f62da..6b2b6fd5 100644 --- a/arista/inventory/xcvr.py +++ b/arista/inventory/xcvr.py @@ -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() diff --git a/arista/utils/sonic_platform/sfp.py b/arista/utils/sonic_platform/sfp.py index 7760a592..73047193 100644 --- a/arista/utils/sonic_platform/sfp.py +++ b/arista/utils/sonic_platform/sfp.py @@ -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