Skip to content

Commit

Permalink
[devices]: Add support for the Nokia-7215 platform (sonic-net#5827)
Browse files Browse the repository at this point in the history
Platform: armhf-nokia_ixs7215_52x-r0
HwSKU: Nokia-7215
ASIC: marvell
Port Config: 48x1G + 4x10G

Co-authored-by: dflynn <dennis.flynn@nokia.com>
Co-authored-by: Carl Keene <keene@nokia.com>
  • Loading branch information
3 people authored Nov 19, 2020
1 parent 3be3f4d commit 0a9d7a2
Show file tree
Hide file tree
Showing 54 changed files with 4,316 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{% for port_idx in range(0,32) %}
{% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %}
{% endfor %}
{%- endmacro %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "7326924",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"1518",
"dynamic_th":"3"
}
},
{%- endmacro %}
53 changes: 53 additions & 0 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/Nokia-7215/port_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# name lanes alias index speed
Ethernet0 1 Ethernet0 1 1000
Ethernet1 2 Ethernet1 2 1000
Ethernet2 3 Ethernet2 3 1000
Ethernet3 4 Ethernet3 4 1000
Ethernet4 5 Ethernet4 5 1000
Ethernet5 6 Ethernet5 6 1000
Ethernet6 7 Ethernet6 7 1000
Ethernet7 8 Ethernet7 8 1000
Ethernet8 9 Ethernet8 9 1000
Ethernet9 10 Ethernet9 10 1000
Ethernet10 11 Ethernet10 11 1000
Ethernet11 12 Ethernet11 12 1000
Ethernet12 13 Ethernet12 13 1000
Ethernet13 14 Ethernet13 14 1000
Ethernet14 15 Ethernet14 15 1000
Ethernet15 16 Ethernet15 16 1000
Ethernet16 17 Ethernet16 17 1000
Ethernet17 18 Ethernet17 18 1000
Ethernet18 19 Ethernet18 19 1000
Ethernet19 20 Ethernet19 20 1000
Ethernet20 21 Ethernet20 21 1000
Ethernet21 22 Ethernet21 22 1000
Ethernet22 23 Ethernet22 23 1000
Ethernet23 24 Ethernet23 24 1000
Ethernet24 25 Ethernet24 25 1000
Ethernet25 26 Ethernet25 26 1000
Ethernet26 27 Ethernet26 27 1000
Ethernet27 28 Ethernet27 28 1000
Ethernet28 29 Ethernet28 29 1000
Ethernet29 30 Ethernet29 30 1000
Ethernet30 31 Ethernet30 31 1000
Ethernet31 32 Ethernet31 32 1000
Ethernet32 33 Ethernet32 33 1000
Ethernet33 34 Ethernet33 34 1000
Ethernet34 35 Ethernet34 35 1000
Ethernet35 36 Ethernet35 36 1000
Ethernet36 37 Ethernet36 37 1000
Ethernet37 38 Ethernet37 38 1000
Ethernet38 39 Ethernet38 39 1000
Ethernet39 40 Ethernet39 40 1000
Ethernet40 41 Ethernet40 41 1000
Ethernet41 42 Ethernet41 42 1000
Ethernet42 43 Ethernet42 43 1000
Ethernet43 44 Ethernet43 44 1000
Ethernet44 45 Ethernet44 45 1000
Ethernet45 46 Ethernet45 46 1000
Ethernet46 47 Ethernet46 47 1000
Ethernet47 48 Ethernet47 48 1000
Ethernet48 49 Ethernet48 49 10000
Ethernet49 50 Ethernet49 50 10000
Ethernet50 51 Ethernet50 51 10000
Ethernet51 52 Ethernet51 52 10000
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# name lanes alias index speed
Ethernet0 1 Ethernet0 1 1000
Ethernet1 2 Ethernet1 2 1000
Ethernet2 3 Ethernet2 3 1000
Ethernet3 4 Ethernet3 4 1000
Ethernet4 5 Ethernet4 5 1000
Ethernet5 6 Ethernet5 6 1000
Ethernet6 7 Ethernet6 7 1000
Ethernet7 8 Ethernet7 8 1000
Ethernet8 9 Ethernet8 9 1000
Ethernet9 10 Ethernet9 10 1000
Ethernet10 11 Ethernet10 11 1000
Ethernet11 12 Ethernet11 12 1000
Ethernet12 13 Ethernet12 13 1000
Ethernet13 14 Ethernet13 14 1000
Ethernet14 15 Ethernet14 15 1000
Ethernet15 16 Ethernet15 16 1000
Ethernet16 17 Ethernet16 17 1000
Ethernet17 18 Ethernet17 18 1000
Ethernet18 19 Ethernet18 19 1000
Ethernet19 20 Ethernet19 20 1000
Ethernet20 21 Ethernet20 21 1000
Ethernet21 22 Ethernet21 22 1000
Ethernet22 23 Ethernet22 23 1000
Ethernet23 24 Ethernet23 24 1000
Ethernet24 25 Ethernet24 25 1000
Ethernet25 26 Ethernet25 26 1000
Ethernet26 27 Ethernet26 27 1000
Ethernet27 28 Ethernet27 28 1000
Ethernet28 29 Ethernet28 29 1000
Ethernet29 30 Ethernet29 30 1000
Ethernet30 31 Ethernet30 31 1000
Ethernet31 32 Ethernet31 32 1000
Ethernet32 33 Ethernet32 33 1000
Ethernet33 34 Ethernet33 34 1000
Ethernet34 35 Ethernet34 35 1000
Ethernet35 36 Ethernet35 36 1000
Ethernet36 37 Ethernet36 37 1000
Ethernet37 38 Ethernet37 38 1000
Ethernet38 39 Ethernet38 39 1000
Ethernet39 40 Ethernet39 40 1000
Ethernet40 41 Ethernet40 41 1000
Ethernet41 42 Ethernet41 42 1000
Ethernet42 43 Ethernet42 43 1000
Ethernet43 44 Ethernet43 44 1000
Ethernet44 45 Ethernet44 45 1000
Ethernet45 46 Ethernet45 46 1000
Ethernet46 47 Ethernet46 47 1000
Ethernet48 49 Ethernet48 49 10000
Ethernet49 50 Ethernet49 50 10000
Ethernet50 51 Ethernet50 51 10000
Ethernet51 52 Ethernet51 52 10000
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# name lanes alias index speed
Ethernet0 1 Ethernet0 1 1000
Ethernet1 2 Ethernet1 2 1000
Ethernet2 3 Ethernet2 3 1000
Ethernet3 4 Ethernet3 4 1000
Ethernet4 5 Ethernet4 5 1000
Ethernet5 6 Ethernet5 6 1000
Ethernet6 7 Ethernet6 7 1000
Ethernet7 8 Ethernet7 8 1000
Ethernet8 9 Ethernet8 9 1000
Ethernet9 10 Ethernet9 10 1000
Ethernet10 11 Ethernet10 11 1000
Ethernet11 12 Ethernet11 12 1000
Ethernet12 13 Ethernet12 13 1000
Ethernet13 14 Ethernet13 14 1000
Ethernet14 15 Ethernet14 15 1000
Ethernet15 16 Ethernet15 16 1000
Ethernet16 17 Ethernet16 17 1000
Ethernet17 18 Ethernet17 18 1000
Ethernet18 19 Ethernet18 19 1000
Ethernet19 20 Ethernet19 20 1000
Ethernet20 21 Ethernet20 21 1000
Ethernet21 22 Ethernet21 22 1000
Ethernet22 23 Ethernet22 23 1000
Ethernet23 24 Ethernet23 24 1000
Ethernet24 25 Ethernet24 25 1000
Ethernet25 26 Ethernet25 26 1000
Ethernet26 27 Ethernet26 27 1000
Ethernet27 28 Ethernet27 28 1000
Ethernet28 29 Ethernet28 29 1000
Ethernet29 30 Ethernet29 30 1000
Ethernet30 31 Ethernet30 31 1000
Ethernet31 32 Ethernet31 32 1000
Ethernet32 33 Ethernet32 33 1000
Ethernet33 34 Ethernet33 34 1000
Ethernet34 35 Ethernet34 35 1000
Ethernet35 36 Ethernet35 36 1000
Ethernet36 37 Ethernet36 37 1000
Ethernet37 38 Ethernet37 38 1000
Ethernet38 39 Ethernet38 39 1000
Ethernet39 40 Ethernet39 40 1000
Ethernet40 41 Ethernet40 41 1000
Ethernet41 42 Ethernet41 42 1000
Ethernet42 43 Ethernet42 43 1000
Ethernet43 44 Ethernet43 44 1000
Ethernet44 45 Ethernet44 45 1000
Ethernet45 46 Ethernet45 46 1000
Ethernet46 47 Ethernet46 47 1000
Ethernet47 48 Ethernet47 48 1000
Ethernet48 49 Ethernet48 49 10000
Ethernet49 50 Ethernet49 50 10000
Ethernet50 51 Ethernet50 51 10000
Ethernet51 52 Ethernet51 52 10000
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
switchMacAddress=XX:XX:XX:XX:XX:XX
ledMode=ac3x97bits
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
switchMacAddress=XX:XX:XX:XX:XX:XX
inbandMgmtPortNum=48
ledMode=ac3x97bits
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
switchMacAddress=XX:XX:XX:XX:XX:XX
ledMode=ac3x97bits
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode=1
hwId=et6448m
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini
1 change: 1 addition & 0 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/default_sku
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Nokia-7215 l2
10 changes: 10 additions & 0 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/platform_components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"chassis": {
"7215 IXS-T1": {
"component": {
"U-Boot": { },
"System-CPLD": { }
}
}
}
}
14 changes: 14 additions & 0 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
try:
import os
from sonic_eeprom import eeprom_tlvinfo
except ImportError as 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 = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
if not os.path.exists(self.eeprom_path):
os.system("echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-0/new_device")
super(board, self).__init__(self.eeprom_path, 0, '', True)
125 changes: 125 additions & 0 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
#

