Exemple #1
0
    def initialize_sfp(self):
        from sonic_platform.sfp import SFP
        from sonic_platform.sfp import initialize_sdk_handle

        self.sfp_module = SFP
        self.sdk_handle = initialize_sdk_handle()

        if self.sdk_handle is None:
            self.sfp_module_initialized = False
            return

        # Initialize SFP list
        port_position_tuple = self._get_port_position_tuple_by_platform_name()
        self.PORT_START = port_position_tuple[0]
        self.QSFP_PORT_START = port_position_tuple[1]
        self.PORT_END = port_position_tuple[2]
        self.PORTS_IN_BLOCK = port_position_tuple[3]

        for index in range(self.PORT_START, self.PORT_END + 1):
            if index in range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1):
                sfp_module = SFP(index, 'QSFP', self.sdk_handle)
            else:
                sfp_module = SFP(index, 'SFP', self.sdk_handle)
            self._sfp_list.append(sfp_module)

        self.sfp_module_initialized = True
Exemple #2
0
 def get_sdk_handle(self):
     if not self.sdk_handle:
         from sonic_platform.sfp import initialize_sdk_handle
         self.sdk_handle = initialize_sdk_handle()
         if self.sdk_handle is None:
             logger.log_error('Failed to open SDK handle')
     return self.sdk_handle
Exemple #3
0
 def get_sdk_handle(self):
     if not self.sdk_handle:
         self.sdk_handle = initialize_sdk_handle()
         if self.sdk_handle is None:
             logger.log_error('Failed to open SDK handle')
     return self.sdk_handle