示例#1
0
def is_sfp_plus(eeprom):
    # Determine by exclusion.
    # Byte 0 = 0x03 can be SFP, SFP+, SFP28
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x03:
        return False

    # If rj45, can only be sfp or sfp+
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=2)) == 0x22:
        return not is_sfp(eeprom)
    return not is_sfp(eeprom) and not is_sfp28(eeprom)
示例#2
0
def is_sfp28(eeprom):
    # Byte 0: bits 0-7: Identifier     = 0x03              -> Still ambiguous
    # Byte 36: bits 0-7: Extended Spec Compliance has to be in set (0x01, 0x02, 0x03,0x04, 0x08, 0x0B, 0x0C,0x0D,0x18, 0x19)

    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x03:
        return False
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=36)) not in [0x01, 0x02, 0x03,0x04, 0x08, 0x0B, 0x0C,0x0D,0x18, 0x19]:
        return False
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=2)) == 0x22:
        return False
    return True
示例#3
0
def is_qsfp28_dd(eeprom):
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x18:
        return False

    # Ideally 200G should not be coded with ver 3.0
    if get_cmis_version(eeprom) >= 0x30:
        return False
    return True
示例#4
0
def is_sfp(eeprom):
    # Conditions:
    # Byte 0: bits 0-7: Identifier     = 0x03, 0x0B              -> Still ambiguous
    # Byte 3: bits 4-7: 10G Compliance = 0                 -> Still ambiguous
    # Max FC Speed <= 1200mbps                             -> Still ambiguous
    # Byte 6: 1G Eth Compliance  != 0

    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x03:
        return False

    if read_eeprom_byte(eeprom, media_eeprom_address(offset=3)) & set_bits([4,5,6,7]):
        return False
    
    if get_max_fc_speed(read_eeprom_byte(eeprom, media_eeprom_address(offset=10))) > 1200:
        return False

    if read_eeprom_byte(eeprom, media_eeprom_address(offset=6)) == 0:
        return False

    return True
示例#5
0
def is_sfp56_dd(eeprom):
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x1A:
        return False
    return True
示例#6
0
def is_qsfp56_dd(eeprom):
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x18:
        return False
    return not is_qsfp28_dd(eeprom)
示例#7
0
def is_qsfp28(eeprom):
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) != 0x11:
        return False
    return True
示例#8
0
def is_qsfp_plus(eeprom):
    if read_eeprom_byte(eeprom, media_eeprom_address(offset=0)) not in [0x0C, 0x0D, 0x1E]:
        return False
    return True
    3: 50,
    4: 100,
    5: 500,
    6: 1 * SEC_TO_MS,
    7: 5 * SEC_TO_MS,
    8: 10 * SEC_TO_MS,
    9: 1 * MIN_TO_MS,
    10: 5 * MIN_TO_MS,
    11: 10 * MIN_TO_MS,
    12: 50 * MIN_TO_MS
}

# Addr, len of bytes to read

# For factor version
FORM_FACTOR_VER_ADDR = (media_eeprom_address(offset=0), 1)
# Version of the CMIS-compliant module
CMIS_VER_ADDR = (media_eeprom_address(offset=1), 1)
# Power limit of the module
MOD_PWR_LIMIT_ADDR = (media_eeprom_address(offset=201), 1)
# Module flags
MOD_FLAGS_ADDR = (media_eeprom_address(offset=3), 9)
# Datapth init
DATAPATH_DE_INIT_ADDR = (media_eeprom_address(page=0x10, offset=128), 1)
# SW controlled power
LOW_PWR_ADDR = (media_eeprom_address(offset=26), 1)
# Module faults
MOD_FAULT_ADDR = (media_eeprom_address(offset=8), 1)
# Laser/TX control (active low)
TX_DISABLE_ADDR = (media_eeprom_address(page=0x10, offset=130), 1)
# Maximum time for datapath to init
import time
import sys
from math import log10
from datetime import datetime
from ext_media_utils import media_eeprom_address

# Addr, len of bytes to read

# For factor version
FORM_FACTOR_VER_ADDR = (media_eeprom_address(offset=0), 1)
# Version of the CMIS-compliant module
CMIS_VER_ADDR = (media_eeprom_address(offset=1), 1)
# Power limit of the module
MOD_PWR_LIMIT_ADDR = (media_eeprom_address(offset=201), 1)
# Module flags
MOD_FLAGS_ADDR = (media_eeprom_address(offset=3), 9)
# Monitor registers
CMIS_MODULE_MONITOR1_ADDR = (media_eeprom_address(offset=14), 2)
CMIS_MODULE_MONITOR2_ADDR = (media_eeprom_address(offset=16), 2)
CMIS_MODULE_MONITOR3_ADDR = (media_eeprom_address(offset=18), 2)
CMIS_MODULE_MONITOR4_ADDR = (media_eeprom_address(offset=20), 2)
CMIS_MODULE_MONITOR5_ADDR = (media_eeprom_address(offset=22), 2)
# Media type encoding
CMIS_MEDIA_TYPE_ENCODING_ADDR   = (media_eeprom_address(offset=85), 1)
#Monitor Advertising registers
CMIS_MODULE_CHARACTERISTICS_ADVERTISING = (media_eeprom_address(page=0x01, offset=145), 1)
CMIS_MODULE_IMPLEMENTED_FLAGS_ADVERTISEMENT = (media_eeprom_address(page=0x1, offset=157),2)
CMIS_MODULE_IMPLEMENTED_MONITORS_ADVERTISING_ADDR = (media_eeprom_address(page=0x01, offset=159), 2)
#Lane status registers
CMIS_MODULE_LANE_TX_FAULT_STATUS_ADDR = (media_eeprom_address(page=0x011, offset=135), 1)
CMIS_MODULE_LANE_TX_LOS_STATUS_ADDR = (media_eeprom_address(page=0x011, offset=136), 1)