try:
from sonic_led.led_control_base import LedControlBase
import os
import time
import syslog
import sonic_platform.platform
import sonic_platform.chassis
except ImportError as e:
raise ImportError(str(e) + " - required module not found")

smbus_present = 1

try:
import smbus
except ImportError as e:
smbus_present = 0


def DBG_PRINT(str):
syslog.openlog("nokia-led")
syslog.syslog(syslog.LOG_INFO, str)
syslog.closelog()


class LedControl(LedControlBase):
"""Platform specific LED control class"""

# Constructor
def __init__(self):
self.chassis = sonic_platform.platform.Platform().get_chassis()
self._initDefaultConfig()

def _initDefaultConfig(self):
# For the D1 box the port leds are controlled by Trident3 LED program
# The fan tray leds will be managed with the new thermalctl daemon / chassis class based API
# leaving only the system leds to be done old style
DBG_PRINT("starting system leds")
self._initSystemLed()
DBG_PRINT(" led done")

def _set_i2c_register(self, reg_file, value):
# On successful write, the value read will be written on
# reg_name and on failure returns 'ERR'
rv = 'ERR'

if (not os.path.isfile(reg_file)):
return rv
try:
with open(reg_file, 'w') as fd:
rv = fd.write(str(value))
except Exception as e:
rv = 'ERR'

