diff --git a/.gitignore b/.gitignore index 96a073d67fc0..b2c3e81854b0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ src/snmpd/* !src/snmpd/Makefile src/thrift/* !src/thrift/Makefile +src/sonic-device-data/src/device/ # Autogenerated Dockerfiles dockers/docker-database/Dockerfile diff --git a/README.md b/README.md index 5e3cffec91dc..ce41a8f97196 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,51 @@ -Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) -Cavium[![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) -P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) -# Build SONiC Switch Images - buildimage +# sonic-buildimage + +## Build SONiC Switch Images # Description Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. -# Prerequisite -# SAI Version +# Prerequisites + +## SAI Version SONiC V2 is using [SAI 0.9.4](https://github.com/opencomputeproject/SAI/tree/v0.9.4). -# Clone or fetch the code repository with all git submodules -To clone the code repository recursively, assuming git version 1.9 or newer +## Clone or fetch the code repository with all git submodules +To clone the code repository recursively, assuming git version 1.9 or newer: git clone --recursive https://github.com/Azure/sonic-buildimage.git -If it is already cloned, however there is no files under ./dockers/docker-base/ or ./src/sonic-linux-kernel/, manually fetch all the git submodules. - +NOTE: If the repo has already been cloned, however there are no files under the submodule directories (e.g., src/lldpd, src/ptf, src/sonic-linux-kernel, etc.), you can manually fetch all the git submodules as follows: git submodule update --init --recursive -You also need to change all git paths to relative path as we build all submodules inside the docker. +You also need to change all git paths to relative path as we build all submodules inside the docker: git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git' -# Usage +## Usage -To build NOS installer image and docker images, run command line +To build NOS installer image and docker images, run the following commands: make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] make - **NOTE**: We recommend to reserve 50G free space to build one platform. + **NOTE**: We recommend reserving 50G free space to build one platform. -Supported PLATFORM AND SKU are: +Supported PLATFORM and SKU are: - PLATFORM=broadcom SKU=Force10-S6000 - PLATFORM=mellanox SKU=ACS-MSN2700 - PLATFORM=cavium SKU=AS7512 - PLATFORM=p4 -You can find rules/config file useful. It contains configuration options for build process, like adding more verbosity or showing dependencies, username and password for base image etc. +You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. Every docker image is built and saved to target/ directory. -So, for instance, to build only docker-database, execute +So, for instance, to build only docker-database, execute: make target/docker-database.gz @@ -51,37 +53,37 @@ Same goes for debian packages, which are under target/debs/: make target/debs/swss_1.0.0_amd64.deb -Every target has a clean target, so in order to clean swss, execute +Every target has a clean target, so in order to clean swss, execute: make target/debs/swss_1.0.0_amd64.deb-clean -It is recommended to use clean targets to clean all packages, that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md). +It is recommended to use clean targets to clean all packages that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md). -# Note: -If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. -It is a one time action, so be patient. +## Notes: +- If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. +This may take a while, but it is a one-time action, so please be patient. -The root is disabled, but the created user could sudo. +- The root user account is disabled. However, the created user can sudo. -The target directory is ./target, containing the NOS installer image and docker images. -- sonic-generic.bin: SONiC switch installer image (ONIE compatiable) -- sonic-aboot.bin: SONiC switch installer image (Aboot compatiable) -- docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) -- docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) -- docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) -- docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) -- docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) -- docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) -- docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) -- docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) -- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) -- docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) +- The target directory is ./target, containing the NOS installer image and docker images. + - sonic-generic.bin: SONiC switch installer image (ONIE compatiable) + - sonic-aboot.bin: SONiC switch installer image (Aboot compatiable) + - docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) + - docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) + - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) + - docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) + - docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) + - docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) + - docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) + - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) + - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) + - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) -# Contribution guide +## Contribution Guide All contributors must sign a contribution license agreement before contributions can be accepted. Contact sonic-cla-agreements@microsoft.com. -### GitHub Workflow +## GitHub Workflow We're following basic GitHub Flow. If you have no idea what we're talking about, check out [GitHub's official guide](https://guides.github.com/introduction/flow/). Note that merge is only performed by the repository maintainer. diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini new file mode 100644 index 000000000000..c10cd2786941 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini new file mode 100644 index 000000000000..b9ab8854a2ec --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 125,126,127,128 Ethernet1/1 +Ethernet4 121,122,123,124 Ethernet2/1 +Ethernet8 13,14,15,16 Ethernet3/1 +Ethernet12 9,10,11,12 Ethernet4/1 +Ethernet16 17,18,19,20 Ethernet5/1 +Ethernet20 21,22,23,24 Ethernet6/1 +Ethernet24 25,26,27,28 Ethernet7/1 +Ethernet28 29,30,31,32 Ethernet8/1 +Ethernet32 37,38,39,40 Ethernet9/1 +Ethernet36 33,34,35,36 Ethernet10/1 +Ethernet40 45,46,47,48 Ethernet11/1 +Ethernet44 41,42,43,44 Ethernet12/1 +Ethernet48 53,54,55,56 Ethernet13/1 +Ethernet52 49,50,51,52 Ethernet14/1 +Ethernet56 69,70,71,72 Ethernet15/1 +Ethernet60 65,66,67,68 Ethernet16/1 +Ethernet64 77,78,79,80 Ethernet17/1 +Ethernet68 73,74,75,76 Ethernet18/1 +Ethernet72 93,94,95,96 Ethernet19/1 +Ethernet76 89,90,91,92 Ethernet20/1 +Ethernet80 101,102,103,104 Ethernet21/1 +Ethernet84 97,98,99,100 Ethernet22/1 +Ethernet88 109,110,111,112 Ethernet23/1 +Ethernet92 105,106,107,108 Ethernet24/1 +Ethernet96 61,62,63,64 Ethernet25 +Ethernet100 57,58,59,60 Ethernet26 +Ethernet104 81,82,83,84 Ethernet27 +Ethernet108 85,86,87,88 Ethernet28 +Ethernet112 117,118,119,120 Ethernet29 +Ethernet116 113,114,115,116 Ethernet30 +Ethernet120 5,6,7,8 Ethernet31 +Ethernet124 1,2,3,4 Ethernet32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile new file mode 100644 index 000000000000..76ffdfc028ed --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py new file mode 100644 index 000000000000..f8a3515d924f --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python + +############################################################################# +# Arista 7050-QX32 +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import subprocess + import re + import struct + import zlib + import StringIO + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +def showMac( m ): + return ":".join([m[0:2], m[2:4], m[4:6], m[6:8], m[8:10], m[10:12]]) + +typeMap = { + "END" : ( "00", None, None, None, False ), + "SKU" : ( "03", None, None, None, False ), + "MAC" : ( "05", None, showMac, None, False ), + "SerialNumber" : ( "0E", None, None, None, False ), + } + +idToNameMap = {} +for k, v in typeMap.iteritems(): + idToNameMap[ v[0] ] = k + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + _TLV_HDR_ENABLED = 0 + + pFdl = None + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/drivers/eeprom/1-0052/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + + def _decode_eeprom(self, e): + # For format 0002 and more recent fdls use the new Prefdl class + data = e[0:4] + if data in ("0002", "0003"): + fp = StringIO.StringIO(e[4:]) + self.pFdl = PreFdl( fp, data, data ) + + def decode_eeprom(self, e): + self._decode_eeprom(e) + return self.pFdl.show() + + def is_checksum_valid(self, e): + self._decode_eeprom(e) + return (True, self.pFdl.get_crc()) + + def serial_number_str(self, e): + self._decode_eeprom(e) + return self.pFdl.get_field('SerialNumber') + + def mgmtaddrstr(self,e): + self._decode_eeprom(e) + return self.pFdl.get_field('MAC') + +def crc32( data ): + return struct.unpack("I",struct.pack("i",zlib.crc32( data )))[0] + +def validSerial( x ): + x = x.replace( " ", "" ) + x = x.replace( "-", "" ) + # All serial numbers are upper case + x = x.upper() + if re.compile( "[A-Z]{3}\d{4}[A-Z0-9]{4}$" ).match( x ): + return x + return None + +class PreFdlField( ): + def __init__( self, name, valid, show, optionName, data=None, append=False ): + self.name = name + if valid: + self.valid = valid + else: + self.valid = lambda x: x + self.show = show + self.optionName = optionName + self.data = [] + self.append = append + if data: + self.dataIs( data ) + + def dataIs( self, data ): + vd = self.valid( data ) + if not vd: + raise InvalidPrefdlData( "Invalid %s: %s" % ( self.name, data ) ) + if self.append: + self.data.append( vd ) + else: + self.data = [ vd ] + +class TlvField( PreFdlField ): + def __init__( self, name ): + args = typeMap.get( name ) + valid = None + show = None + optionName = None + append = False + if args: + self.id, valid, show, optionName, append = args + PreFdlField.__init__( self, name, valid, show, optionName, append=append ) + + +class PreFdl(): + def __init__( self, fp=None, preFdlStr=None, version="0002" ): + # populate the required fields + self.requiredFields = [] + self.mac = None + self.serial = None + + if version == "0002": + preFdlStr, offset = self.initPreFdl2( fp, preFdlStr ) + elif version == "0003": + preFdlStr, offset = self.initPreFdl3( fp, preFdlStr ) + else: + raise NotImplementedError( + "Only Prefdl data format version 0002 or 0003 are supported" ) + + # populate the tlv fileds + self.tlvFields = {} + for k in typeMap.keys(): + self.tlvFields[ k ] = TlvField( k ) + + # create the map option to field + self.optionMap = {} + for f in self.requiredFields + self.tlvFields.values(): + # Do not add the option from TLV if already added by required fields + if f.optionName and f.optionName not in self.optionMap: + self.optionMap[ f.optionName ] = f + + # save the current tlv fields + if fp: + while True: + tlv = fp.read( 6 ) + ( id, lengthStr ) = ( tlv[0:2], tlv[2:6] ) + length = int( lengthStr, base=16 ) + bytes = fp.read( length ) + what = None if id not in idToNameMap.keys() else idToNameMap[ id ] + if what and what != "END": + self.tlvFields[ what ].dataIs( bytes ) + preFdlStr += tlv + bytes + offset += 6 + length + if what == "END": + # End of the tlv list + break + self.crc = fp.read( 8 ) + # Check the CRC + computed = crc32( preFdlStr ) + if int( self.crc, 16 ) != computed: + raise Exception( "Invalid CRC -- saw %s expected %8X" % + ( self.crc, computed ) ) + + # Initialize and parse fixed section for prefdl version 2. Return the offset + # to where the TLV section starts. + def initPreFdl2( self, fp, preFdlStr ): + # if we start with an existing file + if fp: + # if no preFdlStr is specified, read the fixed section, 30 bytes. + # Otherwise, only the 4 byte data version section was written and + # read the remaining 26 bytes from the fixed section. + if not preFdlStr: + preFdlStr = fp.read( 30 ).strip() + elif preFdlStr == "0002": + preFdlStr += fp.read( 26 ).strip() + else: + raise ValueError( "preFdlStr arg has invalid data format" ) + if len( preFdlStr ) < 12: + fatal( "prefdl is too short exiting" ) + data = None if not preFdlStr else preFdlStr[ 16:16 + 11 ] + self.requiredFields.append( + PreFdlField( "SerialNumber", validSerial, None, None, data ) ) + return preFdlStr, 30 + + # Initialize and parse fixed section for prefdl version 3. Return the offset + # to where the TLV section starts. + def initPreFdl3( self, fp, preFdlStr ): + # if we start with an existing file + currPtr = 0 + if fp and not preFdlStr: + preFdlStr = fp.read( 4 ).strip() + if len( preFdlStr ) < 4: + fatal( "prefdl is too short exiting" ) + return preFdlStr, 4 + + def show( self ): + for f in self.requiredFields + self.tlvFields.values(): + for d in f.data: + dStr = d if f.show is None else f.show( d ) + print "%s: %s" % ( f.name, dStr ) + + def get_field( self, name ): + for f in self.requiredFields + self.tlvFields.values(): + for d in f.data: + if f.name == name: + dStr = d if f.show is None else f.show( d ) + return dStr + + def get_crc( self ): + return self.crc + diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py new file mode 100644 index 000000000000..5d2d28b8f328 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 10 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf new file mode 100644 index 000000000000..7745054a05ca --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -0,0 +1,79 @@ +# libsensors configuration file +# ---------------------------------------------- +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +chip "lm73-i2c-3-48" + label temp1 "Rear Temp Sensor" + set temp1_max 65 + #set temp1_max_alarm 75 # read-only + +chip "lm86-i2c-2-4c" + label temp1 "Board Temp Sensor" + set temp1_max 65 + set temp1_crit 75 + + label temp2 "Front-panel Temp Sensor" + set temp2_max 65 + set temp2_crit 75 + +chip "pmbus-i2c-3-4e" + label temp1 "Power Controller Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Controller Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore curr1 + +chip "pmbus-i2c-5-58" + label temp1 "Power Supply 1 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 1 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 + +chip "pmbus-i2c-6-58" + label temp1 "Power Supply 2 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 2 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini new file mode 100644 index 000000000000..414fb94efbc1 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 33,34,35,36 Ethernet1/1 +Ethernet4 37,38,39,40 Ethernet2/1 +Ethernet8 41,42,43,44 Ethernet3/1 +Ethernet12 45,46,47,48 Ethernet4/1 +Ethernet16 49,50,51,52 Ethernet5/1 +Ethernet20 53,54,55,56 Ethernet6/1 +Ethernet24 57,58,59,60 Ethernet7/1 +Ethernet28 61,62,63,64 Ethernet8/1 +Ethernet32 65,66,67,68 Ethernet9/1 +Ethernet36 69,70,71,72 Ethernet10/1 +Ethernet40 73,74,75,76 Ethernet11/1 +Ethernet44 77,78,79,80 Ethernet12/1 +Ethernet48 81,82,83,84 Ethernet13/1 +Ethernet52 85,86,87,88 Ethernet14/1 +Ethernet56 89,90,91,92 Ethernet15/1 +Ethernet60 93,94,95,96 Ethernet16/1 +Ethernet64 97,98,99,100 Ethernet17/1 +Ethernet68 101,102,103,104 Ethernet18/1 +Ethernet72 105,106,107,108 Ethernet19/1 +Ethernet76 109,110,111,112 Ethernet20/1 +Ethernet80 113,114,115,116 Ethernet21/1 +Ethernet84 117,118,119,120 Ethernet22/1 +Ethernet88 121,122,123,124 Ethernet23/1 +Ethernet92 125,126,127,128 Ethernet24/1 +Ethernet96 1,2,3,4 Ethernet25/1 +Ethernet100 5,6,7,8 Ethernet26/1 +Ethernet104 9,10,11,12 Ethernet27/1 +Ethernet108 13,14,15,16 Ethernet28/1 +Ethernet112 17,18,19,20 Ethernet29/1 +Ethernet116 21,22,23,24 Ethernet30/1 +Ethernet120 25,26,27,28 Ethernet31/1 +Ethernet124 29,30,31,32 Ethernet32/1 diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf new file mode 100644 index 000000000000..3b4dd2385322 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -0,0 +1,47 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +# missing support for +# chip "max6697-i2c-2-1a" +# board sensor 65 75 +# (1) switch chip left sensor 95 105 +# (5) switch chip right sensor 95 105 +# (6) front panel temp sensor 65 75 + +chip "max6658-i2c-3-4c" + label temp1 "Cpu board temp sensor" + set temp1_max 75 + set temp1_crit 80 + + label temp2 "Back panel temp sensor" + set temp2_max 75 + set temp2_crit 80 + +chip "pmbus-i2c-3-4e" + label temp1 "Power controller 1 sensor 1" + label temp2 "Power controller 1 sensor 2" + +chip "pmbus-i2c-7-4e" + label temp1 "Power controller 2 sensor 1" + label temp2 "Power controller 2 sensor 2" + +chip "pmbus-i2c-6-58" + label temp1 "Power supply 1 hotspot sensor" + label temp2 "Power supply 1 inlet temp sensor" + label temp3 "Power supply 1 sensor" + +chip "pmbus-i2c-5-58" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 sensor" + diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini new file mode 100644 index 000000000000..06898f1d7964 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 29,30,31,32 fortyGigE0/0 +Ethernet4 25,26,27,28 fortyGigE0/4 +Ethernet8 37,38,39,40 fortyGigE0/8 +Ethernet12 33,34,35,36 fortyGigE0/12 +Ethernet16 41,42,43,44 fortyGigE0/16 +Ethernet20 45,46,47,48 fortyGigE0/20 +Ethernet24 5,6,7,8 fortyGigE0/24 +Ethernet28 1,2,3,4 fortyGigE0/28 +Ethernet32 9,10,11,12 fortyGigE0/32 +Ethernet36 13,14,15,16 fortyGigE0/36 +Ethernet40 21,22,23,24 fortyGigE0/40 +Ethernet44 17,18,19,20 fortyGigE0/44 +Ethernet48 49,50,51,52 fortyGigE0/48 +Ethernet52 53,54,55,56 fortyGigE0/52 +Ethernet56 61,62,63,64 fortyGigE0/56 +Ethernet60 57,58,59,60 fortyGigE0/60 +Ethernet64 65,66,67,68 fortyGigE0/64 +Ethernet68 69,70,71,72 fortyGigE0/68 +Ethernet72 77,78,79,80 fortyGigE0/72 +Ethernet76 73,74,75,76 fortyGigE0/76 +Ethernet80 105,106,107,108 fortyGigE0/80 +Ethernet84 109,110,111,112 fortyGigE0/84 +Ethernet88 117,118,119,120 fortyGigE0/88 +Ethernet92 113,114,115,116 fortyGigE0/92 +Ethernet96 121,122,123,124 fortyGigE0/96 +Ethernet100 125,126,127,128 fortyGigE0/100 +Ethernet104 85,86,87,88 fortyGigE0/104 +Ethernet108 81,82,83,84 fortyGigE0/108 +Ethernet112 89,90,91,92 fortyGigE0/112 +Ethernet116 93,94,95,96 fortyGigE0/116 +Ethernet120 97,98,99,100 fortyGigE0/120 +Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile new file mode 100644 index 000000000000..b64d997fb451 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s6000-32x40G.config.bcm diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py new file mode 100644 index 000000000000..f08c5ba52cec --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python + +############################################################################# +# Dell S6000 +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import subprocess + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 128 + _TLV_HDR_ENABLED = 0 + + _TLV_BLOCK_NUMBER = 3 + _TLV_BLOCK_HDR_STRING = "\x3a\x29" + + _TLV_CODE_MFG = 0x20 + _TLV_CODE_SW = 0x1f + _TLV_CODE_MAC = 0x21 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-10/10-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + + def decode_eeprom(self, e): + tlv_block_index = 0 + tlv_index = self.eeprom_start + tlv_end = self._TLV_INFO_MAX_LEN + + print "TLV Name Len Value" + print "-------------------- --- -----" + while tlv_block_index < self._TLV_BLOCK_NUMBER: + if not self.is_valid_block(e[tlv_index:]): + print "Invalid TLV field starting at EEPROM offset %d" % (tlv_index,) + return + print self.decoder(None, e[tlv_index:tlv_index + ord(e[tlv_index+2])]) + if not self.is_valid_block_checksum(e[tlv_index:tlv_index + ord(e[tlv_index+2])]): + print "(*** checksum invalid)" + tlv_index += ord(e[tlv_index+2]) + tlv_block_index += 1 + + def is_valid_block(self, e): + return (len(e) >= 8 and ord(e[2]) <= len(e) and \ + e[0:2] == self._TLV_BLOCK_HDR_STRING) + + def is_valid_block_checksum(self, e): + crc = self.compute_dell_crc(e[:-2]) + tlv_crc = ord(e[-1]) << 8 | ord(e[-2]) + return crc == tlv_crc + + def decoder(self, s, t): + ret = "" + if ord(t[4]) == self._TLV_CODE_MFG: + name = "PPID" + value = t[6:8] + "-" + t[8:14] + "-" + t[14:19] + "-" + \ + t[19:22] + "-" + t[22:26] + ret += "%-20s %3d %s\n" % (name, 20, value) + name = "DPN Rev" + ret += "%-20s %3d %s\n" % (name, 3, t[26:29]) + name = "Service Tag" + ret += "%-20s %3d %s\n" % (name, 7, t[29:36]) + name = "Part Number" + ret += "%-20s %3d %s\n" % (name, 10, t[36:46]) + name = "Part Number Rev" + ret += "%-20s %3d %s\n" % (name, 3, t[46:49]) + name = "Mfg Test Results" + ret += "%-20s %3d %s" % (name, 2, t[49:51]) + if ord(t[4]) == self._TLV_CODE_SW: + name = "Card ID" + ret += "%-20s %3d 0x%s\n" % (name, 2, t[6:8].encode('hex')) + name = "Module ID" + ret += "%-20s %3d %s" % (name, 2, ord(t[8:9])) + if ord(t[4]) == self._TLV_CODE_MAC: + name = "Base MAC Address" + value = ":".join([binascii.b2a_hex(T) for T in t[6:12]]).upper() + ret += "%-20s %3d %s" % (name, 12, value) + return ret + + def is_checksum_valid(self, e): + # Checksum is already calculated before + return (True, 0) + + def get_tlv_index(self, e, code): + tlv_index = 0 + while tlv_index < len(e): + if not self.is_valid_block(e[tlv_index:]): + return (False, 0) + if ord(e[tlv_index+4]) == code: + if not self.is_valid_block_checksum(e[tlv_index:tlv_index + ord(e[tlv_index+2])]): + print "(*** checksum invalid)" + return (True, tlv_index) + tlv_index += ord(e[tlv_index+2]) + return (Flase, 0) + + def base_mac_addr(self, e): + (is_valid, t) = self.get_tlv_index(e, self._TLV_CODE_MAC) + if not is_valid: + return "Bad base MAC address" + return ":".join([binascii.b2a_hex(T) for T in e[t:][6:12]]).upper() + + def serial_number_str(self, e): + ''' Return Service Tag ''' + (is_valid, t) = self.get_tlv_index(e, self._TLV_CODE_MFG) + if not is_valid: + return "Bad service tag" + t = e[t:] + return t[29:36] diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py new file mode 100644 index 000000000000..8b1ec277d79f --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 20 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf new file mode 100644 index 000000000000..2208bb6340d1 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf @@ -0,0 +1,57 @@ +# libsensors configuration file +# -------------------------------------------------- +# + +# tmp75-i2c-11-4c has sensors close to Networking ASIC. +# tmp75-i2c-11-4d has sensors close to NIC. +# tmp75-i2c-11-4e is an ambient temperature sensor. + +chip "tmp75-*" + set temp1_max 50 + set temp1_max_hyst 25 + +# emc1403-i2c-10-4d has following temperature sensors: +# temp1: CPU0 external Temp Sensor +# temp2: CPU1 external Temp Sensor +# temp3: CPU Internal DTS (Internal die, max of all die readings) + +chip "emc1403-*" + set temp1_crit 85 + set temp1_max 50 + set temp2_crit 85 + set temp2_max 50 + set temp3_crit 85 + set temp3_max 50 + +chip "max6620-i2c-*-2a" + ignore fan3 + ignore fan4 + +chip "w83627dhg-*" + label in0 "VCore 1" + label in1 "VCore 2" + set in0_min 0 + set in0_max 1.74 + set in1_min 0 + set in1_max 1.74 + ignore fan1 + ignore fan2 + ignore fan3 + ignore fan4 + ignore fan5 + ignore in4 + ignore in5 + ignore in6 + ignore temp1 + ignore temp2 + ignore temp3 + ignore cpu0_vid + ignore intrusion0 + +chip "jc42-*" + set temp1_max 50 + set temp1_crit 85 + +chip "dni_dps460-*" + set temp1_max 50 + set temp2_max 50 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini new file mode 100644 index 000000000000..dcdd6548c198 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias +Ethernet0 101,102 fortyGigE1/1/1 +Ethernet1 103,104 fortyGigE1/1/2 +Ethernet2 97,98 fortyGigE1/1/3 +Ethernet3 99,100 fortyGigE1/1/4 +Ethernet4 69,70 fortyGigE1/1/5 +Ethernet5 71,72 fortyGigE1/1/6 +Ethernet6 65,66 fortyGigE1/1/7 +Ethernet7 67,68 fortyGigE1/1/8 +Ethernet8 53,54 fortyGigE1/1/9 +Ethernet9 55,56 fortyGigE1/1/10 +Ethernet10 49,50 fortyGigE1/1/11 +Ethernet11 51,52 fortyGigE1/1/12 +Ethernet12 21,22 fortyGigE1/1/13 +Ethernet13 23,24 fortyGigE1/1/14 +Ethernet14 17,18 fortyGigE1/1/15 +Ethernet15 19,20 fortyGigE1/1/16 +Ethernet16 25,26 fortyGigE1/2/1 +Ethernet17 27,28 fortyGigE1/2/2 +Ethernet18 29,30 fortyGigE1/2/3 +Ethernet19 31,32 fortyGigE1/2/4 +Ethernet20 57,58 fortyGigE1/2/5 +Ethernet21 59,60 fortyGigE1/2/6 +Ethernet22 61,62 fortyGigE1/2/7 +Ethernet23 63,64 fortyGigE1/2/8 +Ethernet24 73,74 fortyGigE1/2/9 +Ethernet25 75,76 fortyGigE1/2/10 +Ethernet26 77,78 fortyGigE1/2/11 +Ethernet27 79,80 fortyGigE1/2/12 +Ethernet28 105,106 fortyGigE1/2/13 +Ethernet29 107,108 fortyGigE1/2/14 +Ethernet30 109,110 fortyGigE1/2/15 +Ethernet31 111,112 fortyGigE1/2/16 +Ethernet32 13,14 fortyGigE1/3/1 +Ethernet33 15,16 fortyGigE1/3/2 +Ethernet34 9,10 fortyGigE1/3/3 +Ethernet35 11,12 fortyGigE1/3/4 +Ethernet36 125,126 fortyGigE1/3/5 +Ethernet37 127,128 fortyGigE1/3/6 +Ethernet38 121,122 fortyGigE1/3/7 +Ethernet39 123,124 fortyGigE1/3/8 +Ethernet40 93,94 fortyGigE1/3/9 +Ethernet41 95,96 fortyGigE1/3/10 +Ethernet42 89,90 fortyGigE1/3/11 +Ethernet43 91,92 fortyGigE1/3/12 +Ethernet44 45,46 fortyGigE1/3/13 +Ethernet45 47,48 fortyGigE1/3/14 +Ethernet46 41,42 fortyGigE1/3/15 +Ethernet47 43,44 fortyGigE1/3/16 +Ethernet48 113,114 fortyGigE1/4/1 +Ethernet49 115,116 fortyGigE1/4/2 +Ethernet50 117,118 fortyGigE1/4/3 +Ethernet51 119,120 fortyGigE1/4/4 +Ethernet52 1,2 fortyGigE1/4/5 +Ethernet53 3,4 fortyGigE1/4/6 +Ethernet54 5,6 fortyGigE1/4/7 +Ethernet55 7,8 fortyGigE1/4/8 +Ethernet56 33,34 fortyGigE1/4/9 +Ethernet57 35,36 fortyGigE1/4/10 +Ethernet58 37,38 fortyGigE1/4/11 +Ethernet59 39,40 fortyGigE1/4/12 +Ethernet60 81,82 fortyGigE1/4/13 +Ethernet61 83,84 fortyGigE1/4/14 +Ethernet62 85,86 fortyGigE1/4/15 +Ethernet63 87,88 fortyGigE1/4/16 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile new file mode 100644 index 000000000000..ee286905f907 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G.config.bcm diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py new file mode 100644 index 000000000000..534e587ae722 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 63 + ports_in_block = 64 + + eeprom_offset = 18 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini new file mode 100644 index 000000000000..d2b36ebf5e2a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 5,6,7,8 Ethernet0 +Ethernet4 1,2,3,4 Ethernet4 +Ethernet8 13,14,15,16 Ethernet8 +Ethernet12 9,10,11,12 Ethernet12 +Ethernet16 21,22,23,24 Ethernet16 +Ethernet20 17,18,19,20 Ethernet20 +Ethernet24 29,30,31,32 Ethernet24 +Ethernet28 25,26,27,28 Ethernet28 +Ethernet32 37,38,39,40 Ethernet32 +Ethernet36 33,34,35,36 Ethernet36 +Ethernet40 45,46,47,48 Ethernet40 +Ethernet44 41,42,43,44 Ethernet44 +Ethernet48 53,54,55,56 Ethernet48 +Ethernet52 49,50,51,52 Ethernet52 +Ethernet56 61,62,63,64 Ethernet56 +Ethernet60 57,58,59,60 Ethernet60 +Ethernet64 69,70,71,72 Ethernet64 +Ethernet68 65,66,67,68 Ethernet68 +Ethernet72 77,78,79,80 Ethernet72 +Ethernet76 73,74,75,76 Ethernet76 +Ethernet80 85,86,87,88 Ethernet80 +Ethernet84 81,82,83,84 Ethernet84 +Ethernet88 93,94,95,96 Ethernet88 +Ethernet92 89,90,91,92 Ethernet92 +Ethernet96 101,102,103,104 Ethernet96 +Ethernet100 97,98,99,100 Ethernet100 +Ethernet104 109,110,111,112 Ethernet104 +Ethernet108 105,106,107,108 Ethernet108 +Ethernet112 117,118,119,120 Ethernet112 +Ethernet116 113,114,115,116 Ethernet116 +Ethernet120 125,126,127,128 Ethernet120 +Ethernet124 121,122,123,124 Ethernet124 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf new file mode 100644 index 000000000000..44eedb4b11b0 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf @@ -0,0 +1,35 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "1.0V" + label in1 "1.0V_ROV" + label in2 "1.25V" + label in3 "1.8V" + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "+3.3V" + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label temp1 "Front MAC Temp" + label temp2 "Rear MAC Temp" + ignore temp3 + ignore temp4 + ignore intrusion0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile new file mode 100644 index 000000000000..9a9a38aeb068 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py new file mode 100644 index 000000000000..a9e22e3e698c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import eeprom_base + import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py new file mode 100644 index 000000000000..04e9a4eff85e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -0,0 +1,28 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 1 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/bsp/qsfp/qsfp{0}' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6f604c63aefb..5a753471911d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -1,11 +1,18 @@ #!/bin/bash +# Obtain our platform and HWSKU as we will mount directories with these names in each docker +PLATFORM=`/usr/bin/sonic-cfggen -v platform` +HWSKU=`/usr/bin/sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + start() { docker inspect --type container {{docker_container_name}} &>/dev/null if [ "$?" -eq "0" ]; then docker start -a {{docker_container_name}} else - docker run {{docker_image_run_opt}} --name={{docker_container_name}} {{docker_image_name}} + docker run {{docker_image_run_opt}} \ + -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ + -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ + --name={{docker_container_name}} {{docker_image_name}} fi } diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f69d9ff87372..c02263d3e37e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -34,45 +34,44 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs sudo chroot $FILESYSTEM_ROOT service docker start sudo chroot $FILESYSTEM_ROOT docker version -# Install config engine dependencies -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ - python-lxml \ - python-jinja2 \ - python-netaddr \ - python-ipaddr \ - python-yaml - -sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} - -# Python tabulate required for sonic-utilities -python_tabulate_url=http://packages.microsoft.com/repos/sonic-dev/pool/main/p/python-tabulate/python-tabulate_0.7.7-1_all.deb -python_template_deb_temp=`mktemp` -trap_push "rm -f $python_template_deb_temp" -wget $python_tabulate_url -qO $python_template_deb_temp && { \ - sudo dpkg --root=$FILESYSTEM_ROOT -i $python_template_deb_temp || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f; \ -} - -# Sonic utilities -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-utilities_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - -# Create all needed directories -sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ -sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ - # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/ $FILESYSTEM_ROOT/etc/apt/ cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add - +# Update apt's snapshot of its repos +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get update + # Apply environtment configuration files sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ +# Create all needed directories +sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ +sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ + # Copy default minigraph sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml +# Install dependencies for SONiC config engine +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ + python-lxml \ + python-jinja2 \ + python-netaddr \ + python-ipaddr \ + python-yaml + +# Install SONiC config engine +sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} + +# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + +# Install SONiC Device Data (and its dependencies via 'apt-get -y install -f') +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Copy NTP configuration files and templates sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service diff --git a/rules/sonic-device-data.mk b/rules/sonic-device-data.mk new file mode 100644 index 000000000000..abf7d0501f93 --- /dev/null +++ b/rules/sonic-device-data.mk @@ -0,0 +1,10 @@ +# sonic-device-data Debian package + +SONIC_DEVICE_DATA_VERSION = 1.0 +SONIC_DEVICE_DATA_VERSION_FULL = $(SONIC_DEVICE_DATA_VERSION)-1 + +export SONIC_DEVICE_DATA_VERSION SONIC_DEVICE_DATA_VERSION_FULL + +SONIC_DEVICE_DATA = sonic-device-data_$(SONIC_DEVICE_DATA_VERSION_FULL)_all.deb +$(SONIC_DEVICE_DATA)_SRC_PATH = $(SRC_PATH)/sonic-device-data +SONIC_MAKE_DEBS += $(SONIC_DEVICE_DATA) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7f40cdc93c6c..7377ed50cbca 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,5 +1,5 @@ # sonic utilities package -SONIC_UTILS = sonic-utilities_0.1_amd64.deb +SONIC_UTILS = python-sonic-utilities_1.0-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities -SONIC_DPKG_DEBS += $(SONIC_UTILS) +SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/slave.mk b/slave.mk index 2484e323c194..213cda522303 100644 --- a/slave.mk +++ b/slave.mk @@ -286,7 +286,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_UTILS)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_CONFIG_ENGINE) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 317d9c963a33..4d0aca11ec5a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -287,10 +287,10 @@ def get_mgmt_info(devices, dev, port): def get_alias_map_list(hwsku, platform=None): port_config_candidates = [] - port_config_candidates.append('/usr/share/sonic/sku/port_config.ini') + port_config_candidates.append('/usr/share/sonic/hwsku/port_config.ini') if platform != None: port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) - port_config_candidates.append(os.path.join('/usr/share/sonic/device', hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic/platform', hwsku, 'port_config.ini')) port_config_candidates.append(os.path.join('/usr/share/sonic', hwsku, 'port_config.ini')) port_config = None for candidate in port_config_candidates: diff --git a/src/sonic-device-data/LICENSE b/src/sonic-device-data/LICENSE new file mode 100644 index 000000000000..2ff086dedcdd --- /dev/null +++ b/src/sonic-device-data/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2017 Microsoft + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/sonic-device-data/MAINTAINERS b/src/sonic-device-data/MAINTAINERS new file mode 100644 index 000000000000..fde1eede3214 --- /dev/null +++ b/src/sonic-device-data/MAINTAINERS @@ -0,0 +1,7 @@ +# This file describes the maintainers for sonic-device-data +# See the SONiC project governance document for more information + +Name = "Joe LeVeque" +Email = "jolevequ@microsoft.com" +Github = jleveque +Mailinglist = sonicproject@googlegroups.com diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile new file mode 100644 index 000000000000..dc45dc6bff9f --- /dev/null +++ b/src/sonic-device-data/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = sonic-device-data_$(SONIC_DEVICE_DATA_VERSION_FULL)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + pushd ./src + + # Remove any stale data + rm -rf ./device + + # Create a new dir and copy all ONIE-platform-string-named dirs into it + mkdir ./device + cp -r ../../../device/*/* ./device/ + + # Build the package + dpkg-buildpackage -rfakeroot -b -us -uc + + popd + + mv $* $(DEST)/ diff --git a/src/sonic-device-data/README.md b/src/sonic-device-data/README.md new file mode 100644 index 000000000000..e8ccad58b819 --- /dev/null +++ b/src/sonic-device-data/README.md @@ -0,0 +1,4 @@ +# sonic-device-data +Device-specific data for the SONiC project + +See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-device-data/src/debian/changelog b/src/sonic-device-data/src/debian/changelog new file mode 100644 index 000000000000..9cf0041aa890 --- /dev/null +++ b/src/sonic-device-data/src/debian/changelog @@ -0,0 +1,5 @@ +sonic-device-data (1.0-1) UNRELEASED; urgency=low + + * Initial release. (Closes: #XXXXXX) + + -- Joe LeVeque Tue, 20 Feb 2017 14:00:00 -0700 diff --git a/src/sonic-device-data/src/debian/compat b/src/sonic-device-data/src/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/src/sonic-device-data/src/debian/compat @@ -0,0 +1 @@ +9 diff --git a/src/sonic-device-data/src/debian/control b/src/sonic-device-data/src/debian/control new file mode 100644 index 000000000000..a9969efc4b84 --- /dev/null +++ b/src/sonic-device-data/src/debian/control @@ -0,0 +1,11 @@ +Source: sonic-device-data +Maintainer: Joe LeVeque +Section: misc +Priority: optional +Standards-Version: 0.1 +Build-Depends: debhelper (>=9) + +Package: sonic-device-data +Architecture: all +Depends: ${misc:Depends} +Description: Device-specific data files for SONiC diff --git a/src/sonic-device-data/src/debian/copyright b/src/sonic-device-data/src/debian/copyright new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/src/sonic-device-data/src/debian/install b/src/sonic-device-data/src/debian/install new file mode 100644 index 000000000000..707d39adfccb --- /dev/null +++ b/src/sonic-device-data/src/debian/install @@ -0,0 +1 @@ +device/ usr/share/sonic/ diff --git a/src/sonic-device-data/src/debian/rules b/src/sonic-device-data/src/debian/rules new file mode 100755 index 000000000000..e91562ccbb5a --- /dev/null +++ b/src/sonic-device-data/src/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +build: + +%: + dh $@ + diff --git a/src/sonic-utilities b/src/sonic-utilities index be32ae1646ce..07a8b3ab377f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit be32ae1646ce3f98e6fbe15f70aa0629fba0735c +Subproject commit 07a8b3ab377f4ceb2ad84c82dcdbb0e592a70b4c