[HWSKU] [Marvell] Added HWSKU for Platform 98cx8580 (#4205)

Suuported profiles 32x400G and 16x400G

Signed-off-by: Antony Rheneus <arheneus@marvell.com>
This commit is contained in:
arheneus@marvell.com 2020-04-03 22:55:03 +05:30 committed by GitHub
parent ea38d061c7
commit 4ed3fe4a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 3234 additions and 0 deletions

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 10000 tenGigE16
Ethernet17 17 10000 tenGigE17

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16X25G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE1
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE2
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE2
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE3
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE4
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE5
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE6
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE7
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE8
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE9
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE10
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE11
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE12
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE13
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE14
Ethernet128 128 10000 tenGigE128
Ethernet129 129 10000 tenGigE129

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"170000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"170000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,35 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 25000 twenty5GigE16
Ethernet17 17 25000 twenty5GigE17
Ethernet18 18 25000 twenty5GigE18
Ethernet19 19 25000 twenty5GigE19
Ethernet20 20 25000 twenty5GigE20
Ethernet21 21 25000 twenty5GigE21
Ethernet22 22 25000 twenty5GigE22
Ethernet23 23 25000 twenty5GigE23
Ethernet24 24 25000 twenty5GigE24
Ethernet25 25 25000 twenty5GigE25
Ethernet26 26 25000 twenty5GigE26
Ethernet27 27 25000 twenty5GigE27
Ethernet28 28 25000 twenty5GigE28
Ethernet29 29 25000 twenty5GigE29
Ethernet30 30 25000 twenty5GigE30
Ethernet31 31 25000 twenty5GigE31
Ethernet32 32 10000 tenGigE32
Ethernet33 33 10000 tenGigE33

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1 016:1 017:1 018:1 019:1 020:1 021:1 022:1 023:1 024:1 025:1 026:1 027:1 028:1 029:1 030:1 031:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x25G64
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1,165 @@
{%- macro set_default_topology() %}
{%- if default_topo is defined %}
{{ default_topo }}
{%- else %}
def
{%- endif %}
{%- endmacro -%}
{# Determine device topology and filename postfix #}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- if switch_role.lower() == 'torrouter' %}
{%- set filename_postfix = 't0' %}
{%- elif switch_role.lower() == 'leafrouter' %}
{%- set filename_postfix = 't1' %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- endif %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- set switch_role = '' %}
{%- endif -%}
{# Import default values from device HWSKU folder #}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %}
{%- set default_cable = defs.default_cable -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{%- if defs.ports2cable is defined %}
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
-%}
{%- endif %}
{%- macro cable_length(port_name) %}
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role %}
{%- set roles1 = roles1 | lower %}
{%- set roles2 = roles2 | lower %}
{%- if roles1 in ports2cable %}
{%- if cable_len.append(ports2cable[roles1]) %}{% endif %}
{%- elif roles2 in ports2cable %}
{%- if cable_len.append(ports2cable[roles2]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else %}
{%- if switch_role.lower() == 'torrouter' %}
{%- for local_port in VLAN_MEMBER %}
{%- if local_port[1] == port_name %}
{%- set roles3 = switch_role + '_' + 'server' %}
{%- set roles3 = roles3 | lower %}
{%- if roles3 in ports2cable %}
{%- if cable_len.append(ports2cable[roles3]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- endif %}
{%- endmacro %}
{%- set PORT_ALL = [] %}
{%- if PORT is not defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT_ALL %}
{%- set cable = cable_length(port) %}
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
{% endfor %}
}
},
{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
{% endif %}
{%- if defs.generate_profile_lists is defined %}
{{ defs.generate_profile_lists(port_names_active) }},
{% endif %}
{%- if defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
{% endif %}
{% if defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
"{{ port }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0-2": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% endif %}
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE1
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE2
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE2
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE3
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE4
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE5
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE6
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE7
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE8
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE9
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE10
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE11
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE12
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE13
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE14
Ethernet128 128 10000 tenGigE128
Ethernet129 129 10000 tenGigE129

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
db98cx8580_16cd t1

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/etc/sonic/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,255 @@
#!/usr/bin/env python
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
if sys.version_info[0] < 3:
import commands as cmd
else:
import subprocess as cmd
smbus_present = 1
try:
import smbus
except ImportError, e:
smbus_present = 0
class SfpUtil(SfpUtilBase):
"""Platform specific sfputil class"""
_port_start = 1
_port_end = 132
ports_in_block = 132
_port_to_eeprom_mapping = {}
_qsfp_ports = range(_port_start, ports_in_block + 1)
def __init__(self):
os.system("modprobe i2c-dev")
if not os.path.exists("/sys/bus/i2c/devices/0-0050") :
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
#for x in range(self.port _start, self.port_end +1):
x = self.port_start
while(x<self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path
x = x + 1
SfpUtilBase.__init__(self)
def reset(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
port_ps = "/sys/bus/i2c/devices/0-0050/sfp_port_reset"
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
#toggle reset
reg_file.seek(0)
reg_file.write('1')
time.sleep(1)
reg_file.seek(0)
reg_file.write('0')
reg_file.close()
return True
def set_low_power_mode(self, port_nuM, lpmode):
raise NotImplementedError
def get_low_power_mode(self, port_num):
raise NotImplementedError
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = cmd.getstatusoutput(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
else:
bus = smbus.SMBus(0)
status = bus.read_byte_data(device_addr, offset)
return status
def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
else:
self.i2c_set(0x70, 0, 0)
self.i2c_set(0x71, 0, 0)
self.i2c_set(0x74, 0, 0)
reg = (port_num)/8
offset = reg % 8
if offset >=4:
offset=offset-4
elif offset<4:
offset=offset+4
bin_offset = 1<<offset
if port_num >= 0 and port_num <= 63:
device_reg = 0x70
elif port_num >= 64 and port_num <= 127:
device_reg = 0x71
elif port_num >= 128 and port_num <= 131:
device_reg = 0x74
#print "i2c %d %x %x" % (port_num, device_reg, bin_offset)
self.i2c_set(device_reg, 0, bin_offset)
path = "/sys/bus/i2c/devices/0-0050/eeprom"
try:
reg_file = open(path)
reg_file.seek(01)
reg_file.read(02)
except IOError as e:
return False
return True
def read_porttab_mappings(self, porttabfile):
#print("I am in porttab_mappings")
logical = []
logical_to_bcm = {}
logical_to_physical = {}
physical_to_logical = {}
last_fp_port_index = 0
last_portname = ""
first = 1
port_pos_in_file = 0
parse_fmt_port_config_ini = False
try:
f = open(porttabfile)
except:
raise
parse_fmt_port_config_ini = (os.path.basename(porttabfile) == "port_config.ini")
# Read the porttab file and generate dicts
# with mapping for future reference.
#
# TODO: Refactor this to use the portconfig.py module that now
# exists as part of the sonic-config-engine package.
title = []
for line in f:
line.strip()
if re.search("^#", line) is not None:
# The current format is: # name lanes alias index speed
# Where the ordering of the columns can vary
title = line.split()[1:]
continue
#print title
# Parsing logic for 'port_config.ini' file
if (parse_fmt_port_config_ini):
# bcm_port is not explicitly listed in port_config.ini format
# Currently we assume ports are listed in numerical order according to bcm_port
# so we use the port's position in the file (zero-based) as bcm_port
portname = line.split()[0]
bcm_port = str(port_pos_in_file)
if "index" in title:
fp_port_index = int(line.split()[title.index("index")])
# Leave the old code for backward compatibility
#if len(line.split()) >= 4:
# fp_port_index = (line.split()[3])
# print(fp_port_index)
else:
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
else: # Parsing logic for older 'portmap.ini' file
(portname, bcm_port) = line.split("=")[1].split(",")[:2]
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
if ((len(self.sfp_ports) > 0) and (fp_port_index not in self.sfp_ports)):
continue
if first == 1:
# Initialize last_[physical|logical]_port
# to the first valid port
last_fp_port_index = fp_port_index
last_portname = portname
first = 0
logical.append(portname)
logical_to_bcm[portname] = "xe" + bcm_port
logical_to_physical[portname] = [fp_port_index]
if physical_to_logical.get(fp_port_index) is None:
physical_to_logical[fp_port_index] = [portname]
else:
physical_to_logical[fp_port_index].append(
portname)
if (fp_port_index - last_fp_port_index) > 1:
# last port was a gang port
for p in range(last_fp_port_index+1, fp_port_index):
logical_to_physical[last_portname].append(p)
if physical_to_logical.get(p) is None:
physical_to_logical[p] = [last_portname]
else:
physical_to_logical[p].append(last_portname)
last_fp_port_index = fp_port_index
last_portname = portname
port_pos_in_file += 1
self.logical = logical
self.logical_to_bcm = logical_to_bcm
self.logical_to_physical = logical_to_physical
self.physical_to_logical = physical_to_logical
#print(self.logical_to_physical)
'''print("logical: " + self.logical)
print("logical to bcm: " + self.logical_to_bcm)
print("logical to physical: " + self.logical_to_physical)
print("physical to logical: " + self.physical_to_logical)'''
#print("exiting port_tab_mappings")
@property
def port_start(self):
return self._port_start
@property
def port_end(self):
return self._port_end
@property
def qsfp_ports(self):
return self._qsfp_ports
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def get_transceiver_change_event(self):
raise NotImplementedError

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 25000 twenty5GigE16
Ethernet17 17 25000 twenty5GigE17
Ethernet18 18 25000 twenty5GigE18
Ethernet19 19 25000 twenty5GigE19
Ethernet20 20 25000 twenty5GigE20
Ethernet21 21 25000 twenty5GigE21
Ethernet22 22 25000 twenty5GigE22
Ethernet23 23 25000 twenty5GigE23
Ethernet24 24 25000 twenty5GigE24
Ethernet25 25 25000 twenty5GigE25
Ethernet26 26 25000 twenty5GigE26
Ethernet27 27 25000 twenty5GigE27
Ethernet28 28 25000 twenty5GigE28
Ethernet29 29 25000 twenty5GigE29
Ethernet30 30 25000 twenty5GigE30
Ethernet31 31 25000 twenty5GigE31
Ethernet32 32 10000 tenGigE32

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1 016:1 017:1 018:1 019:1 020:1 021:1 022:1 023:1 024:1 025:1 026:1 027:1 028:1 029:1 030:1 031:1 032:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32X25G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE8
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE16
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE24
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE32
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE40
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE48
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE56
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE64
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE72
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE80
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE88
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE96
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE104
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE112
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE120
Ethernet128 128,129,130,131,132,133,134,135 400000 four00GigE128
Ethernet136 136,137,138,139,140,141,142,143 400000 four00GigE136
Ethernet144 144,145,146,147,148,149,150,151 400000 four00GigE144
Ethernet152 152,153,154,155,156,157,158,159 400000 four00GigE152
Ethernet160 160,161,162,163,164,165,166,167 400000 four00GigE160
Ethernet168 168,169,170,171,172,173,174,175 400000 four00GigE168
Ethernet176 176,177,178,179,180,181,182,183 400000 four00GigE176
Ethernet184 184,185,186,187,188,189,190,191 400000 four00GigE184
Ethernet192 192,193,194,195,196,197,198,199 400000 four00GigE192
Ethernet200 200,201,202,203,204,205,206,207 400000 four00GigE200
Ethernet208 208,209,210,211,212,213,214,215 400000 four00GigE208
Ethernet216 216,217,218,219,220,221,222,223 400000 four00GigE216
Ethernet224 224,225,226,227,228,229,230,231 400000 four00GigE224
Ethernet232 232,233,234,235,236,237,238,239 400000 four00GigE232
Ethernet240 240,241,242,243,244,245,246,247 400000 four00GigE240
Ethernet248 248,249,250,251,252,253,254,255 400000 four00GigE248
Ethernet256 256 10000 tenGigE256

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1 128:1 136:1 144:1 152:1 160:1 168:1 176:1 184:1 192:1 200:1 208:1 216:1 224:1 232:1 240:1 248:1 256:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1,165 @@
{%- macro set_default_topology() %}
{%- if default_topo is defined %}
{{ default_topo }}
{%- else %}
def
{%- endif %}
{%- endmacro -%}
{# Determine device topology and filename postfix #}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- if switch_role.lower() == 'torrouter' %}
{%- set filename_postfix = 't0' %}
{%- elif switch_role.lower() == 'leafrouter' %}
{%- set filename_postfix = 't1' %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- endif %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- set switch_role = '' %}
{%- endif -%}
{# Import default values from device HWSKU folder #}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %}
{%- set default_cable = defs.default_cable -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{%- if defs.ports2cable is defined %}
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
-%}
{%- endif %}
{%- macro cable_length(port_name) %}
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role %}
{%- set roles1 = roles1 | lower %}
{%- set roles2 = roles2 | lower %}
{%- if roles1 in ports2cable %}
{%- if cable_len.append(ports2cable[roles1]) %}{% endif %}
{%- elif roles2 in ports2cable %}
{%- if cable_len.append(ports2cable[roles2]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else %}
{%- if switch_role.lower() == 'torrouter' %}
{%- for local_port in VLAN_MEMBER %}
{%- if local_port[1] == port_name %}
{%- set roles3 = switch_role + '_' + 'server' %}
{%- set roles3 = roles3 | lower %}
{%- if roles3 in ports2cable %}
{%- if cable_len.append(ports2cable[roles3]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- endif %}
{%- endmacro %}
{%- set PORT_ALL = [] %}
{%- if PORT is not defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT_ALL %}
{%- set cable = cable_length(port) %}
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
{% endfor %}
}
},
{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
{% endif %}
{%- if defs.generate_profile_lists is defined %}
{{ defs.generate_profile_lists(port_names_active) }},
{% endif %}
{%- if defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
{% endif %}
{% if defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
"{{ port }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0-2": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% endif %}
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE8
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE16
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE24
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE32
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE40
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE48
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE56
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE64
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE72
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE80
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE88
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE96
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE104
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE112
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE120
Ethernet128 128,129,130,131,132,133,134,135 400000 four00GigE128
Ethernet136 136,137,138,139,140,141,142,143 400000 four00GigE136
Ethernet144 144,145,146,147,148,149,150,151 400000 four00GigE144
Ethernet152 152,153,154,155,156,157,158,159 400000 four00GigE152
Ethernet160 160,161,162,163,164,165,166,167 400000 four00GigE160
Ethernet168 168,169,170,171,172,173,174,175 400000 four00GigE168
Ethernet176 176,177,178,179,180,181,182,183 400000 four00GigE176
Ethernet184 184,185,186,187,188,189,190,191 400000 four00GigE184
Ethernet192 192,193,194,195,196,197,198,199 400000 four00GigE192
Ethernet200 200,201,202,203,204,205,206,207 400000 four00GigE200
Ethernet208 208,209,210,211,212,213,214,215 400000 four00GigE208
Ethernet216 216,217,218,219,220,221,222,223 400000 four00GigE216
Ethernet224 224,225,226,227,228,229,230,231 400000 four00GigE224
Ethernet232 232,233,234,235,236,237,238,239 400000 four00GigE232
Ethernet240 240,241,242,243,244,245,246,247 400000 four00GigE240
Ethernet248 248,249,250,251,252,253,254,255 400000 four00GigE248
Ethernet256 256 10000 tenGigE256

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1 128:1 136:1 144:1 152:1 160:1 168:1 176:1 184:1 192:1 200:1 208:1 216:1 224:1 232:1 240:1 248:1 256:1

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
db98cx8580_32cd t1

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/etc/sonic/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,261 @@
#!/usr/bin/env python
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
if sys.version_info[0] < 3:
import commands as cmd
else:
import subprocess as cmd
smbus_present = 1
try:
import smbus
except ImportError, e:
smbus_present = 0
class SfpUtil(SfpUtilBase):
"""Platform specific sfputil class"""
_port_start = 1
_port_end = 257
ports_in_block = 257
_port_to_eeprom_mapping = {}
_qsfp_ports = range(_port_start, ports_in_block + 1)
def __init__(self):
os.system("modprobe i2c-dev")
if not os.path.exists("/sys/bus/i2c/devices/0-0050") :
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
#for x in range(self.port _start, self.port_end +1):
x = self.port_start
while(x<self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path
x = x + 1
SfpUtilBase.__init__(self)
def reset(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
port_ps = "/sys/bus/i2c/devices/0-0050/sfp_port_reset"
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
#toggle reset
reg_file.seek(0)
reg_file.write('1')
time.sleep(1)
reg_file.seek(0)
reg_file.write('0')
reg_file.close()
return True
def set_low_power_mode(self, port_nuM, lpmode):
raise NotImplementedError
def get_low_power_mode(self, port_num):
raise NotImplementedError
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = cmd.getstatusoutput(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
else:
bus = smbus.SMBus(0)
status = bus.read_byte_data(device_addr, offset)
return status
def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
else:
self.i2c_set(0x70, 0, 0)
self.i2c_set(0x71, 0, 0)
self.i2c_set(0x72, 0, 0)
self.i2c_set(0x73, 0, 0)
self.i2c_set(0x74, 0, 0)
reg = (port_num)/8
offset = reg % 8
if offset >=4:
offset=offset-4
elif offset<4:
offset=offset+4
bin_offset = 1<<offset
if port_num >= 0 and port_num <= 63:
device_reg = 0x70
elif port_num >= 64 and port_num <= 127:
device_reg = 0x71
elif port_num >= 128 and port_num <= 191:
device_reg = 0x72
elif port_num >= 192 and port_num <= 255:
device_reg = 0x73
elif port_num >= 256 and port_num <= 257:
device_reg = 0x74
#print "i2c %d %x %x" % (port_num, device_reg, bin_offset)
self.i2c_set(device_reg, 0, bin_offset)
path = "/sys/bus/i2c/devices/0-0050/eeprom"
try:
reg_file = open(path)
reg_file.seek(01)
reg_file.read(02)
except IOError as e:
return False
return True
def read_porttab_mappings(self, porttabfile):
#print("I am in porttab_mappings")
logical = []
logical_to_bcm = {}
logical_to_physical = {}
physical_to_logical = {}
last_fp_port_index = 0
last_portname = ""
first = 1
port_pos_in_file = 0
parse_fmt_port_config_ini = False
try:
f = open(porttabfile)
except:
raise
parse_fmt_port_config_ini = (os.path.basename(porttabfile) == "port_config.ini")
# Read the porttab file and generate dicts
# with mapping for future reference.
#
# TODO: Refactor this to use the portconfig.py module that now
# exists as part of the sonic-config-engine package.
title = []
for line in f:
line.strip()
if re.search("^#", line) is not None:
# The current format is: # name lanes alias index speed
# Where the ordering of the columns can vary
title = line.split()[1:]
continue
#print title
# Parsing logic for 'port_config.ini' file
if (parse_fmt_port_config_ini):
# bcm_port is not explicitly listed in port_config.ini format
# Currently we assume ports are listed in numerical order according to bcm_port
# so we use the port's position in the file (zero-based) as bcm_port
portname = line.split()[0]
bcm_port = str(port_pos_in_file)
if "index" in title:
fp_port_index = int(line.split()[title.index("index")])
# Leave the old code for backward compatibility
#if len(line.split()) >= 4:
# fp_port_index = (line.split()[3])
# print(fp_port_index)
else:
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
else: # Parsing logic for older 'portmap.ini' file
(portname, bcm_port) = line.split("=")[1].split(",")[:2]
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
if ((len(self.sfp_ports) > 0) and (fp_port_index not in self.sfp_ports)):
continue
if first == 1:
# Initialize last_[physical|logical]_port
# to the first valid port
last_fp_port_index = fp_port_index
last_portname = portname
first = 0
logical.append(portname)
logical_to_bcm[portname] = "xe" + bcm_port
logical_to_physical[portname] = [fp_port_index]
if physical_to_logical.get(fp_port_index) is None:
physical_to_logical[fp_port_index] = [portname]
else:
physical_to_logical[fp_port_index].append(
portname)
if (fp_port_index - last_fp_port_index) > 1:
# last port was a gang port
for p in range(last_fp_port_index+1, fp_port_index):
logical_to_physical[last_portname].append(p)
if physical_to_logical.get(p) is None:
physical_to_logical[p] = [last_portname]
else:
physical_to_logical[p].append(last_portname)
last_fp_port_index = fp_port_index
last_portname = portname
port_pos_in_file += 1
self.logical = logical
self.logical_to_bcm = logical_to_bcm
self.logical_to_physical = logical_to_physical
self.physical_to_logical = physical_to_logical
#print(self.logical_to_physical)
'''print("logical: " + self.logical)
print("logical to bcm: " + self.logical_to_bcm)
print("logical to physical: " + self.logical_to_physical)
print("physical to logical: " + self.physical_to_logical)'''
#print("exiting port_tab_mappings")
@property
def port_start(self):
return self._port_start
@property
def port_end(self):
return self._port_end
@property
def qsfp_ports(self):
return self._qsfp_ports
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def get_transceiver_change_event(self):
raise NotImplementedError

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 10000 tenGigE16
Ethernet17 17 10000 tenGigE17

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16X25G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE1
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE2
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE2
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE3
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE4
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE5
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE6
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE7
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE8
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE9
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE10
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE11
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE12
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE13
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE14
Ethernet128 128 10000 tenGigE128
Ethernet129 129 10000 tenGigE129

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"170000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"170000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,35 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 25000 twenty5GigE16
Ethernet17 17 25000 twenty5GigE17
Ethernet18 18 25000 twenty5GigE18
Ethernet19 19 25000 twenty5GigE19
Ethernet20 20 25000 twenty5GigE20
Ethernet21 21 25000 twenty5GigE21
Ethernet22 22 25000 twenty5GigE22
Ethernet23 23 25000 twenty5GigE23
Ethernet24 24 25000 twenty5GigE24
Ethernet25 25 25000 twenty5GigE25
Ethernet26 26 25000 twenty5GigE26
Ethernet27 27 25000 twenty5GigE27
Ethernet28 28 25000 twenty5GigE28
Ethernet29 29 25000 twenty5GigE29
Ethernet30 30 25000 twenty5GigE30
Ethernet31 31 25000 twenty5GigE31
Ethernet32 32 10000 tenGigE32
Ethernet33 33 10000 tenGigE33

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1 016:1 017:1 018:1 019:1 020:1 021:1 022:1 023:1 024:1 025:1 026:1 027:1 028:1 029:1 030:1 031:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x25G64
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1,165 @@
{%- macro set_default_topology() %}
{%- if default_topo is defined %}
{{ default_topo }}
{%- else %}
def
{%- endif %}
{%- endmacro -%}
{# Determine device topology and filename postfix #}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- if switch_role.lower() == 'torrouter' %}
{%- set filename_postfix = 't0' %}
{%- elif switch_role.lower() == 'leafrouter' %}
{%- set filename_postfix = 't1' %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- endif %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- set switch_role = '' %}
{%- endif -%}
{# Import default values from device HWSKU folder #}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %}
{%- set default_cable = defs.default_cable -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{%- if defs.ports2cable is defined %}
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
-%}
{%- endif %}
{%- macro cable_length(port_name) %}
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role %}
{%- set roles1 = roles1 | lower %}
{%- set roles2 = roles2 | lower %}
{%- if roles1 in ports2cable %}
{%- if cable_len.append(ports2cable[roles1]) %}{% endif %}
{%- elif roles2 in ports2cable %}
{%- if cable_len.append(ports2cable[roles2]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else %}
{%- if switch_role.lower() == 'torrouter' %}
{%- for local_port in VLAN_MEMBER %}
{%- if local_port[1] == port_name %}
{%- set roles3 = switch_role + '_' + 'server' %}
{%- set roles3 = roles3 | lower %}
{%- if roles3 in ports2cable %}
{%- if cable_len.append(ports2cable[roles3]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- endif %}
{%- endmacro %}
{%- set PORT_ALL = [] %}
{%- if PORT is not defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT_ALL %}
{%- set cable = cable_length(port) %}
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
{% endfor %}
}
},
{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
{% endif %}
{%- if defs.generate_profile_lists is defined %}
{{ defs.generate_profile_lists(port_names_active) }},
{% endif %}
{%- if defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
{% endif %}
{% if defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
"{{ port }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0-2": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% endif %}
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "11500000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "11500000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"330000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,19 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE1
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE2
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE2
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE3
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE4
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE5
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE6
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE7
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE8
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE9
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE10
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE11
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE12
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE13
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE14
Ethernet128 128 10000 tenGigE128
Ethernet129 129 10000 tenGigE129

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON16x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
db98cx8580_16cd t1

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/etc/sonic/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,255 @@
#!/usr/bin/env python
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
if sys.version_info[0] < 3:
import commands as cmd
else:
import subprocess as cmd
smbus_present = 1
try:
import smbus
except ImportError, e:
smbus_present = 0
class SfpUtil(SfpUtilBase):
"""Platform specific sfputil class"""
_port_start = 1
_port_end = 132
ports_in_block = 132
_port_to_eeprom_mapping = {}
_qsfp_ports = range(_port_start, ports_in_block + 1)
def __init__(self):
os.system("modprobe i2c-dev")
if not os.path.exists("/sys/bus/i2c/devices/0-0050") :
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
#for x in range(self.port _start, self.port_end +1):
x = self.port_start
while(x<self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path
x = x + 1
SfpUtilBase.__init__(self)
def reset(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
port_ps = "/sys/bus/i2c/devices/0-0050/sfp_port_reset"
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
#toggle reset
reg_file.seek(0)
reg_file.write('1')
time.sleep(1)
reg_file.seek(0)
reg_file.write('0')
reg_file.close()
return True
def set_low_power_mode(self, port_nuM, lpmode):
raise NotImplementedError
def get_low_power_mode(self, port_num):
raise NotImplementedError
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = cmd.getstatusoutput(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
else:
bus = smbus.SMBus(0)
status = bus.read_byte_data(device_addr, offset)
return status
def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
else:
self.i2c_set(0x70, 0, 0)
self.i2c_set(0x71, 0, 0)
self.i2c_set(0x74, 0, 0)
reg = (port_num)/8
offset = reg % 8
if offset >=4:
offset=offset-4
elif offset<4:
offset=offset+4
bin_offset = 1<<offset
if port_num >= 0 and port_num <= 63:
device_reg = 0x70
elif port_num >= 64 and port_num <= 127:
device_reg = 0x71
elif port_num >= 128 and port_num <= 131:
device_reg = 0x74
#print "i2c %d %x %x" % (port_num, device_reg, bin_offset)
self.i2c_set(device_reg, 0, bin_offset)
path = "/sys/bus/i2c/devices/0-0050/eeprom"
try:
reg_file = open(path)
reg_file.seek(01)
reg_file.read(02)
except IOError as e:
return False
return True
def read_porttab_mappings(self, porttabfile):
#print("I am in porttab_mappings")
logical = []
logical_to_bcm = {}
logical_to_physical = {}
physical_to_logical = {}
last_fp_port_index = 0
last_portname = ""
first = 1
port_pos_in_file = 0
parse_fmt_port_config_ini = False
try:
f = open(porttabfile)
except:
raise
parse_fmt_port_config_ini = (os.path.basename(porttabfile) == "port_config.ini")
# Read the porttab file and generate dicts
# with mapping for future reference.
#
# TODO: Refactor this to use the portconfig.py module that now
# exists as part of the sonic-config-engine package.
title = []
for line in f:
line.strip()
if re.search("^#", line) is not None:
# The current format is: # name lanes alias index speed
# Where the ordering of the columns can vary
title = line.split()[1:]
continue
#print title
# Parsing logic for 'port_config.ini' file
if (parse_fmt_port_config_ini):
# bcm_port is not explicitly listed in port_config.ini format
# Currently we assume ports are listed in numerical order according to bcm_port
# so we use the port's position in the file (zero-based) as bcm_port
portname = line.split()[0]
bcm_port = str(port_pos_in_file)
if "index" in title:
fp_port_index = int(line.split()[title.index("index")])
# Leave the old code for backward compatibility
#if len(line.split()) >= 4:
# fp_port_index = (line.split()[3])
# print(fp_port_index)
else:
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
else: # Parsing logic for older 'portmap.ini' file
(portname, bcm_port) = line.split("=")[1].split(",")[:2]
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
if ((len(self.sfp_ports) > 0) and (fp_port_index not in self.sfp_ports)):
continue
if first == 1:
# Initialize last_[physical|logical]_port
# to the first valid port
last_fp_port_index = fp_port_index
last_portname = portname
first = 0
logical.append(portname)
logical_to_bcm[portname] = "xe" + bcm_port
logical_to_physical[portname] = [fp_port_index]
if physical_to_logical.get(fp_port_index) is None:
physical_to_logical[fp_port_index] = [portname]
else:
physical_to_logical[fp_port_index].append(
portname)
if (fp_port_index - last_fp_port_index) > 1:
# last port was a gang port
for p in range(last_fp_port_index+1, fp_port_index):
logical_to_physical[last_portname].append(p)
if physical_to_logical.get(p) is None:
physical_to_logical[p] = [last_portname]
else:
physical_to_logical[p].append(last_portname)
last_fp_port_index = fp_port_index
last_portname = portname
port_pos_in_file += 1
self.logical = logical
self.logical_to_bcm = logical_to_bcm
self.logical_to_physical = logical_to_physical
self.physical_to_logical = physical_to_logical
#print(self.logical_to_physical)
'''print("logical: " + self.logical)
print("logical to bcm: " + self.logical_to_bcm)
print("logical to physical: " + self.logical_to_physical)
print("physical to logical: " + self.physical_to_logical)'''
#print("exiting port_tab_mappings")
@property
def port_start(self):
return self._port_start
@property
def port_end(self):
return self._port_end
@property
def qsfp_ports(self):
return self._qsfp_ports
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def get_transceiver_change_event(self):
raise NotImplementedError

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0 25000 twenty5GigE0
Ethernet1 1 25000 twenty5GigE1
Ethernet2 2 25000 twenty5GigE2
Ethernet3 3 25000 twenty5GigE3
Ethernet4 4 25000 twenty5GigE4
Ethernet5 5 25000 twenty5GigE5
Ethernet6 6 25000 twenty5GigE6
Ethernet7 7 25000 twenty5GigE7
Ethernet8 8 25000 twenty5GigE8
Ethernet9 9 25000 twenty5GigE9
Ethernet10 10 25000 twenty5GigE10
Ethernet11 11 25000 twenty5GigE11
Ethernet12 12 25000 twenty5GigE12
Ethernet13 13 25000 twenty5GigE13
Ethernet14 14 25000 twenty5GigE14
Ethernet15 15 25000 twenty5GigE15
Ethernet16 16 25000 twenty5GigE16
Ethernet17 17 25000 twenty5GigE17
Ethernet18 18 25000 twenty5GigE18
Ethernet19 19 25000 twenty5GigE19
Ethernet20 20 25000 twenty5GigE20
Ethernet21 21 25000 twenty5GigE21
Ethernet22 22 25000 twenty5GigE22
Ethernet23 23 25000 twenty5GigE23
Ethernet24 24 25000 twenty5GigE24
Ethernet25 25 25000 twenty5GigE25
Ethernet26 26 25000 twenty5GigE26
Ethernet27 27 25000 twenty5GigE27
Ethernet28 28 25000 twenty5GigE28
Ethernet29 29 25000 twenty5GigE29
Ethernet30 30 25000 twenty5GigE30
Ethernet31 31 25000 twenty5GigE31
Ethernet32 32 10000 tenGigE32

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 001:1 002:1 003:1 004:1 005:1 006:1 007:1 008:1 009:1 010:1 011:1 012:1 013:1 014:1 015:1 016:1 017:1 018:1 019:1 020:1 021:1 022:1 023:1 024:1 025:1 026:1 027:1 028:1 029:1 030:1 031:1 032:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32X25G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE8
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE16
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE24
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE32
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE40
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE48
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE56
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE64
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE72
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE80
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE88
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE96
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE104
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE112
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE120
Ethernet128 128,129,130,131,132,133,134,135 400000 four00GigE128
Ethernet136 136,137,138,139,140,141,142,143 400000 four00GigE136
Ethernet144 144,145,146,147,148,149,150,151 400000 four00GigE144
Ethernet152 152,153,154,155,156,157,158,159 400000 four00GigE152
Ethernet160 160,161,162,163,164,165,166,167 400000 four00GigE160
Ethernet168 168,169,170,171,172,173,174,175 400000 four00GigE168
Ethernet176 176,177,178,179,180,181,182,183 400000 four00GigE176
Ethernet184 184,185,186,187,188,189,190,191 400000 four00GigE184
Ethernet192 192,193,194,195,196,197,198,199 400000 four00GigE192
Ethernet200 200,201,202,203,204,205,206,207 400000 four00GigE200
Ethernet208 208,209,210,211,212,213,214,215 400000 four00GigE208
Ethernet216 216,217,218,219,220,221,222,223 400000 four00GigE216
Ethernet224 224,225,226,227,228,229,230,231 400000 four00GigE224
Ethernet232 232,233,234,235,236,237,238,239 400000 four00GigE232
Ethernet240 240,241,242,243,244,245,246,247 400000 four00GigE240
Ethernet248 248,249,250,251,252,253,254,255 400000 four00GigE248
Ethernet256 256 10000 tenGigE256

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1 128:1 136:1 144:1 152:1 160:1 168:1 176:1 184:1 192:1 200:1 208:1 216:1 224:1 232:1 240:1 248:1 256:1

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1,165 @@
{%- macro set_default_topology() %}
{%- if default_topo is defined %}
{{ default_topo }}
{%- else %}
def
{%- endif %}
{%- endmacro -%}
{# Determine device topology and filename postfix #}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- if switch_role.lower() == 'torrouter' %}
{%- set filename_postfix = 't0' %}
{%- elif switch_role.lower() == 'leafrouter' %}
{%- set filename_postfix = 't1' %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- endif %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- set switch_role = '' %}
{%- endif -%}
{# Import default values from device HWSKU folder #}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %}
{%- set default_cable = defs.default_cable -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{%- if defs.ports2cable is defined %}
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
-%}
{%- endif %}
{%- macro cable_length(port_name) %}
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role %}
{%- set roles1 = roles1 | lower %}
{%- set roles2 = roles2 | lower %}
{%- if roles1 in ports2cable %}
{%- if cable_len.append(ports2cable[roles1]) %}{% endif %}
{%- elif roles2 in ports2cable %}
{%- if cable_len.append(ports2cable[roles2]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else %}
{%- if switch_role.lower() == 'torrouter' %}
{%- for local_port in VLAN_MEMBER %}
{%- if local_port[1] == port_name %}
{%- set roles3 = switch_role + '_' + 'server' %}
{%- set roles3 = roles3 | lower %}
{%- if roles3 in ports2cable %}
{%- if cable_len.append(ports2cable[roles3]) %}{% endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- endif %}
{%- endmacro %}
{%- set PORT_ALL = [] %}
{%- if PORT is not defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT_ALL %}
{%- set cable = cable_length(port) %}
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
{% endfor %}
}
},
{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
{% endif %}
{%- if defs.generate_profile_lists is defined %}
{{ defs.generate_profile_lists(port_names_active) }},
{% endif %}
{%- if defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
{% endif %}
{% if defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
"{{ port }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0-2": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% endif %}
}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,36 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "23000000",
"type": "ingress",
"mode": "dynamic"
},
"egress_pool": {
"size": "23000000",
"type": "egress",
"mode": "static"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"mode": "static",
"size":"340000",
"static_th":"0"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_pool]",
"size":"0",
"mode": "dynamic",
"dynamic_th":"3"
}
},
{%- endmacro %}

View File

@ -0,0 +1,34 @@
# name lanes speed alias
Ethernet0 0,1,2,3,4,5,6,7 400000 four00GigE0
Ethernet8 8,9,10,11,12,13,14,15 400000 four00GigE8
Ethernet16 16,17,18,19,20,21,22,23 400000 four00GigE16
Ethernet24 24,25,26,27,28,29,30,31 400000 four00GigE24
Ethernet32 32,33,34,35,36,37,38,39 400000 four00GigE32
Ethernet40 40,41,42,43,44,45,46,47 400000 four00GigE40
Ethernet48 48,49,50,51,52,53,54,55 400000 four00GigE48
Ethernet56 56,57,58,59,60,61,62,63 400000 four00GigE56
Ethernet64 64,65,66,67,68,69,70,71 400000 four00GigE64
Ethernet72 72,73,74,75,76,77,78,79 400000 four00GigE72
Ethernet80 80,81,82,83,84,85,86,87 400000 four00GigE80
Ethernet88 88,89,90,91,92,93,94,95 400000 four00GigE88
Ethernet96 96,97,98,99,100,101,102,103 400000 four00GigE96
Ethernet104 104,105,106,107,108,109,110,111 400000 four00GigE104
Ethernet112 112,113,114,115,116,117,118,119 400000 four00GigE112
Ethernet120 120,121,122,123,124,125,126,127 400000 four00GigE120
Ethernet128 128,129,130,131,132,133,134,135 400000 four00GigE128
Ethernet136 136,137,138,139,140,141,142,143 400000 four00GigE136
Ethernet144 144,145,146,147,148,149,150,151 400000 four00GigE144
Ethernet152 152,153,154,155,156,157,158,159 400000 four00GigE152
Ethernet160 160,161,162,163,164,165,166,167 400000 four00GigE160
Ethernet168 168,169,170,171,172,173,174,175 400000 four00GigE168
Ethernet176 176,177,178,179,180,181,182,183 400000 four00GigE176
Ethernet184 184,185,186,187,188,189,190,191 400000 four00GigE184
Ethernet192 192,193,194,195,196,197,198,199 400000 four00GigE192
Ethernet200 200,201,202,203,204,205,206,207 400000 four00GigE200
Ethernet208 208,209,210,211,212,213,214,215 400000 four00GigE208
Ethernet216 216,217,218,219,220,221,222,223 400000 four00GigE216
Ethernet224 224,225,226,227,228,229,230,231 400000 four00GigE224
Ethernet232 232,233,234,235,236,237,238,239 400000 four00GigE232
Ethernet240 240,241,242,243,244,245,246,247 400000 four00GigE240
Ethernet248 248,249,250,251,252,253,254,255 400000 four00GigE248
Ethernet256 256 10000 tenGigE256

View File

@ -0,0 +1,2 @@
switchMacAddress=00:01:02:03:04:05
apPortListWithCableLen=000:1 008:1 016:1 024:1 032:1 040:1 048:1 056:1 064:1 072:1 080:1 088:1 096:1 104:1 112:1 120:1 128:1 136:1 144:1 152:1 160:1 168:1 176:1 184:1 192:1 200:1 208:1 216:1 224:1 232:1 240:1 248:1 256:1

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,3 @@
mode=1
hwId=FALCON32x400G
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini

View File

@ -0,0 +1 @@
db98cx8580_32cd t1

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/etc/sonic/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,261 @@
#!/usr/bin/env python
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
if sys.version_info[0] < 3:
import commands as cmd
else:
import subprocess as cmd
smbus_present = 1
try:
import smbus
except ImportError, e:
smbus_present = 0
class SfpUtil(SfpUtilBase):
"""Platform specific sfputil class"""
_port_start = 1
_port_end = 257
ports_in_block = 257
_port_to_eeprom_mapping = {}
_qsfp_ports = range(_port_start, ports_in_block + 1)
def __init__(self):
os.system("modprobe i2c-dev")
if not os.path.exists("/sys/bus/i2c/devices/0-0050") :
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
#for x in range(self.port _start, self.port_end +1):
x = self.port_start
while(x<self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path
x = x + 1
SfpUtilBase.__init__(self)
def reset(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
port_ps = "/sys/bus/i2c/devices/0-0050/sfp_port_reset"
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
#toggle reset
reg_file.seek(0)
reg_file.write('1')
time.sleep(1)
reg_file.seek(0)
reg_file.write('0')
reg_file.close()
return True
def set_low_power_mode(self, port_nuM, lpmode):
raise NotImplementedError
def get_low_power_mode(self, port_num):
raise NotImplementedError
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = cmd.getstatusoutput(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
else:
bus = smbus.SMBus(0)
status = bus.read_byte_data(device_addr, offset)
return status
def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
else:
self.i2c_set(0x70, 0, 0)
self.i2c_set(0x71, 0, 0)
self.i2c_set(0x72, 0, 0)
self.i2c_set(0x73, 0, 0)
self.i2c_set(0x74, 0, 0)
reg = (port_num)/8
offset = reg % 8
if offset >=4:
offset=offset-4
elif offset<4:
offset=offset+4
bin_offset = 1<<offset
if port_num >= 0 and port_num <= 63:
device_reg = 0x70
elif port_num >= 64 and port_num <= 127:
device_reg = 0x71
elif port_num >= 128 and port_num <= 191:
device_reg = 0x72
elif port_num >= 192 and port_num <= 255:
device_reg = 0x73
elif port_num >= 256 and port_num <= 257:
device_reg = 0x74
#print "i2c %d %x %x" % (port_num, device_reg, bin_offset)
self.i2c_set(device_reg, 0, bin_offset)
path = "/sys/bus/i2c/devices/0-0050/eeprom"
try:
reg_file = open(path)
reg_file.seek(01)
reg_file.read(02)
except IOError as e:
return False
return True
def read_porttab_mappings(self, porttabfile):
#print("I am in porttab_mappings")
logical = []
logical_to_bcm = {}
logical_to_physical = {}
physical_to_logical = {}
last_fp_port_index = 0
last_portname = ""
first = 1
port_pos_in_file = 0
parse_fmt_port_config_ini = False
try:
f = open(porttabfile)
except:
raise
parse_fmt_port_config_ini = (os.path.basename(porttabfile) == "port_config.ini")
# Read the porttab file and generate dicts
# with mapping for future reference.
#
# TODO: Refactor this to use the portconfig.py module that now
# exists as part of the sonic-config-engine package.
title = []
for line in f:
line.strip()
if re.search("^#", line) is not None:
# The current format is: # name lanes alias index speed
# Where the ordering of the columns can vary
title = line.split()[1:]
continue
#print title
# Parsing logic for 'port_config.ini' file
if (parse_fmt_port_config_ini):
# bcm_port is not explicitly listed in port_config.ini format
# Currently we assume ports are listed in numerical order according to bcm_port
# so we use the port's position in the file (zero-based) as bcm_port
portname = line.split()[0]
bcm_port = str(port_pos_in_file)
if "index" in title:
fp_port_index = int(line.split()[title.index("index")])
# Leave the old code for backward compatibility
#if len(line.split()) >= 4:
# fp_port_index = (line.split()[3])
# print(fp_port_index)
else:
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
else: # Parsing logic for older 'portmap.ini' file
(portname, bcm_port) = line.split("=")[1].split(",")[:2]
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))+1
if ((len(self.sfp_ports) > 0) and (fp_port_index not in self.sfp_ports)):
continue
if first == 1:
# Initialize last_[physical|logical]_port
# to the first valid port
last_fp_port_index = fp_port_index
last_portname = portname
first = 0
logical.append(portname)
logical_to_bcm[portname] = "xe" + bcm_port
logical_to_physical[portname] = [fp_port_index]
if physical_to_logical.get(fp_port_index) is None:
physical_to_logical[fp_port_index] = [portname]
else:
physical_to_logical[fp_port_index].append(
portname)
if (fp_port_index - last_fp_port_index) > 1:
# last port was a gang port
for p in range(last_fp_port_index+1, fp_port_index):
logical_to_physical[last_portname].append(p)
if physical_to_logical.get(p) is None:
physical_to_logical[p] = [last_portname]
else:
physical_to_logical[p].append(last_portname)
last_fp_port_index = fp_port_index
last_portname = portname
port_pos_in_file += 1
self.logical = logical
self.logical_to_bcm = logical_to_bcm
self.logical_to_physical = logical_to_physical
self.physical_to_logical = physical_to_logical
#print(self.logical_to_physical)
'''print("logical: " + self.logical)
print("logical to bcm: " + self.logical_to_bcm)
print("logical to physical: " + self.logical_to_physical)
print("physical to logical: " + self.physical_to_logical)'''
#print("exiting port_tab_mappings")
@property
def port_start(self):
return self._port_start
@property
def port_end(self):
return self._port_end
@property
def qsfp_ports(self):
return self._qsfp_ports
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def get_transceiver_change_event(self):
raise NotImplementedError

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}