return rv

def _initSystemLed(self):
# Front Panel System LEDs setting
oldfan = 0xf
oldpsu = 0xf

# Write sys led
if smbus_present == 0:
DBG_PRINT(" PMON LED SET ERROR -> smbus present = 0 ")
else:
bus = smbus.SMBus(0)
DEVICE_ADDRESS = 0x41
DEVICEREG = 0x7
bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, 0x02)
DBG_PRINT(" System LED set O.K. ")

while True:
# Front Panel FAN Panel LED setting in register 0x08
if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True):
if oldfan != 0x1:
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
oldfan = 0x1
else:
if oldfan != 0x0:
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
oldfan = 0x0

# Front Panel PSU Panel LED setting in register 0x09
if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True):
if oldpsu != 0x1:
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
oldpsu = 0x1
else:
if oldpsu != 0x0:
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
oldpsu = 0x0
time.sleep(6)

# Helper method to map SONiC port name to index
def _port_name_to_index(self, port_name):
# Strip "Ethernet" off port name
if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX):
return -1

port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):])
return port_idx

def _port_state_to_mode(self, port_idx, state):
DBG_PRINT("_port_state_to_mode")

def _port_led_mode_update(self, port_idx, ledMode):
DBG_PRINT("_port_led_mode_update")

# called when port states change- implementation of port_link_state_change() method if needed
def port_link_state_change(self, portname, state):
# DBG_PRINT("port_link_state_change ")
return
Loading

0 comments on commit 0a9d7a2

Please sign in to comment.