diff --git a/.azure-pipelines/azure-pipelines-Official.yml b/.azure-pipelines/azure-pipelines-Official.yml new file mode 100644 index 000000000000..a5a08167ca1d --- /dev/null +++ b/.azure-pipelines/azure-pipelines-Official.yml @@ -0,0 +1,31 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: none +pr: none + +schedules: +- cron: "0 0 * * *" + displayName: Daily Build + branches: + include: + - 202012 + always: true + +pool: sonicbld + +stages: +- stage: Build + jobs: + - template: azure-pipelines-build.yml + parameters: + buildOptions: 'SONIC_CONFIG_BUILD_JOBS=1 SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web' + postSteps: + - script: | + make freeze + git status files/build/versions + git add files/build/versions + git diff HEAD files/build/versions + displayName: "Show git diff" diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml new file mode 100644 index 000000000000..172cccab0783 --- /dev/null +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -0,0 +1,109 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: none +pr: none + +schedules: +- cron: "0 0 * * *" + displayName: Daily Build + branches: + include: + - 202012 + always: true + +pool: sonicbld + +stages: +- stage: Build + jobs: + - template: azure-pipelines-build.yml + parameters: + buildSlave: y +- stage: UpgradeVersions + jobs: + - job: UpgradeVersions + pool: + vmImage: 'ubuntu-20.04' + steps: + - script: | + if [ -z "$(which gh)" ]; then + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 + sudo apt-add-repository https://cli.github.com/packages + sudo apt update + sudo apt install gh + fi + displayName: 'Install gh' + - checkout: self + displayName: 'Checkout code' + - download: current + patterns: '**/versions-*' + - script: | + mkdir -p target + default_platform=broadcom + artifacts=$(find $(Pipeline.Workspace) -maxdepth 1 -type d -name 'sonic-buildimage.*' | grep -v "sonic-buildimage.${default_platform}") + echo "artifacts$artifacts" + cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/versions target/ + make freeze FREEZE_VERSION_OPTIONS=-r + find files/build/versions + for artifact in $artifacts + do + rm -rf target/versions + cp -r $artifact/versions target/ + make freeze FREEZE_VERSION_OPTIONS="-a -d" + done + git diff files/build/versions + displayName: 'Freeze Versions' + - script: | + if [ -z "$GIT_USER" ]; then + echo "Skipped to send the pull request, GIT_USER not set." + exit 0 + fi + GIT_STATUS=$(git status --porcelain files/build/versions) + if [ -z "$GIT_STATUS" ]; then + echo "Skipped to send the pull request, no version change in files/build/versions" + exit 0 + fi + if [ ! -d "$HOME" ]; then + sudo mkdir -p $HOME + sudo chown -R $(id -un):$(id -gn) $HOME + fi + SOURCE_BRANCH=$(Build.SourceBranch) + REPO_NAME=$(Build.Repository.Name) + [ -z "$GIT_REPO" ] && GIT_REPO=${REPO_NAME#*/} + BRANCH_NAME=repd/versions/${SOURCE_BRANCH#refs/heads/} + echo '#!/bin/bash' > git_env_password.sh + echo 'echo $GIT_PASSWORD' >> git_env_password.sh + chmod a+x git_env_password.sh + export GIT_ASKPASS=./git_env_password.sh + + git config user.name $GIT_USER + git config credential.https://jackfan.us.kg.username $GIT_USER + git add files/build/versions + git commit -m "Update SONiC version files" + git checkout -b $BRANCH_NAME + git remote add remote https://github.com/$GIT_USER/$GIT_REPO + git push remote HEAD:refs/heads/$BRANCH_NAME -f + git branch -u remote/$BRANCH_NAME + + echo $GIT_PASSWORD | gh auth login --with-token + TITLE="Upgrade SONiC Versions" + BODY="Upgrade SONiC Versions" + RET=0 + if ! gh pr create -t "$TITLE" -b "$BODY" -B $(Build.SourceBranch) -R $(Build.Repository.Name) > pr.log 2>&1; then + if ! grep -q "already exists" pr.log; then + RET=1 + fi + fi + cat pr.log + exit $RET + env: + GIT_USER: $(GIT_USER) + GIT_PASSWORD: $(GIT_PASSWORD) + displayName: 'Send Pull Request' + - publish: $(System.DefaultWorkingDirectory)/files/build/versions + artifact: 'sonic-buildimage.versions' + displayName: 'Archive SONiC versions' + diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml new file mode 100644 index 000000000000..550e2ccd9799 --- /dev/null +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -0,0 +1,72 @@ +parameters: +- name: 'jobFilters' + type: object + default: '' +- name: 'buildOptions' + type: string + default: 'SONIC_CONFIG_BUILD_JOBS=1' +- name: 'buildSlave' + type: string + default: 'n' +- name: 'postSteps' + type: stepList + default: [] + +jobs: +- template: azure-pipelines-job-groups.yml + parameters: + jobFilters: ${{ parameters.jobFilters }} + preSteps: + - script: | + containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }') + if [ ! -z "$containers" ]; then + docker container kill $containers || true + sleep 5 + fi + if [ "${{ parameters.buildSlave }}" == "y" ]; then + images=$(docker images 'sonic-slave-*' -a -q) + [ ! -z "$images" ] && docker rmi -f $images + fi + sudo rm -rf $(ls -A1) + displayName: 'Init' + - checkout: self + submodules: recursive + displayName: 'Checkout code' + - script: | + make ${{ parameters.buildOptions }} PLATFORM=$GROUP_NAME configure + displayName: 'Make configure' + postSteps: + - ${{ parameters.postSteps }} + - publish: $(System.DefaultWorkingDirectory)/target + artifact: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)' + displayName: "Archive sonic image" + jobGroups: + - name: vs + script: | + sudo bash -c "echo 1 > /proc/sys/vm/compact_memory" + make ${{ parameters.buildOptions }} target/sonic-vs.img.gz + - name: broadcom + script: | + make ${{ parameters.buildOptions }} target/sonic-broadcom.bin target/sonic-aboot-broadcom.swi + - name: barefoot + script: | + make ${{ parameters.buildOptions }} target/sonic-barefoot.bin target/sonic-aboot-barefoot.swi + - name: centec + script: | + make ${{ parameters.buildOptions }} INSTALL_DEBUG_TOOLS=y target/sonic-centec.bin + mv target/sonic-centec.bin target/sonic-centec-dbg.bin + make ${{ parameters.buildOptions }} target/sonic-centec.bin + make ${{ parameters.buildOptions }} ENABLE_SYNCD_RPC=y target/docker-syncd-centec-rpc.gz + - name: innovium + script: | + make ${{ parameters.buildOptions }} SONIC_CONFIG_BUILD_JOBS=1 target/sonic-innovium.bin + - name: mellanox + script: | + make ${{ parameters.buildOptions }} target/sonic-mellanox.bin + - name: mellanox + extName: _rpc + script: | + make ${{ parameters.buildOptions }} ENABLE_SYNCD_RPC=y all + - name: nephos + script: | + make ${{ parameters.buildOptions }} target/sonic-nephos.bin diff --git a/.azure-pipelines/azure-pipelines-job-groups.yml b/.azure-pipelines/azure-pipelines-job-groups.yml new file mode 100644 index 000000000000..1ca5c932b0a6 --- /dev/null +++ b/.azure-pipelines/azure-pipelines-job-groups.yml @@ -0,0 +1,53 @@ +parameters: +- name: 'preSteps' + type: stepList + default: [] +- name: "postSteps" + type: stepList + default: [] +- name: 'jobGroups' + type: object + default: [] +- name: 'jobVariables' + type: object + default: {} +- name: 'scriptEnv' + type: object + default: '' +- name: 'timeoutInMinutes' + type: 'number' + default: 1440 +- name: 'jobFilters' + type: object + default: '' + +jobs: +- ${{ each jobGroup in parameters.jobGroups }}: + - ${{ if or(eq(parameters.jobFilters, ''), containsValue(parameters.jobFilters, jobGroup.name)) }}: + - job: ${{ replace(format('{0}{1}', jobGroup.name, jobGroup.extName), '-', '_') }} + ${{ each pair in jobGroup }}: + ${{ if not(in(pair.key, 'job', 'name', 'extName', 'variables', 'steps', 'script', 'scriptEnv')) }}: + ${{ pair.key }}: ${{ pair.value }} + ${{ if eq(jobGroup.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + variables: + GROUP_NAME: ${{ jobGroup.name }} + GROUP_EXTNAME: '${{ jobGroup.extName }}' + GROUP_NAMES: ${{ join(',', parameters.jobGroups.*.name ) }} + ${{ if ne(jobGroup.variables, '') }}: + ${{ jobGroup.variables }} + ${{ each para in parameters.jobvariables }}: + ${{ if eq(jobGroup.variables[para.key], '') }}: + ${{ para.key }}: ${{ para.value }} + steps: + - ${{ parameters.preSteps }} + - ${{ if ne(jobGroup.script, '') }}: + - script: | + ${{ jobGroup.script }} + env: + ${{ if ne(parameters.scriptEnv, '') }}: + ${{ parameters.scriptEnv }} + displayName: 'JobScript' + - ${{ if ne(jobGroup.steps, '') }}: + - ${{ jobGroup.steps }} + - ${{ parameters.postSteps }} diff --git a/.azure-pipelines/official-build.yml b/.azure-pipelines/official-build.yml index b353ab678c29..8524027d7b11 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -28,6 +28,14 @@ stages: raw_image: true sync_rpc_image: true + - template: build-template.yml + parameters: + platform: mellanox + platform_short: mlnx + cache_mode: wcache + dbg_image: true + sync_rpc_image: true + - template: build-template.yml parameters: platform: vs diff --git a/.gitignore b/.gitignore index 7e2f73f718e9..5e76a6cf92da 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,13 @@ platform/**/*-none-any.whl platform/**/.pybuild platform/**/debian/* platform/**/build +platform/**/*.ko +platform/**/*.mod.c +platform/**/*.mod.o +platform/**/*.o +platform/**/*.d +platform/**/*.cmd +platform/**/*.order platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/ipmihelper.py platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_ich.c platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_lpc.c diff --git a/.gitmodules b/.gitmodules index 9f2ae12ebb46..96e5645dcaee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -59,7 +59,7 @@ url = https://github.com/aristanetworks/sonic [submodule "platform/mellanox/hw-management/hw-mgmt"] path = platform/mellanox/hw-management/hw-mgmt - url = https://github.com/Mellanox/hw-mgmt/ + url = https://github.com/Mellanox/hw-mgmt [submodule "src/redis-dump-load"] path = src/redis-dump-load url = https://github.com/p/redis-dump-load.git diff --git a/README.md b/README.md index b21bfeaf7826..680a9b5140ba 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -*static anaylsis*: +*static analysis*: [![Total alerts](https://img.shields.io/lgtm/alerts/g/Azure/sonic-buildimage.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-buildimage/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Azure/sonic-buildimage.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-buildimage/context:python) @@ -114,7 +114,7 @@ To build SONiC installer image and docker images, run the following commands: make all ## Usage for ARM Architecture -To build Arm32 bit for (ARMHF) plaform +To build Arm32 bit for (ARMHF) platform ARM build has dependency in docker version 18, if docker version is 19, downgrade to 18 as below sudo apt-get install --allow-downgrades -y docker-ce=5:18.09.0~3-0~ubuntu-xenial @@ -134,7 +134,7 @@ To build Arm32 bit for (ARMHF) plaform -To build Arm64 bit for plaform +To build Arm64 bit for platform # Execute make configure once to configure ASIC and ARCH diff --git a/build_debian.sh b/build_debian.sh index 17a5aea4e617..09e94313fede 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -302,7 +302,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in ethtool \ screen \ hping3 \ - python-scapy \ tcptraceroute \ mtr-tiny \ locales \ @@ -432,6 +431,9 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'wheel # docker Python API package is needed by Ansible docker module as well as some SONiC applications sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docker==4.3.1' +# Install scapy +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'scapy==2.4.4' + ## Note: keep pip installed for maintainance purpose # Install GCC, needed for building/installing some Python packages diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini new file mode 100755 index 000000000000..f8965dfe41d0 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias index speed autoneg +Ethernet0 26 thousandE1 1 1000 1 +Ethernet1 25 thousandE2 2 1000 1 +Ethernet2 28 thousandE3 3 1000 1 +Ethernet3 27 thousandE4 4 1000 1 +Ethernet4 30 thousandE5 5 1000 1 +Ethernet5 29 thousandE6 6 1000 1 +Ethernet6 32 thousandE7 7 1000 1 +Ethernet7 31 thousandE8 8 1000 1 +Ethernet8 38 thousandE9 9 1000 1 +Ethernet9 37 thousandE10 10 1000 1 +Ethernet10 40 thousandE11 11 1000 1 +Ethernet11 39 thousandE12 12 1000 1 +Ethernet12 34 thousandE13 13 1000 1 +Ethernet13 33 thousandE14 14 1000 1 +Ethernet14 36 thousandE15 15 1000 1 +Ethernet15 35 thousandE16 16 1000 1 +Ethernet16 46 thousandE17 17 1000 1 +Ethernet17 45 thousandE18 18 1000 1 +Ethernet18 48 thousandE19 19 1000 1 +Ethernet19 47 thousandE20 20 1000 1 +Ethernet20 42 thousandE21 21 1000 1 +Ethernet21 41 thousandE22 22 1000 1 +Ethernet22 44 thousandE23 23 1000 1 +Ethernet23 43 thousandE24 24 1000 1 +Ethernet24 2 thousandE25 25 1000 1 +Ethernet25 1 thousandE26 26 1000 1 +Ethernet26 4 thousandE27 27 1000 1 +Ethernet27 3 thousandE28 28 1000 1 +Ethernet28 6 thousandE29 29 1000 1 +Ethernet29 5 thousandE30 30 1000 1 +Ethernet30 8 thousandE31 31 1000 1 +Ethernet31 7 thousandE32 32 1000 1 +Ethernet32 10 thousandE33 33 1000 1 +Ethernet33 9 thousandE34 34 1000 1 +Ethernet34 12 thousandE35 35 1000 1 +Ethernet35 11 thousandE36 36 1000 1 +Ethernet36 14 thousandE37 37 1000 1 +Ethernet37 13 thousandE38 38 1000 1 +Ethernet38 16 thousandE39 39 1000 1 +Ethernet39 15 thousandE40 40 1000 1 +Ethernet40 18 thousandE41 41 1000 1 +Ethernet41 17 thousandE42 42 1000 1 +Ethernet42 20 thousandE43 43 1000 1 +Ethernet43 19 thousandE44 44 1000 1 +Ethernet44 22 thousandE45 45 1000 1 +Ethernet45 21 thousandE46 46 1000 1 +Ethernet46 24 thousandE47 47 1000 1 +Ethernet47 23 thousandE48 48 1000 1 +Ethernet48 67 twentyfiveGigE49 49 25000 0 +Ethernet49 66 twentyfiveGigE50 50 25000 0 +Ethernet50 65 twentyfiveGigE51 51 25000 0 +Ethernet51 68 twentyfiveGigE52 52 25000 0 +Ethernet52 73,74,75,76 hundredGigE53 53 100000 0 +Ethernet56 69,70,71,72 hundredGigE54 54 100000 0 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/default_sku b/device/accton/x86_64-accton_as4630_54te-r0/default_sku new file mode 100755 index 000000000000..8fb346d4ad3d --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/default_sku @@ -0,0 +1 @@ +Accton-AS4630-54TE t1 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/installer.conf b/device/accton/x86_64-accton_as4630_54te-r0/installer.conf new file mode 100755 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py new file mode 100755 index 000000000000..7409239d01f3 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py @@ -0,0 +1,13 @@ +try: + from sonic_eeprom import eeprom_tlvinfo + +except ImportError as 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 = "/sys/bus/i2c/devices/1-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py new file mode 100755 index 000000000000..92ae68eb87bf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "10-0050", + 2: "11-0051", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py new file mode 100755 index 000000000000..63e6bd53645c --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py @@ -0,0 +1,196 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import sys + import time + from ctypes import create_string_buffer + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +SFP_STATUS_INSERTED = '1' +SFP_STATUS_REMOVED = '0' + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 49 + PORT_END = 54 + PORTS_IN_BLOCK = 54 + QSFP_START = 53 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD_PATH = "/sys/bus/i2c/devices/3-0060/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 49: [18], + 50: [19], + 51: [20], + 52: [21], + 53: [22], + 54: [23], + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "eeprom" + for x in range(self.port_start, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][0]) + SfpUtilBase.__init__(self) + + 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 + + present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num) + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + content = val_file.readline().rstrip() + val_file.close() + except IOError as e: + print ('Error: unable to access file: %s') % str(e) + return False + + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.QSFP_START or port_num > self.port_end: + return False + + try: + eeprom = None + if not self.get_presence(port_num): + return False + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") + eeprom.seek(93) + lpmode = ord(eeprom.read(1)) + + # if "Power override" bit is 1 and "Power set" bit is 1 + if ((lpmode & 0x3) == 0x3): + return True + + # High Power Mode if one of the following conditions is matched: + # 1. "Power override" bit is 0 + # 2. "Power override" bit is 1 and "Power set" bit is 0 + else: + return False + + except IOError as e: + print ('Error: unable to open file: %s') % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.QSFP_START or port_num > self.port_end: + return False + + try: + eeprom = None + if not self.get_presence(port_num): + return False # Port is not present, unable to set the eeprom + + # Fill in write buffer + # 0x3:Low Power Mode, 0x1:High Power Mode + regval = 0x3 if lpmode else 0x1 + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = regval + else: + buffer[0] = chr(regval) + + # Write to eeprom + eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") + eeprom.seek(93) + eeprom.write(buffer[0]) + return True + except IOError as e: + print ('Error: unable to open file: %s') % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + + def reset(self, port_num): + raise NotImplementedError + + @property + def _get_presence_bitmap(self): + + bits = [] + for x in range(self.port_start, self.port_end + 1): + bits.append(str(int(self.get_presence(x)))) + + rev = "".join(bits[::-1]) + return int(rev, 2) + + data = {'present': 0} + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + + if timeout == 0: + cd_ms = sys.maxsize + else: + cd_ms = timeout + + # poll per second + while cd_ms > 0: + reg_value = self._get_presence_bitmap + changed_ports = self.data['present'] ^ reg_value + if changed_ports != 0: + break + time.sleep(1) + cd_ms = cd_ms - 1000 + + if changed_ports != 0: + for port in range(self.port_start, self.port_end + 1): + # Mask off the bit corresponding to our port + mask = (1 << (port - self.port_start)) + if changed_ports & mask: + if (reg_value & mask) == 0: + port_dict[port] = SFP_STATUS_REMOVED + else: + port_dict[port] = SFP_STATUS_INSERTED + + # Update cache + self.data['present'] = reg_value + return True, port_dict + else: + return True, {} diff --git a/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..584a14b9d942 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json @@ -0,0 +1,5 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} + diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..a18a2a2d2a3b --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan'] +from . import platform diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..d666e0c5bf86 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py @@ -0,0 +1,194 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 3 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 3 +NUM_QSFP = 6 +PORT_START = 49 +PORT_END = 54 +NUM_COMPONENT = 2 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "docker > /dev/null 2>&1" + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(0, PORT_END): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan import Fan + for fant_index in range(0, NUM_FAN_TRAY): + for fan_index in range(0, NUM_FAN): + fan = Fan(fant_index, fan_index) + self._fan_list.append(fan) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(0, NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog + self._watchdog = Watchdog() + + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return self._api_helper.hwsku + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py new file mode 100644 index 000000000000..c34da704432a --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py @@ -0,0 +1,121 @@ +############################################################################# +# Accton +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +import shlex +import subprocess + + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": "3-0060" +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..7bf2bb58d19f --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py @@ -0,0 +1,102 @@ +try: + import os + import sys + import re + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' + + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def get_eeprom(self): + return self._eeprom + + def get_serial(self): + return self._eeprom.get('0x23', "Undefined.") + + def get_mac(self): + return self._eeprom.get('0x24', "Undefined.") diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..663c343a75f6 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py @@ -0,0 +1,171 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_FAN_MAX_RPM = 26688 + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/fan_" +PSU_HWMON_I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + + if self.is_psu_fan: + self.psu_index = psu_index + self.psu_i2c_num = PSU_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = PSU_HWMON_I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + FanBase.__init__(self) + + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + + + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_I2C_PATH, 'direction_', self.fan_tray_index) + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if val==0:#F2B + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if val=='F2B': + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + """ + speed = 0 + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 + elif self.get_presence(): + speed_path = "{}{}".format(CPLD_I2C_PATH, 'duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + Note: + speed_pc = pwm_target/255*100 + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return False #Not supported + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return False #Not supported + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + + if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_I2C_PATH, 'duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + present_path = "{}{}{}".format(CPLD_I2C_PATH, 'present_', self.fan_index+1) + val=self._api_helper.read_txt_file(present_path) + if not self.is_psu_fan: + if val is not None: + return int(val, 10)==1 + else: + return False + else: + return True diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..4cd60ac90611 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py @@ -0,0 +1,117 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info + +HOST_CHK_CMD = "docker > /dev/null 2>&1" +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_command(self, cmd): + status = True + result = "" + try: + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + cmd = "ipmitool fru print {}".format(str( + id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) + + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..3413ab5779cc --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py @@ -0,0 +1,228 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +#import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + #from sonic_platform.fan import Fan + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + self._api_helper = APIHelper() + + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + self.__initialize_fan() + ''' + for fan_index in range(0, PSU_NUM_FAN[self.index]): + #def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + #fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + fan = Fan(fan_index, 0, True, self.index) + self._fan_list.append(fan) + ''' + + def __initialize_fan(self): + from sonic_platform.fan import Fan + for fan_index in range(0, PSU_NUM_FAN[self.index]): + fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + self._fan_list.append(fan) + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + + return False #Controlled by HW + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..25e5bce8fe40 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py @@ -0,0 +1,1169 @@ +#!/usr/bin/env python + +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + #from sonic_platform_base.sonic_sfp.sff8472 import sffbase + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/" + +QSFP_INFO_OFFSET = 128 +QSFP_DOM_OFFSET = 0 + +SFP_INFO_OFFSET = 0 +SFP_DOM_OFFSET = 256 + +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_OSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 1 + +# Offset for values in QSFP eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_POWEROVERRIDE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_MODULE_THRESHOLD_OFFSET = 128 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNEL_THRESHOLD_OFFSET = 176 +QSFP_CHANNEL_THRESHOLD_WIDTH = 16 + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + + +# Offset for values in SFP eeprom +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_CHANNL_MON_OFFSET = 100 +SFP_CHANNL_MON_WIDTH = 6 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 40 +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 +SFP_STATUS_CONTROL_OFFSET = 110 +SFP_STATUS_CONTROL_WIDTH = 1 +SFP_TX_DISABLE_HARD_BIT = 7 +SFP_TX_DISABLE_SOFT_BIT = 6 + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes', 'FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') + + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 49 + PORT_END = 54 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as4630_54te-r0" + HWSKU = "Accton-AS4630-54TE" + + _port_to_i2c_mapping = { + 49: 18, + 50: 19, + 51: 20, + 52: 21, + 53: 22, + 54: 23, + } + + def __init__(self, sfp_index=0): + self._api_helper=APIHelper() + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + + self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] + + self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', + 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] + + self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + SfpBase.__init__(self) + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w', buffering=0) as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + if sys.version_info[0] >= 3: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + hardware_rev |1*255VCHAR |hardware version of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + ======================================================================== + """ + # check present status + if self.port_num < 49: + return {} + elif self.port_num < 53: + sfpi_obj = sff8472InterfaceId() #SFP + else: + sfpi_obj = sff8436InterfaceId() #QSFP + if not self.get_presence() or not sfpi_obj: + return {} + + if self.port_num < 53: + offset = SFP_INFO_OFFSET + sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_SFP) + else: + offset = QSFP_INFO_OFFSET + sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_QSFP) + + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( + sfp_interface_bulk_raw, 0) + + sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) + sfp_vendor_name_data = sfpi_obj.parse_vendor_name( + sfp_vendor_name_raw, 0) + + sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( + sfp_vendor_pn_raw, 0) + + if self.port_num < 53: + sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_SFP) + else: + sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_QSFP) + + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( + sfp_vendor_rev_raw, 0) + + sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( + sfp_vendor_sn_raw, 0) + + sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) + if sfp_vendor_oui_raw is not None: + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( + sfp_vendor_oui_raw, 0) + + sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) + sfp_vendor_date_data = sfpi_obj.parse_vendor_date( + sfp_vendor_date_raw, 0) + + transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') + compliance_code_dict = dict() + + if sfp_interface_bulk_data: + transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] + + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ + 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' + transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ + 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' + transceiver_info_dict['cable_type'] = "Unknown" + transceiver_info_dict['cable_length'] = "Unknown" + + if self.port_num < 53: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + else: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) + + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + # check present status + if self.port_num < 53: #SFP case + sfpd_obj = sff8472Dom() + if not self.get_presence() or not sfpd_obj: + return {} + + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = SFP_DOM_OFFSET + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_voltage_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] + transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] + + else: #QSFP case + sfpd_obj = sff8436Dom() + sfpi_obj = sff8436InterfaceId() + + if not self.get_presence() or not sfpi_obj or not sfpd_obj: + return {} + + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + offset = QSFP_DOM_OFFSET + offset_xcvr = QSFP_INFO_OFFSET + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qspf_dom_capability_data = sfpi_obj.parse_qsfp_dom_capability( + qsfp_dom_capability_raw, 0) + else: + return None + + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + + # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 + # and claimed that it support tx_power with one indicator bit. + dom_channel_monitor_data = {} + dom_channel_monitor_raw = None + qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] + if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + + else: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + + if dom_channel_monitor_raw: + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] + transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] + transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] + transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + #End of else + + + for key in transceiver_dom_info_dict: + transceiver_dom_info_dict[key] = self._convert_string_to_num( + transceiver_dom_info_dict[key]) + + transceiver_dom_info_dict['rx_los'] = self.get_rx_los() + transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() + transceiver_dom_info_dict['reset_status'] = self.get_reset_status() + transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + # check present status + if self.port_num < 53: + sfpd_obj = sff8472Dom() + + if not self.get_presence() and not sfpd_obj: + return {} + + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = SFP_DOM_OFFSET + transceiver_dom_threshold_info_dict = dict.fromkeys( + self.threshold_dict_keys, 'N/A') + dom_module_threshold_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( + dom_module_threshold_raw, 0) + + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ + 'data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + for key in transceiver_dom_threshold_info_dict: + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num( + transceiver_dom_threshold_info_dict[key]) + + return transceiver_dom_threshold_info_dict + + + else: + sfpd_obj = sff8436Dom() + + if not self.get_presence() or not sfpd_obj: + return {} + + transceiver_dom_threshold_dict = dict.fromkeys( + self.threshold_dict_keys, 'N/A') + dom_thres_raw = self.__read_eeprom_specific_bytes( + QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None + + if dom_thres_raw: + module_threshold_values = sfpd_obj.parse_module_threshold_values( + dom_thres_raw, 0) + module_threshold_data = module_threshold_values.get('data') + if module_threshold_data: + transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] + transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] + transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] + transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] + transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] + transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] + transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] + transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] + + dom_thres_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None + channel_threshold_values = sfpd_obj.parse_channel_threshold_values( + dom_thres_raw, 0) + channel_threshold_data = channel_threshold_values.get('data') + if channel_threshold_data: + transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] + transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] + transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] + transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] + + for key in transceiver_dom_threshold_dict: + transceiver_dom_threshold_dict[key] = self._convert_string_to_num( + transceiver_dom_threshold_dict[key]) + + return transceiver_dom_threshold_dict + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + return False # CPLD port doesn't support this feature + + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + rx_los = False + + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) + rx_los=self._api_helper.read_txt_file(rx_path) + if rx_los is None: + return False + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # rx_los = (sffbase().test_bit(data, 1) != 0) + + else: + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] + return rx_los + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault = False + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) + tx_fault=self._api_helper.read_txt_file(tx_path) + if tx_fault is None: + return False + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # tx_fault = (sffbase().test_bit(data, 2) != 0) + else: + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] + + return tx_fault + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_disable = False + + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + tx_disable=self._api_helper.read_txt_file(tx_path) + + + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # tx_disable_hard = (sffbase().test_bit( + # data, SFP_TX_DISABLE_HARD_BIT) != 0) + # tx_disable_soft = (sffbase().test_bit( + # data, SFP_TX_DISABLE_SOFT_BIT) != 0) + # tx_disable = tx_disable_hard | tx_disable_soft + if tx_disable is not None: + return tx_disable + else: + return False + + else: + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + power_set=self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + + def get_power_set(self): + + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + power_set = False + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_POWEROVERRIDE_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_set = ( + 'On' == dom_control_data['data']['PowerSet']['value']) + + return power_set + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + power_override = False + + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_POWEROVERRIDE_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + Returns: + An integer number of current temperature in Celsius + """ + transceiver_dom_info_dict = self.get_transceiver_bulk_status() + return transceiver_dom_info_dict.get("temperature", "N/A") + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + Returns: + An integer number of supply voltage in mV + """ + transceiver_dom_info_dict = self.get_transceiver_bulk_status() + return transceiver_dom_info_dict.get("voltage", "N/A") + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + transceiver_dom_info_dict = self.get_transceiver_bulk_status() + + tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") + if self.port_num < 53: + return [tx1_bs, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] + + tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") + tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") + tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") + return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + transceiver_dom_info_dict = self.get_transceiver_bulk_status() + + rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") + if self.port_num < 53: + return [rx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] + rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") + rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") + rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") + return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + transceiver_dom_info_dict = self.get_transceiver_bulk_status() + tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") + if self.port_num < 53: + return [tx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] + tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") + tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") + tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") + return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + if self.port_num < 49: #Copper port, no sysfs + return False + + ''' + reset_path = "{}{}{}".format(CPLD_I2C_PATH, 'module_reset_', self.port_num) + ret = self.__write_txt_file(reset_path, 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self.__write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret + ''' + + return False #CPLD doens't support this feature + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + ret = self.__write_txt_file(tx_path, 1 if tx_disable else 0) + if ret is not None: + time.sleep(0.01) + return ret + else: + return False + + else: + if not self.get_presence(): + return False + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ',str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if lpmode is True: + self.set_power_override(True, True) + else: + self.set_power_override(False, False) + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception: + print ('Error: unable to open file: ', str(e)) + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + transceiver_dom_info_dict = self.get_transceiver_info() + return transceiver_dom_info_dict.get("model", "N/A") + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + transceiver_dom_info_dict = self.get_transceiver_info() + return transceiver_dom_info_dict.get("serial", "N/A") + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() and self.get_transceiver_bulk_status() diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..7a453c594fde --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py @@ -0,0 +1,145 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0): + self.THERMAL_NAME_LIST = [] + self.SYSFS_PATH = "/sys/bus/i2c/devices" + self.index = thermal_index + # Add thermal name + self.THERMAL_NAME_LIST.append("Temp sensor 1") + self.THERMAL_NAME_LIST.append("Temp sensor 2") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + + # Set hwmon path + i2c_path = { + 0: "14-0048/hwmon/hwmon*/", + 1: "24-004b/hwmon/hwmon*/", + 2: "25-004a/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.ss_key = self.THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().rstrip() + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 0 + + def __set_threshold(self, file_name, temperature): + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_file = "temp{}_input".format(self.ss_index) + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/pcie.yaml b/device/arista/x86_64-arista_7050_qx32s/pcie.yaml similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/plugins/pcie.yaml rename to device/arista/x86_64-arista_7050_qx32s/pcie.yaml diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 deleted file mode 100644 index 1430479d08e0..000000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,61 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,6) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(10,22) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(26,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(6,10) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(22,26) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "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_lossless_pool]", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini deleted file mode 100644 index 0b5d680edda7..000000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 79872 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 56160 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 85696 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/plugins/pcie.yaml b/device/arista/x86_64-arista_7050cx3_32s/pcie.yaml similarity index 100% rename from device/arista/x86_64-arista_7050cx3_32s/plugins/pcie.yaml rename to device/arista/x86_64-arista_7050cx3_32s/pcie.yaml diff --git a/device/arista/x86_64-arista_7050sx3_48c8 b/device/arista/x86_64-arista_7050sx3_48c8 new file mode 120000 index 000000000000..0334c5411d31 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8 @@ -0,0 +1 @@ +x86_64-arista_7050sx3_48yc8 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 rename to device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers.json.j2 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 similarity index 81% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 rename to device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 index cc7a687514ce..b6e6a948928d 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 @@ -1,16 +1,12 @@ - -{%- set default_cable = '300m' %} - -{%- set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } --%} +{%- set default_cable = '5m' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,32) %} + {%- for port_idx in range(0,28) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(28,32) %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} {%- endfor %} {%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/pg_profile_lookup.ini similarity index 100% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini rename to device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini new file mode 100644 index 000000000000..bccaa602f203 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 1,2 Ethernet1/1 1 25000 +Ethernet2 3,4 Ethernet1/3 1 25000 +Ethernet4 5,6 Ethernet2/1 2 25000 +Ethernet6 7,8 Ethernet2/3 2 25000 +Ethernet8 9,10 Ethernet3/1 3 25000 +Ethernet10 11,12 Ethernet3/3 3 25000 +Ethernet12 13,14 Ethernet4/1 4 25000 +Ethernet14 15,16 Ethernet4/3 4 25000 +Ethernet16 21,22 Ethernet5/1 5 25000 +Ethernet18 23,24 Ethernet5/3 5 25000 +Ethernet20 17,18 Ethernet6/1 6 25000 +Ethernet22 19,20 Ethernet6/3 6 25000 +Ethernet24 25,26 Ethernet7/1 7 25000 +Ethernet26 27,28 Ethernet7/3 7 25000 +Ethernet28 29,30 Ethernet8/1 8 25000 +Ethernet30 31,32 Ethernet8/3 8 25000 +Ethernet32 37,38 Ethernet9/1 9 25000 +Ethernet34 39,40 Ethernet9/3 9 25000 +Ethernet36 33,34 Ethernet10/1 10 25000 +Ethernet38 35,46 Ethernet10/3 10 25000 +Ethernet40 41,42 Ethernet11/1 11 25000 +Ethernet42 43,44 Ethernet11/3 11 25000 +Ethernet44 45,46 Ethernet12/1 12 25000 +Ethernet46 47,48 Ethernet12/3 12 25000 +Ethernet48 53,54 Ethernet13/1 13 25000 +Ethernet50 55,56 Ethernet13/3 13 25000 +Ethernet52 49,50 Ethernet14/1 14 25000 +Ethernet54 51,52 Ethernet14/3 14 25000 +Ethernet56 57,58 Ethernet15/1 15 25000 +Ethernet58 59,60 Ethernet15/3 15 25000 +Ethernet60 61,62 Ethernet16/1 16 25000 +Ethernet62 63,64 Ethernet16/3 16 25000 +Ethernet64 69,70 Ethernet17/1 17 25000 +Ethernet66 71,72 Ethernet17/3 17 25000 +Ethernet68 65,66 Ethernet18/1 18 25000 +Ethernet70 67,68 Ethernet18/3 18 25000 +Ethernet72 73,74 Ethernet19/1 19 25000 +Ethernet74 75,76 Ethernet19/3 19 25000 +Ethernet76 77,78 Ethernet20/1 20 25000 +Ethernet78 79,80 Ethernet20/3 20 25000 +Ethernet80 85,86 Ethernet21/1 21 25000 +Ethernet82 87,88 Ethernet21/3 21 25000 +Ethernet84 81,82 Ethernet22/1 22 25000 +Ethernet86 83,84 Ethernet22/3 22 25000 +Ethernet88 89,90 Ethernet23/1 23 25000 +Ethernet88 91,92 Ethernet23/3 23 25000 +Ethernet92 93,94 Ethernet24/1 24 25000 +Ethernet92 95,96 Ethernet24/3 24 25000 +Ethernet96 101,102,103,104 Ethernet25/1 25 100000 +Ethernet100 97,98,99,100 Ethernet26/1 26 100000 +Ethernet104 105,106,107,108 Ethernet27/1 27 100000 +Ethernet108 109,110,111,112 Ethernet28/1 28 100000 +Ethernet112 117,118,119,120 Ethernet29/1 29 100000 +Ethernet116 113,114,115,116 Ethernet30/1 30 100000 +Ethernet120 121,122,123,124 Ethernet31/1 31 100000 +Ethernet124 125,126,127,128 Ethernet32/1 32 100000 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 rename to device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/sai.profile b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/sai.profile new file mode 100644 index 000000000000..7342226cd38c --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm +SAI_NUM_ECMP_MEMBERS=64 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm new file mode 100644 index 000000000000..aa9b32d4a350 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm @@ -0,0 +1,422 @@ +PHY_AN_ALLOW_PLL_CHANGE=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +dma_desc_timeout_usec=15000000 +fpem_mem_entries=0 +higig2_hdr_mode=1 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0 +l2xmsg_mode=1 +l2_mem_entries=163840 +l3_mem_entries=147456 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +multicast_l2_range=16383 +multicast_l3_range=0 +num_ipv6_lpm_128b_entries=0 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0x1ffffffe1ffffffe +phy_an_c73_1=1 +phy_an_c73_2=1 +phy_an_c73_3=1 +phy_an_c73_4=1 +phy_an_c73_5=1 +phy_an_c73_6=1 +phy_an_c73_7=1 +phy_an_c73_8=1 +phy_an_c73_9=1 +phy_an_c73_10=1 +phy_an_c73_11=1 +phy_an_c73_12=1 +phy_an_c73_13=1 +phy_an_c73_14=1 +phy_an_c73_15=1 +phy_an_c73_16=1 +phy_an_c73_17=1 +phy_an_c73_18=1 +phy_an_c73_19=1 +phy_an_c73_20=1 +phy_an_c73_21=1 +phy_an_c73_22=1 +phy_an_c73_23=1 +phy_an_c73_24=1 +phy_an_c73_25=0 +phy_an_c73_26=0 +phy_an_c73_27=0 +phy_an_c73_28=0 +phy_an_c73_33=1 +phy_an_c73_34=1 +phy_an_c73_35=1 +phy_an_c73_36=1 +phy_an_c73_37=1 +phy_an_c73_38=1 +phy_an_c73_39=1 +phy_an_c73_40=1 +phy_an_c73_41=1 +phy_an_c73_42=1 +phy_an_c73_43=1 +phy_an_c73_44=1 +phy_an_c73_45=1 +phy_an_c73_46=1 +phy_an_c73_47=1 +phy_an_c73_48=1 +phy_an_c73_49=1 +phy_an_c73_50=1 +phy_an_c73_51=1 +phy_an_c73_52=1 +phy_an_c73_53=1 +phy_an_c73_54=1 +phy_an_c73_55=1 +phy_an_c73_56=1 +phy_an_c73_57=0 +phy_an_c73_58=0 +phy_an_c73_59=0 +phy_an_c73_60=0 +phy_chain_rx_lane_map_physical{1.0}=0x0123 +phy_chain_rx_lane_map_physical{5.0}=0x0123 +phy_chain_rx_lane_map_physical{9.0}=0x0123 +phy_chain_rx_lane_map_physical{13.0}=0x0123 +phy_chain_rx_lane_map_physical{17.0}=0x0123 +phy_chain_rx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_lane_map_physical{25.0}=0x0213 +phy_chain_rx_lane_map_physical{29.0}=0x2031 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x3120 +phy_chain_rx_lane_map_physical{41.0}=0x2031 +phy_chain_rx_lane_map_physical{45.0}=0x0213 +phy_chain_rx_lane_map_physical{49.0}=0x2031 +phy_chain_rx_lane_map_physical{53.0}=0x0213 +phy_chain_rx_lane_map_physical{57.0}=0x3210 +phy_chain_rx_lane_map_physical{61.0}=0x3210 +phy_chain_rx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{73.0}=0x3210 +phy_chain_rx_lane_map_physical{77.0}=0x3210 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x1 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x1 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x1 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x1 +phy_chain_rx_polarity_flip_physical{53.0}=0x1 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x0 +phy_chain_rx_polarity_flip_physical{56.0}=0x1 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x1 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x1 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x0123 +phy_chain_tx_lane_map_physical{5.0}=0x0123 +phy_chain_tx_lane_map_physical{9.0}=0x0123 +phy_chain_tx_lane_map_physical{13.0}=0x0123 +phy_chain_tx_lane_map_physical{17.0}=0x0123 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_tx_lane_map_physical{25.0}=0x0123 +phy_chain_tx_lane_map_physical{29.0}=0x3210 +phy_chain_tx_lane_map_physical{33.0}=0x0123 +phy_chain_tx_lane_map_physical{37.0}=0x3201 +phy_chain_tx_lane_map_physical{41.0}=0x3201 +phy_chain_tx_lane_map_physical{45.0}=0x0123 +phy_chain_tx_lane_map_physical{49.0}=0x3201 +phy_chain_tx_lane_map_physical{53.0}=0x0132 +phy_chain_tx_lane_map_physical{57.0}=0x3210 +phy_chain_tx_lane_map_physical{61.0}=0x3210 +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_lane_map_physical{69.0}=0x3210 +phy_chain_tx_lane_map_physical{73.0}=0x3210 +phy_chain_tx_lane_map_physical{77.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x0 +phy_chain_tx_polarity_flip_physical{20.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{37.0}=0x0 +phy_chain_tx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x0 +phy_chain_tx_polarity_flip_physical{55.0}=0x0 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x1 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +portmap_1=1:25 +portmap_2=2:25 +portmap_3=3:25 +portmap_4=4:25 +portmap_5=5:25 +portmap_6=6:25 +portmap_7=7:25 +portmap_8=8:25 +portmap_9=9:25 +portmap_10=10:25 +portmap_11=11:25 +portmap_12=12:25 +portmap_13=13:25 +portmap_14=14:25 +portmap_15=15:25 +portmap_16=16:25 +portmap_17=17:25 +portmap_18=18:25 +portmap_19=19:25 +portmap_20=20:25 +portmap_21=21:25 +portmap_22=22:25 +portmap_23=23:25 +portmap_24=24:25 +portmap_25=25:100:4 +portmap_26=29:100:4 +portmap_27=33:100:4 +portmap_28=37:100:4 +portmap_33=57:25 +portmap_34=58:25 +portmap_35=59:25 +portmap_36=60:25 +portmap_37=61:25 +portmap_38=62:25 +portmap_39=63:25 +portmap_40=64:25 +portmap_41=65:25 +portmap_42=66:25 +portmap_43=67:25 +portmap_44=68:25 +portmap_45=69:25 +portmap_46=70:25 +portmap_47=71:25 +portmap_48=72:25 +portmap_49=73:25 +portmap_50=74:25 +portmap_51=75:25 +portmap_52=76:25 +portmap_53=77:25 +portmap_54=78:25 +portmap_55=79:25 +portmap_56=80:25 +portmap_57=41:100:4 +portmap_58=45:100:4 +portmap_59=49:100:4 +portmap_60=53:100:4 +port_flex_enable=1 +port_init_autoneg_1=0 +port_init_autoneg_5=0 +port_init_autoneg_9=0 +port_init_autoneg_13=0 +port_init_autoneg_17=0 +port_init_autoneg_21=0 +port_init_autoneg_25=0 +port_init_autoneg_26=0 +port_init_autoneg_27=0 +port_init_autoneg_28=0 +port_init_autoneg_33=0 +port_init_autoneg_37=0 +port_init_autoneg_41=0 +port_init_autoneg_45=0 +port_init_autoneg_49=0 +port_init_autoneg_53=0 +port_init_autoneg_57=0 +port_init_autoneg_58=0 +port_init_autoneg_59=0 +port_init_autoneg_60=0 +port_phy_addr_1=0xff +port_phy_addr_5=0xff +port_phy_addr_9=0xff +port_phy_addr_13=0xff +port_phy_addr_17=0xff +port_phy_addr_21=0xff +port_phy_addr_25=0xff +port_phy_addr_26=0xff +port_phy_addr_27=0xff +port_phy_addr_28=0xff +port_phy_addr_33=0xff +port_phy_addr_37=0xff +port_phy_addr_41=0xff +port_phy_addr_45=0xff +port_phy_addr_49=0xff +port_phy_addr_53=0xff +port_phy_addr_57=0xff +port_phy_addr_58=0xff +port_phy_addr_59=0xff +port_phy_addr_60=0xff +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +serdes_core_rx_polarity_flip_physical{1}=0xa +serdes_core_rx_polarity_flip_physical{5}=0x5 +serdes_core_rx_polarity_flip_physical{9}=0x5 +serdes_core_rx_polarity_flip_physical{13}=0x5 +serdes_core_rx_polarity_flip_physical{17}=0xa +serdes_core_rx_polarity_flip_physical{21}=0x5 +serdes_core_rx_polarity_flip_physical{25}=0x0 +serdes_core_rx_polarity_flip_physical{29}=0xc +serdes_core_rx_polarity_flip_physical{33}=0x3 +serdes_core_rx_polarity_flip_physical{37}=0x1 +serdes_core_rx_polarity_flip_physical{41}=0x9 +serdes_core_rx_polarity_flip_physical{45}=0x9 +serdes_core_rx_polarity_flip_physical{49}=0x8 +serdes_core_rx_polarity_flip_physical{53}=0x9 +serdes_core_rx_polarity_flip_physical{57}=0xa +serdes_core_rx_polarity_flip_physical{61}=0x5 +serdes_core_rx_polarity_flip_physical{65}=0xa +serdes_core_rx_polarity_flip_physical{69}=0xa +serdes_core_rx_polarity_flip_physical{73}=0xa +serdes_core_rx_polarity_flip_physical{77}=0x5 +serdes_core_tx_polarity_flip_physical{1}=0x0 +serdes_core_tx_polarity_flip_physical{5}=0x0 +serdes_core_tx_polarity_flip_physical{9}=0x0 +serdes_core_tx_polarity_flip_physical{13}=0x0 +serdes_core_tx_polarity_flip_physical{17}=0x0 +serdes_core_tx_polarity_flip_physical{21}=0x0 +serdes_core_tx_polarity_flip_physical{25}=0x0 +serdes_core_tx_polarity_flip_physical{29}=0x0 +serdes_core_tx_polarity_flip_physical{33}=0x0 +serdes_core_tx_polarity_flip_physical{37}=0x8 +serdes_core_tx_polarity_flip_physical{41}=0x0 +serdes_core_tx_polarity_flip_physical{45}=0x8 +serdes_core_tx_polarity_flip_physical{49}=0x1 +serdes_core_tx_polarity_flip_physical{53}=0x0 +serdes_core_tx_polarity_flip_physical{57}=0xf +serdes_core_tx_polarity_flip_physical{61}=0x7 +serdes_core_tx_polarity_flip_physical{65}=0x0 +serdes_core_tx_polarity_flip_physical{69}=0x0 +serdes_core_tx_polarity_flip_physical{73}=0x0 +serdes_core_tx_polarity_flip_physical{77}=0x0 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/default_sku b/device/arista/x86_64-arista_7050sx3_48yc8/default_sku new file mode 100644 index 000000000000..4332a11e9f75 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/default_sku @@ -0,0 +1 @@ +Arista-7050SX3-48YC8 t1 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/platform_reboot b/device/arista/x86_64-arista_7050sx3_48yc8/platform_reboot new file mode 120000 index 000000000000..7f94a49e38b0 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/platform_reboot @@ -0,0 +1 @@ +../x86_64-arista_common/platform_reboot \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/plugins/eeprom.py b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/eeprom.py new file mode 120000 index 000000000000..35cfaff3de4e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/eeprom.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/plugins/led_control.py b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/led_control.py new file mode 120000 index 000000000000..8d733780117e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/led_control.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/led_control.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/plugins/psuutil.py b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/psuutil.py new file mode 120000 index 000000000000..2b0024ade969 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/psuutil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/plugins/sfputil.py b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/sfputil.py new file mode 120000 index 000000000000..c333e23763d7 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/sfputil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/pmon_daemon_control.json b/device/arista/x86_64-arista_7050sx3_48yc8/pmon_daemon_control.json new file mode 120000 index 000000000000..51d5ab7b0059 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-arista_common/pmon_daemon_control.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf b/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf new file mode 100644 index 000000000000..c6c60f294675 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf @@ -0,0 +1,50 @@ +# libsensors configuration file for DCS-7050SX3-48YC8 +# --------------------------------------------------- +# + +bus "i2c-8" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-9" "SCD 0000:02:00.0 SMBus master 0 bus 1" +bus "i2c-10" "SCD 0000:02:00.0 SMBus master 0 bus 2" +bus "i2c-72" "SCD 0000:00:09.0 SMBus master 0 bus 2" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +chip "pmbus-i2c-8-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-9-58" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 sensor" + +chip "max6658-i2c-72-4c" + label temp1 "Board temp sensor" + set temp1_max 75 + set temp1_crit 85 + + label temp2 "Front panel temp sensor" + set temp2_max 75 + set temp2_crit 85 + +chip "tmp464-i2c-10-48" + label temp1 "Switch Card temp sensor" + set temp1_max 100 + set temp1_crit 110 + + label temp2 "Front-panel temp sensor" + set temp2_max 65 + set temp2_crit 75 + + label temp3 "Front PCB temp sensor" + set temp3_max 75 + set temp3_crit 80 + + ignore temp4 + ignore temp5 + ignore temp6 + ignore temp7 + ignore temp8 + ignore temp9 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/system_health_monitoring_config.json b/device/arista/x86_64-arista_7050sx3_48yc8/system_health_monitoring_config.json new file mode 120000 index 000000000000..1185f771fa8e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/system_health_monitoring_config.json @@ -0,0 +1 @@ +../x86_64-arista_common/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/thermal_policy.json b/device/arista/x86_64-arista_7050sx3_48yc8/thermal_policy.json new file mode 120000 index 000000000000..0991dc7f3638 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/thermal_policy.json @@ -0,0 +1 @@ +../x86_64-arista_common/thermal_policy.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/pcie.yaml b/device/arista/x86_64-arista_7060_cx32s/pcie.yaml similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/plugins/pcie.yaml rename to device/arista/x86_64-arista_7060_cx32s/pcie.yaml diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/pcie.yaml b/device/arista/x86_64-arista_7260cx3_64/pcie.yaml similarity index 100% rename from device/arista/x86_64-arista_7260cx3_64/plugins/pcie.yaml rename to device/arista/x86_64-arista_7260cx3_64/pcie.yaml diff --git a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm index 4467d5d033ce..4e9d02fdc821 100644 --- a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm @@ -135,13 +135,13 @@ tm_port_header_type_in_203.BCM8869X=INJECTED_2_PP tm_port_header_type_out_203.BCM8869X=ETH sat_enable.BCM8869X=1 -tm_port_header_type_out_218.BCM8869X=CPU -tm_port_header_type_in_218.BCM8869X=INJECTED_2 +tm_port_header_type_out_210.BCM8869X=CPU +tm_port_header_type_in_210.BCM8869X=INJECTED_2 -tm_port_header_type_in_232.BCM8869X=INJECTED_2 -tm_port_header_type_out_232.BCM8869X=CPU -tm_port_header_type_in_233.BCM8869X=INJECTED_2 -tm_port_header_type_out_233.BCM8869X=CPU +tm_port_header_type_in_211.BCM8869X=INJECTED_2 +tm_port_header_type_out_211.BCM8869X=CPU +tm_port_header_type_in_212.BCM8869X=INJECTED_2 +tm_port_header_type_out_212.BCM8869X=CPU tm_port_header_type_in_240.BCM8869X=INJECTED_2 tm_port_header_type_out_240.BCM8869X=RAW diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm index 3d89e2b41b4a..541e26302dc0 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm @@ -131,13 +131,13 @@ tm_port_header_type_in_203.BCM8869X=INJECTED_2_PP tm_port_header_type_out_203.BCM8869X=ETH sat_enable.BCM8869X=1 -tm_port_header_type_out_218.BCM8869X=CPU -tm_port_header_type_in_218.BCM8869X=INJECTED_2 +tm_port_header_type_out_210.BCM8869X=CPU +tm_port_header_type_in_210.BCM8869X=INJECTED_2 -tm_port_header_type_in_232.BCM8869X=INJECTED_2 -tm_port_header_type_out_232.BCM8869X=CPU -tm_port_header_type_in_233.BCM8869X=INJECTED_2 -tm_port_header_type_out_233.BCM8869X=CPU +tm_port_header_type_in_211.BCM8869X=INJECTED_2 +tm_port_header_type_out_211.BCM8869X=CPU +tm_port_header_type_in_212.BCM8869X=INJECTED_2 +tm_port_header_type_out_212.BCM8869X=CPU tm_port_header_type_in_240.BCM8869X=INJECTED_2 tm_port_header_type_out_240.BCM8869X=RAW diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C40/jr2-a7280cr3-32p4-40x100G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C40/jr2-a7280cr3-32p4-40x100G.config.bcm index 654a4d8f158f..ca3c266eadfc 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C40/jr2-a7280cr3-32p4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C40/jr2-a7280cr3-32p4-40x100G.config.bcm @@ -108,7 +108,7 @@ ucode_port_139.BCM8869X=RCY_MIRROR.19:core_1.139 port_priorities.BCM8869X=8 -ucode_port_240.BCM8869X=OLP:core_0.240 +ucode_port_213.BCM8869X=OLP:core_0.213 sw_state_max_size.BCM8869X=750000000 @@ -135,16 +135,16 @@ tm_port_header_type_in_203.BCM8869X=INJECTED_2_PP tm_port_header_type_out_203.BCM8869X=ETH sat_enable.BCM8869X=1 -tm_port_header_type_out_218.BCM8869X=CPU -tm_port_header_type_in_218.BCM8869X=INJECTED_2 +tm_port_header_type_out_210.BCM8869X=CPU +tm_port_header_type_in_210.BCM8869X=INJECTED_2 -tm_port_header_type_in_232.BCM8869X=INJECTED_2 -tm_port_header_type_out_232.BCM8869X=CPU -tm_port_header_type_in_233.BCM8869X=INJECTED_2 -tm_port_header_type_out_233.BCM8869X=CPU +tm_port_header_type_in_211.BCM8869X=INJECTED_2 +tm_port_header_type_out_211.BCM8869X=CPU +tm_port_header_type_in_212.BCM8869X=INJECTED_2 +tm_port_header_type_out_212.BCM8869X=CPU -tm_port_header_type_in_240.BCM8869X=INJECTED_2 -tm_port_header_type_out_240.BCM8869X=RAW +tm_port_header_type_in_213.BCM8869X=INJECTED_2 +tm_port_header_type_out_213.BCM8869X=RAW dtm_flow_mapping_mode_region_64.BCM8869X=3 dtm_flow_mapping_mode_region_65.BCM8869X=3 diff --git a/device/arista/x86_64-arista_7280cr3mk_32d4 b/device/arista/x86_64-arista_7280cr3mk_32d4 new file mode 120000 index 000000000000..50478132d933 --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3mk_32d4 @@ -0,0 +1 @@ +x86_64-arista_7280cr3_32d4 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7280cr3mk_32p4 b/device/arista/x86_64-arista_7280cr3mk_32p4 new file mode 120000 index 000000000000..d6e2ddbb64bd --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3mk_32p4 @@ -0,0 +1 @@ +x86_64-arista_7280cr3_32p4 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins b/device/arista/x86_64-arista_7800_sup/plugins deleted file mode 120000 index 789a45fcace9..000000000000 --- a/device/arista/x86_64-arista_7800_sup/plugins +++ /dev/null @@ -1 +0,0 @@ -../x86_64-arista_common/plugins \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins/eeprom.py b/device/arista/x86_64-arista_7800_sup/plugins/eeprom.py new file mode 120000 index 000000000000..35cfaff3de4e --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/eeprom.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins/led_control.py b/device/arista/x86_64-arista_7800_sup/plugins/led_control.py new file mode 120000 index 000000000000..8d733780117e --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/plugins/led_control.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/led_control.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins/psuutil.py b/device/arista/x86_64-arista_7800_sup/plugins/psuutil.py new file mode 120000 index 000000000000..2b0024ade969 --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/psuutil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins/sfputil.py b/device/arista/x86_64-arista_7800_sup/plugins/sfputil.py new file mode 120000 index 000000000000..c333e23763d7 --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/sfputil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800_sup/plugins/udevprefix.conf b/device/arista/x86_64-arista_7800_sup/plugins/udevprefix.conf new file mode 100644 index 000000000000..e2f2966c864d --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/plugins/udevprefix.conf @@ -0,0 +1 @@ +ttySCD \ No newline at end of file diff --git a/device/arista/x86_64-arista_common/system_health_monitoring_config.json b/device/arista/x86_64-arista_common/system_health_monitoring_config.json index 1733fcffdba3..5ceec23fd26f 100644 --- a/device/arista/x86_64-arista_common/system_health_monitoring_config.json +++ b/device/arista/x86_64-arista_common/system_health_monitoring_config.json @@ -9,8 +9,8 @@ "user_defined_checkers": [], "polling_interval": 60, "led_color": { - "fault": "orange", + "fault": "amber", "normal": "green", - "booting": "orange_blink" + "booting": "amber_blink" } } diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/plugins/pcie.yaml b/device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn-newport/plugins/pcie.yaml rename to device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/plugins/pcie.yaml b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn-montara/plugins/pcie.yaml rename to device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json index 0b68edf1610c..b7f3756b1be1 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json @@ -3,194 +3,290 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "Ethernet0,Ethernet1,Ethernet2,Ethernet3", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet0"], + "2x50G": ["Ethernet0", "Ethernet2"], + "4x25G[10G]": ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "Ethernet4,Ethernet5,Ethernet6,Ethernet7", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet4"], + "2x50G": ["Ethernet4", "Ethernet6"], + "4x25G[10G]": ["Ethernet4", "Ethernet5", "Ethernet6", "Ethernet7"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "Ethernet8,Ethernet9,Ethernet10,Ethernet11", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet8"], + "2x50G": ["Ethernet8", "Ethernet10"], + "4x25G[10G]": ["Ethernet8", "Ethernet9", "Ethernet10", "Ethernet11"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "Ethernet12,Ethernet13,Ethernet14,Ethernet15", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet12"], + "2x50G": ["Ethernet12", "Ethernet14"], + "4x25G[10G]": ["Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "Ethernet16,Ethernet17,Ethernet18,Ethernet19", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet16"], + "2x50G": ["Ethernet16", "Ethernet18"], + "4x25G[10G]": ["Ethernet16", "Ethernet17", "Ethernet18", "Ethernet19"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "Ethernet20,Ethernet21,Ethernet22,Ethernet23", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet20"], + "2x50G": ["Ethernet20", "Ethernet22"], + "4x25G[10G]": ["Ethernet20", "Ethernet21", "Ethernet22", "Ethernet23"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "Ethernet24,Ethernet25,Ethernet26,Ethernet27", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet24"], + "2x50G": ["Ethernet24", "Ethernet26"], + "4x25G[10G]": ["Ethernet24", "Ethernet25", "Ethernet26", "Ethernet27"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "Ethernet28,Ethernet29,Ethernet30,Ethernet31", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet28"], + "2x50G": ["Ethernet28", "Ethernet30"], + "4x25G[10G]": ["Ethernet28", "Ethernet29", "Ethernet30", "Ethernet31"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "Ethernet32,Ethernet33,Ethernet34,Ethernet35", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet32"], + "2x50G": ["Ethernet32", "Ethernet34"], + "4x25G[10G]": ["Ethernet32", "Ethernet33", "Ethernet34", "Ethernet35"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "Ethernet36,Ethernet37,Ethernet38,Ethernet39", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet36"], + "2x50G": ["Ethernet36", "Ethernet38"], + "4x25G[10G]": ["Ethernet36", "Ethernet37", "Ethernet38", "Ethernet39"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "Ethernet40,Ethernet41,Ethernet42,Ethernet43", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet40"], + "2x50G": ["Ethernet40", "Ethernet42"], + "4x25G[10G]": ["Ethernet40", "Ethernet41", "Ethernet42", "Ethernet43"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "Ethernet44,Ethernet45,Ethernet46,Ethernet47", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet44"], + "2x50G": ["Ethernet44", "Ethernet46"], + "4x25G[10G]": ["Ethernet44", "Ethernet45", "Ethernet46", "Ethernet47"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "Ethernet48,Ethernet49,Ethernet50,Ethernet51", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet48"], + "2x50G": ["Ethernet48", "Ethernet50"], + "4x25G[10G]": ["Ethernet48", "Ethernet49", "Ethernet50", "Ethernet51"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "Ethernet52,Ethernet53,Ethernet54,Ethernet55", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet52"], + "2x50G": ["Ethernet52", "Ethernet54"], + "4x25G[10G]": ["Ethernet52", "Ethernet53", "Ethernet54", "Ethernet55"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "Ethernet56,Ethernet57,Ethernet58,Ethernet59", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet56"], + "2x50G": ["Ethernet56", "Ethernet58"], + "4x25G[10G]": ["Ethernet56", "Ethernet57", "Ethernet58", "Ethernet59"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "Ethernet60,Ethernet61,Ethernet62,Ethernet63", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet60"], + "2x50G": ["Ethernet60", "Ethernet62"], + "4x25G[10G]": ["Ethernet60", "Ethernet61", "Ethernet62", "Ethernet63"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "Ethernet64,Ethernet65,Ethernet66,Ethernet67", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet64"], + "2x50G": ["Ethernet64", "Ethernet66"], + "4x25G[10G]": ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "Ethernet68,Ethernet69,Ethernet70,Ethernet71", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet68"], + "2x50G": ["Ethernet68", "Ethernet70"], + "4x25G[10G]": ["Ethernet68", "Ethernet69", "Ethernet70", "Ethernet71"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "Ethernet72,Ethernet73,Ethernet74,Ethernet75", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet72"], + "2x50G": ["Ethernet72", "Ethernet74"], + "4x25G[10G]": ["Ethernet72", "Ethernet73", "Ethernet74", "Ethernet75"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "Ethernet76,Ethernet77,Ethernet78,Ethernet79", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet76"], + "2x50G": ["Ethernet76", "Ethernet78"], + "4x25G[10G]": ["Ethernet76", "Ethernet77", "Ethernet78", "Ethernet79"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "Ethernet80,Ethernet81,Ethernet82,Ethernet83", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet80"], + "2x50G": ["Ethernet80", "Ethernet82"], + "4x25G[10G]": ["Ethernet80", "Ethernet81", "Ethernet82", "Ethernet83"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "Ethernet84,Ethernet85,Ethernet86,Ethernet87", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet84"], + "2x50G": ["Ethernet84", "Ethernet86"], + "4x25G[10G]": ["Ethernet84", "Ethernet85", "Ethernet86", "Ethernet87"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "Ethernet88,Ethernet89,Ethernet90,Ethernet91", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet88"], + "2x50G": ["Ethernet88", "Ethernet90"], + "4x25G[10G]": ["Ethernet88", "Ethernet89", "Ethernet90", "Ethernet91"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "Ethernet92,Ethernet93,Ethernet94,Ethernet95", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet92"], + "2x50G": ["Ethernet92", "Ethernet94"], + "4x25G[10G]": ["Ethernet92", "Ethernet93", "Ethernet94", "Ethernet95"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "Ethernet96,Ethernet97,Ethernet98,Ethernet99", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet96"], + "2x50G": ["Ethernet96", "Ethernet98"], + "4x25G[10G]": ["Ethernet96", "Ethernet97", "Ethernet98", "Ethernet99"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "Ethernet100,Ethernet101,Ethernet102,Ethernet103", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet100"], + "2x50G": ["Ethernet100", "Ethernet102"], + "4x25G[10G]": ["Ethernet100", "Ethernet101", "Ethernet102", "Ethernet103"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "Ethernet104,Ethernet105,Ethernet106,Ethernet107", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet104"], + "2x50G": ["Ethernet104", "Ethernet106"], + "4x25G[10G]": ["Ethernet104", "Ethernet105", "Ethernet106", "Ethernet107"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "Ethernet108,Ethernet109,Ethernet110,Ethernet111", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet108"], + "2x50G": ["Ethernet108", "Ethernet110"], + "4x25G[10G]": ["Ethernet108", "Ethernet109", "Ethernet110", "Ethernet111"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "Ethernet112,Ethernet113,Ethernet114,Ethernet115", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet112"], + "2x50G": ["Ethernet112", "Ethernet114"], + "4x25G[10G]": ["Ethernet112", "Ethernet113", "Ethernet112", "Ethernet113"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "Ethernet116,Ethernet117,Ethernet118,Ethernet119", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet116"], + "2x50G": ["Ethernet116", "Ethernet118"], + "4x25G[10G]": ["Ethernet116", "Ethernet117", "Ethernet118", "Ethernet119"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "Ethernet120,Ethernet121,Ethernet122,Ethernet123", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet120"], + "2x50G": ["Ethernet120", "Ethernet122"], + "4x25G[10G]": ["Ethernet120", "Ethernet121", "Ethernet122", "Ethernet123"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "Ethernet124,Ethernet125,Ethernet126,Ethernet127", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet124"], + "2x50G": ["Ethernet124", "Ethernet126"], + "4x25G[10G]": ["Ethernet124", "Ethernet125", "Ethernet126", "Ethernet127"] + } } } } diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json index 866706a28357..a2394135c0fc 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json @@ -3,392 +3,587 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "Ethernet0,Ethernet1,Ethernet2,Ethernet3", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet0"], + "2x50G": ["Ethernet0", "Ethernet2"], + "4x25G[10G]": ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "Ethernet4,Ethernet5,Ethernet6,Ethernet7", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet4"], + "2x50G": ["Ethernet4", "Ethernet6"], + "4x25G[10G]": ["Ethernet4", "Ethernet5", "Ethernet6", "Ethernet7"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "Ethernet8,Ethernet9,Ethernet10,Ethernet11", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet8"], + "2x50G": ["Ethernet8", "Ethernet10"], + "4x25G[10G]": ["Ethernet8", "Ethernet9", "Ethernet10", "Ethernet11"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "Ethernet12,Ethernet13,Ethernet14,Ethernet15", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet12"], + "2x50G": ["Ethernet12", "Ethernet14"], + "4x25G[10G]": ["Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "Ethernet16,Ethernet17,Ethernet18,Ethernet19", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet16"], + "2x50G": ["Ethernet16", "Ethernet18"], + "4x25G[10G]": ["Ethernet16", "Ethernet17", "Ethernet18", "Ethernet19"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "Ethernet20,Ethernet21,Ethernet22,Ethernet23", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet20"], + "2x50G": ["Ethernet20", "Ethernet22"], + "4x25G[10G]": ["Ethernet20", "Ethernet21", "Ethernet22", "Ethernet23"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "Ethernet24,Ethernet25,Ethernet26,Ethernet27", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet24"], + "2x50G": ["Ethernet24", "Ethernet26"], + "4x25G[10G]": ["Ethernet24", "Ethernet25", "Ethernet26", "Ethernet27"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "Ethernet28,Ethernet29,Ethernet30,Ethernet31", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet28"], + "2x50G": ["Ethernet28", "Ethernet30"], + "4x25G[10G]": ["Ethernet28", "Ethernet29", "Ethernet30", "Ethernet31"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "Ethernet32,Ethernet33,Ethernet34,Ethernet35", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet32"], + "2x50G": ["Ethernet32", "Ethernet34"], + "4x25G[10G]": ["Ethernet32", "Ethernet33", "Ethernet34", "Ethernet35"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "Ethernet36,Ethernet37,Ethernet38,Ethernet39", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet36"], + "2x50G": ["Ethernet36", "Ethernet38"], + "4x25G[10G]": ["Ethernet36", "Ethernet37", "Ethernet38", "Ethernet39"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "Ethernet40,Ethernet41,Ethernet42,Ethernet43", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet40"], + "2x50G": ["Ethernet40", "Ethernet42"], + "4x25G[10G]": ["Ethernet40", "Ethernet41", "Ethernet42", "Ethernet43"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "Ethernet44,Ethernet45,Ethernet46,Ethernet47", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet44"], + "2x50G": ["Ethernet44", "Ethernet46"], + "4x25G[10G]": ["Ethernet44", "Ethernet45", "Ethernet46", "Ethernet47"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "Ethernet48,Ethernet49,Ethernet50,Ethernet51", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet48"], + "2x50G": ["Ethernet48", "Ethernet50"], + "4x25G[10G]": ["Ethernet48", "Ethernet49", "Ethernet50", "Ethernet51"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "Ethernet52,Ethernet53,Ethernet54,Ethernet55", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet52"], + "2x50G": ["Ethernet52", "Ethernet54"], + "4x25G[10G]": ["Ethernet52", "Ethernet53", "Ethernet54", "Ethernet55"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "Ethernet56,Ethernet57,Ethernet58,Ethernet59", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet56"], + "2x50G": ["Ethernet56", "Ethernet58"], + "4x25G[10G]": ["Ethernet56", "Ethernet57", "Ethernet58", "Ethernet59"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "Ethernet60,Ethernet61,Ethernet62,Ethernet63", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet60"], + "2x50G": ["Ethernet60", "Ethernet62"], + "4x25G[10G]": ["Ethernet60", "Ethernet61", "Ethernet62", "Ethernet63"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "Ethernet64,Ethernet65,Ethernet66,Ethernet67", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet64"], + "2x50G": ["Ethernet64", "Ethernet66"], + "4x25G[10G]": ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "Ethernet68,Ethernet69,Ethernet70,Ethernet71", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet68"], + "2x50G": ["Ethernet68", "Ethernet70"], + "4x25G[10G]": ["Ethernet68", "Ethernet69", "Ethernet70", "Ethernet71"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "Ethernet72,Ethernet73,Ethernet74,Ethernet75", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet72"], + "2x50G": ["Ethernet72", "Ethernet74"], + "4x25G[10G]": ["Ethernet72", "Ethernet73", "Ethernet74", "Ethernet75"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "Ethernet76,Ethernet77,Ethernet78,Ethernet79", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet76"], + "2x50G": ["Ethernet76", "Ethernet78"], + "4x25G[10G]": ["Ethernet76", "Ethernet77", "Ethernet78", "Ethernet79"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "Ethernet80,Ethernet81,Ethernet82,Ethernet83", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet80"], + "2x50G": ["Ethernet80", "Ethernet82"], + "4x25G[10G]": ["Ethernet80", "Ethernet81", "Ethernet82", "Ethernet83"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "Ethernet84,Ethernet85,Ethernet86,Ethernet87", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet84"], + "2x50G": ["Ethernet84", "Ethernet86"], + "4x25G[10G]": ["Ethernet84", "Ethernet85", "Ethernet86", "Ethernet87"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "Ethernet88,Ethernet89,Ethernet90,Ethernet91", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet88"], + "2x50G": ["Ethernet88", "Ethernet90"], + "4x25G[10G]": ["Ethernet88", "Ethernet89", "Ethernet90", "Ethernet91"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "Ethernet92,Ethernet93,Ethernet94,Ethernet95", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet92"], + "2x50G": ["Ethernet92", "Ethernet94"], + "4x25G[10G]": ["Ethernet92", "Ethernet93", "Ethernet94", "Ethernet95"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "Ethernet96,Ethernet97,Ethernet98,Ethernet99", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet96"], + "2x50G": ["Ethernet96", "Ethernet98"], + "4x25G[10G]": ["Ethernet96", "Ethernet97", "Ethernet98", "Ethernet99"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "Ethernet100,Ethernet101,Ethernet102,Ethernet103", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet100"], + "2x50G": ["Ethernet100", "Ethernet102"], + "4x25G[10G]": ["Ethernet100", "Ethernet101", "Ethernet102", "Ethernet103"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "Ethernet104,Ethernet105,Ethernet106,Ethernet107", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet104"], + "2x50G": ["Ethernet104", "Ethernet106"], + "4x25G[10G]": ["Ethernet104", "Ethernet105", "Ethernet106", "Ethernet107"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "Ethernet108,Ethernet109,Ethernet110,Ethernet111", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet108"], + "2x50G": ["Ethernet108", "Ethernet110"], + "4x25G[10G]": ["Ethernet108", "Ethernet109", "Ethernet110", "Ethernet111"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "Ethernet112,Ethernet113,Ethernet114,Ethernet115", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet112"], + "2x50G": ["Ethernet112", "Ethernet114"], + "4x25G[10G]": ["Ethernet112", "Ethernet113", "Ethernet114", "Ethernet115"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "Ethernet116,Ethernet117,Ethernet118,Ethernet119", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet116"], + "2x50G": ["Ethernet116", "Ethernet118"], + "4x25G[10G]": ["Ethernet116", "Ethernet117", "Ethernet118", "Ethernet119"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "Ethernet120,Ethernet121,Ethernet122,Ethernet123", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet120"], + "2x50G": ["Ethernet120", "Ethernet122"], + "4x25G[10G]": ["Ethernet120", "Ethernet121", "Ethernet122", "Ethernet123"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "Ethernet124,Ethernet125,Ethernet126,Ethernet127", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet124"], + "2x50G": ["Ethernet124", "Ethernet126"], + "4x25G[10G]": ["Ethernet124", "Ethernet125", "Ethernet126", "Ethernet127"] + } }, "Ethernet128": { "index": "33,33,33,33", "lanes": "128,129,130,131", - "alias_at_lanes": "Ethernet128,Ethernet129,Ethernet130,Ethernet131", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet128"], + "2x50G": ["Ethernet128", "Ethernet130"], + "4x25G[10G]": ["Ethernet128", "Ethernet129", "Ethernet130", "Ethernet131"] + } }, "Ethernet132": { "index": "34,34,34,34", "lanes": "132,133,134,135", - "alias_at_lanes": "Ethernet132,Ethernet133,Ethernet134,Ethernet135", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet132"], + "2x50G": ["Ethernet132", "Ethernet134"], + "4x25G[10G]": ["Ethernet132", "Ethernet133", "Ethernet134", "Ethernet135"] + } }, "Ethernet136": { "index": "35,35,35,35", "lanes": "136,137,138,139", - "alias_at_lanes": "Ethernet136,Ethernet137,Ethernet138,Ethernet139", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet136"], + "2x50G": ["Ethernet136", "Ethernet138"], + "4x25G[10G]": ["Ethernet136", "Ethernet137", "Ethernet138", "Ethernet139"] + } }, "Ethernet140": { "index": "36,36,36,36", "lanes": "140,141,142,143", - "alias_at_lanes": "Ethernet140,Ethernet141,Ethernet142,Ethernet143", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet140"], + "2x50G": ["Ethernet140", "Ethernet142"], + "4x25G[10G]": ["Ethernet140", "Ethernet141", "Ethernet142", "Ethernet143"] + } }, "Ethernet144": { "index": "37,37,37,37", "lanes": "144,145,146,147", - "alias_at_lanes": "Ethernet144,Ethernet145,Ethernet146,Ethernet147", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet144"], + "2x50G": ["Ethernet144", "Ethernet146"], + "4x25G[10G]": ["Ethernet144", "Ethernet145", "Ethernet146", "Ethernet147"] + } }, "Ethernet148": { "index": "38,38,38,38", "lanes": "148,149,150,151", - "alias_at_lanes": "Ethernet148,Ethernet149,Ethernet150,Ethernet151", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet148"], + "2x50G": ["Ethernet148", "Ethernet150"], + "4x25G[10G]": ["Ethernet148", "Ethernet149", "Ethernet150", "Ethernet151"] + } }, "Ethernet152": { "index": "39,39,39,39", "lanes": "152,153,154,155", - "alias_at_lanes": "Ethernet152,Ethernet153,Ethernet154,Ethernet155", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet152"], + "2x50G": ["Ethernet152", "Ethernet154"], + "4x25G[10G]": ["Ethernet152", "Ethernet153", "Ethernet154", "Ethernet155"] + } }, "Ethernet156": { "index": "40,40,40,40", "lanes": "156,157,158,159", - "alias_at_lanes": "Ethernet156,Ethernet157,Ethernet158,Ethernet159", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet156"], + "2x50G": ["Ethernet156", "Ethernet158"], + "4x25G[10G]": ["Ethernet156", "Ethernet157", "Ethernet158", "Ethernet159"] + } }, "Ethernet160": { "index": "41,41,41,41", "lanes": "160,161,162,163", - "alias_at_lanes": "Ethernet160,Ethernet161,Ethernet162,Ethernet163", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet160"], + "2x50G": ["Ethernet160", "Ethernet162"], + "4x25G[10G]": ["Ethernet160", "Ethernet161", "Ethernet162", "Ethernet163"] + } }, "Ethernet164": { "index": "42,42,42,42", "lanes": "164,165,166,167", - "alias_at_lanes": "Ethernet164,Ethernet165,Ethernet166,Ethernet167", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet164"], + "2x50G": ["Ethernet164", "Ethernet166"], + "4x25G[10G]": ["Ethernet164", "Ethernet165", "Ethernet166", "Ethernet167"] + } }, "Ethernet168": { "index": "43,43,43,43", "lanes": "168,169,170,171", - "alias_at_lanes": "Ethernet168,Ethernet169,Ethernet170,Ethernet171", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet168"], + "2x50G": ["Ethernet168", "Ethernet170"], + "4x25G[10G]": ["Ethernet168", "Ethernet169", "Ethernet170", "Ethernet171"] + } }, "Ethernet172": { "index": "44,44,44,44", "lanes": "172,173,174,175", - "alias_at_lanes": "Ethernet172,Ethernet173,Ethernet174,Ethernet175", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet172"], + "2x50G": ["Ethernet172", "Ethernet174"], + "4x25G[10G]": ["Ethernet172", "Ethernet173", "Ethernet174", "Ethernet175"] + } }, "Ethernet176": { "index": "45,45,45,45", "lanes": "176,177,178,179", - "alias_at_lanes": "Ethernet176,Ethernet177,Ethernet178,Ethernet179", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet176"], + "2x50G": ["Ethernet176", "Ethernet178"], + "4x25G[10G]": ["Ethernet176", "Ethernet177", "Ethernet178", "Ethernet179"] + } }, "Ethernet180": { "index": "46,46,46,46", "lanes": "180,181,182,183", - "alias_at_lanes": "Ethernet180,Ethernet181,Ethernet182,Ethernet183", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet180"], + "2x50G": ["Ethernet180", "Ethernet182"], + "4x25G[10G]": ["Ethernet180", "Ethernet181", "Ethernet182", "Ethernet183"] + } }, "Ethernet184": { "index": "47,47,47,47", "lanes": "184,185,186,187", - "alias_at_lanes": "Ethernet184,Ethernet185,Ethernet186,Ethernet187", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet184"], + "2x50G": ["Ethernet184", "Ethernet186"], + "4x25G[10G]": ["Ethernet184", "Ethernet185", "Ethernet186", "Ethernet187"] + } }, "Ethernet188": { "index": "48,48,48,48", "lanes": "188,189,190,191", - "alias_at_lanes": "Ethernet188,Ethernet189,Ethernet190,Ethernet191", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet188"], + "2x50G": ["Ethernet188", "Ethernet190"], + "4x25G[10G]": ["Ethernet188", "Ethernet189", "Ethernet190", "Ethernet191"] + } }, "Ethernet192": { "index": "49,49,49,49", "lanes": "192,193,194,195", - "alias_at_lanes": "Ethernet192,Ethernet193,Ethernet194,Ethernet195", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet192"], + "2x50G": ["Ethernet192", "Ethernet194"], + "4x25G[10G]": ["Ethernet192", "Ethernet193", "Ethernet194", "Ethernet195"] + } }, "Ethernet196": { "index": "50,50,50,50", "lanes": "196,197,198,199", - "alias_at_lanes": "Ethernet196,Ethernet197,Ethernet198,Ethernet199", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet196"], + "2x50G": ["Ethernet196", "Ethernet198"], + "4x25G[10G]": ["Ethernet196", "Ethernet197", "Ethernet198", "Ethernet199"] + } }, "Ethernet200": { "index": "51,51,51,51", "lanes": "200,201,202,203", - "alias_at_lanes": "Ethernet200,Ethernet201,Ethernet202,Ethernet203", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet200"], + "2x50G": ["Ethernet200", "Ethernet202"], + "4x25G[10G]": ["Ethernet200", "Ethernet201", "Ethernet202", "Ethernet203"] + } }, "Ethernet204": { "index": "52,52,52,52", "lanes": "204,205,206,207", - "alias_at_lanes": "Ethernet204,Ethernet205,Ethernet206,Ethernet207", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet204"], + "2x50G": ["Ethernet204", "Ethernet206"], + "4x25G[10G]": ["Ethernet204", "Ethernet205", "Ethernet206", "Ethernet207"] + } }, "Ethernet208": { "index": "53,53,53,53", "lanes": "208,209,210,211", - "alias_at_lanes": "Ethernet208,Ethernet209,Ethernet210,Ethernet211", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet208"], + "2x50G": ["Ethernet208", "Ethernet210"], + "4x25G[10G]": ["Ethernet208", "Ethernet209", "Ethernet210", "Ethernet211"] + } }, "Ethernet212": { "index": "54,54,54,54", "lanes": "212,213,214,215", - "alias_at_lanes": "Ethernet212,Ethernet213,Ethernet214,Ethernet215", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet212"], + "2x50G": ["Ethernet212", "Ethernet214"], + "4x25G[10G]": ["Ethernet212", "Ethernet213", "Ethernet214", "Ethernet215"] + } }, "Ethernet216": { "index": "55,55,55,55", "lanes": "216,217,218,219", - "alias_at_lanes": "Ethernet216,Ethernet217,Ethernet218,Ethernet219", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet216"], + "2x50G": ["Ethernet216", "Ethernet218"], + "4x25G[10G]": ["Ethernet216", "Ethernet217", "Ethernet218", "Ethernet219"] + } }, "Ethernet220": { "index": "56,56,56,56", "lanes": "220,221,222,223", - "alias_at_lanes": "Ethernet220,Ethernet221,Ethernet222,Ethernet223", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet220"], + "2x50G": ["Ethernet220", "Ethernet222"], + "4x25G[10G]": ["Ethernet220", "Ethernet221", "Ethernet222", "Ethernet223"] + } }, "Ethernet224": { "index": "57,57,57,57", "lanes": "224,225,226,227", - "alias_at_lanes": "Ethernet224,Ethernet225,Ethernet226,Ethernet227", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet224"], + "2x50G": ["Ethernet224", "Ethernet226"], + "4x25G[10G]": ["Ethernet224", "Ethernet225", "Ethernet226", "Ethernet227"] + } }, "Ethernet228": { "index": "58,58,58,58", "lanes": "228,229,230,231", - "alias_at_lanes": "Ethernet228,Ethernet229,Ethernet230,Ethernet231", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet228"], + "2x50G": ["Ethernet228", "Ethernet230"], + "4x25G[10G]": ["Ethernet228", "Ethernet229", "Ethernet230", "Ethernet231"] + } }, "Ethernet232": { "index": "59,59,59,59", "lanes": "232,233,234,235", - "alias_at_lanes": "Ethernet232,Ethernet233,Ethernet234,Ethernet235", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet232"], + "2x50G": ["Ethernet232", "Ethernet234"], + "4x25G[10G]": ["Ethernet232", "Ethernet233", "Ethernet234", "Ethernet235"] + } }, "Ethernet236": { "index": "60,60,60,60", "lanes": "236,237,238,239", - "alias_at_lanes": "Ethernet236,Ethernet237,Ethernet238,Ethernet239", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet236"], + "2x50G": ["Ethernet236", "Ethernet238"], + "4x25G[10G]": ["Ethernet236", "Ethernet237", "Ethernet238", "Ethernet239"] + } }, "Ethernet240": { "index": "61,61,61,61", "lanes": "240,241,242,243", - "alias_at_lanes": "Ethernet240,Ethernet241,Ethernet242,Ethernet243", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet240"], + "2x50G": ["Ethernet240", "Ethernet242"], + "4x25G[10G]": ["Ethernet240", "Ethernet241", "Ethernet242", "Ethernet243"] + } }, "Ethernet244": { "index": "62,62,62,62", "lanes": "244,245,246,247", - "alias_at_lanes": "Ethernet244,Ethernet245,Ethernet246,Ethernet247", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet244"], + "2x50G": ["Ethernet244", "Ethernet246"], + "4x25G[10G]": ["Ethernet244", "Ethernet245", "Ethernet246", "Ethernet247"] + } }, "Ethernet248": { "index": "63,63,63,63", "lanes": "248,249,250,251", - "alias_at_lanes": "Ethernet248,Ethernet249,Ethernet250,Ethernet251", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet248"], + "2x50G": ["Ethernet248", "Ethernet250"], + "4x25G[10G]": ["Ethernet248", "Ethernet249", "Ethernet250", "Ethernet251"] + } }, "Ethernet252": { "index": "64,64,64,64", "lanes": "252,253,254,255", - "alias_at_lanes": "Ethernet252,Ethernet253,Ethernet254,Ethernet255", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet252"], + "2x50G": ["Ethernet252", "Ethernet254"], + "4x25G[10G]": ["Ethernet252", "Ethernet253", "Ethernet254", "Ethernet255"] + } }, "Ethernet256": { "index": "65,65,65,65", "lanes": "256,257,258,259", - "alias_at_lanes": "Ethernet256,Ethernet257,Ethernet258,Ethernet259", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Ethernet256"], + "2x50G": ["Ethernet256", "Ethernet258"], + "4x25G[10G]": ["Ethernet256", "Ethernet257", "Ethernet258", "Ethernet259"] + } } } } diff --git a/device/celestica/x86_64-cel_e1031-r0/plugins/pcie.yaml b/device/celestica/x86_64-cel_e1031-r0/pcie.yaml similarity index 100% rename from device/celestica/x86_64-cel_e1031-r0/plugins/pcie.yaml rename to device/celestica/x86_64-cel_e1031-r0/pcie.yaml diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py index 157f49a7c3e2..6c73845287cd 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py @@ -25,6 +25,8 @@ class Thermal(ThermalBase): SS_CONFIG_PATH = "/usr/share/sonic/device/x86_64-cel_e1031-r0/sensors.conf" def __init__(self, thermal_index): + ThermalBase.__init__(self) + self.index = thermal_index # Add thermal name diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py index 882285251784..6db0508cb845 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py @@ -53,6 +53,7 @@ class Watchdog(WatchdogBase): def __init__(self): + WatchdogBase.__init__(self) self.watchdog, self.wdt_main_dev_name = self._get_wdt() self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/pcie.yaml b/device/celestica/x86_64-cel_seastone-r0/pcie.yaml similarity index 100% rename from device/celestica/x86_64-cel_seastone-r0/plugins/pcie.yaml rename to device/celestica/x86_64-cel_seastone-r0/pcie.yaml diff --git a/device/celestica/x86_64-cel_seastone-r0/platform.json b/device/celestica/x86_64-cel_seastone-r0/platform.json index 66ed83ef2060..aebb6ee0ac5c 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform.json @@ -3,194 +3,290 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "65,66,67,68", - "alias_at_lanes": "Eth1/1, Eth1/2, Eth1/3, Eth1/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth1"], + "2x50G": ["Eth1/1", "Eth1/2"], + "4x25G[10G]": ["Eth1/1", "Eth1/2", "Eth1/3", "Eth1/4"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "69,70,71,72", - "alias_at_lanes": "Eth2/1, Eth2/2, Eth2/3, Eth2/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth2"], + "2x50G": ["Eth2/1", "Eth2/2"], + "4x25G[10G]": ["Eth2/1", "Eth2/2", "Eth2/3", "Eth2/4"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "73,74,75,76", - "alias_at_lanes": "Eth3/1, Eth3/2, Eth3/3, Eth3/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth3"], + "2x50G": ["Eth3/1", "Eth3/2"], + "4x25G[10G]": ["Eth3/1", "Eth3/2", "Eth3/3", "Eth3/4"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "77,78,79,80", - "alias_at_lanes": "Eth4/1, Eth4/2, Eth4/3, Eth4/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth4"], + "2x50G": ["Eth4/1", "Eth4/2"], + "4x25G[10G]": ["Eth4/1", "Eth4/2", "Eth4/3", "Eth4/4"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "33,34,35,36", - "alias_at_lanes": "Eth5/1, Eth5/2, Eth5/3, Eth5/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth5"], + "2x50G": ["Eth5/1", "Eth5/2"], + "4x25G[10G]": ["Eth5/1", "Eth5/2", "Eth5/3", "Eth5/4"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "37,38,39,40", - "alias_at_lanes": "Eth6/1, Eth6/2, Eth6/3, Eth6/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth6"], + "2x50G": ["Eth6/1", "Eth6/2"], + "4x25G[10G]": ["Eth6/1", "Eth6/2", "Eth6/3", "Eth6/4"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "41,42,43,44", - "alias_at_lanes": "Eth7/1, Eth7/2, Eth7/3, Eth7/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth7"], + "2x50G": ["Eth7/1", "Eth7/2"], + "4x25G[10G]": ["Eth7/1", "Eth7/2", "Eth7/3", "Eth7/4"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "45,46,47,48", - "alias_at_lanes": "Eth8/1, Eth8/2, Eth8/3, Eth8/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth8"], + "2x50G": ["Eth8/1", "Eth8/2"], + "4x25G[10G]": ["Eth8/1", "Eth8/2", "Eth8/3", "Eth8/4"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "49,50,51,52", - "alias_at_lanes": "Eth9/1, Eth9/2, Eth9/3, Eth9/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth9"], + "2x50G": ["Eth9/1", "Eth9/2"], + "4x25G[10G]": ["Eth9/1", "Eth9/2", "Eth9/3", "Eth9/4"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "53,54,55,56", - "alias_at_lanes": "Eth10/1, Eth10/2, Eth10/3, Eth10/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth10"], + "2x50G": ["Eth10/1", "Eth10/2"], + "4x25G[10G]": ["Eth10/1", "Eth10/2", "Eth10/3", "Eth10/4"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "57,58,59,60", - "alias_at_lanes": "Eth11/1, Eth11/2, Eth11/3, Eth11/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth11"], + "2x50G": ["Eth11/1", "Eth11/2"], + "4x25G[10G]": ["Eth11/1", "Eth11/2", "Eth11/3", "Eth11/4"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "61,62,63,64", - "alias_at_lanes": "Eth12/1, Eth12/2, Eth12/3, Eth12/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth12"], + "2x50G": ["Eth12/1", "Eth12/2"], + "4x25G[10G]": ["Eth12/1", "Eth12/2", "Eth12/3", "Eth12/4"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "81,82,83,84", - "alias_at_lanes": "Eth13/1, Eth13/2, Eth13/3, Eth13/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth13"], + "2x50G": ["Eth13/1", "Eth13/2"], + "4x25G[10G]": ["Eth13/1", "Eth13/2", "Eth13/3", "Eth13/4"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "85,86,87,88", - "alias_at_lanes": "Eth14/1, Eth14/2, Eth14/3, Eth14/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth14"], + "2x50G": ["Eth14/1", "Eth14/2"], + "4x25G[10G]": ["Eth14/1", "Eth14/2", "Eth14/3", "Eth14/4"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "89,90,91,92", - "alias_at_lanes": "Eth15/1, Eth15/2, Eth15/3, Eth15/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth15"], + "2x50G": ["Eth15/1", "Eth15/2"], + "4x25G[10G]": ["Eth15/1", "Eth15/2", "Eth15/3", "Eth15/4"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "93,94,95,96", - "alias_at_lanes": "Eth16/1, Eth16/2, Eth16/3, Eth16/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth16"], + "2x50G": ["Eth16/1", "Eth16/2"], + "4x25G[10G]": ["Eth16/1", "Eth16/2", "Eth16/3", "Eth16/4"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "97,98,99,100", - "alias_at_lanes": "Eth17/1, Eth17/2, Eth17/3, Eth17/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth17"], + "2x50G": ["Eth17/1", "Eth17/2"], + "4x25G[10G]": ["Eth17/1", "Eth17/2", "Eth17/3", "Eth17/4"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "101,102,103,104", - "alias_at_lanes": "Eth18/1, Eth18/2, Eth18/3, Eth18/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth18"], + "2x50G": ["Eth18/1", "Eth18/2"], + "4x25G[10G]": ["Eth18/1", "Eth18/2", "Eth18/3", "Eth18/4"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "105,106,107,108", - "alias_at_lanes": "Eth19/1, Eth19/2, Eth19/3, Eth19/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth19"], + "2x50G": ["Eth19/1", "Eth19/2"], + "4x25G[10G]": ["Eth19/1", "Eth19/2", "Eth19/3", "Eth19/4"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "109,110,111,112", - "alias_at_lanes": "Eth20/1, Eth20/2, Eth20/3, Eth20/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth20"], + "2x50G": ["Eth20/1", "Eth20/2"], + "4x25G[10G]": ["Eth20/1", "Eth20/2", "Eth20/3", "Eth20/4"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "1,2,3,4", - "alias_at_lanes": "Eth21/1, Eth21/2, Eth21/3, Eth21/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth21"], + "2x50G": ["Eth21/1", "Eth21/2"], + "4x25G[10G]": ["Eth21/1", "Eth21/2", "Eth21/3", "Eth21/4"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "5,6,7,8", - "alias_at_lanes": "Eth22/1, Eth22/2, Eth22/3, Eth22/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth22"], + "2x50G": ["Eth22/1", "Eth22/2"], + "4x25G[10G]": ["Eth22/1", "Eth22/2", "Eth22/3", "Eth22/4"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "9,10,11,12", - "alias_at_lanes": "Eth23/1, Eth23/2, Eth23/3, Eth23/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth23"], + "2x50G": ["Eth23/1", "Eth23/2"], + "4x25G[10G]": ["Eth23/1", "Eth23/2", "Eth23/3", "Eth23/4"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "13,14,15,16", - "alias_at_lanes": "Eth24/1, Eth24/2, Eth24/3, Eth24/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth24"], + "2x50G": ["Eth24/1", "Eth24/2"], + "4x25G[10G]": ["Eth24/1", "Eth24/2", "Eth24/3", "Eth24/4"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "17,18,19,20", - "alias_at_lanes": "Eth25/1, Eth25/2, Eth25/3, Eth25/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth25"], + "2x50G": ["Eth25/1", "Eth25/2"], + "4x25G[10G]": ["Eth25/1", "Eth25/2", "Eth25/3", "Eth25/4"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "21,22,23,24", - "alias_at_lanes": "Eth26/1, Eth26/2, Eth26/3, Eth26/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth26"], + "2x50G": ["Eth26/1", "Eth26/2"], + "4x25G[10G]": ["Eth26/1", "Eth26/2", "Eth26/3", "Eth26/4"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "25,26,27,28", - "alias_at_lanes": "Eth27/1, Eth27/2, Eth27/3, Eth27/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth27"], + "2x50G": ["Eth27/1", "Eth27/2"], + "4x25G[10G]": ["Eth27/1", "Eth27/2", "Eth27/3", "Eth27/4"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "29,30,31,32", - "alias_at_lanes": "Eth28/1, Eth28/2, Eth28/3, Eth28/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth28"], + "2x50G": ["Eth28/1", "Eth28/2"], + "4x25G[10G]": ["Eth28/1", "Eth28/2", "Eth28/3", "Eth28/4"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "113,114,115,116", - "alias_at_lanes": "Eth29/1, Eth29/2, Eth29/3, Eth29/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth29"], + "2x50G": ["Eth29/1", "Eth29/2"], + "4x25G[10G]": ["Eth29/1", "Eth29/2", "Eth29/3", "Eth29/4"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "117,118,119,120", - "alias_at_lanes": "Eth30/1, Eth30/2, Eth30/3, Eth30/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth30"], + "2x50G": ["Eth30/1", "Eth30/2"], + "4x25G[10G]": ["Eth30/1", "Eth30/2", "Eth30/3", "Eth30/4"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "121,122,123,124", - "alias_at_lanes": "Eth31/1, Eth31/2, Eth31/3, Eth31/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth31"], + "2x50G": ["Eth31/1", "Eth31/2"], + "4x25G[10G]": ["Eth31/1", "Eth31/2", "Eth31/3", "Eth31/4"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "125,126,127,128", - "alias_at_lanes": "Eth32/1, Eth32/2, Eth32/3, Eth32/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth32"], + "2x50G": ["Eth32/1", "Eth32/2"], + "4x25G[10G]": ["Eth32/1", "Eth32/2", "Eth32/3", "Eth32/4"] + } } } -} \ No newline at end of file +} diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/thermal.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/thermal.py index 2b38ef94d6c4..3848f9340541 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/thermal.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/thermal.py @@ -67,6 +67,7 @@ class Thermal(ThermalBase): SS_CONFIG_PATH = "/usr/share/sonic/device/x86_64-cel_seastone-r0/sensors.conf" def __init__(self, thermal_index, airflow): + ThermalBase.__init__(self) self.index = thermal_index self._api_helper = APIHelper() self._airflow = airflow diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py index 31bb911d2401..5ab79309f0fe 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py @@ -31,6 +31,8 @@ class Watchdog(WatchdogBase): def __init__(self): + WatchdogBase.__init__(self) + # Init helper self._api_helper = APIHelper() diff --git a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/watchdog.py b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/watchdog.py index cc87c3d6b32a..fac5c40e134f 100644 --- a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/watchdog.py +++ b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/watchdog.py @@ -29,6 +29,8 @@ class Watchdog(WatchdogBase): def __init__(self): + WatchdogBase.__init__(self) + self._api_common = Common() # Init cpld reg path diff --git a/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/fan.py b/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/fan.py index 1055aee68fc7..1a18eed9c8d5 100644 --- a/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/fan.py +++ b/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/fan.py @@ -54,6 +54,7 @@ class Fan(FanBase): """Platform-specific Fan class""" def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + FanBase.__init__(self) self.fan_index = fan_index self.fan_tray_index = fan_tray_index self.is_psu_fan = is_psu_fan diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/pcie.yaml b/device/dell/x86_64-dell_s6000_s1220-r0/pcie.yaml similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/plugins/pcie.yaml rename to device/dell/x86_64-dell_s6000_s1220-r0/pcie.yaml diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot b/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot deleted file mode 100755 index 28f2ec626605..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python3 - -import sys -import os -import struct - -PORT_RES = '/dev/port' -NVRAM_RES = '/dev/nvram' -COLD_RESET = 0xE # Cold Reset -WARM_RESET = 0x6 # Warm Reset -RESET_REG = 0xCF9 - -def io_reg_write(resource, offset, val): - fd = os.open(resource, os.O_RDWR) - if(fd < 0): - print('file open failed %s" % resource') - return - if(os.lseek(fd, offset, os.SEEK_SET) != offset): - print('lseek failed on %s' % resource) - return - ret = os.write(fd, struct.pack('B', val)) - if(ret != 1): - print('write failed %d' % ret) - return - os.close(fd) - -def power_reset(val): - with open('/sys/devices/platform/dell-s6000-cpld.0/power_reset', 'w') as p: - p.write(str(int(val)) + '\n') - p.flush() - -def gpio_direction(pin, direction): - kernpath = '/sys/class/gpio/gpio'+str(pin)+'/direction' - with open(('kernpath'), 'w') as p: - p.write(str(direction) + '\n') - p.flush() - -def gpio_set(pin, value): - kernpath = '/sys/class/gpio/gpio'+str(pin)+'/value' - with open(('kernpath'), 'w') as p: - p.write(str(int(value)) + '\n') - p.flush() - -def gpio_export(value): - with open('/sys/class/gpio/export', 'w') as p: - p.write(str(int(value)) + '\n') - p.flush() - -if __name__ == "__main__": - - retry_count = 0 - io_reg_write(NVRAM_RES, 0x49, COLD_RESET) - - while retry_count < 3: - if not os.path.isdir("/sys/class/gpio/gpio10"): - gpio_export(10) - gpio_direction("10", "out") - # Toggle GPIO10 pin (to reset MUX) - gpio_set("10", 1) - gpio_set("10", 0) - power_reset(1) - retry_count += 1 - io_reg_write(PORT_RES, RESET_REG, COLD_RESET) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/system_health_monitoring_config.json b/device/dell/x86_64-dell_s6000_s1220-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..bb8ffbcd2172 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "blinking green" + } +} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/pcie.yaml b/device/dell/x86_64-dell_s6100_c2538-r0/pcie.yaml similarity index 100% rename from device/dell/x86_64-dell_s6100_c2538-r0/plugins/pcie.yaml rename to device/dell/x86_64-dell_s6100_c2538-r0/pcie.yaml diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/system_health_monitoring_config.json b/device/dell/x86_64-dell_s6100_c2538-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..bb8ffbcd2172 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "blinking green" + } +} diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/port_config.ini b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/port_config.ini index 542992d761a6..101780149b57 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/port_config.ini +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/port_config.ini @@ -15,10 +15,22 @@ Ethernet24 57,58 hundredGigE1/4/1 4 1 Ethernet26 59,60 hundredGigE1/4/2 4 100000 Ethernet28 61,62 hundredGigE1/4/3 4 100000 Ethernet30 63,64 hundredGigE1/4/4 4 100000 -Ethernet32 65,66,67,68,69,70,71,72 fourhundredGigE1/5 5 400000 -Ethernet40 73,74,75,76,77,78,79,80 fourhundredGigE1/6 6 400000 -Ethernet48 81,82,83,84,85,86,87,88 fourhundredGigE1/7 7 400000 -Ethernet56 89,90,91,92,93,94,95,96 fourhundredGigE1/8 8 400000 +Ethernet32 65,66 hundredGigE1/5/1 5 100000 +Ethernet34 67,68 hundredGigE1/5/2 5 100000 +Ethernet36 69,70 hundredGigE1/5/3 5 100000 +Ethernet38 71,72 hundredGigE1/5/4 5 100000 +Ethernet40 73,74 hundredGigE1/6/1 6 100000 +Ethernet42 75,76 hundredGigE1/6/2 6 100000 +Ethernet44 77,78 hundredGigE1/6/3 6 100000 +Ethernet46 79,80 hundredGigE1/6/4 6 100000 +Ethernet48 81,82 hundredGigE1/7/1 7 100000 +Ethernet50 83,84 hundredGigE1/7/2 7 100000 +Ethernet52 85,86 hundredGigE1/7/3 7 100000 +Ethernet54 87,88 hundredGigE1/7/4 7 100000 +Ethernet56 89,90 hundredGigE1/8/1 8 100000 +Ethernet58 91,92 hundredGigE1/8/2 8 100000 +Ethernet60 93,94 hundredGigE1/8/3 8 100000 +Ethernet62 95,96 hundredGigE1/8/4 8 100000 Ethernet64 1,2 hundredGigE1/9/1 9 100000 Ethernet66 3,4 hundredGigE1/9/2 9 100000 Ethernet68 5,6 hundredGigE1/9/3 9 100000 @@ -39,45 +51,33 @@ Ethernet96 97,98,99,100,101,102,103,104 fourhundredGigE1/13 13 4 Ethernet104 105,106,107,108,109,110,111,112 fourhundredGigE1/14 14 400000 Ethernet112 113,114,115,116,117,118,119,120 fourhundredGigE1/15 15 400000 Ethernet120 121,122,123,124,125,126,127,128 fourhundredGigE1/16 16 400000 -Ethernet128 129,130,131,132,133,134,135,136 fourhundredGigE1/17 17 400000 -Ethernet136 137,138,139,140,141,142,143,144 fourhundredGigE1/18 18 400000 -Ethernet144 145,146,147,148,149,150,151,152 fourhundredGigE1/19 19 400000 -Ethernet152 153,154,155,156,157,158,159,160 fourhundredGigE1/20 20 400000 -Ethernet160 225,226 hundredGigE1/21/1 21 100000 -Ethernet162 227,228 hundredGigE1/21/2 21 100000 -Ethernet164 229,230 hundredGigE1/21/3 21 100000 -Ethernet166 231,232 hundredGigE1/21/4 21 100000 -Ethernet168 233,234 hundredGigE1/22/1 22 100000 -Ethernet170 235,236 hundredGigE1/22/2 22 100000 -Ethernet172 237,238 hundredGigE1/22/3 22 100000 -Ethernet174 239,240 hundredGigE1/22/4 22 100000 -Ethernet176 241,242 hundredGigE1/23/1 23 100000 -Ethernet178 243,244 hundredGigE1/23/2 23 100000 -Ethernet180 245,246 hundredGigE1/23/3 23 100000 -Ethernet182 247,248 hundredGigE1/23/4 23 100000 -Ethernet184 249,250 hundredGigE1/24/1 24 100000 -Ethernet186 251,252 hundredGigE1/24/2 24 100000 -Ethernet188 253,254 hundredGigE1/24/3 24 100000 -Ethernet190 255,256 hundredGigE1/24/4 24 100000 +Ethernet128 129,130 hundredGigE1/17/1 17 100000 +Ethernet130 131,132 hundredGigE1/17/2 17 100000 +Ethernet132 133,134 hundredGigE1/17/3 17 100000 +Ethernet134 135,136 hundredGigE1/17/4 17 100000 +Ethernet136 137,138 hundredGigE1/18/1 18 100000 +Ethernet138 139,140 hundredGigE1/18/2 18 100000 +Ethernet140 141,142 hundredGigE1/18/3 18 100000 +Ethernet142 143,144 hundredGigE1/18/4 18 100000 +Ethernet144 145,146 hundredGigE1/19/1 19 100000 +Ethernet146 147,148 hundredGigE1/19/2 19 100000 +Ethernet148 149,150 hundredGigE1/19/3 19 100000 +Ethernet150 151,152 hundredGigE1/19/4 19 100000 +Ethernet152 153,154 hundredGigE1/20/1 20 100000 +Ethernet154 155,156 hundredGigE1/20/2 20 100000 +Ethernet156 157,158 hundredGigE1/20/3 20 100000 +Ethernet158 159,160 hundredGigE1/20/4 20 100000 +Ethernet160 225,226,227,228,229,230,231,232 fourhundredGigE1/21 21 400000 +Ethernet168 233,234,235,236,237,238,239,240 fourhundredGigE1/22 22 400000 +Ethernet176 241,242,243,244,245,246,247,248 fourhundredGigE1/23 23 400000 +Ethernet184 249,250,251,252,253,254,255,256 fourhundredGigE1/24 24 400000 Ethernet192 161,162,163,164,165,166,167,168 fourhundredGigE1/25 25 400000 Ethernet200 169,170,171,172,173,174,175,176 fourhundredGigE1/26 26 400000 Ethernet208 177,178,179,180,181,182,183,184 fourhundredGigE1/27 27 400000 Ethernet216 185,186,187,188,189,190,191,192 fourhundredGigE1/28 28 400000 -Ethernet224 193,194 hundredGigE1/29/1 29 100000 -Ethernet226 195,196 hundredGigE1/29/2 29 100000 -Ethernet228 197,198 hundredGigE1/29/3 29 100000 -Ethernet230 199,200 hundredGigE1/29/4 29 100000 -Ethernet232 201,202 hundredGigE1/30/1 30 100000 -Ethernet234 203,204 hundredGigE1/30/2 30 100000 -Ethernet236 205,206 hundredGigE1/30/3 30 100000 -Ethernet238 207,208 hundredGigE1/30/4 30 100000 -Ethernet240 209,210 hundredGigE1/31/1 31 100000 -Ethernet242 211,212 hundredGigE1/31/2 31 100000 -Ethernet244 213,214 hundredGigE1/31/3 31 100000 -Ethernet246 215,216 hundredGigE1/31/4 31 100000 -Ethernet248 217,218 hundredGigE1/32/1 32 100000 -Ethernet250 219,220 hundredGigE1/32/2 32 100000 -Ethernet252 221,222 hundredGigE1/32/3 32 100000 -Ethernet254 223,224 hundredGigE1/32/4 32 100000 +Ethernet224 193,194,195,196,197,198,199,200 fourhundredGigE1/29 29 400000 +Ethernet232 201,202,203,204,205,206,207,208 fourhundredGigE1/30 30 400000 +Ethernet240 209,210,211,212,213,214,215,216 fourhundredGigE1/31 31 400000 +Ethernet248 217,218,219,220,221,222,223,224 fourhundredGigE1/32 32 400000 Ethernet256 257 tenGigE1/33 33 10000 Ethernet257 258 tenGigE1/34 34 10000 diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json index d80e66f9e011..937ba5075c06 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json @@ -3,134 +3,164 @@ "Ethernet0": { "index": "1", "lanes": "0", - "alias_at_lanes": "etp1", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp1"] + } }, "Ethernet4": { "index": "2", "lanes": "4", - "alias_at_lanes": "etp2", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp2"] + } }, "Ethernet8": { "index": "3", "lanes": "8", - "alias_at_lanes": "etp3", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp3"] + } }, "Ethernet12": { "index": "4", "lanes": "12", - "alias_at_lanes": "etp4", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp4"] + } }, "Ethernet16": { "index": "5", "lanes": "16", - "alias_at_lanes": "etp5", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp5"] + } }, "Ethernet20": { "index": "6", "lanes": "20", - "alias_at_lanes": "etp6", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp6"] + } }, "Ethernet24": { "index": "7", "lanes": "24", - "alias_at_lanes": "etp7", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp7"] + } }, "Ethernet28": { "index": "8", "lanes": "28", - "alias_at_lanes": "etp8", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp8"] + } }, "Ethernet32": { "index": "9", "lanes": "32", - "alias_at_lanes": "etp9", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp9"] + } }, "Ethernet36": { "index": "10", "lanes": "36", - "alias_at_lanes": "etp10", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp10"] + } }, "Ethernet40": { "index": "11", "lanes": "40", - "alias_at_lanes": "etp11", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp11"] + } }, "Ethernet44": { "index": "12", "lanes": "44", - "alias_at_lanes": "etp12", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp12"] + } }, "Ethernet48": { "index": "13", "lanes": "48", - "alias_at_lanes": "etp13", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp13"] + } }, "Ethernet52": { "index": "14", "lanes": "52", - "alias_at_lanes": "etp14", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp14"] + } }, "Ethernet56": { "index": "15", "lanes": "56", - "alias_at_lanes": "etp15", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp15"] + } }, "Ethernet60": { "index": "16", "lanes": "60", - "alias_at_lanes": "etp16", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp16"] + } }, "Ethernet64": { "index": "17", "lanes": "64", - "alias_at_lanes": "etp17", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp17"] + } }, "Ethernet68": { "index": "18", "lanes": "68", - "alias_at_lanes": "etp18", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp18"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp19"], + "2x50G[40G,25G,10G]": ["etp19a", "etp19b"], + "4x25G[10G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp20"], + "2x50G[40G,25G,10G]": ["etp20a", "etp20b"], + "4x25G[10G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp21"], + "2x50G[40G,25G,10G]": ["etp21a", "etp21b"], + "4x25G[10G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp22"], + "2x50G[40G,25G,10G]": ["etp22a", "etp22b"], + "4x25G[10G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json index aa08998861fb..cf16b7de93c2 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json @@ -3,98 +3,146 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp1"], + "2x50G[40G,25G,10G]": ["etp1a", "etp1b"], + "4x25G[10G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp2"], + "2x50G[40G,25G,10G]": ["etp2a", "etp2b"], + "4x25G[10G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp3"], + "2x50G[40G,25G,10G]": ["etp3a", "etp3b"], + "4x25G[10G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp4"], + "2x50G[40G,25G,10G]": ["etp4a", "etp4b"], + "4x25G[10G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp5"], + "2x50G[40G,25G,10G]": ["etp5a", "etp5b"], + "4x25G[10G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp6"], + "2x50G[40G,25G,10G]": ["etp6a", "etp6b"], + "4x25G[10G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp7"], + "2x50G[40G,25G,10G]": ["etp7a", "etp7b"], + "4x25G[10G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp8"], + "2x50G[40G,25G,10G]": ["etp8a", "etp8b"], + "4x25G[10G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp9"], + "2x50G[40G,25G,10G]": ["etp9a", "etp9b"], + "4x25G[10G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp10"], + "2x50G[40G,25G,10G]": ["etp10a", "etp10b"], + "4x25G[10G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp11"], + "2x50G[40G,25G,10G]": ["etp11a", "etp11b"], + "4x25G[10G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp12"], + "2x50G[40G,25G,10G]": ["etp12a", "etp12b"], + "4x25G[10G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp13"], + "2x50G[40G,25G,10G]": ["etp13a", "etp13b"], + "4x25G[10G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp14"], + "2x50G[40G,25G,10G]": ["etp14a", "etp14b"], + "4x25G[10G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp15"], + "2x50G[40G,25G,10G]": ["etp15a", "etp15b"], + "4x25G[10G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G],4x25G[10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp16"], + "2x50G[40G,25G,10G]": ["etp16a", "etp16b"], + "4x25G[10G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json index 0009dee63ba5..5624ef60d49a 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json @@ -3,338 +3,402 @@ "Ethernet0": { "index": "1", "lanes": "0", - "alias_at_lanes": "etp1", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp1"] + } }, "Ethernet4": { "index": "2", "lanes": "4", - "alias_at_lanes": "etp2", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp2"] + } }, "Ethernet8": { "index": "3", "lanes": "8", - "alias_at_lanes": "etp3", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp3"] + } }, "Ethernet12": { "index": "4", "lanes": "12", - "alias_at_lanes": "etp4", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp4"] + } }, "Ethernet16": { "index": "5", "lanes": "16", - "alias_at_lanes": "etp5", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp5"] + } }, "Ethernet20": { "index": "6", "lanes": "20", - "alias_at_lanes": "etp6", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp6"] + } }, "Ethernet24": { "index": "7", "lanes": "24", - "alias_at_lanes": "etp7", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp7"] + } }, "Ethernet28": { "index": "8", "lanes": "28", - "alias_at_lanes": "etp8", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp8"] + } }, "Ethernet32": { "index": "9", "lanes": "32", - "alias_at_lanes": "etp9", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp9"] + } }, "Ethernet36": { "index": "10", "lanes": "36", - "alias_at_lanes": "etp10", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp10"] + } }, "Ethernet40": { "index": "11", "lanes": "40", - "alias_at_lanes": "etp11", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp11"] + } }, "Ethernet44": { "index": "12", "lanes": "44", - "alias_at_lanes": "etp12", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp12"] + } }, "Ethernet48": { "index": "13", "lanes": "48", - "alias_at_lanes": "etp13", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp13"] + } }, "Ethernet52": { "index": "14", "lanes": "52", - "alias_at_lanes": "etp14", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp14"] + } }, "Ethernet56": { "index": "15", "lanes": "56", - "alias_at_lanes": "etp15", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp15"] + } }, "Ethernet60": { "index": "16", "lanes": "60", - "alias_at_lanes": "etp16", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp16"] + } }, "Ethernet64": { "index": "17", "lanes": "64", - "alias_at_lanes": "etp17", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp17"] + } }, "Ethernet68": { "index": "18", "lanes": "68", - "alias_at_lanes": "etp18", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp18"] + } }, "Ethernet72": { "index": "19", "lanes": "72", - "alias_at_lanes": "etp19", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp19"] + } }, "Ethernet76": { "index": "20", "lanes": "76", - "alias_at_lanes": "etp20", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp20"] + } }, "Ethernet80": { "index": "21", "lanes": "80", - "alias_at_lanes": "etp21", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp21"] + } }, "Ethernet84": { "index": "22", "lanes": "84", - "alias_at_lanes": "etp22", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp22"] + } }, "Ethernet88": { "index": "23", "lanes": "88", - "alias_at_lanes": "etp23", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp23"] + } }, "Ethernet92": { "index": "24", "lanes": "92", - "alias_at_lanes": "etp24", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp24"] + } }, "Ethernet96": { "index": "25", "lanes": "96", - "alias_at_lanes": "etp25", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp25"] + } }, "Ethernet100": { "index": "26", "lanes": "100", - "alias_at_lanes": "etp26", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp26"] + } }, "Ethernet104": { "index": "27", "lanes": "104", - "alias_at_lanes": "etp27", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp27"] + } }, "Ethernet108": { "index": "28", "lanes": "108", - "alias_at_lanes": "etp28", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp28"] + } }, "Ethernet112": { "index": "29", "lanes": "112", - "alias_at_lanes": "etp29", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp29"] + } }, "Ethernet116": { "index": "30", "lanes": "116", - "alias_at_lanes": "etp30", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp30"] + } }, "Ethernet120": { "index": "31", "lanes": "120", - "alias_at_lanes": "etp31", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp31"] + } }, "Ethernet124": { "index": "32", "lanes": "124", - "alias_at_lanes": "etp32", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp32"] + } }, "Ethernet128": { "index": "33", "lanes": "128", - "alias_at_lanes": "etp33", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp33"] + } }, "Ethernet132": { "index": "34", "lanes": "132", - "alias_at_lanes": "etp34", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp34"] + } }, "Ethernet136": { "index": "35", "lanes": "136", - "alias_at_lanes": "etp35", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp35"] + } }, "Ethernet140": { "index": "36", "lanes": "140", - "alias_at_lanes": "etp36", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp36"] + } }, "Ethernet144": { "index": "37", "lanes": "144", - "alias_at_lanes": "etp37", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp37"] + } }, "Ethernet148": { "index": "38", "lanes": "148", - "alias_at_lanes": "etp38", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp38"] + } }, "Ethernet152": { "index": "39", "lanes": "152", - "alias_at_lanes": "etp39", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp39"] + } }, "Ethernet156": { "index": "40", "lanes": "156", - "alias_at_lanes": "etp40", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp40"] + } }, "Ethernet160": { "index": "41", "lanes": "160", - "alias_at_lanes": "etp41", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp41"] + } }, "Ethernet164": { "index": "42", "lanes": "164", - "alias_at_lanes": "etp42", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp42"] + } }, "Ethernet168": { "index": "43", "lanes": "168", - "alias_at_lanes": "etp43", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp43"] + } }, "Ethernet172": { "index": "44", "lanes": "172", - "alias_at_lanes": "etp44", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp44"] + } }, "Ethernet176": { "index": "45", "lanes": "176", - "alias_at_lanes": "etp45", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp45"] + } }, "Ethernet180": { "index": "46", "lanes": "180", - "alias_at_lanes": "etp46", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp46"] + } }, "Ethernet184": { "index": "47", "lanes": "184", - "alias_at_lanes": "etp47", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp47"] + } }, "Ethernet188": { "index": "48", "lanes": "188", - "alias_at_lanes": "etp48", - "breakout_modes": "1x25G[10G]" + "breakout_modes": { + "1x25G[10G]" : ["etp48"] + } }, "Ethernet192": { "index": "49,49,49,49", "lanes": "192,193,194,195", - "alias_at_lanes": "etp49a, etp49b, etp49c, etp49d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp49"], + "2x50G[40G,25G,10G]": ["etp49a", "etp49b"] + } }, "Ethernet196": { "index": "50,50,50,50", "lanes": "196,197,198,199", - "alias_at_lanes": "etp50a, etp50b, etp50c, etp50d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp50"], + "2x50G[40G,25G,10G]": ["etp50a", "etp50b"] + } }, "Ethernet200": { "index": "51,51,51,51", "lanes": "200,201,202,203", - "alias_at_lanes": "etp51a, etp51b, etp51c, etp51d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp51"], + "2x50G[40G,25G,10G]": ["etp51a", "etp51b"] + } }, "Ethernet204": { "index": "52,52,52,52", "lanes": "204,205,206,207", - "alias_at_lanes": "etp52a, etp52b, etp52c, etp52d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp52"], + "2x50G[40G,25G,10G]": ["etp52a", "etp52b"] + } }, "Ethernet208": { "index": "53,53,53,53", "lanes": "208,209,210,211", - "alias_at_lanes": "etp53a, etp53b, etp53c, etp53d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp53"], + "2x50G[40G,25G,10G]": ["etp53a", "etp53b"] + } }, "Ethernet212": { "index": "54,54,54,54", "lanes": "212,213,214,215", - "alias_at_lanes": "etp54a, etp54b, etp54c, etp54d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp54"], + "2x50G[40G,25G,10G]": ["etp54a", "etp54b"] + } }, "Ethernet216": { "index": "55,55,55,55", "lanes": "216,217,218,219", - "alias_at_lanes": "etp55a, etp55b, etp55c, etp55d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp55"], + "2x50G[40G,25G,10G]": ["etp55a", "etp55b"] + } }, "Ethernet220": { "index": "56,56,56,56", "lanes": "220,221,222,223", - "alias_at_lanes": "etp56a, etp56b, etp56c, etp56d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp56"], + "2x50G[40G,25G,10G]": ["etp56a", "etp56b"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers.json.j2 new file mode 120000 index 000000000000..30c4e1d5bfdd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..c2bdb607d5a7 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t0.j2 @@ -0,0 +1,102 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '7719936' %} +{% set ingress_lossless_pool_xoff = '1032192' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '7719936' %} + +{%- 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)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "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", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..6f444b61df43 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_t1.j2 @@ -0,0 +1,102 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '9686016' %} +{% set ingress_lossless_pool_xoff = '1179648' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '9686016' %} + +{%- 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)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "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", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini new file mode 100644 index 000000000000..cdd674e4e715 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 19456 19456 22528 0 + 25000 5m 19456 19456 22528 0 + 40000 5m 19456 19456 22528 0 + 50000 5m 19456 19456 22528 0 + 100000 5m 19456 19456 23552 0 + 10000 40m 19456 19456 22528 0 + 25000 40m 19456 19456 24576 0 + 40000 40m 19456 19456 25600 0 + 50000 40m 19456 19456 25600 0 + 100000 40m 19456 19456 29696 0 + 10000 300m 19456 19456 27648 0 + 25000 300m 19456 19456 36864 0 + 40000 300m 19456 19456 45056 0 + 50000 300m 19456 19456 50176 0 + 100000 300m 19456 19456 78848 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini new file mode 100644 index 000000000000..b4072ceb32a1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 0 etp1a 1 10000 +Ethernet1 1 etp1b 1 10000 +Ethernet2 2 etp1c 1 10000 +Ethernet3 3 etp1d 1 10000 +Ethernet8 8 etp3a 3 10000 +Ethernet9 9 etp3b 3 10000 +Ethernet10 10 etp3c 3 10000 +Ethernet11 11 etp3d 3 10000 +Ethernet16 16,17 etp5a 5 50000 +Ethernet18 18,19 etp5b 5 50000 +Ethernet20 20,21 etp6a 6 50000 +Ethernet22 22,23 etp6b 6 50000 +Ethernet24 24,25,26,27 etp7 7 100000 +Ethernet28 28,29,30,31 etp8 8 100000 +Ethernet32 32,33,34,35 etp9 9 100000 +Ethernet36 36,37,38,39 etp10 10 100000 +Ethernet40 40,41 etp11a 11 50000 +Ethernet42 42,43 etp11b 11 50000 +Ethernet44 44,45 etp12a 12 50000 +Ethernet46 46,47 etp12b 12 50000 +Ethernet48 48,49 etp13a 13 50000 +Ethernet50 50,51 etp13b 13 50000 +Ethernet52 52,53 etp14a 14 50000 +Ethernet54 54,55 etp14b 14 50000 +Ethernet56 56,57 etp15a 15 50000 +Ethernet58 58,59 etp15b 15 50000 +Ethernet60 60,61 etp16a 16 50000 +Ethernet62 62,63 etp16b 16 50000 +Ethernet64 64,65 etp17a 17 50000 +Ethernet66 66,67 etp17b 17 50000 +Ethernet68 68,69 etp18a 18 50000 +Ethernet70 70,71 etp18b 18 50000 +Ethernet72 72,73 etp19a 19 50000 +Ethernet74 74,75 etp19b 19 50000 +Ethernet76 76,77 etp20a 20 50000 +Ethernet78 78,79 etp20b 20 50000 +Ethernet80 80,81 etp21a 21 50000 +Ethernet82 82,83 etp21b 21 50000 +Ethernet84 84,85 etp22a 22 50000 +Ethernet86 86,87 etp22b 22 50000 +Ethernet88 88,89,90,91 etp23 23 100000 +Ethernet92 92,93,94,95 etp24 24 100000 +Ethernet96 96,97,98,99 etp25 25 100000 +Ethernet100 100,101,102,103 etp26 26 100000 +Ethernet104 104,105 etp27a 27 50000 +Ethernet106 106,107 etp27b 27 50000 +Ethernet108 108,109 etp28a 28 50000 +Ethernet110 110,111 etp28b 28 50000 +Ethernet112 112,113 etp29a 29 50000 +Ethernet114 114,115 etp29b 29 50000 +Ethernet116 116,117 etp30a 30 50000 +Ethernet118 118,119 etp30b 30 50000 +Ethernet120 120,121 etp31a 31 50000 +Ethernet122 122,123 etp31b 31 50000 +Ethernet124 124,125 etp32a 32 50000 +Ethernet126 126,127 etp32b 32 50000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai.profile new file mode 100644 index 000000000000..a98e620cfa10 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_8x100g_40x50g_8x10g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml new file mode 100644 index 000000000000..0376eb548d26 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml @@ -0,0 +1,269 @@ + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 2 + 4 + 16 + + + 3 + + + 3221225472 + + + 3 + 2 + 4 + 17 + 1 + 3221225472 + + + 5 + 2 + 4 + 18 + 3 + 3221225472 + + + 7 + 2 + 4 + 19 + 1 + 3221225472 + + + 9 + 2 + 4 + 20 + 3 + 3221225472 + + + 11 + 2 + 4 + 21 + 1 + 3221225472 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 2 + 4 + 26 + 3 + 3221225472 + + + 23 + 2 + 4 + 27 + 1 + 3221225472 + + + 25 + 4 + 28 + 3 + 3221225472 + 2 + + + 27 + 2 + 4 + 29 + 1 + 3221225472 + + + 29 + 2 + 4 + 30 + 3 + 3221225472 + + + 31 + 2 + 4 + 31 + 1 + 3221225472 + + + 33 + 2 + 4 + 14 + 3 + 3221225472 + + + 35 + 2 + 4 + 15 + 1 + 3221225472 + + + 37 + 2 + 4 + 12 + 3 + 3221225472 + + + 39 + 2 + 4 + 13 + 1 + 3221225472 + + + 41 + 2 + 4 + 10 + 3 + 3221225472 + + + 43 + 2 + 4 + 11 + 1 + 3221225472 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 2 + 4 + 6 + 3 + 3221225472 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 2 + 4 + 4 + 3 + 3221225472 + + + 55 + 2 + 4 + 5 + 1 + 3221225472 + + + 57 + 4 + 4 + 2 + 3 + 4096 + + + 59 + 4 + 3 + 1 + 11534336 + + + 61 + 4 + 4 + 0 + 3 + 4096 + + + 63 + 4 + 1 + 1 + 11534336 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 index 0ad78e08c6b5..6fc5efcf9b88 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '6687744' %} +{% set ingress_lossless_pool_size = '7719936' %} +{% set ingress_lossless_pool_xoff = '1032192' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '6687744' %} +{% set egress_lossy_pool_size = '7719936' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 index 82f6a15b33c8..95d35539253e 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '8506368' %} +{% set ingress_lossless_pool_size = '9686016' %} +{% set ingress_lossless_pool_xoff = '1179648' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '8506368' %} +{% set egress_lossy_pool_size = '9686016' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini index 15c12c1637e6..cdd674e4e715 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini @@ -1,17 +1,17 @@ # PG lossless profiles. # speed cable size xon xoff threshold - 10000 5m 41984 19456 22528 0 - 25000 5m 41984 19456 22528 0 - 40000 5m 41984 19456 22528 0 - 50000 5m 41984 19456 22528 0 - 100000 5m 43008 19456 23552 0 - 10000 40m 41984 19456 22528 0 - 25000 40m 44032 19456 24576 0 - 40000 40m 45056 19456 25600 0 - 50000 40m 45056 19456 25600 0 - 100000 40m 49152 19456 29696 0 - 10000 300m 47104 19456 27648 0 - 25000 300m 56320 19456 36864 0 - 40000 300m 64512 19456 45056 0 - 50000 300m 69632 19456 50176 0 - 100000 300m 98304 19456 78848 0 + 10000 5m 19456 19456 22528 0 + 25000 5m 19456 19456 22528 0 + 40000 5m 19456 19456 22528 0 + 50000 5m 19456 19456 22528 0 + 100000 5m 19456 19456 23552 0 + 10000 40m 19456 19456 22528 0 + 25000 40m 19456 19456 24576 0 + 40000 40m 19456 19456 25600 0 + 50000 40m 19456 19456 25600 0 + 100000 40m 19456 19456 29696 0 + 10000 300m 19456 19456 27648 0 + 25000 300m 19456 19456 36864 0 + 40000 300m 19456 19456 45056 0 + 50000 300m 19456 19456 50176 0 + 100000 300m 19456 19456 78848 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 index 41afd1f22444..d2bf72b15f7c 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '9489408' %} +{% set ingress_lossless_pool_size = '10177536' %} +{% set ingress_lossless_pool_xoff = '688128' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '9489408' %} +{% set egress_lossy_pool_size = '10177536' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 index 08e21ba05f75..c4422556d87a 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '7719936' %} +{% set ingress_lossless_pool_size = '9292800' %} +{% set ingress_lossless_pool_xoff = '1572864' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '7719936' %} +{% set egress_lossy_pool_size = '9292800' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json index 65d28529ec14..e5ec0b2f3ca0 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json @@ -379,194 +379,258 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp1"], + "2x50G[40G,25G,10G]": ["etp1a", "etp1b"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp2"], + "2x50G[40G,25G,10G]": ["etp2a", "etp2b"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp3"], + "2x50G[40G,25G,10G]": ["etp3a", "etp3b"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp4"], + "2x50G[40G,25G,10G]": ["etp4a", "etp4b"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp5"], + "2x50G[40G,25G,10G]": ["etp5a", "etp5b"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp6"], + "2x50G[40G,25G,10G]": ["etp6a", "etp6b"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp7"], + "2x50G[40G,25G,10G]": ["etp7a", "etp7b"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp8"], + "2x50G[40G,25G,10G]": ["etp8a", "etp8b"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp9"], + "2x50G[40G,25G,10G]": ["etp9a", "etp9b"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp10"], + "2x50G[40G,25G,10G]": ["etp10a", "etp10b"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp11"], + "2x50G[40G,25G,10G]": ["etp11a", "etp11b"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp12"], + "2x50G[40G,25G,10G]": ["etp12a", "etp12b"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp13"], + "2x50G[40G,25G,10G]": ["etp13a", "etp13b"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp14"], + "2x50G[40G,25G,10G]": ["etp14a", "etp14b"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp15"], + "2x50G[40G,25G,10G]": ["etp15a", "etp15b"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp16"], + "2x50G[40G,25G,10G]": ["etp16a", "etp16b"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp17"], + "2x50G[40G,25G,10G]": ["etp17a", "etp17b"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp18"], + "2x50G[40G,25G,10G]": ["etp18a", "etp18b"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp19"], + "2x50G[40G,25G,10G]": ["etp19a", "etp19b"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp20"], + "2x50G[40G,25G,10G]": ["etp20a", "etp20b"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp21"], + "2x50G[40G,25G,10G]": ["etp21a", "etp21b"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp22"], + "2x50G[40G,25G,10G]": ["etp22a", "etp22b"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp23"], + "2x50G[40G,25G,10G]": ["etp23a", "etp23b"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp24"], + "2x50G[40G,25G,10G]": ["etp24a", "etp24b"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp25"], + "2x50G[40G,25G,10G]": ["etp25a", "etp25b"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp26"], + "2x50G[40G,25G,10G]": ["etp26a", "etp26b"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp27"], + "2x50G[40G,25G,10G]": ["etp27a", "etp27b"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp28"], + "2x50G[40G,25G,10G]": ["etp28a", "etp28b"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp29"], + "2x50G[40G,25G,10G]": ["etp29a", "etp29b"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp30"], + "2x50G[40G,25G,10G]": ["etp30a", "etp30b"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp31"], + "2x50G[40G,25G,10G]": ["etp31a", "etp31b"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp32"], + "2x50G[40G,25G,10G]": ["etp32a", "etp32b"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index df60c5256f2a..64618a0e5a21 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -41,8 +41,10 @@ # magic code defnition for port number, qsfp port position of each platform # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -platform_dict = {'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_msn2740-r0': 0, 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 3, - 'x86_64-mlnx_msn3420-r0': 5, 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, 'x86_64-mlnx_msn3800-r0': 4, 'x86_64-mlnx_msn4600c': 4, 'x86_64-mlnx_msn4700-r0': 0} +platform_dict = {'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_msn2740-r0': 0, 'x86_64-mlnx_msn2100-r0': 1, + 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 3, 'x86_64-mlnx_msn3420-r0': 5, + 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, 'x86_64-mlnx_msn3800-r0': 4, + 'x86_64-mlnx_msn4600-r0': 4, 'x86_64-mlnx_msn4600c': 4, 'x86_64-mlnx_msn4700-r0': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), (0, 18, 21, 22, 1), (0, 0, 63, 64, 1), (0, 48, 59, 60, 1)] diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json index 401cd4b660e3..da8df3b25cb7 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json @@ -3,362 +3,446 @@ "Ethernet0": { "index": "1", "lanes": "0", - "alias_at_lanes": "etp1", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp1"] + } }, "Ethernet4": { "index": "2", "lanes": "4", - "alias_at_lanes": "etp2", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp2"] + } }, "Ethernet8": { "index": "3", "lanes": "8", - "alias_at_lanes": "etp3", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp3"] + } }, "Ethernet12": { "index": "4", "lanes": "12", - "alias_at_lanes": "etp4", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp4"] + } }, "Ethernet16": { "index": "5", "lanes": "16", - "alias_at_lanes": "etp5", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp5"] + } }, "Ethernet20": { "index": "6", "lanes": "20", - "alias_at_lanes": "etp6", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp6"] + } }, "Ethernet24": { "index": "7", "lanes": "24", - "alias_at_lanes": "etp7", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp7"] + } }, "Ethernet28": { "index": "8", "lanes": "28", - "alias_at_lanes": "etp8", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp8"] + } }, "Ethernet32": { "index": "9", "lanes": "32", - "alias_at_lanes": "etp9", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp9"] + } }, "Ethernet36": { "index": "10", "lanes": "36", - "alias_at_lanes": "etp10", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp10"] + } }, "Ethernet40": { "index": "11", "lanes": "40", - "alias_at_lanes": "etp11", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp11"] + } }, "Ethernet44": { "index": "12", "lanes": "44", - "alias_at_lanes": "etp12", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp12"] + } }, "Ethernet48": { "index": "13", "lanes": "48", - "alias_at_lanes": "etp13", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp13"] + } }, "Ethernet52": { "index": "14", "lanes": "52", - "alias_at_lanes": "etp14", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp14"] + } }, "Ethernet56": { "index": "15", "lanes": "56", - "alias_at_lanes": "etp15", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp15"] + } }, "Ethernet60": { "index": "16", "lanes": "60", - "alias_at_lanes": "etp16", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp16"] + } }, "Ethernet64": { "index": "17", "lanes": "64", - "alias_at_lanes": "etp17", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp17"] + } }, "Ethernet68": { "index": "18", "lanes": "68", - "alias_at_lanes": "etp18", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp18"] + } }, "Ethernet72": { "index": "19", "lanes": "72", - "alias_at_lanes": "etp19", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp19"] + } }, "Ethernet76": { "index": "20", "lanes": "76", - "alias_at_lanes": "etp20", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp20"] + } }, "Ethernet80": { "index": "21", "lanes": "80", - "alias_at_lanes": "etp21", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp21"] + } }, "Ethernet84": { "index": "22", "lanes": "84", - "alias_at_lanes": "etp22", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp22"] + } }, "Ethernet88": { "index": "23", "lanes": "88", - "alias_at_lanes": "etp23", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp23"] + } }, "Ethernet92": { "index": "24", "lanes": "92", - "alias_at_lanes": "etp24", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp24"] + } }, "Ethernet96": { "index": "25", "lanes": "96", - "alias_at_lanes": "etp25", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp25"] + } }, "Ethernet100": { "index": "26", "lanes": "100", - "alias_at_lanes": "etp26", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp26"] + } }, "Ethernet104": { "index": "27", "lanes": "104", - "alias_at_lanes": "etp27", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp27"] + } }, "Ethernet108": { "index": "28", "lanes": "108", - "alias_at_lanes": "etp28", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp28"] + } }, "Ethernet112": { "index": "29", "lanes": "112", - "alias_at_lanes": "etp29", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp29"] + } }, "Ethernet116": { "index": "30", "lanes": "116", - "alias_at_lanes": "etp30", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp30"] + } }, "Ethernet120": { "index": "31", "lanes": "120", - "alias_at_lanes": "etp31", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp31"] + } }, "Ethernet124": { "index": "32", "lanes": "124", - "alias_at_lanes": "etp32", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp32"] + } }, "Ethernet128": { "index": "33", "lanes": "128", - "alias_at_lanes": "etp33", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp33"] + } }, "Ethernet132": { "index": "34", "lanes": "132", - "alias_at_lanes": "etp34", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp34"] + } }, "Ethernet136": { "index": "35", "lanes": "136", - "alias_at_lanes": "etp35", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp35"] + } }, "Ethernet140": { "index": "36", "lanes": "140", - "alias_at_lanes": "etp36", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp36"] + } }, "Ethernet144": { "index": "37", "lanes": "144", - "alias_at_lanes": "etp37", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp37"] + } }, "Ethernet148": { "index": "38", "lanes": "148", - "alias_at_lanes": "etp38", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp38"] + } }, "Ethernet152": { "index": "39", "lanes": "152", - "alias_at_lanes": "etp39", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp39"] + } }, "Ethernet156": { "index": "40", "lanes": "156", - "alias_at_lanes": "etp40", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp40"] + } }, "Ethernet160": { "index": "41", "lanes": "160", - "alias_at_lanes": "etp41", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp41"] + } }, "Ethernet164": { "index": "42", "lanes": "164", - "alias_at_lanes": "etp42", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp42"] + } }, "Ethernet168": { "index": "43", "lanes": "168", - "alias_at_lanes": "etp43", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp43"] + } }, "Ethernet172": { "index": "44", "lanes": "172", - "alias_at_lanes": "etp44", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp44"] + } }, "Ethernet176": { "index": "45", "lanes": "176", - "alias_at_lanes": "etp45", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp45"] + } }, "Ethernet180": { "index": "46", "lanes": "180", - "alias_at_lanes": "etp46", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp46"] + } }, "Ethernet184": { "index": "47", "lanes": "184", - "alias_at_lanes": "etp47", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp47"] + } }, "Ethernet188": { "index": "48", "lanes": "188", - "alias_at_lanes": "etp48", - "breakout_modes": "1x25G[10G,1G]" + "breakout_modes": { + "1x25G[10G,1G]" : ["etp48"] + } }, "Ethernet192": { "index": "49,49,49,49", "lanes": "192,193,194,195", - "alias_at_lanes": "etp49a, etp49b, etp49c, etp49d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp49"], + "2x50G[40G,25G,10G,1G]": ["etp49a", "etp49b"], + "4x25G[10G,1G]": ["etp49a", "etp49b", "etp49c", "etp49d"] + } }, "Ethernet196": { "index": "50,50,50,50", "lanes": "196,197,198,199", - "alias_at_lanes": "etp50a, etp50b, etp50c, etp50d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp50"], + "2x50G[40G,25G,10G,1G]": ["etp50a", "etp50b"], + "4x25G[10G,1G]": ["etp50a", "etp50b", "etp50c", "etp50d"] + } }, "Ethernet200": { "index": "51,51,51,51", "lanes": "200,201,202,203", - "alias_at_lanes": "etp51a, etp51b, etp51c, etp51d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp51"], + "2x50G[40G,25G,10G,1G]": ["etp51a", "etp51b"], + "4x25G[10G,1G]": ["etp51a", "etp51b", "etp51c", "etp51d"] + } }, "Ethernet204": { "index": "52,52,52,52", "lanes": "204,205,206,207", - "alias_at_lanes": "etp52a, etp52b, etp52c, etp52d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp52"], + "2x50G[40G,25G,10G,1G]": ["etp52a", "etp52b"], + "4x25G[10G,1G]": ["etp52a", "etp52b", "etp52c", "etp52d"] + } }, "Ethernet208": { "index": "53,53,53,53", "lanes": "208,209,210,211", - "alias_at_lanes": "etp53a, etp53b, etp53c, etp53d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp53"], + "2x50G[40G,25G,10G,1G]": ["etp53a", "etp53b"], + "4x25G[10G,1G]": ["etp53a", "etp53b", "etp53c", "etp53d"] + } }, "Ethernet212": { "index": "54,54,54,54", "lanes": "212,213,214,215", - "alias_at_lanes": "etp54a, etp54b, etp54c, etp54d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp54"], + "2x50G[40G,25G,10G,1G]": ["etp54a", "etp54b"], + "4x25G[10G,1G]": ["etp54a", "etp54b", "etp54c", "etp54d"] + } }, "Ethernet216": { "index": "55,55,55,55", "lanes": "216,217,218,219", - "alias_at_lanes": "etp55a, etp55b, etp55c, etp55d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp55"], + "2x50G[40G,25G,10G,1G]": ["etp55a", "etp55b"], + "4x25G[10G,1G]": ["etp55a", "etp55b", "etp55c", "etp55d"] + } }, "Ethernet220": { "index": "56,56,56,56", "lanes": "220,221,222,223", - "alias_at_lanes": "etp56a, etp56b, etp56c, etp56d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp56"], + "2x50G[40G,25G,10G,1G]": ["etp56a", "etp56b"], + "4x25G[10G,1G]": ["etp56a", "etp56b", "etp56c", "etp56d"] + } }, "Ethernet224": { "index": "57,57,57,57", "lanes": "224,225,226,227", - "alias_at_lanes": "etp57a, etp57b, etp57c, etp57d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp57"], + "2x50G[40G,25G,10G,1G]": ["etp57a", "etp57b"], + "4x25G[10G,1G]": ["etp57a", "etp57b", "etp57c", "etp57d"] + } }, "Ethernet228": { "index": "58,58,58,58", "lanes": "228,229,230,231", - "alias_at_lanes": "etp58a, etp58b, etp58c, etp58d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp58"], + "2x50G[40G,25G,10G,1G]": ["etp58a", "etp58b"], + "4x25G[10G,1G]": ["etp58a", "etp58b", "etp58c", "etp58d"] + } }, "Ethernet232": { "index": "59,59,59,59", "lanes": "232,233,234,235", - "alias_at_lanes": "etp59a, etp59b, etp59c, etp59d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp59"], + "2x50G[40G,25G,10G,1G]": ["etp59a", "etp59b"], + "4x25G[10G,1G]": ["etp59a", "etp59b", "etp59c", "etp59d"] + } }, "Ethernet236": { "index": "60,60,60,60", "lanes": "236,237,238,239", - "alias_at_lanes": "etp60a, etp60b, etp60c, etp60d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp60"], + "2x50G[40G,25G,10G,1G]": ["etp60a", "etp60b"], + "4x25G[10G,1G]": ["etp60a", "etp60b", "etp60c", "etp60d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json index 8231004e9290..1ab03932bb13 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json @@ -3,194 +3,290 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp1"], + "2x100G[50G,40G,25G,10G,1G]": ["etp1a", "etp1b"], + "4x50G[40G,25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp2"], + "2x100G[50G,40G,25G,10G,1G]": ["etp2a", "etp2b"], + "4x50G[40G,25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp3"], + "2x100G[50G,40G,25G,10G,1G]": ["etp3a", "etp3b"], + "4x50G[40G,25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp4"], + "2x100G[50G,40G,25G,10G,1G]": ["etp4a", "etp4b"], + "4x50G[40G,25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp5"], + "2x100G[50G,40G,25G,10G,1G]": ["etp5a", "etp5b"], + "4x50G[40G,25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp6"], + "2x100G[50G,40G,25G,10G,1G]": ["etp6a", "etp6b"], + "4x50G[40G,25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp7"], + "2x100G[50G,40G,25G,10G,1G]": ["etp7a", "etp7b"], + "4x50G[40G,25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp8"], + "2x100G[50G,40G,25G,10G,1G]": ["etp8a", "etp8b"], + "4x50G[40G,25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp9"], + "2x100G[50G,40G,25G,10G,1G]": ["etp9a", "etp9b"], + "4x50G[40G,25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp10"], + "2x100G[50G,40G,25G,10G,1G]": ["etp10a", "etp10b"], + "4x50G[40G,25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp11"], + "2x100G[50G,40G,25G,10G,1G]": ["etp11a", "etp11b"], + "4x50G[40G,25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp12"], + "2x100G[50G,40G,25G,10G,1G]": ["etp12a", "etp12b"], + "4x50G[40G,25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp13"], + "2x100G[50G,40G,25G,10G,1G]": ["etp13a", "etp13b"], + "4x50G[40G,25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp14"], + "2x100G[50G,40G,25G,10G,1G]": ["etp14a", "etp14b"], + "4x50G[40G,25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp15"], + "2x100G[50G,40G,25G,10G,1G]": ["etp15a", "etp15b"], + "4x50G[40G,25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp16"], + "2x100G[50G,40G,25G,10G,1G]": ["etp16a", "etp16b"], + "4x50G[40G,25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp17"], + "2x100G[50G,40G,25G,10G,1G]": ["etp17a", "etp17b"], + "4x50G[40G,25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp18"], + "2x100G[50G,40G,25G,10G,1G]": ["etp18a", "etp18b"], + "4x50G[40G,25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp19"], + "2x100G[50G,40G,25G,10G,1G]": ["etp19a", "etp19b"], + "4x50G[40G,25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp20"], + "2x100G[50G,40G,25G,10G,1G]": ["etp20a", "etp20b"], + "4x50G[40G,25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp21"], + "2x100G[50G,40G,25G,10G,1G]": ["etp21a", "etp21b"], + "4x50G[40G,25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp22"], + "2x100G[50G,40G,25G,10G,1G]": ["etp22a", "etp22b"], + "4x50G[40G,25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp23"], + "2x100G[50G,40G,25G,10G,1G]": ["etp23a", "etp23b"], + "4x50G[40G,25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp24"], + "2x100G[50G,40G,25G,10G,1G]": ["etp24a", "etp24b"], + "4x50G[40G,25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp25"], + "2x100G[50G,40G,25G,10G,1G]": ["etp25a", "etp25b"], + "4x50G[40G,25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp26"], + "2x100G[50G,40G,25G,10G,1G]": ["etp26a", "etp26b"], + "4x50G[40G,25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp27"], + "2x100G[50G,40G,25G,10G,1G]": ["etp27a", "etp27b"], + "4x50G[40G,25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp28"], + "2x100G[50G,40G,25G,10G,1G]": ["etp28a", "etp28b"], + "4x50G[40G,25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp29"], + "2x100G[50G,40G,25G,10G,1G]": ["etp29a", "etp29b"], + "4x50G[40G,25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp30"], + "2x100G[50G,40G,25G,10G,1G]": ["etp30a", "etp30b"], + "4x50G[40G,25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp31"], + "2x100G[50G,40G,25G,10G,1G]": ["etp31a", "etp31b"], + "4x50G[40G,25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d", - "breakout_modes": "1x200G[100G,50G,40G,25G,10G,1G],2x100G[50G,40G,25G,10G,1G],4x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp32"], + "2x100G[50G,40G,25G,10G,1G]": ["etp32a", "etp32b"], + "4x50G[40G,25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml index 21c48fe64008..6daf5eefa130 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml @@ -130,13 +130,13 @@ id: 6f53 name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology Register DMA Channel 3' -- bus: '06' +- bus: '07' dev: '00' fn: '0' id: cf6c name: 'Ethernet controller: Mellanox Technologies MT53100 [Spectrum-2, 64 x 100GbE switch]' -- bus: 08 +- bus: 09 dev: '00' fn: '0' id: '1533' diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json index 33db99b06a3a..0a39adfa26a4 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json @@ -3,194 +3,290 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp1"], + "2x50G[40G,25G,10G,1G]": ["etp1a", "etp1b"], + "4x25G[10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp2"], + "2x50G[40G,25G,10G,1G]": ["etp2a", "etp2b"], + "4x25G[10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp3"], + "2x50G[40G,25G,10G,1G]": ["etp3a", "etp3b"], + "4x25G[10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp4"], + "2x50G[40G,25G,10G,1G]": ["etp4a", "etp4b"], + "4x25G[10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp5"], + "2x50G[40G,25G,10G,1G]": ["etp5a", "etp5b"], + "4x25G[10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp6"], + "2x50G[40G,25G,10G,1G]": ["etp6a", "etp6b"], + "4x25G[10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp7"], + "2x50G[40G,25G,10G,1G]": ["etp7a", "etp7b"], + "4x25G[10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp8"], + "2x50G[40G,25G,10G,1G]": ["etp8a", "etp8b"], + "4x25G[10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp9"], + "2x50G[40G,25G,10G,1G]": ["etp9a", "etp9b"], + "4x25G[10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp10"], + "2x50G[40G,25G,10G,1G]": ["etp10a", "etp10b"], + "4x25G[10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp11"], + "2x50G[40G,25G,10G,1G]": ["etp11a", "etp11b"], + "4x25G[10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp12"], + "2x50G[40G,25G,10G,1G]": ["etp12a", "etp12b"], + "4x25G[10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp13"], + "2x50G[40G,25G,10G,1G]": ["etp13a", "etp13b"], + "4x25G[10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp14"], + "2x50G[40G,25G,10G,1G]": ["etp14a", "etp14b"], + "4x25G[10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp15"], + "2x50G[40G,25G,10G,1G]": ["etp15a", "etp15b"], + "4x25G[10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp16"], + "2x50G[40G,25G,10G,1G]": ["etp16a", "etp16b"], + "4x25G[10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp17"], + "2x50G[40G,25G,10G,1G]": ["etp17a", "etp17b"], + "4x25G[10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp18"], + "2x50G[40G,25G,10G,1G]": ["etp18a", "etp18b"], + "4x25G[10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp19"], + "2x50G[40G,25G,10G,1G]": ["etp19a", "etp19b"], + "4x25G[10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp20"], + "2x50G[40G,25G,10G,1G]": ["etp20a", "etp20b"], + "4x25G[10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp21"], + "2x50G[40G,25G,10G,1G]": ["etp21a", "etp21b"], + "4x25G[10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp22"], + "2x50G[40G,25G,10G,1G]": ["etp22a", "etp22b"], + "4x25G[10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp23"], + "2x50G[40G,25G,10G,1G]": ["etp23a", "etp23b"], + "4x25G[10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp24"], + "2x50G[40G,25G,10G,1G]": ["etp24a", "etp24b"], + "4x25G[10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp25"], + "2x50G[40G,25G,10G,1G]": ["etp25a", "etp25b"], + "4x25G[10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp26"], + "2x50G[40G,25G,10G,1G]": ["etp26a", "etp26b"], + "4x25G[10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp27"], + "2x50G[40G,25G,10G,1G]": ["etp27a", "etp27b"], + "4x25G[10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp28"], + "2x50G[40G,25G,10G,1G]": ["etp28a", "etp28b"], + "4x25G[10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp29"], + "2x50G[40G,25G,10G,1G]": ["etp29a", "etp29b"], + "4x25G[10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp30"], + "2x50G[40G,25G,10G,1G]": ["etp30a", "etp30b"], + "4x25G[10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp31"], + "2x50G[40G,25G,10G,1G]": ["etp31a", "etp31b"], + "4x25G[10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp32"], + "2x50G[40G,25G,10G,1G]": ["etp32a", "etp32b"], + "4x25G[10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 index 2bc09d9ccc83..a59beaeeb698 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '23343104' %} +{% set ingress_lossless_pool_size = '25866240' %} +{% set ingress_lossless_pool_xoff = '2523136' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '23343104' %} +{% set egress_lossy_pool_size = '25866240' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 index 531f1587ba7a..d610abeb4f26 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '19410944' %} +{% set ingress_lossless_pool_size = '23900160' %} +{% set ingress_lossless_pool_xoff = '4489216' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '19410944' %} +{% set egress_lossy_pool_size = '23900160' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 index 26e89cf269ff..63e5d5f3a85a 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '16576512' %} +{% set ingress_lossless_pool_size = '20017152' %} +{% set ingress_lossless_pool_xoff = '3440640' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '16576512' %} +{% set egress_lossy_pool_size = '20017152' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 index 31fd4c7692dd..d1ccce62bb14 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '14790656' %} +{% set ingress_lossless_pool_size = '19124224' %} +{% set ingress_lossless_pool_xoff = '4333568' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '14790656' %} +{% set egress_lossy_pool_size = '19124224' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini index ea772d0823a1..810d7e77e61f 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini @@ -1,17 +1,17 @@ # PG lossless profiles. # speed cable size xon xoff threshold - 10000 5m 45056 19456 25600 0 - 25000 5m 48128 19456 28672 0 - 40000 5m 50176 19456 30720 0 - 50000 5m 52224 19456 32768 0 - 100000 5m 60416 19456 40960 0 - 10000 40m 46080 19456 26624 0 - 25000 40m 50176 19456 30720 0 - 40000 40m 53248 19456 33792 0 - 50000 40m 56320 19456 36864 0 - 100000 40m 67584 19456 48128 0 - 10000 300m 51200 19456 31744 0 - 25000 300m 63488 19456 44032 0 - 40000 300m 74752 19456 55296 0 - 50000 300m 82944 19456 63488 0 - 100000 300m 121856 19456 102400 0 + 10000 5m 19456 19456 25600 0 + 25000 5m 19456 19456 28672 0 + 40000 5m 19456 19456 30720 0 + 50000 5m 19456 19456 32768 0 + 100000 5m 19456 19456 40960 0 + 10000 40m 19456 19456 26624 0 + 25000 40m 19456 19456 30720 0 + 40000 40m 19456 19456 33792 0 + 50000 40m 19456 19456 36864 0 + 100000 40m 19456 19456 48128 0 + 10000 300m 19456 19456 31744 0 + 25000 300m 19456 19456 44032 0 + 40000 300m 19456 19456 55296 0 + 50000 300m 19456 19456 63488 0 + 100000 300m 19456 19456 102400 0 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 index edccf5e652bc..0ff424a30a57 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '21819392' %} +{% set ingress_lossless_pool_size = '24576000' %} +{% set ingress_lossless_pool_xoff = '2756608' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '21819392' %} +{% set egress_lossy_pool_size = '24576000' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 index 90f626db6a52..49adf1331c1c 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '17862656' %} +{% set ingress_lossless_pool_size = '22597632' %} +{% set ingress_lossless_pool_xoff = '4734976' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '17862656' %} +{% set egress_lossy_pool_size = '22597632' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 index e732ff1a3d65..c64f1c548631 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '21565440' %} +{% set ingress_lossless_pool_size = '24360960' %} +{% set ingress_lossless_pool_xoff = '2795520' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '21565440' %} +{% set egress_lossy_pool_size = '24360960' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 index a6556db59587..bbb51cc778b2 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '17604608' %} +{% set ingress_lossless_pool_size = '22380544' %} +{% set ingress_lossless_pool_xoff = '4775936' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '17604608' %} +{% set egress_lossy_pool_size = '22380544' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", {%- endif %} "type": "ingress", "mode": "dynamic" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn3800-r0/pcie.yaml index d4a25d40bd54..3dc31739f7d9 120000 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/pcie.yaml @@ -1 +1 @@ -../x86_64-mlnx_msn3700-r0/pcie.yaml \ No newline at end of file +../x86_64-mlnx_msn3700c-r0/pcie.yaml \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json index eff763be7d75..6564e7dfdaa1 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json @@ -3,386 +3,514 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp1"], + "2x50G[40G,25G,10G]": ["etp1a", "etp1b"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp2"], + "2x50G[40G,25G,10G]": ["etp2a", "etp2b"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp3"], + "2x50G[40G,25G,10G]": ["etp3a", "etp3b"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp4"], + "2x50G[40G,25G,10G]": ["etp4a", "etp4b"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp5"], + "2x50G[40G,25G,10G]": ["etp5a", "etp5b"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp6"], + "2x50G[40G,25G,10G]": ["etp6a", "etp6b"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp7"], + "2x50G[40G,25G,10G]": ["etp7a", "etp7b"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp8"], + "2x50G[40G,25G,10G]": ["etp8a", "etp8b"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp9"], + "2x50G[40G,25G,10G]": ["etp9a", "etp9b"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp10"], + "2x50G[40G,25G,10G]": ["etp10a", "etp10b"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp11"], + "2x50G[40G,25G,10G]": ["etp11a", "etp11b"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp12"], + "2x50G[40G,25G,10G]": ["etp12a", "etp12b"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp13"], + "2x50G[40G,25G,10G]": ["etp13a", "etp13b"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp14"], + "2x50G[40G,25G,10G]": ["etp14a", "etp14b"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp15"], + "2x50G[40G,25G,10G]": ["etp15a", "etp15b"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp16"], + "2x50G[40G,25G,10G]": ["etp16a", "etp16b"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp17"], + "2x50G[40G,25G,10G]": ["etp17a", "etp17b"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp18"], + "2x50G[40G,25G,10G]": ["etp18a", "etp18b"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp19"], + "2x50G[40G,25G,10G]": ["etp19a", "etp19b"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp20"], + "2x50G[40G,25G,10G]": ["etp20a", "etp20b"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp21"], + "2x50G[40G,25G,10G]": ["etp21a", "etp21b"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp22"], + "2x50G[40G,25G,10G]": ["etp22a", "etp22b"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp23"], + "2x50G[40G,25G,10G]": ["etp23a", "etp23b"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp24"], + "2x50G[40G,25G,10G]": ["etp24a", "etp24b"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp25"], + "2x50G[40G,25G,10G]": ["etp25a", "etp25b"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp26"], + "2x50G[40G,25G,10G]": ["etp26a", "etp26b"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp27"], + "2x50G[40G,25G,10G]": ["etp27a", "etp27b"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp28"], + "2x50G[40G,25G,10G]": ["etp28a", "etp28b"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp29"], + "2x50G[40G,25G,10G]": ["etp29a", "etp29b"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp30"], + "2x50G[40G,25G,10G]": ["etp30a", "etp30b"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp31"], + "2x50G[40G,25G,10G]": ["etp31a", "etp31b"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp32"], + "2x50G[40G,25G,10G]": ["etp32a", "etp32b"] + } }, "Ethernet128": { "index": "33,33,33,33", "lanes": "128,129,130,131", - "alias_at_lanes": "etp33a, etp33b, etp33c, etp33d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp33"], + "2x50G[40G,25G,10G]": ["etp33a", "etp33b"] + } }, "Ethernet132": { "index": "34,34,34,34", "lanes": "132,133,134,135", - "alias_at_lanes": "etp34a, etp34b, etp34c, etp34d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp34"], + "2x50G[40G,25G,10G]": ["etp34a", "etp34b"] + } }, "Ethernet136": { "index": "35,35,35,35", "lanes": "136,137,138,139", - "alias_at_lanes": "etp35a, etp35b, etp35c, etp35d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp35"], + "2x50G[40G,25G,10G]": ["etp35a", "etp35b"] + } }, "Ethernet140": { "index": "36,36,36,36", "lanes": "140,141,142,143", - "alias_at_lanes": "etp36a, etp36b, etp36c, etp36d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp36"], + "2x50G[40G,25G,10G]": ["etp36a", "etp36b"] + } }, "Ethernet144": { "index": "37,37,37,37", "lanes": "144,145,146,147", - "alias_at_lanes": "etp37a, etp37b, etp37c, etp37d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp37"], + "2x50G[40G,25G,10G]": ["etp37a", "etp37b"] + } }, "Ethernet148": { "index": "38,38,38,38", "lanes": "148,149,150,151", - "alias_at_lanes": "etp38a, etp38b, etp38c, etp38d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp38"], + "2x50G[40G,25G,10G]": ["etp38a", "etp38b"] + } }, "Ethernet152": { "index": "39,39,39,39", "lanes": "152,153,154,155", - "alias_at_lanes": "etp39a, etp39b, etp39c, etp39d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp39"], + "2x50G[40G,25G,10G]": ["etp39a", "etp39b"] + } }, "Ethernet156": { "index": "40,40,40,40", "lanes": "156,157,158,159", - "alias_at_lanes": "etp40a, etp40b, etp40c, etp40d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp40"], + "2x50G[40G,25G,10G]": ["etp40a", "etp40b"] + } }, "Ethernet160": { "index": "41,41,41,41", "lanes": "160,161,162,163", - "alias_at_lanes": "etp41a, etp41b, etp41c, etp41d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp41"], + "2x50G[40G,25G,10G]": ["etp41a", "etp41b"] + } }, "Ethernet164": { "index": "42,42,42,42", "lanes": "164,165,166,167", - "alias_at_lanes": "etp42a, etp42b, etp42c, etp42d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp42"], + "2x50G[40G,25G,10G]": ["etp42a", "etp42b"] + } }, "Ethernet168": { "index": "43,43,43,43", "lanes": "168,169,170,171", - "alias_at_lanes": "etp43a, etp43b, etp43c, etp43d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp43"], + "2x50G[40G,25G,10G]": ["etp43a", "etp43b"] + } }, "Ethernet172": { "index": "44,44,44,44", "lanes": "172,173,174,175", - "alias_at_lanes": "etp44a, etp44b, etp44c, etp44d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp44"], + "2x50G[40G,25G,10G]": ["etp44a", "etp44b"] + } }, "Ethernet176": { "index": "45,45,45,45", "lanes": "176,177,178,179", - "alias_at_lanes": "etp45a, etp45b, etp45c, etp45d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp45"], + "2x50G[40G,25G,10G]": ["etp45a", "etp45b"] + } }, "Ethernet180": { "index": "46,46,46,46", "lanes": "180,181,182,183", - "alias_at_lanes": "etp46a, etp46b, etp46c, etp46d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp46"], + "2x50G[40G,25G,10G]": ["etp46a", "etp46b"] + } }, "Ethernet184": { "index": "47,47,47,47", "lanes": "184,185,186,187", - "alias_at_lanes": "etp47a, etp47b, etp47c, etp47d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp47"], + "2x50G[40G,25G,10G]": ["etp47a", "etp47b"] + } }, "Ethernet188": { "index": "48,48,48,48", "lanes": "188,189,190,191", - "alias_at_lanes": "etp48a, etp48b, etp48c, etp48d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp48"], + "2x50G[40G,25G,10G]": ["etp48a", "etp48b"] + } }, "Ethernet192": { "index": "49,49,49,49", "lanes": "192,193,194,195", - "alias_at_lanes": "etp49a, etp49b, etp49c, etp49d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp49"], + "2x50G[40G,25G,10G]": ["etp49a", "etp49b"] + } }, "Ethernet196": { "index": "50,50,50,50", "lanes": "196,197,198,199", - "alias_at_lanes": "etp50a, etp50b, etp50c, etp50d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp50"], + "2x50G[40G,25G,10G]": ["etp50a", "etp50b"] + } }, "Ethernet200": { "index": "51,51,51,51", "lanes": "200,201,202,203", - "alias_at_lanes": "etp51a, etp51b, etp51c, etp51d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp51"], + "2x50G[40G,25G,10G]": ["etp51a", "etp51b"] + } }, "Ethernet204": { "index": "52,52,52,52", "lanes": "204,205,206,207", - "alias_at_lanes": "etp52a, etp52b, etp52c, etp52d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp52"], + "2x50G[40G,25G,10G]": ["etp52a", "etp52b"] + } }, "Ethernet208": { "index": "53,53,53,53", "lanes": "208,209,210,211", - "alias_at_lanes": "etp53a, etp53b, etp53c, etp53d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp53"], + "2x50G[40G,25G,10G]": ["etp53a", "etp53b"] + } }, "Ethernet212": { "index": "54,54,54,54", "lanes": "212,213,214,215", - "alias_at_lanes": "etp54a, etp54b, etp54c, etp54d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp54"], + "2x50G[40G,25G,10G]": ["etp54a", "etp54b"] + } }, "Ethernet216": { "index": "55,55,55,55", "lanes": "216,217,218,219", - "alias_at_lanes": "etp55a, etp55b, etp55c, etp55d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp55"], + "2x50G[40G,25G,10G]": ["etp55a", "etp55b"] + } }, "Ethernet220": { "index": "56,56,56,56", "lanes": "220,221,222,223", - "alias_at_lanes": "etp56a, etp56b, etp56c, etp56d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp56"], + "2x50G[40G,25G,10G]": ["etp56a", "etp56b"] + } }, "Ethernet224": { "index": "57,57,57,57", "lanes": "224,225,226,227", - "alias_at_lanes": "etp57a, etp57b, etp57c, etp57d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp57"], + "2x50G[40G,25G,10G]": ["etp57a", "etp57b"] + } }, "Ethernet228": { "index": "58,58,58,58", "lanes": "228,229,230,231", - "alias_at_lanes": "etp58a, etp58b, etp58c, etp58d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp58"], + "2x50G[40G,25G,10G]": ["etp58a", "etp58b"] + } }, "Ethernet232": { "index": "59,59,59,59", "lanes": "232,233,234,235", - "alias_at_lanes": "etp59a, etp59b, etp59c, etp59d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp59"], + "2x50G[40G,25G,10G]": ["etp59a", "etp59b"] + } }, "Ethernet236": { "index": "60,60,60,60", "lanes": "236,237,238,239", - "alias_at_lanes": "etp60a, etp60b, etp60c, etp60d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp60"], + "2x50G[40G,25G,10G]": ["etp60a", "etp60b"] + } }, "Ethernet240": { "index": "61,61,61,61", "lanes": "240,241,242,243", - "alias_at_lanes": "etp61a, etp61b, etp61c, etp61d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp61"], + "2x50G[40G,25G,10G]": ["etp61a", "etp61b"] + } }, "Ethernet244": { "index": "62,62,62,62", "lanes": "244,245,246,247", - "alias_at_lanes": "etp62a, etp62b, etp62c, etp62d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp62"], + "2x50G[40G,25G,10G]": ["etp62a", "etp62b"] + } }, "Ethernet248": { "index": "63,63,63,63", "lanes": "248,249,250,251", - "alias_at_lanes": "etp63a, etp63b, etp63c, etp63d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp63"], + "2x50G[40G,25G,10G]": ["etp63a", "etp63b"] + } }, "Ethernet252": { "index": "64,64,64,64", "lanes": "252,253,254,255", - "alias_at_lanes": "etp64a, etp64b, etp64c, etp64d", - "breakout_modes": "1x100G[50G,40G,25G,10G],2x50G[40G,25G,10G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp64"], + "2x50G[40G,25G,10G]": ["etp64a", "etp64b"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json index 01ad8221815b..e1ea36676bd2 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json @@ -3,194 +3,290 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp1"], + "2x50G[40G,25G,10G,1G]": ["etp1a", "etp1b"], + "4x25G[10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } }, "Ethernet8": { "index": "2,2,2,2", "lanes": "8,9,10,11", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp2"], + "2x50G[40G,25G,10G,1G]": ["etp2a", "etp2b"], + "4x25G[10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } }, "Ethernet16": { "index": "3,3,3,3", "lanes": "16,17,18,19", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp3"], + "2x50G[40G,25G,10G,1G]": ["etp3a", "etp3b"], + "4x25G[10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } }, "Ethernet24": { "index": "4,4,4,4", "lanes": "24,25,26,27", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp4"], + "2x50G[40G,25G,10G,1G]": ["etp4a", "etp4b"], + "4x25G[10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } }, "Ethernet32": { "index": "5,5,5,5", "lanes": "32,33,34,35", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp5"], + "2x50G[40G,25G,10G,1G]": ["etp5a", "etp5b"], + "4x25G[10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } }, "Ethernet40": { "index": "6,6,6,6", "lanes": "40,41,42,43", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp6"], + "2x50G[40G,25G,10G,1G]": ["etp6a", "etp6b"], + "4x25G[10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } }, "Ethernet48": { "index": "7,7,7,7", "lanes": "48,49,50,51", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp7"], + "2x50G[40G,25G,10G,1G]": ["etp7a", "etp7b"], + "4x25G[10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } }, "Ethernet56": { "index": "8,8,8,8", "lanes": "56,57,58,59", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp8"], + "2x50G[40G,25G,10G,1G]": ["etp8a", "etp8b"], + "4x25G[10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } }, "Ethernet64": { "index": "9,9,9,9", "lanes": "64,65,66,67", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp9"], + "2x50G[40G,25G,10G,1G]": ["etp9a", "etp9b"], + "4x25G[10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } }, "Ethernet72": { "index": "10,10,10,10", "lanes": "72,73,74,75", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp10"], + "2x50G[40G,25G,10G,1G]": ["etp10a", "etp10b"], + "4x25G[10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } }, "Ethernet80": { "index": "11,11,11,11", "lanes": "80,81,82,83", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp11"], + "2x50G[40G,25G,10G,1G]": ["etp11a", "etp11b"], + "4x25G[10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } }, "Ethernet88": { "index": "12,12,12,12", "lanes": "88,89,90,91", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp12"], + "2x50G[40G,25G,10G,1G]": ["etp12a", "etp12b"], + "4x25G[10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } }, "Ethernet96": { "index": "13,13,13,13", "lanes": "96,97,98,99", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp13"], + "2x50G[40G,25G,10G,1G]": ["etp13a", "etp13b"], + "4x25G[10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } }, "Ethernet104": { "index": "14,14,14,14", "lanes": "104,105,106,107", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp14"], + "2x50G[40G,25G,10G,1G]": ["etp14a", "etp14b"], + "4x25G[10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } }, "Ethernet112": { "index": "15,15,15,15", "lanes": "112,113,114,115", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp15"], + "2x50G[40G,25G,10G,1G]": ["etp15a", "etp15b"], + "4x25G[10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } }, "Ethernet120": { "index": "16,16,16,16", "lanes": "120,121,122,123", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp16"], + "2x50G[40G,25G,10G,1G]": ["etp16a", "etp16b"], + "4x25G[10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } }, "Ethernet128": { "index": "17,17,17,17", "lanes": "128,129,130,131", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp17"], + "2x50G[40G,25G,10G,1G]": ["etp17a", "etp17b"], + "4x25G[10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + } }, "Ethernet136": { "index": "18,18,18,18", "lanes": "136,137,138,139", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp18"], + "2x50G[40G,25G,10G,1G]": ["etp18a", "etp18b"], + "4x25G[10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + } }, "Ethernet144": { "index": "19,19,19,19", "lanes": "144,145,146,147", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp19"], + "2x50G[40G,25G,10G,1G]": ["etp19a", "etp19b"], + "4x25G[10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } }, "Ethernet152": { "index": "20,20,20,20", "lanes": "152,153,154,155", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp20"], + "2x50G[40G,25G,10G,1G]": ["etp20a", "etp20b"], + "4x25G[10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } }, "Ethernet160": { "index": "21,21,21,21", "lanes": "160,161,162,163", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp21"], + "2x50G[40G,25G,10G,1G]": ["etp21a", "etp21b"], + "4x25G[10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } }, "Ethernet168": { "index": "22,22,22,22", "lanes": "168,169,170,171", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp22"], + "2x50G[40G,25G,10G,1G]": ["etp22a", "etp22b"], + "4x25G[10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } }, "Ethernet176": { "index": "23,23,23,23", "lanes": "176,177,178,179", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp23"], + "2x50G[40G,25G,10G,1G]": ["etp23a", "etp23b"], + "4x25G[10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + } }, "Ethernet184": { "index": "24,24,24,24", "lanes": "184,185,186,187", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G],4x25G[10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp24"], + "2x50G[40G,25G,10G,1G]": ["etp24a", "etp24b"], + "4x25G[10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + } }, "Ethernet192": { "index": "25,25,25,25,25,25,25,25", "lanes": "192,193,194,195,196,197,198,199", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d, etp25e, etp25f, etp25g, etp25h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp25"], + "2x50G[40G,25G,10G,1G]": ["etp25a", "etp25b"], + "4x25G[10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + } }, "Ethernet200": { "index": "26,26,26,26,26,26,26,26", "lanes": "200,201,202,203,204,205,206,207", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d, etp26e, etp26f, etp26g, etp26h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp26"], + "2x50G[40G,25G,10G,1G]": ["etp26a", "etp26b"], + "4x25G[10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + } }, "Ethernet208": { "index": "27,27,27,27,27,27,27,27", "lanes": "208,209,210,211,212,213,214,215", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d, etp27e, etp27f, etp27g, etp27h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp27"], + "2x50G[40G,25G,10G,1G]": ["etp27a", "etp27b"], + "4x25G[10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + } }, "Ethernet216": { "index": "28,28,28,28,28,28,28,28", "lanes": "216,217,218,219,220,221,222,223", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d, etp28e, etp28f, etp28g, etp28h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp28"], + "2x50G[40G,25G,10G,1G]": ["etp28a", "etp28b"], + "4x25G[10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + } }, "Ethernet224": { "index": "29,29,29,29,29,29,29,29", "lanes": "224,225,226,227,228,229,230,231", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d, etp29e, etp29f, etp29g, etp29h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp29"], + "2x50G[40G,25G,10G,1G]": ["etp29a", "etp29b"], + "4x25G[10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + } }, "Ethernet232": { "index": "30,30,30,30,30,30,30,30", "lanes": "232,233,234,235,236,237,238,239", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d, etp30e, etp30f, etp30g, etp30h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp30"], + "2x50G[40G,25G,10G,1G]": ["etp30a", "etp30b"], + "4x25G[10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + } }, "Ethernet240": { "index": "31,31,31,31,31,31,31,31", "lanes": "240,241,242,243,244,245,246,247", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d, etp31e, etp31f, etp31g, etp31h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp31"], + "2x50G[40G,25G,10G,1G]": ["etp31a", "etp31b"], + "4x25G[10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + } }, "Ethernet248": { "index": "32,32,32,32,32,32,32,32", "lanes": "248,249,250,251,252,253,254,255", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d, etp32e, etp32f, etp32g, etp32h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp32"], + "2x50G[40G,25G,10G,1G]": ["etp32a", "etp32b"], + "4x25G[10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + } } } } diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers.json.j2 new file mode 120000 index 000000000000..f46e9600153b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..ddb883a1daa4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..f8bbb6e631e7 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_dynamic.json.j2 new file mode 120000 index 000000000000..8c4117c66214 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/hwsku.json b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/hwsku.json new file mode 100644 index 000000000000..ff0cda3b54d3 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/hwsku.json @@ -0,0 +1,196 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet8": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet16": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet24": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet32": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet40": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet48": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet56": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet64": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet72": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet80": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet88": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet96": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet104": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet112": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet120": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet128": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet136": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet144": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet152": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet160": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet168": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet176": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet184": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet192": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet200": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet208": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet216": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet224": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet232": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet240": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet248": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet256": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet264": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet272": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet280": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet288": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet296": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet304": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet312": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet320": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet328": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet336": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet344": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet352": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet360": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet368": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet376": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet384": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet392": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet400": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet408": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet416": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet424": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet432": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet440": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet448": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet456": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet464": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet472": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet480": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet488": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet496": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet504": { + "default_brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/pg_profile_lookup.ini new file mode 120000 index 000000000000..88e51ceae044 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini new file mode 100644 index 000000000000..a1ecf9aa3266 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 0,1,2,3 etp1 1 +Ethernet8 8,9,10,11 etp2 2 +Ethernet16 16,17,18,19 etp3 3 +Ethernet24 24,25,26,27 etp4 4 +Ethernet32 32,33,34,35 etp5 5 +Ethernet40 40,41,42,43 etp6 6 +Ethernet48 48,49,50,51 etp7 7 +Ethernet56 56,57,58,59 etp8 8 +Ethernet64 64,65,66,67 etp9 9 +Ethernet72 72,73,74,75 etp10 10 +Ethernet80 80,81,82,83 etp11 11 +Ethernet88 88,89,90,91 etp12 12 +Ethernet96 96,97,98,99 etp13 13 +Ethernet104 104,105,106,107 etp14 14 +Ethernet112 112,113,114,115 etp15 15 +Ethernet120 120,121,122,123 etp16 16 +Ethernet128 128,129,130,131 etp17 17 +Ethernet136 136,137,138,139 etp18 18 +Ethernet144 144,145,146,147 etp19 19 +Ethernet152 152,153,154,155 etp20 20 +Ethernet160 160,161,162,163 etp21 21 +Ethernet168 168,169,170,171 etp22 22 +Ethernet176 176,177,178,179 etp23 23 +Ethernet184 184,185,186,187 etp24 24 +Ethernet192 192,193,194,195 etp25 25 +Ethernet200 200,201,202,203 etp26 26 +Ethernet208 208,209,210,211 etp27 27 +Ethernet216 216,217,218,219 etp28 28 +Ethernet224 224,225,226,227 etp29 29 +Ethernet232 232,233,234,235 etp30 30 +Ethernet240 240,241,242,243 etp31 31 +Ethernet248 248,249,250,251 etp32 32 +Ethernet256 256,257,258,259 etp33 33 +Ethernet264 264,265,266,267 etp34 34 +Ethernet272 272,273,274,275 etp35 35 +Ethernet280 280,281,282,283 etp36 36 +Ethernet288 288,289,290,291 etp37 37 +Ethernet296 296,297,298,299 etp38 38 +Ethernet304 304,305,306,307 etp39 39 +Ethernet312 312,313,314,315 etp40 40 +Ethernet320 320,321,322,323 etp41 41 +Ethernet328 328,329,330,331 etp42 42 +Ethernet336 336,337,338,339 etp43 43 +Ethernet344 344,345,346,347 etp44 44 +Ethernet352 352,353,354,355 etp45 45 +Ethernet360 360,361,362,363 etp46 46 +Ethernet368 368,369,370,371 etp47 47 +Ethernet376 376,377,378,379 etp48 48 +Ethernet384 384,385,386,387 etp49 49 +Ethernet392 392,393,394,395 etp50 50 +Ethernet400 400,401,402,403 etp51 51 +Ethernet408 408,409,410,411 etp52 52 +Ethernet416 416,417,418,419 etp53 53 +Ethernet424 424,425,426,427 etp54 54 +Ethernet432 432,433,434,435 etp55 55 +Ethernet440 440,441,442,443 etp56 56 +Ethernet448 448,449,450,451 etp57 57 +Ethernet456 456,457,458,459 etp58 58 +Ethernet464 464,465,466,467 etp59 59 +Ethernet472 472,473,474,475 etp60 60 +Ethernet480 480,481,482,483 etp61 61 +Ethernet488 488,489,490,491 etp62 62 +Ethernet496 496,497,498,499 etp63 63 +Ethernet504 504,505,506,507 etp64 64 diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/qos.json.j2 new file mode 120000 index 000000000000..8633303ece77 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai.profile b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai.profile new file mode 100644 index 000000000000..8d18361c1620 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4600.xml diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml new file mode 100644 index 000000000000..96e09ce694f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml @@ -0,0 +1,471 @@ + + + + + + 00:02:03:04:05:80 + + + 1 + + + 64 + + + + + 105 + 4 + 0 + + + 3 + + + 4096 + + + 107 + 4 + 1 + 3 + 4096 + + + 109 + 4 + 2 + 3 + 4096 + + + 111 + 4 + 3 + 3 + 4096 + + + 97 + 4 + 4 + 3 + 4096 + + + 99 + 4 + 5 + 3 + 4096 + + + 101 + 4 + 6 + 3 + 4096 + + + 103 + 4 + 7 + 3 + 4096 + + + 121 + 4 + 8 + 3 + 4096 + + + 123 + 4 + 9 + 3 + 4096 + + + 125 + 4 + 10 + 3 + 4096 + + + 127 + 4 + 11 + 3 + 4096 + + + 113 + 4 + 12 + 3 + 4096 + + + 115 + 4 + 13 + 3 + 4096 + + + 117 + 4 + 14 + 3 + 4096 + + + 119 + 4 + 15 + 3 + 4096 + + + 89 + 4 + 16 + 3 + 4096 + + + 91 + 4 + 17 + 3 + 4096 + + + 93 + 4 + 18 + 3 + 4096 + + + 95 + 4 + 19 + 3 + 4096 + + + 81 + 4 + 20 + 3 + 4096 + + + 83 + 4 + 21 + 3 + 4096 + + + 85 + 4 + 22 + 3 + 4096 + + + 87 + 4 + 23 + 3 + 4096 + + + 73 + 4 + 24 + 3 + 4096 + + + 75 + 4 + 25 + 3 + 4096 + + + 77 + 4 + 26 + 3 + 4096 + + + 79 + 4 + 27 + 3 + 4096 + + + 65 + 4 + 28 + 3 + 4096 + + + 67 + 4 + 29 + 3 + 4096 + + + 69 + 4 + 30 + 3 + 4096 + + + 71 + 4 + 31 + 3 + 4096 + + + 5 + 4 + 32 + 3 + 4096 + + + 7 + 4 + 33 + 3 + 4096 + + + 1 + 4 + 34 + 3 + 4096 + + + 3 + 4 + 35 + 3 + 4096 + + + 13 + 4 + 36 + 3 + 4096 + + + 15 + 4 + 37 + 3 + 4096 + + + 9 + 4 + 38 + 3 + 4096 + + + 11 + 4 + 39 + 3 + 4096 + + + 21 + 4 + 40 + 3 + 4096 + + + 23 + 4 + 41 + 3 + 4096 + + + 17 + 4 + 42 + 3 + 4096 + + + 19 + 4 + 43 + 3 + 4096 + + + 29 + 4 + 44 + 3 + 4096 + + + 31 + 4 + 45 + 3 + 4096 + + + 25 + 4 + 46 + 3 + 4096 + + + 27 + 4 + 47 + 3 + 4096 + + + 53 + 4 + 48 + 3 + 4096 + + + 55 + 4 + 49 + 3 + 4096 + + + 49 + 4 + 50 + 3 + 4096 + + + 51 + 4 + 51 + 3 + 4096 + + + 61 + 4 + 52 + 3 + 4096 + + + 63 + 4 + 53 + 3 + 4096 + + + 57 + 4 + 54 + 3 + 4096 + + + 59 + 4 + 55 + 3 + 4096 + + + 37 + 4 + 56 + 3 + 4096 + + + 39 + 4 + 57 + 3 + 4096 + + + 33 + 4 + 58 + 3 + 4096 + + + 35 + 4 + 59 + 3 + 4096 + + + 45 + 4 + 60 + 3 + 4096 + + + 47 + 4 + 61 + 3 + 4096 + + + 41 + 4 + 62 + 3 + 4096 + + + 43 + 4 + 63 + 3 + 4096 + + + + + diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/default_sku b/device/mellanox/x86_64-mlnx_msn4600-r0/default_sku new file mode 100644 index 000000000000..08921eaa2578 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN4600 t1 diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml new file mode 100644 index 000000000000..d110ef7c79cb --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml @@ -0,0 +1,419 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '2' + id: 6f0a + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '1c' + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: '1c' + fn: '7' + id: 8c1e + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #8 (rev d5)' +- bus: '00' + dev: '1d' + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: '1f' + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: '1f' + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: '1f' + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '07' + dev: '00' + fn: '0' + id: cf70 + name: 'Ethernet controller: Mellanox Technologies Device cf70' +- bus: '09' + dev: '00' + fn: '0' + id: 1533 + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: 'ff' + dev: '0b' + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: 'ff' + dev: '0b' + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: 'ff' + dev: '0b' + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: 'ff' + dev: '0b' + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: 'ff' + dev: '0c' + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0c' + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0c' + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0c' + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0f' + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0f' + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0f' + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '0f' + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: 'ff' + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: 'ff' + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: 'ff' + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: 'ff' + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: 'ff' + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: 'ff' + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: 'ff' + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: 'ff' + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: 'ff' + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: 'ff' + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: 'ff' + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: 'ff' + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: 'ff' + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: 'ff' + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: 'ff' + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: 'ff' + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: 'ff' + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: 'ff' + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: 'ff' + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: 'ff' + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: 'ff' + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: 'ff' + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: 'ff' + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: 'ff' + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: 'ff' + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: 'ff' + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: 'ff' + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: 'ff' + dev: '1e' + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1e' + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1e' + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1e' + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1e' + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1f' + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: 'ff' + dev: '1f' + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json new file mode 100644 index 000000000000..e5d16cc578f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json @@ -0,0 +1,579 @@ +{ + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "0,1,2,3", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp1"], + "2x100G[50G,40G,25G,10G,1G]": ["etp1a", "etp1b"], + "4x50G[40G,25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } + }, + "Ethernet8": { + "index": "2,2,2,2", + "lanes": "8,9,10,11", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp2"], + "2x100G[50G,40G,25G,10G,1G]": ["etp2a", "etp2b"], + "4x50G[40G,25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } + }, + "Ethernet16": { + "index": "3,3,3,3", + "lanes": "16,17,18,19", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp3"], + "2x100G[50G,40G,25G,10G,1G]": ["etp3a", "etp3b"], + "4x50G[40G,25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } + }, + "Ethernet24": { + "index": "4,4,4,4", + "lanes": "24,25,26,27", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp4"], + "2x100G[50G,40G,25G,10G,1G]": ["etp4a", "etp4b"], + "4x50G[40G,25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } + }, + "Ethernet32": { + "index": "5,5,5,5", + "lanes": "32,33,34,35", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp5"], + "2x100G[50G,40G,25G,10G,1G]": ["etp5a", "etp5b"], + "4x50G[40G,25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } + }, + "Ethernet40": { + "index": "6,6,6,6", + "lanes": "40,41,42,43", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp6"], + "2x100G[50G,40G,25G,10G,1G]": ["etp6a", "etp6b"], + "4x50G[40G,25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } + }, + "Ethernet48": { + "index": "7,7,7,7", + "lanes": "48,49,50,51", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp7"], + "2x100G[50G,40G,25G,10G,1G]": ["etp7a", "etp7b"], + "4x50G[40G,25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } + }, + "Ethernet56": { + "index": "8,8,8,8", + "lanes": "56,57,58,59", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp8"], + "2x100G[50G,40G,25G,10G,1G]": ["etp8a", "etp8b"], + "4x50G[40G,25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } + }, + "Ethernet64": { + "index": "9,9,9,9", + "lanes": "64,65,66,67", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp9"], + "2x100G[50G,40G,25G,10G,1G]": ["etp9a", "etp9b"], + "4x50G[40G,25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } + }, + "Ethernet72": { + "index": "10,10,10,10", + "lanes": "72,73,74,75", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp10"], + "2x100G[50G,40G,25G,10G,1G]": ["etp10a", "etp10b"], + "4x50G[40G,25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } + }, + "Ethernet80": { + "index": "11,11,11,11", + "lanes": "80,81,82,83", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp11"], + "2x100G[50G,40G,25G,10G,1G]": ["etp11a", "etp11b"], + "4x50G[40G,25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } + }, + "Ethernet88": { + "index": "12,12,12,12", + "lanes": "88,89,90,91", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp12"], + "2x100G[50G,40G,25G,10G,1G]": ["etp12a", "etp12b"], + "4x50G[40G,25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } + }, + "Ethernet96": { + "index": "13,13,13,13", + "lanes": "96,97,98,99", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp13"], + "2x100G[50G,40G,25G,10G,1G]": ["etp13a", "etp13b"], + "4x50G[40G,25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } + }, + "Ethernet104": { + "index": "14,14,14,14", + "lanes": "104,105,106,107", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp14"], + "2x100G[50G,40G,25G,10G,1G]": ["etp14a", "etp14b"], + "4x50G[40G,25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } + }, + "Ethernet112": { + "index": "15,15,15,15", + "lanes": "112,113,114,115", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp15"], + "2x100G[50G,40G,25G,10G,1G]": ["etp15a", "etp15b"], + "4x50G[40G,25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } + }, + "Ethernet120": { + "index": "16,16,16,16", + "lanes": "120,121,122,123", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp16"], + "2x100G[50G,40G,25G,10G,1G]": ["etp16a", "etp16b"], + "4x50G[40G,25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } + }, + "Ethernet128": { + "index": "17,17,17,17", + "lanes": "128,129,130,131", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp17"], + "2x100G[50G,40G,25G,10G,1G]": ["etp17a", "etp17b"], + "4x50G[40G,25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + } + }, + "Ethernet136": { + "index": "18,18,18,18", + "lanes": "136,137,138,139", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp18"], + "2x100G[50G,40G,25G,10G,1G]": ["etp18a", "etp18b"], + "4x50G[40G,25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + } + }, + "Ethernet144": { + "index": "19,19,19,19", + "lanes": "144,145,146,147", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp19"], + "2x100G[50G,40G,25G,10G,1G]": ["etp19a", "etp19b"], + "4x50G[40G,25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } + }, + "Ethernet152": { + "index": "20,20,20,20", + "lanes": "152,153,154,155", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp20"], + "2x100G[50G,40G,25G,10G,1G]": ["etp20a", "etp20b"], + "4x50G[40G,25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } + }, + "Ethernet160": { + "index": "21,21,21,21", + "lanes": "160,161,162,163", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp21"], + "2x100G[50G,40G,25G,10G,1G]": ["etp21a", "etp21b"], + "4x50G[40G,25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } + }, + "Ethernet168": { + "index": "22,22,22,22", + "lanes": "168,169,170,171", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp22"], + "2x100G[50G,40G,25G,10G,1G]": ["etp22a", "etp22b"], + "4x50G[40G,25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } + }, + "Ethernet176": { + "index": "23,23,23,23", + "lanes": "176,177,178,179", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp23"], + "2x100G[50G,40G,25G,10G,1G]": ["etp23a", "etp23b"], + "4x50G[40G,25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + } + }, + "Ethernet184": { + "index": "24,24,24,24", + "lanes": "184,185,186,187", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp24"], + "2x100G[50G,40G,25G,10G,1G]": ["etp24a", "etp24b"], + "4x50G[40G,25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + } + }, + "Ethernet192": { + "index": "25,25,25,25", + "lanes": "192,193,194,195", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp25"], + "2x100G[50G,40G,25G,10G,1G]": ["etp25a", "etp25b"], + "4x50G[40G,25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + } + }, + "Ethernet200": { + "index": "26,26,26,26", + "lanes": "200,201,202,203", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp26"], + "2x100G[50G,40G,25G,10G,1G]": ["etp26a", "etp26b"], + "4x50G[40G,25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + } + }, + "Ethernet208": { + "index": "27,27,27,27", + "lanes": "208,209,210,211", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp27"], + "2x100G[50G,40G,25G,10G,1G]": ["etp27a", "etp27b"], + "4x50G[40G,25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + } + }, + "Ethernet216": { + "index": "28,28,28,28", + "lanes": "216,217,218,219", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp28"], + "2x100G[50G,40G,25G,10G,1G]": ["etp28a", "etp28b"], + "4x50G[40G,25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + } + }, + "Ethernet224": { + "index": "29,29,29,29", + "lanes": "224,225,226,227", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp29"], + "2x100G[50G,40G,25G,10G,1G]": ["etp29a", "etp29b"], + "4x50G[40G,25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + } }, + "Ethernet232": { + "index": "30,30,30,30", + "lanes": "232,233,234,235", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp30"], + "2x100G[50G,40G,25G,10G,1G]": ["etp30a", "etp30b"], + "4x50G[40G,25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + } + }, + "Ethernet240": { + "index": "31,31,31,31", + "lanes": "240,241,242,243", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp31"], + "2x100G[50G,40G,25G,10G,1G]": ["etp31a", "etp31b"], + "4x50G[40G,25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + } + }, + "Ethernet248": { + "index": "32,32,32,32", + "lanes": "248,249,250,251", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp32"], + "2x100G[50G,40G,25G,10G,1G]": ["etp32a", "etp32b"], + "4x50G[40G,25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + } + }, + "Ethernet256": { + "index": "33,33,33,33", + "lanes": "256,257,258,259", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp33"], + "2x100G[50G,40G,25G,10G,1G]": ["etp33a", "etp33b"], + "4x50G[40G,25G,10G,1G]": ["etp33a", "etp33b", "etp33c", "etp33d"] + } + }, + "Ethernet264": { + "index": "34,34,34,34", + "lanes": "264,265,266,267", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp34"], + "2x100G[50G,40G,25G,10G,1G]": ["etp34a", "etp34b"], + "4x50G[40G,25G,10G,1G]": ["etp34a", "etp34b", "etp34c", "etp34d"] + } + }, + "Ethernet272": { + "index": "35,35,35,35", + "lanes": "272,273,274,275", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp35"], + "2x100G[50G,40G,25G,10G,1G]": ["etp35a", "etp35b"], + "4x50G[40G,25G,10G,1G]": ["etp35a", "etp35b", "etp35c", "etp35d"] + } + }, + "Ethernet280": { + "index": "36,36,36,36", + "lanes": "280,281,282,283", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp36"], + "2x100G[50G,40G,25G,10G,1G]": ["etp36a", "etp36b"], + "4x50G[40G,25G,10G,1G]": ["etp36a", "etp36b", "etp36c", "etp36d"] + } + }, + "Ethernet288": { + "index": "37,37,37,37", + "lanes": "288,289,290,291", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp37"], + "2x100G[50G,40G,25G,10G,1G]": ["etp37a", "etp37b"], + "4x50G[40G,25G,10G,1G]": ["etp37a", "etp37b", "etp37c", "etp37d"] + } + }, + "Ethernet296": { + "index": "38,38,38,38", + "lanes": "296,297,298,299", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp38"], + "2x100G[50G,40G,25G,10G,1G]": ["etp38a", "etp38b"], + "4x50G[40G,25G,10G,1G]": ["etp38a", "etp38b", "etp38c", "etp38d"] + } + }, + "Ethernet304": { + "index": "39,39,39,39", + "lanes": "304,305,306,307", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp39"], + "2x100G[50G,40G,25G,10G,1G]": ["etp39a", "etp39b"], + "4x50G[40G,25G,10G,1G]": ["etp39a", "etp39b", "etp39c", "etp39d"] + } + }, + "Ethernet312": { + "index": "40,40,40,40", + "lanes": "312,313,314,315", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp40"], + "2x100G[50G,40G,25G,10G,1G]": ["etp40a", "etp40b"], + "4x50G[40G,25G,10G,1G]": ["etp40a", "etp40b", "etp40c", "etp40d"] + } + }, + "Ethernet320": { + "index": "41,41,41,41", + "lanes": "320,321,322,323", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp41"], + "2x100G[50G,40G,25G,10G,1G]": ["etp41a", "etp41b"], + "4x50G[40G,25G,10G,1G]": ["etp41a", "etp41b", "etp41c", "etp41d"] + } + }, + "Ethernet328": { + "index": "42,42,42,42", + "lanes": "328,329,330,331", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp42"], + "2x100G[50G,40G,25G,10G,1G]": ["etp42a", "etp42b"], + "4x50G[40G,25G,10G,1G]": ["etp42a", "etp42b", "etp42c", "etp42d"] + } + }, + "Ethernet336": { + "index": "43,43,43,43", + "lanes": "336,337,338,339", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp43"], + "2x100G[50G,40G,25G,10G,1G]": ["etp43a", "etp43b"], + "4x50G[40G,25G,10G,1G]": ["etp43a", "etp43b", "etp43c", "etp43d"] + } + }, + "Ethernet344": { + "index": "44,44,44,44", + "lanes": "344,345,346,347", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp44"], + "2x100G[50G,40G,25G,10G,1G]": ["etp44a", "etp44b"], + "4x50G[40G,25G,10G,1G]": ["etp44a", "etp44b", "etp44c", "etp44d"] + } + }, + "Ethernet352": { + "index": "45,45,45,45", + "lanes": "352,353,354,355", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp45"], + "2x100G[50G,40G,25G,10G,1G]": ["etp45a", "etp45b"], + "4x50G[40G,25G,10G,1G]": ["etp45a", "etp45b", "etp45c", "etp45d"] + } + }, + "Ethernet360": { + "index": "46,46,46,46", + "lanes": "360,361,362,363", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp46"], + "2x100G[50G,40G,25G,10G,1G]": ["etp46a", "etp46b"], + "4x50G[40G,25G,10G,1G]": ["etp46a", "etp46b", "etp46c", "etp46d"] + } + }, + "Ethernet368": { + "index": "47,47,47,47", + "lanes": "368,369,370,371", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp47"], + "2x100G[50G,40G,25G,10G,1G]": ["etp47a", "etp47b"], + "4x50G[40G,25G,10G,1G]": ["etp47a", "etp47b", "etp47c", "etp47d"] + } + }, + "Ethernet376": { + "index": "48,48,48,48", + "lanes": "376,377,378,379", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp48"], + "2x100G[50G,40G,25G,10G,1G]": ["etp48a", "etp48b"], + "4x50G[40G,25G,10G,1G]": ["etp48a", "etp48b", "etp48c", "etp48d"] + } + }, + "Ethernet384": { + "index": "49,49,49,49", + "lanes": "384,385,386,387", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp49"], + "2x100G[50G,40G,25G,10G,1G]": ["etp49a", "etp49b"], + "4x50G[40G,25G,10G,1G]": ["etp49a", "etp49b", "etp49c", "etp49d"] + } + }, + "Ethernet392": { + "index": "50,50,50,50", + "lanes": "392,393,394,395", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp50"], + "2x100G[50G,40G,25G,10G,1G]": ["etp50a", "etp50b"], + "4x50G[40G,25G,10G,1G]": ["etp50a", "etp50b", "etp50c", "etp50d"] + } + }, + "Ethernet400": { + "index": "51,51,51,51", + "lanes": "400,401,402,403", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp51"], + "2x100G[50G,40G,25G,10G,1G]": ["etp51a", "etp51b"], + "4x50G[40G,25G,10G,1G]": ["etp51a", "etp51b", "etp51c", "etp51d"] + } + }, + "Ethernet408": { + "index": "52,52,52,52", + "lanes": "408,409,410,411", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp52"], + "2x100G[50G,40G,25G,10G,1G]": ["etp52a", "etp52b"], + "4x50G[40G,25G,10G,1G]": ["etp52a", "etp52b", "etp52c", "etp52d"] + } + }, + "Ethernet416": { + "index": "53,53,53,53", + "lanes": "416,417,418,419", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp53"], + "2x100G[50G,40G,25G,10G,1G]": ["etp53a", "etp53b"], + "4x50G[40G,25G,10G,1G]": ["etp53a", "etp53b", "etp53c", "etp53d"] + } + }, + "Ethernet424": { + "index": "54,54,54,54", + "lanes": "424,425,426,427", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp54"], + "2x100G[50G,40G,25G,10G,1G]": ["etp54a", "etp54b"], + "4x50G[40G,25G,10G,1G]": ["etp54a", "etp54b", "etp54c", "etp54d"] + } + }, + "Ethernet432": { + "index": "55,55,55,55", + "lanes": "432,433,434,435", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp55"], + "2x100G[50G,40G,25G,10G,1G]": ["etp55a", "etp55b"], + "4x50G[40G,25G,10G,1G]": ["etp55a", "etp55b", "etp55c", "etp55d"] + } + }, + "Ethernet440": { + "index": "56,56,56,56", + "lanes": "440,441,442,443", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp56"], + "2x100G[50G,40G,25G,10G,1G]": ["etp56a", "etp56b"], + "4x50G[40G,25G,10G,1G]": ["etp56a", "etp56b", "etp56c", "etp56d"] + } + }, + "Ethernet448": { + "index": "57,57,57,57", + "lanes": "448,449,450,451", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp57"], + "2x100G[50G,40G,25G,10G,1G]": ["etp57a", "etp57b"], + "4x50G[40G,25G,10G,1G]": ["etp57a", "etp57b", "etp57c", "etp57d"] + } + }, + "Ethernet456": { + "index": "58,58,58,58", + "lanes": "456,457,458,459", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp58"], + "2x100G[50G,40G,25G,10G,1G]": ["etp58a", "etp58b"], + "4x50G[40G,25G,10G,1G]": ["etp58a", "etp58b", "etp58c", "etp58d"] + } + }, + "Ethernet464": { + "index": "59,59,59,59", + "lanes": "464,465,466,467", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp59"], + "2x100G[50G,40G,25G,10G,1G]": ["etp59a", "etp59b"], + "4x50G[40G,25G,10G,1G]": ["etp59a", "etp59b", "etp59c", "etp59d"] + } + }, + "Ethernet472": { + "index": "60,60,60,60", + "lanes": "472,473,474,475", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp60"], + "2x100G[50G,40G,25G,10G,1G]": ["etp60a", "etp60b"], + "4x50G[40G,25G,10G,1G]": ["etp60a", "etp60b", "etp60c", "etp60d"] + } + }, + "Ethernet480": { + "index": "61,61,61,61", + "lanes": "480,481,482,483", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp61"], + "2x100G[50G,40G,25G,10G,1G]": ["etp61a", "etp61b"], + "4x50G[40G,25G,10G,1G]": ["etp61a", "etp61b", "etp61c", "etp61d"] + } + }, + "Ethernet488": { + "index": "62,62,62,62", + "lanes": "488,489,490,491", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp62"], + "2x100G[50G,40G,25G,10G,1G]": ["etp62a", "etp62b"], + "4x50G[40G,25G,10G,1G]": ["etp62a", "etp62b", "etp62c", "etp62d"] + } + }, + "Ethernet496": { + "index": "63,63,63,63", + "lanes": "496,497,498,499", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp63"], + "2x100G[50G,40G,25G,10G,1G]": ["etp63a", "etp63b"], + "4x50G[40G,25G,10G,1G]": ["etp63a", "etp63b", "etp63c", "etp63d"] + } + }, + "Ethernet504": { + "index": "64,64,64,64", + "lanes": "504,505,506,507", + "breakout_modes": { + "1x200G[100G,50G,40G,25G,10G,1G]": ["etp64"], + "2x100G[50G,40G,25G,10G,1G]": ["etp64a", "etp64b"], + "4x50G[40G,25G,10G,1G]": ["etp64a", "etp64b", "etp64c", "etp64d"] + } + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform_components.json b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_components.json new file mode 100644 index 000000000000..35ebe3943dac --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "MSN4600": { + "component": { + "ONIE": { }, + "SSD": { }, + "BIOS": { }, + "CPLD1": { }, + "CPLD2": { }, + "CPLD3": { } + } + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform_wait b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_wait new file mode 120000 index 000000000000..4b30bd429854 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_wait @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_wait \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/psuutil.py new file mode 120000 index 000000000000..9f724238a8d5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/psuutil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn4600-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..435a2ce7c0ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf new file mode 100644 index 000000000000..da05cd94bf9f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf @@ -0,0 +1,189 @@ +################################################################################ +# Copyright (c) 2021 Mellanox Technologies +# +# Platform specific sensors config for SN4600 +################################################################################ + +# Temperature sensors +bus "i2c-2" "i2c-1-mux (chan_id 1)" + chip "mlxsw-i2c-*-48" + label temp1 "Ambient ASIC Temp" + +bus "i2c-7" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-*-49" + label temp1 "Ambient Fan Side Temp (air intake)" + chip "tmp102-i2c-*-4a" + label temp1 "Ambient Port Side Temp (air exhaust)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-15-49" + label temp1 "Ambient COMEX Temp" + +# Power controllers +bus "i2c-5" "i2c-1-mux (chan_id 4)" + chip "xdpe12284-i2c-*-62" + label in1 "PMIC-1 PSU 12V Rail (in)" + ignore in2 + label in3 "PMIC-1 ASIC 0.8V VCORE_MAIN Rail (out)" + ignore in4 + label temp1 "PMIC-1 Temp 1" + label temp2 "PMIC-1 Temp 2" + label power1 "PMIC-1 ASIC 12V VCORE_MAIN Rail Pwr (in)" + ignore power2 + label power3 "PMIC-1 ASIC 0.8V VCORE_MAIN Rail Pwr (out)" + ignore power4 + label curr1 "PMIC-1 ASIC 12V VCORE_MAIN Rail Curr (in)" + ignore curr2 + label curr3 "PMIC-1 ASIC 0.8V VCORE_MAIN Rail Curr (out)" + ignore curr4 + chip "xdpe12284-i2c-*-64" + label in1 "PMIC-2 PSU 12V Rail_1 (in)" + label in2 "PMIC-2 PSU 12V Rail_2 (in)" + label in3 "PMIC-2 ASIC 1.8V Rail_1 (out)" + label in4 "PMIC-2 ASIC 1.2V Rail_2 (out)" + label temp1 "PMIC-2 Temp 1" + label temp2 "PMIC-2 Temp 2" + label power1 "PMIC-2 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-2 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-2 ASIC 1.8V Rail_1 Pwr (out)" + label power4 "PMIC-2 ASIC 1.2V Rail_2 Pwr (out)" + label curr1 "PMIC-2 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-2 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-2 ASIC 1.8V Rail_1 Curr (out)" + label curr4 "PMIC-2 ASIC 1.2V Rail_2 Curr (out)" + chip "xdpe12284-i2c-*-66" + label in1 "PMIC-3 PSU 12V Rail_1 (in)" + label in2 "PMIC-3 PSU 12V Rail_2 (in)" + label in3 "PMIC-3 ASIC 0.85V Rail_1 T0_1 (out)" + label in4 "PMIC-3 ASIC 1.8V Rail_2 T0_1 (out)" + label temp1 "PMIC-3 Temp 1" + label temp2 "PMIC-3 Temp 2" + label power1 "PMIC-3 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-3 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-3 ASIC 0.85V Rail_1 T0_1 Pwr (out)" + label power4 "PMIC-3 ASIC 1.8V Rail_2 T0_1 Pwr (out)" + label curr1 "PMIC-3 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-3 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-3 ASIC 0.85V Rail_1 T0_1 Curr (out)" + label curr4 "PMIC-3 ASIC 1.8V Rail_2 T0_1 Curr (out)" + chip "xdpe12284-i2c-*-68" + label in1 "PMIC-4 PSU 12V Rail_1 (in)" + label in2 "PMIC-4 PSU 12V Rail_2 (in)" + label in3 "PMIC-4 ASIC 0.85V Rail_1 T2_3 (out)" + label in4 "PMIC-4 ASIC 1.8V Rail_2 T2_3 (out)" + label temp1 "PMIC-4 Temp 1" + label temp2 "PMIC-4 Temp 2" + label power1 "PMIC-4 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-4 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-4 ASIC 0.85V Rail_1 T2_3 Pwr (out)" + label power4 "PMIC-4 ASIC 1.8V Rail_2 T2_3 Pwr (out)" + label curr1 "PMIC-4 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-4 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-4 ASIC 0.85V Rail_1 T2_3 Curr (out)" + label curr4 "PMIC-4 ASIC 1.8V Rail_2 T2_3 Curr (out)" + chip "xdpe12284-i2c-*-6a" + label in1 "PMIC-5 PSU 12V Rail_1 (in)" + label in2 "PMIC-5 PSU 12V Rail_2 (in)" + label in3 "PMIC-5 ASIC 0.85V Rail_1 T4_5 (out)" + label in4 "PMIC-5 ASIC 1.8V Rail_2 T4_5 (out)" + label temp1 "PMIC-5 Temp 1" + label temp2 "PMIC-5 Temp 2" + label power1 "PMIC-5 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-5 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-5 ASIC 0.85V Rail_1 T4_5 Pwr (out)" + label power4 "PMIC-5 ASIC 1.8V Rail_2 T4_5 Pwr (out)" + label curr1 "PMIC-5 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-5 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-5 ASIC 0.85V Rail_1 T4_5 Curr (out)" + label curr4 "PMIC-5 ASIC 1.8V Rail_2 T4_5 Curr (out)" + chip "xdpe12284-i2c-*-6c" + label in1 "PMIC-6 PSU 12V Rail_1 (in)" + label in2 "PMIC-6 PSU 12V Rail_2 (in)" + label in3 "PMIC-6 ASIC 0.85V Rail_1 T6_7 (out)" + label in4 "PMIC-6 ASIC 1.8V Rail_2 T6_7 (out)" + label temp1 "PMIC-6 Temp 1" + label temp2 "PMIC-6 Temp 2" + label power1 "PMIC-6 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-6 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-6 ASIC 0.85V Rail_1 T6_7 Pwr (out)" + label power4 "PMIC-6 ASIC 1.8V Rail_2 T6_7 Pwr (out)" + label curr1 "PMIC-6 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-6 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-6 ASIC 0.85V Rail_1 T6_7 Curr (out)" + label curr4 "PMIC-6 ASIC 1.8V Rail_2 T6_7 Curr (out)" + chip "xdpe12284-i2c-*-6e" + label in1 "PMIC-7 PSU 12V Rail_1 (in)" + label in2 "PMIC-7 PSU 12V Rail_2 (in)" + label in3 "PMIC-7 ASIC 1.2V Rail_1 T0_3 (out)" + label in4 "PMIC-7 ASIC 1.2V Rail_2 T4_7 (out)" + label temp1 "PMIC-7 Temp 1" + label temp2 "PMIC-7 Temp 2" + label power1 "PMIC-7 ASIC 12V Rail_1 Pwr (in)" + label power2 "PMIC-7 ASIC 12V Rail_2 Pwr (in)" + label power3 "PMIC-7 ASIC 1.2V Rail_1 T0_3 Pwr (out)" + label power4 "PMIC-7 ASIC 1.2V Rail_2 T4_7 Pwr (out)" + label curr1 "PMIC-7 ASIC 12V Rail_1 Curr (in)" + label curr2 "PMIC-7 ASIC 12V Rail_2 Curr (in)" + label curr3 "PMIC-7 ASIC 1.2V Rail_1 T0_3 Curr (out)" + label curr4 "PMIC-7 ASIC 1.2V Rail_2 T4_7 Curr (out)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tps53679-i2c-*-58" + label in1 "PMIC-8 PSU 12V Rail (in1)" + label in2 "PMIC-8 PSU 12V Rail (in2)" + label in3 "PMIC-8 COMEX 1.8V Rail (out)" + label in4 "PMIC-8 COMEX 1.05V Rail (out)" + label temp1 "PMIC-8 Temp 1" + label temp2 "PMIC-8 Temp 2" + label power1 "PMIC-8 COMEX 1.8V Rail Pwr (out)" + label power2 "PMIC-8 COMEX 1.05V Rail Pwr (out)" + label curr1 "PMIC-8 COMEX 1.8V Rail Curr (out)" + label curr2 "PMIC-8 COMEX 1.05V Rail Curr (out)" + chip "tps53679-i2c-*-61" + label in1 "PMIC-9 PSU 12V Rail (in1)" + label in2 "PMIC-9 PSU 12V Rail (in2)" + label in3 "PMIC-9 COMEX 1.2V Rail (out)" + ignore in4 + label temp1 "PMIC-9 Temp 1" + label temp2 "PMIC-9 Temp 2" + label power1 "PMIC-9 COMEX 1.2V Rail Pwr (out)" + ignore power2 + label curr1 "PMIC-9 COMEX 1.2V Rail Curr (out)" + ignore curr2 + +# Power supplies +bus "i2c-4" "i2c-1-mux (chan_id 3)" + chip "dps460-i2c-*-58" + label in1 "PSU-1(L) 220V Rail (in)" + ignore in2 + label in3 "PSU-1(L) 12V Rail (out)" + label fan1 "PSU-1(L) Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-1(L) Temp 1" + label temp2 "PSU-1(L) Temp 2" + label temp3 "PSU-1(L) Temp 3" + label power1 "PSU-1(L) 220V Rail Pwr (in)" + label power2 "PSU-1(L) 12V Rail Pwr (out)" + label curr1 "PSU-1(L) 220V Rail Curr (in)" + label curr2 "PSU-1(L) 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-2(R) 220V Rail (in)" + ignore in2 + label in3 "PSU-2(R) 12V Rail (out)" + label fan1 "PSU-2(R) Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-2(R) Temp 1" + label temp2 "PSU-2(R) Temp 2" + label temp3 "PSU-2(R) Temp 3" + label power1 "PSU-2(R) 220V Rail Pwr (in)" + label power2 "PSU-2(R) 12V Rail Pwr (out)" + label curr1 "PSU-2(R) 220V Rail Curr (in)" + label curr2 "PSU-2(R) 12V Rail Curr (out)" + +# Chassis fans +chip "mlxreg_fan-isa-*" + label fan1 "Chassis Fan Drawer-1" + label fan2 "Chassis Fan Drawer-2" + label fan3 "Chassis Fan Drawer-3" diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json new file mode 120000 index 000000000000..98df66c27ca5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/thermal_policy.json b/device/mellanox/x86_64-mlnx_msn4600-r0/thermal_policy.json new file mode 120000 index 000000000000..5a25cd87f70c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/thermal_policy.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/thermal_policy.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 index 33df493e117e..aa74c4645678 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '56369152' %} +{% set ingress_lossless_pool_size = '47587328' %} +{% set ingress_lossless_xoff_size = '2400256' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '56369152' %} +{% set egress_lossy_pool_size = '47587328' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_xoff_size }}", {%- endif %} "type": "ingress", "mode": "dynamic" @@ -39,7 +41,7 @@ "dynamic_th":"7" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", "dynamic_th":"3" }, @@ -50,7 +52,7 @@ }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", + "size":"9216", "dynamic_th":"7" }, "q_lossy_profile": { diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 index 7b6e6fdf3883..1cc727f8c85e 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 @@ -1,7 +1,8 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '55115776' %} +{% set ingress_lossless_pool_size = '46702592' %} +{% set ingress_lossless_xoff_size = '3284992' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '55115776' %} +{% set egress_lossy_pool_size = '46702592' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -15,6 +16,7 @@ "ingress_lossless_pool": { {%- if dynamic_mode is not defined %} "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_xoff_size }}", {%- endif %} "type": "ingress", "mode": "dynamic" @@ -39,7 +41,7 @@ "dynamic_th":"7" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", "dynamic_th":"3" }, @@ -50,7 +52,7 @@ }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", + "size":"9216", "dynamic_th":"7" }, "q_lossy_profile": { diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/hwsku.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/hwsku.json index 2e095568b91c..03af6221121b 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/hwsku.json +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/hwsku.json @@ -19,7 +19,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet24": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet26": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet32": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -40,7 +43,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet56": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet58": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet64": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -61,7 +67,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet88": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet90": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet96": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -82,7 +91,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet120": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet122": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet128": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -103,7 +115,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet152": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet154": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet160": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -124,7 +139,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet184": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet186": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet192": { "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" @@ -139,7 +157,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet216": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet218": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet224": { "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" @@ -154,7 +175,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet248": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet250": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet256": { "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" @@ -169,7 +193,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet280": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet282": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet288": { "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" @@ -184,7 +211,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet312": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet314": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet320": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -205,7 +235,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet344": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet346": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet352": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -226,7 +259,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet376": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet378": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet384": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -247,7 +283,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet408": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet410": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet416": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -268,7 +307,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet440": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet442": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet448": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -289,7 +331,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet472": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet474": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet480": { "default_brkout_mode": "2x50G[40G,25G,10G,1G]" @@ -310,7 +355,10 @@ "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet504": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" + }, + "Ethernet506": { + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" } } } \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini index ab397d98de54..4931d4e1d7ae 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini @@ -1,17 +1,17 @@ # PG lossless profiles. # speed cable size xon xoff threshold - 10000 5m 44032 19456 24576 0 - 25000 5m 44032 19456 24576 0 - 40000 5m 44032 19456 24576 0 - 50000 5m 44032 19456 24576 0 - 100000 5m 45056 19456 25600 0 - 10000 40m 44032 19456 24576 0 - 25000 40m 46080 19456 26624 0 - 40000 40m 47104 19456 27648 0 - 50000 40m 48128 19456 28672 0 - 100000 40m 52224 19456 32768 0 - 10000 300m 50176 19456 30720 0 - 25000 300m 59392 19456 39936 0 - 40000 300m 68608 19456 49152 0 - 50000 300m 74752 19456 55296 0 - 100000 300m 105472 19456 86016 0 + 10000 5m 19456 19456 24576 0 + 25000 5m 19456 19456 24576 0 + 40000 5m 19456 19456 24576 0 + 50000 5m 19456 19456 24576 0 + 100000 5m 19456 19456 25600 0 + 10000 40m 19456 19456 24576 0 + 25000 40m 19456 19456 26624 0 + 40000 40m 19456 19456 27648 0 + 50000 40m 19456 19456 28672 0 + 100000 40m 19456 19456 32768 0 + 10000 300m 19456 19456 30720 0 + 25000 300m 19456 19456 39936 0 + 40000 300m 19456 19456 49152 0 + 50000 300m 19456 19456 55296 0 + 100000 300m 19456 19456 86016 0 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini index eb4cdc35637b..27d933d886fa 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini @@ -5,101 +5,117 @@ Ethernet8 8,9 etp2a 2 50000 none Ethernet10 10,11 etp2b 2 50000 none Ethernet16 16,17 etp3a 3 50000 none Ethernet18 18,19 etp3b 3 50000 none -Ethernet24 24,25,26,27 etp4 4 100000 rs +Ethernet24 24,25 etp4a 4 50000 none +Ethernet26 26,27 etp4b 4 50000 none Ethernet32 32,33 etp5a 5 50000 none Ethernet34 34,35 etp5b 5 50000 none Ethernet40 40,41 etp6a 6 50000 none Ethernet42 42,43 etp6b 6 50000 none Ethernet48 48,49 etp7a 7 50000 none Ethernet50 50,51 etp7b 7 50000 none -Ethernet56 56,57,58,59 etp8 8 100000 rs +Ethernet56 56,57 etp8a 8 50000 none +Ethernet58 58,59 etp8b 8 50000 none Ethernet64 64,65 etp9a 9 50000 none Ethernet66 66,67 etp9b 9 50000 none Ethernet72 72,73 etp10a 10 50000 none Ethernet74 74,75 etp10b 10 50000 none Ethernet80 80,81 etp11a 11 50000 none Ethernet82 82,83 etp11b 11 50000 none -Ethernet88 88,89,90,91 etp12 12 100000 rs +Ethernet88 88,89 etp12a 12 50000 none +Ethernet90 90,91 etp12b 12 50000 none Ethernet96 96,97 etp13a 13 50000 none Ethernet98 98,99 etp13b 13 50000 none Ethernet104 104,105 etp14a 14 50000 none Ethernet106 106,107 etp14b 14 50000 none Ethernet112 112,113 etp15a 15 50000 none Ethernet114 114,115 etp15b 15 50000 none -Ethernet120 120,121,122,123 etp16 16 100000 rs +Ethernet120 120,121 etp16a 16 50000 none +Ethernet122 122,123 etp16b 16 50000 none Ethernet128 128,129 etp17a 17 50000 none Ethernet130 130,131 etp17b 17 50000 none Ethernet136 136,137 etp18a 18 50000 none Ethernet138 138,139 etp18b 18 50000 none Ethernet144 144,145 etp19a 19 50000 none Ethernet146 146,147 etp19b 19 50000 none -Ethernet152 152,153,154,155 etp20 20 100000 rs +Ethernet152 152,153 etp20a 20 50000 none +Ethernet154 154,155 etp20b 20 50000 none Ethernet160 160,161 etp21a 21 50000 none Ethernet162 162,163 etp21b 21 50000 none Ethernet168 168,169 etp22a 22 50000 none Ethernet170 170,171 etp22b 22 50000 none Ethernet176 176,177 etp23a 23 50000 none Ethernet178 178,179 etp23b 23 50000 none -Ethernet184 184,185,186,187 etp24 24 100000 rs +Ethernet184 184,185 etp24a 24 50000 none +Ethernet186 186,187 etp24b 24 50000 none Ethernet192 192,193,194,195 etp25 25 100000 rs Ethernet200 200,201,202,203 etp26 26 100000 rs Ethernet208 208,209 etp27a 27 50000 none Ethernet210 210,211 etp27b 27 50000 none -Ethernet216 216,217,218,219 etp28 28 100000 rs +Ethernet216 216,217 etp28a 28 50000 none +Ethernet218 218,219 etp28b 28 50000 none Ethernet224 224,225,226,227 etp29 29 100000 rs Ethernet232 232,233,234,235 etp30 30 100000 rs Ethernet240 240,241 etp31a 31 50000 none Ethernet242 242,243 etp31b 31 50000 none -Ethernet248 248,249,250,251 etp32 32 100000 rs +Ethernet248 248,249 etp32a 32 50000 none +Ethernet250 250,251 etp32b 32 50000 none Ethernet256 256,257,258,259 etp33 33 100000 rs Ethernet264 264,265,266,267 etp34 34 100000 rs Ethernet272 272,273 etp35a 35 50000 none Ethernet274 274,275 etp35b 35 50000 none -Ethernet280 280,281,282,283 etp36 36 100000 rs +Ethernet280 280,281 etp36a 36 50000 none +Ethernet282 282,283 etp36b 36 50000 none Ethernet288 288,289,290,291 etp37 37 100000 rs Ethernet296 296,297,298,299 etp38 38 100000 rs Ethernet304 304,305 etp39a 39 50000 none Ethernet306 306,307 etp39b 39 50000 none -Ethernet312 312,313,314,315 etp40 40 100000 rs +Ethernet312 312,313 etp40a 40 50000 none +Ethernet314 314,315 etp40b 40 50000 none Ethernet320 320,321 etp41a 41 50000 none Ethernet322 322,323 etp41b 41 50000 none Ethernet328 328,329 etp42a 42 50000 none Ethernet330 330,331 etp42b 42 50000 none Ethernet336 336,337 etp43a 43 50000 none Ethernet338 338,339 etp43b 43 50000 none -Ethernet344 344,345,346,347 etp44 44 100000 rs +Ethernet344 344,345 etp44a 44 50000 none +Ethernet346 346,347 etp44b 44 50000 none Ethernet352 352,353 etp45a 45 50000 none Ethernet354 354,355 etp45b 45 50000 none Ethernet360 360,361 etp46a 46 50000 none Ethernet362 362,363 etp46b 46 50000 none Ethernet368 368,369 etp47a 47 50000 none Ethernet370 370,371 etp47b 47 50000 none -Ethernet376 376,377,378,379 etp48 48 100000 rs +Ethernet376 376,377 etp48a 48 50000 none +Ethernet378 378,379 etp48b 48 50000 none Ethernet384 384,385 etp49a 49 50000 none Ethernet386 386,387 etp49b 49 50000 none Ethernet392 392,393 etp50a 50 50000 none Ethernet394 394,395 etp50b 50 50000 none Ethernet400 400,401 etp51a 51 50000 none Ethernet402 402,403 etp51b 51 50000 none -Ethernet408 408,409,410,411 etp52 52 100000 rs +Ethernet408 408,409 etp52a 52 50000 none +Ethernet410 410,411 etp52b 52 50000 none Ethernet416 416,417 etp53a 53 50000 none Ethernet418 418,419 etp53b 53 50000 none Ethernet424 424,425 etp54a 54 50000 none Ethernet426 426,427 etp54b 54 50000 none Ethernet432 432,433 etp55a 55 50000 none Ethernet434 434,435 etp55b 55 50000 none -Ethernet440 440,441,442,443 etp56 56 100000 rs +Ethernet440 440,441 etp56a 56 50000 none +Ethernet442 442,443 etp56b 56 50000 none Ethernet448 448,449 etp57a 57 50000 none Ethernet450 450,451 etp57b 57 50000 none Ethernet456 456,457 etp58a 58 50000 none Ethernet458 458,459 etp58b 58 50000 none Ethernet464 464,465 etp59a 59 50000 none Ethernet466 466,467 etp59b 59 50000 none -Ethernet472 472,473,474,475 etp60 60 100000 rs +Ethernet472 472,473 etp60a 60 50000 none +Ethernet474 474,475 etp60b 60 50000 none Ethernet480 480,481 etp61a 61 50000 none Ethernet482 482,483 etp61b 61 50000 none Ethernet488 488,489 etp62a 62 50000 none Ethernet490 490,491 etp62b 62 50000 none Ethernet496 496,497 etp63a 63 50000 none Ethernet498 498,499 etp63b 63 50000 none -Ethernet504 504,505,506,507 etp64 64 100000 rs +Ethernet504 504,505 etp64a 64 50000 none +Ethernet506 506,507 etp64b 64 50000 none diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml index 199c251fbee2..2016d0bdf297 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml @@ -43,10 +43,11 @@ 111 + 2 4 3 3 - 1536 + 384 97 @@ -74,10 +75,11 @@ 103 + 2 4 7 3 - 1536 + 384 121 @@ -105,10 +107,11 @@ 127 + 2 4 11 3 - 1536 + 384 113 @@ -136,10 +139,11 @@ 119 + 2 4 15 3 - 1536 + 384 89 @@ -167,10 +171,11 @@ 95 + 2 4 19 3 - 1536 + 384 81 @@ -198,10 +203,11 @@ 87 + 2 4 23 3 - 1536 + 384 73 @@ -227,10 +233,11 @@ 79 + 2 4 27 3 - 1536 + 384 65 @@ -256,10 +263,11 @@ 71 + 2 4 31 3 - 1536 + 384 5 @@ -285,10 +293,11 @@ 3 + 2 4 35 3 - 1536 + 384 13 @@ -314,10 +323,11 @@ 11 + 2 4 39 3 - 1536 + 384 21 @@ -345,10 +355,11 @@ 19 + 2 4 43 3 - 1536 + 384 29 @@ -376,10 +387,11 @@ 27 + 2 4 47 3 - 1536 + 384 53 @@ -407,10 +419,11 @@ 51 + 2 4 51 3 - 1536 + 384 61 @@ -438,10 +451,11 @@ 59 + 2 4 55 3 - 1536 + 384 37 @@ -469,10 +483,11 @@ 35 + 2 4 59 3 - 1536 + 384 45 @@ -500,10 +515,11 @@ 43 + 2 4 63 3 - 1536 + 384 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml index dcfdf1c9a59c..d110ef7c79cb 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml @@ -71,37 +71,37 @@ name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)' - bus: '00' - dev: 1c + dev: '1c' fn: '0' id: 8c10 name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)' - bus: '00' - dev: 1c + dev: '1c' fn: '7' id: 8c1e name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #8 (rev d5)' - bus: '00' - dev: 1d + dev: '1d' fn: '0' id: 8c26 name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)' - bus: '00' - dev: 1f + dev: '1f' fn: '0' id: 8c54 name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard SKU LPC Controller (rev 05)' - bus: '00' - dev: 1f + dev: '1f' fn: '2' id: 8c02 name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)' - bus: '00' - dev: 1f + dev: '1f' fn: '3' id: 8c22 name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller @@ -130,289 +130,289 @@ id: 6f53 name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology Register DMA Channel 3' -- bus: '06' +- bus: '07' dev: '00' fn: '0' id: cf70 name: 'Ethernet controller: Mellanox Technologies Device cf70' -- bus: 08 +- bus: '09' dev: '00' fn: '0' - id: '1533' + id: 1533 name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)' -- bus: ff - dev: 0b +- bus: 'ff' + dev: '0b' fn: '0' id: 6f81 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R3 QPI Link 0/1 (rev 03)' -- bus: ff - dev: 0b +- bus: 'ff' + dev: '0b' fn: '1' id: 6f36 name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R3 QPI Link 0/1 (rev 03)' -- bus: ff - dev: 0b +- bus: 'ff' + dev: '0b' fn: '2' id: 6f37 name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R3 QPI Link 0/1 (rev 03)' -- bus: ff - dev: 0b +- bus: 'ff' + dev: '0b' fn: '3' id: 6f76 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R3 QPI Link Debug (rev 03)' -- bus: ff - dev: 0c +- bus: 'ff' + dev: '0c' fn: '0' id: 6fe0 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0c +- bus: 'ff' + dev: '0c' fn: '1' id: 6fe1 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0c +- bus: 'ff' + dev: '0c' fn: '2' id: 6fe2 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0c +- bus: 'ff' + dev: '0c' fn: '3' id: 6fe3 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0f +- bus: 'ff' + dev: '0f' fn: '0' id: 6ff8 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0f +- bus: 'ff' + dev: '0f' fn: '4' id: 6ffc name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0f +- bus: 'ff' + dev: '0f' fn: '5' id: 6ffd name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff - dev: 0f +- bus: 'ff' + dev: '0f' fn: '6' id: 6ffe name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Caching Agent (rev 03)' -- bus: ff +- bus: 'ff' dev: '10' fn: '0' id: 6f1d name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R2PCIe Agent (rev 03)' -- bus: ff +- bus: 'ff' dev: '10' fn: '1' id: 6f34 name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D R2PCIe Agent (rev 03)' -- bus: ff +- bus: 'ff' dev: '10' fn: '5' id: 6f1e name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Ubox (rev 03)' -- bus: ff +- bus: 'ff' dev: '10' fn: '6' id: 6f7d name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Ubox (rev 03)' -- bus: ff +- bus: 'ff' dev: '10' fn: '7' id: 6f1f name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Ubox (rev 03)' -- bus: ff +- bus: 'ff' dev: '12' fn: '0' id: 6fa0 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Home Agent 0 (rev 03)' -- bus: ff +- bus: 'ff' dev: '12' fn: '1' id: 6f30 name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Home Agent 0 (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '0' id: 6fa8 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '1' id: 6f71 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '2' id: 6faa name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '3' id: 6fab name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '4' id: 6fac name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '5' id: 6fad name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel Target Address Decoder (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '6' id: 6fae name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Channel 0/1 Broadcast (rev 03)' -- bus: ff +- bus: 'ff' dev: '13' fn: '7' id: 6faf name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Global Broadcast (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '0' id: 6fb0 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '1' id: 6fb1 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '2' id: 6fb2 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 0 Error (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '3' id: 6fb3 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 1 Error (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '4' id: 6fbc name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Channel 0/1 Interface (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '5' id: 6fbd name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Channel 0/1 Interface (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '6' id: 6fbe name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Channel 0/1 Interface (rev 03)' -- bus: ff +- bus: 'ff' dev: '14' fn: '7' id: 6fbf name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DDRIO Channel 0/1 Interface (rev 03)' -- bus: ff +- bus: 'ff' dev: '15' fn: '0' id: 6fb4 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' -- bus: ff +- bus: 'ff' dev: '15' fn: '1' id: 6fb5 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' -- bus: ff +- bus: 'ff' dev: '15' fn: '2' id: 6fb6 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 2 Error (rev 03)' -- bus: ff +- bus: 'ff' dev: '15' fn: '3' id: 6fb7 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Memory Controller 0 - Channel 3 Error (rev 03)' -- bus: ff - dev: 1e +- bus: 'ff' + dev: '1e' fn: '0' id: 6f98 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1e +- bus: 'ff' + dev: '1e' fn: '1' id: 6f99 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1e +- bus: 'ff' + dev: '1e' fn: '2' id: 6f9a name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1e +- bus: 'ff' + dev: '1e' fn: '3' id: 6fc0 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1e +- bus: 'ff' + dev: '1e' fn: '4' id: 6f9c name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1f +- bus: 'ff' + dev: '1f' fn: '0' id: 6f88 name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Power Control Unit (rev 03)' -- bus: ff - dev: 1f +- bus: 'ff' + dev: '1f' fn: '2' id: 6f8a name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json index 7f9b9202b9b2..adf8e27478aa 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json @@ -2,387 +2,515 @@ "interfaces": { "Ethernet0": { "index": "1,1,1,1", - "lanes": "0,1,2,3", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "lanes": "0,1,2,3", + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp1"], + "2x50G[40G,25G,10G,1G]": ["etp1a", "etp1b"] + } }, "Ethernet8": { "index": "2,2,2,2", - "lanes": "8,9,10,11", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "lanes": "8,9,10,11", + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp2"], + "2x50G[40G,25G,10G,1G]": ["etp2a", "etp2b"] + } }, "Ethernet16": { "index": "3,3,3,3", "lanes": "16,17,18,19", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp3"], + "2x50G[40G,25G,10G,1G]": ["etp3a", "etp3b"] + } }, "Ethernet24": { "index": "4,4,4,4", "lanes": "24,25,26,27", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp4"], + "2x50G[40G,25G,10G,1G]": ["etp4a", "etp4b"] + } }, "Ethernet32": { "index": "5,5,5,5", "lanes": "32,33,34,35", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp5"], + "2x50G[40G,25G,10G,1G]": ["etp5a", "etp5b"] + } }, "Ethernet40": { "index": "6,6,6,6", "lanes": "40,41,42,43", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp6"], + "2x50G[40G,25G,10G,1G]": ["etp6a", "etp6b"] + } }, "Ethernet48": { "index": "7,7,7,7", "lanes": "48,49,50,51", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp7"], + "2x50G[40G,25G,10G,1G]": ["etp7a", "etp7b"] + } }, "Ethernet56": { "index": "8,8,8,8", "lanes": "56,57,58,59", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp8"], + "2x50G[40G,25G,10G,1G]": ["etp8a", "etp8b"] + } }, "Ethernet64": { "index": "9,9,9,9", "lanes": "64,65,66,67", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp9"], + "2x50G[40G,25G,10G,1G]": ["etp9a", "etp9b"] + } }, "Ethernet72": { "index": "10,10,10,10", - "lanes": "72,73,74,75", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "lanes": "72,73,74,75", + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp10"], + "2x50G[40G,25G,10G,1G]": ["etp10a", "etp10b"] + } }, "Ethernet80": { "index": "11,11,11,11", "lanes": "80,81,82,83", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp11"], + "2x50G[40G,25G,10G,1G]": ["etp11a", "etp11b"] + } }, "Ethernet88": { "index": "12,12,12,12", "lanes": "88,89,90,91", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" - }, + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp12"], + "2x50G[40G,25G,10G,1G]": ["etp12a", "etp12b"] + } + }, "Ethernet96": { "index": "13,13,13,13", "lanes": "96,97,98,99", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp13"], + "2x50G[40G,25G,10G,1G]": ["etp13a", "etp13b"] + } }, "Ethernet104": { "index": "14,14,14,14", "lanes": "104,105,106,107", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp14"], + "2x50G[40G,25G,10G,1G]": ["etp14a", "etp14b"] + } }, "Ethernet112": { "index": "15,15,15,15", "lanes": "112,113,114,115", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp15"], + "2x50G[40G,25G,10G,1G]": ["etp15a", "etp15b"] + } }, "Ethernet120": { "index": "16,16,16,16", "lanes": "120,121,122,123", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp16"], + "2x50G[40G,25G,10G,1G]": ["etp16a", "etp16b"] + } }, "Ethernet128": { "index": "17,17,17,17", "lanes": "128,129,130,131", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp17"], + "2x50G[40G,25G,10G,1G]": ["etp17a", "etp17b"] + } }, "Ethernet136": { "index": "18,18,18,18", "lanes": "136,137,138,139", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp18"], + "2x50G[40G,25G,10G,1G]": ["etp18a", "etp18b"] + } }, "Ethernet144": { "index": "19,19,19,19", "lanes": "144,145,146,147", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp19"], + "2x50G[40G,25G,10G,1G]": ["etp19a", "etp19b"] + } }, "Ethernet152": { "index": "20,20,20,20", "lanes": "152,153,154,155", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp20"], + "2x50G[40G,25G,10G,1G]": ["etp20a", "etp20b"] + } }, "Ethernet160": { "index": "21,21,21,21", "lanes": "160,161,162,163", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp21"], + "2x50G[40G,25G,10G,1G]": ["etp21a", "etp21b"] + } }, "Ethernet168": { "index": "22,22,22,22", "lanes": "168,169,170,171", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp22"], + "2x50G[40G,25G,10G,1G]": ["etp22a", "etp22b"] + } }, "Ethernet176": { "index": "23,23,23,23", "lanes": "176,177,178,179", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp23"], + "2x50G[40G,25G,10G,1G]": ["etp23a", "etp23b"] + } }, "Ethernet184": { "index": "24,24,24,24", "lanes": "184,185,186,187", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp24"], + "2x50G[40G,25G,10G,1G]": ["etp24a", "etp24b"] + } }, "Ethernet192": { "index": "25,25,25,25", "lanes": "192,193,194,195", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp25"], + "2x50G[40G,25G,10G,1G]": ["etp25a", "etp25b"] + } }, "Ethernet200": { "index": "26,26,26,26", "lanes": "200,201,202,203", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp26"], + "2x50G[40G,25G,10G,1G]": ["etp26a", "etp26b"] + } }, "Ethernet208": { "index": "27,27,27,27", "lanes": "208,209,210,211", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp27"], + "2x50G[40G,25G,10G,1G]": ["etp27a", "etp27b"] + } }, "Ethernet216": { "index": "28,28,28,28", "lanes": "216,217,218,219", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp28"], + "2x50G[40G,25G,10G,1G]": ["etp28a", "etp28b"] + } }, "Ethernet224": { "index": "29,29,29,29", "lanes": "224,225,226,227", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp29"], + "2x50G[40G,25G,10G,1G]": ["etp29a", "etp29b"] + } }, "Ethernet232": { "index": "30,30,30,30", "lanes": "232,233,234,235", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp30"], + "2x50G[40G,25G,10G,1G]": ["etp30a", "etp30b"] + } }, "Ethernet240": { "index": "31,31,31,31", "lanes": "240,241,242,243", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp31"], + "2x50G[40G,25G,10G,1G]": ["etp31a", "etp31b"] + } }, "Ethernet248": { "index": "32,32,32,32", "lanes": "248,249,250,251", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp32"], + "2x50G[40G,25G,10G,1G]": ["etp32a", "etp32b"] + } }, "Ethernet256": { "index": "33,33,33,33", "lanes": "256,257,258,259", - "alias_at_lanes": "etp33a, etp33b, etp33c, etp33d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp33"], + "2x50G[40G,25G,10G,1G]": ["etp33a", "etp33b"] + } }, "Ethernet264": { "index": "34,34,34,34", "lanes": "264,265,266,267", - "alias_at_lanes": "etp34a, etp34b, etp34c, etp34d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp34"], + "2x50G[40G,25G,10G,1G]": ["etp34a", "etp34b"] + } }, "Ethernet272": { "index": "35,35,35,35", "lanes": "272,273,274,275", - "alias_at_lanes": "etp35a, etp35b, etp35c, etp35d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp35"], + "2x50G[40G,25G,10G,1G]": ["etp35a", "etp35b"] + } }, "Ethernet280": { "index": "36,36,36,36", "lanes": "280,281,282,283", - "alias_at_lanes": "etp36a, etp36b, etp36c, etp36d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp36"], + "2x50G[40G,25G,10G,1G]": ["etp36a", "etp36b"] + } }, "Ethernet288": { "index": "37,37,37,37", "lanes": "288,289,290,291", - "alias_at_lanes": "etp37a, etp37b, etp37c, etp37d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp37"], + "2x50G[40G,25G,10G,1G]": ["etp37a", "etp37b"] + } }, "Ethernet296": { "index": "38,38,38,38", "lanes": "296,297,298,299", - "alias_at_lanes": "etp38a, etp38b, etp38c, etp38d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp38"], + "2x50G[40G,25G,10G,1G]": ["etp38a", "etp38b"] + } }, "Ethernet304": { "index": "39,39,39,39", "lanes": "304,305,306,307", - "alias_at_lanes": "etp39a, etp39b, etp39c, etp39d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp39"], + "2x50G[40G,25G,10G,1G]": ["etp39a", "etp39b"] + } }, "Ethernet312": { "index": "40,40,40,40", "lanes": "312,313,314,315", - "alias_at_lanes": "etp40a, etp40b, etp40c, etp40d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp40"], + "2x50G[40G,25G,10G,1G]": ["etp40a", "etp40b"] + } }, "Ethernet320": { "index": "41,41,41,41", "lanes": "320,321,322,323", - "alias_at_lanes": "etp41a, etp41b, etp41c, etp41d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp41"], + "2x50G[40G,25G,10G,1G]": ["etp42a", "etp42b"] + } }, "Ethernet328": { "index": "42,42,42,42", "lanes": "328,329,330,331", - "alias_at_lanes": "etp42a, etp42b, etp42c, etp42d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp42"], + "2x50G[40G,25G,10G,1G]": ["etp42a", "etp42b"] + } }, "Ethernet336": { "index": "43,43,43,43", "lanes": "336,337,338,339", - "alias_at_lanes": "etp43a, etp43b, etp43c, etp43d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp43"], + "2x50G[40G,25G,10G,1G]": ["etp43a", "etp43b"] + } }, "Ethernet344": { "index": "44,44,44,44", "lanes": "344,345,346,347", - "alias_at_lanes": "etp44a, etp44b, etp44c, etp44d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp44"], + "2x50G[40G,25G,10G,1G]": ["etp44a", "etp44b"] + } }, "Ethernet352": { "index": "45,45,45,45", "lanes": "352,353,354,355", - "alias_at_lanes": "etp45a, etp45b, etp45c, etp45d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp45"], + "2x50G[40G,25G,10G,1G]": ["etp45a", "etp45b"] + } }, "Ethernet360": { "index": "46,46,46,46", "lanes": "360,361,362,363", - "alias_at_lanes": "etp46a, etp46b, etp46c, etp46d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp46"], + "2x50G[40G,25G,10G,1G]": ["etp46a", "etp46b"] + } }, "Ethernet368": { "index": "47,47,47,47", "lanes": "368,369,370,371", - "alias_at_lanes": "etp47a, etp47b, etp47c, etp47d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp47"], + "2x50G[40G,25G,10G,1G]": ["etp47a", "etp47b"] + } }, "Ethernet376": { "index": "48,48,48,48", "lanes": "376,377,378,379", - "alias_at_lanes": "etp48a, etp48b, etp48c, etp48d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp48"], + "2x50G[40G,25G,10G,1G]": ["etp48a", "etp48b"] + } }, "Ethernet384": { "index": "49,49,49,49", "lanes": "384,385,386,387", - "alias_at_lanes": "etp49a, etp49b, etp49c, etp49d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp49"], + "2x50G[40G,25G,10G,1G]": ["etp49a", "etp49b"] + } }, "Ethernet392": { "index": "50,50,50,50", "lanes": "392,393,394,395", - "alias_at_lanes": "etp50a, etp50b, etp50c, etp50d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp50"], + "2x50G[40G,25G,10G,1G]": ["etp50a", "etp50b"] + } }, "Ethernet400": { "index": "51,51,51,51", "lanes": "400,401,402,403", - "alias_at_lanes": "etp51a, etp51b, etp51c, etp51d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp51"], + "2x50G[40G,25G,10G,1G]": ["etp51a", "etp51b"] + } }, "Ethernet408": { "index": "52,52,52,52", "lanes": "408,409,410,411", - "alias_at_lanes": "etp52a, etp52b, etp52c, etp52d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp52"], + "2x50G[40G,25G,10G,1G]": ["etp52a", "etp52b"] + } }, "Ethernet416": { "index": "53,53,53,53", "lanes": "416,417,418,419", - "alias_at_lanes": "etp53a, etp53b, etp53c, etp53d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp53"], + "2x50G[40G,25G,10G,1G]": ["etp53a", "etp53b"] + } }, "Ethernet424": { "index": "54,54,54,54", "lanes": "424,425,426,427", - "alias_at_lanes": "etp54a, etp54b, etp54c, etp54d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp54"], + "2x50G[40G,25G,10G,1G]": ["etp54a", "etp54b"] + } }, "Ethernet432": { "index": "55,55,55,55", "lanes": "432,433,434,435", - "alias_at_lanes": "etp55a, etp55b, etp55c, etp55d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp55"], + "2x50G[40G,25G,10G,1G]": ["etp55a", "etp55b"] + } }, "Ethernet440": { "index": "56,56,56,56", "lanes": "440,441,442,443", - "alias_at_lanes": "etp56a, etp56b, etp56c, etp56d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp56"], + "2x50G[40G,25G,10G,1G]": ["etp56a", "etp56b"] + } }, "Ethernet448": { "index": "57,57,57,57", "lanes": "448,449,450,451", - "alias_at_lanes": "etp57a, etp57b, etp57c, etp57d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp57"], + "2x50G[40G,25G,10G,1G]": ["etp57a", "etp57b"] + } }, "Ethernet456": { "index": "58,58,58,58", "lanes": "456,457,458,459", - "alias_at_lanes": "etp58a, etp58b, etp58c, etp58d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp58"], + "2x50G[40G,25G,10G,1G]": ["etp58a", "etp58b"] + } }, "Ethernet464": { "index": "59,59,59,59", "lanes": "464,465,466,467", - "alias_at_lanes": "etp59a, etp59b, etp59c, etp59d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp59"], + "2x50G[40G,25G,10G,1G]": ["etp59a", "etp59b"] + } }, "Ethernet472": { "index": "60,60,60,60", "lanes": "472,473,474,475", - "alias_at_lanes": "etp60a, etp60b, etp60c, etp60d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp60"], + "2x50G[40G,25G,10G,1G]": ["etp60a", "etp60b"] + } }, "Ethernet480": { "index": "61,61,61,61", "lanes": "480,481,482,483", - "alias_at_lanes": "etp61a, etp61b, etp61c, etp61d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp61"], + "2x50G[40G,25G,10G,1G]": ["etp61a", "etp61b"] + } }, "Ethernet488": { "index": "62,62,62,62", "lanes": "488,489,490,491", - "alias_at_lanes": "etp62a, etp62b, etp62c, etp62d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp62"], + "2x50G[40G,25G,10G,1G]": ["etp62a", "etp62b"] + } }, "Ethernet496": { "index": "63,63,63,63", "lanes": "496,497,498,499", - "alias_at_lanes": "etp63a, etp63b, etp63c, etp63d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp63"], + "2x50G[40G,25G,10G,1G]": ["etp63a", "etp63b"] + } }, "Ethernet504": { "index": "64,64,64,64", "lanes": "504,505,506,507", - "alias_at_lanes": "etp64a, etp64b, etp64c, etp64d", - "breakout_modes": "1x100G[50G,40G,25G,10G,1G],2x50G[40G,25G,10G,1G]" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["etp64"], + "2x50G[40G,25G,10G,1G]": ["etp64a", "etp64b"] + } } } -} \ No newline at end of file +} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json index 750fc49f6e33..5822631ab016 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json @@ -2,195 +2,291 @@ "interfaces": { "Ethernet0": { "index": "1,1,1,1,1,1,1,1", - "lanes": "0,1,2,3,4,5,6,7", - "alias_at_lanes": "etp1a, etp1b, etp1c, etp1d, etp1e, etp1f, etp1g, etp1h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "lanes": "0,1,2,3,4,5,6,7", + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp1"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp1a", "etp1b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } }, "Ethernet8": { "index": "2,2,2,2,2,2,2,2", "lanes": "8,9,10,11,12,13,14,15", - "alias_at_lanes": "etp2a, etp2b, etp2c, etp2d, etp2e, etp2f, etp2g, etp2h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp2"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp2a", "etp2b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + } }, "Ethernet16": { "index": "3,3,3,3,3,3,3,3", "lanes": "16,17,18,19,20,21,22,23", - "alias_at_lanes": "etp3a, etp3b, etp3c, etp3d, etp3e, etp3f, etp3g, etp3h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp3"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp3a", "etp3b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + } }, "Ethernet24": { "index": "4,4,4,4,4,4,4,4", "lanes": "24,25,26,27,28,29,30,31", - "alias_at_lanes": "etp4a, etp4b, etp4c, etp4d, etp4e, etp4f, etp4g, etp4h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp4"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp4a", "etp4b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + } }, "Ethernet32": { "index": "5,5,5,5,5,5,5,5", "lanes": "32,33,34,35,36,37,38,39", - "alias_at_lanes": "etp5a, etp5b, etp5c, etp5d, etp5e, etp5f, etp5g, etp5h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp5"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp5a", "etp5b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + } }, "Ethernet40": { "index": "6,6,6,6,6,6,6,6", "lanes": "40,41,42,43,44,45,46,47", - "alias_at_lanes": "etp6a, etp6b, etp6c, etp6d, etp6e, etp6f, etp6g, etp6h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp6"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp6a", "etp6b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + } }, "Ethernet48": { "index": "7,7,7,7,7,7,7,7", "lanes": "48,49,50,51,52,53,54,55", - "alias_at_lanes": "etp7a, etp7b, etp7c, etp7d, etp7e, etp7f, etp7g, etp7h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp7"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp7a", "etp7b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + } }, "Ethernet56": { "index": "8,8,8,8,8,8,8,8", "lanes": "56,57,58,59,60,61,62,63", - "alias_at_lanes": "etp8a, etp8b, etp8c, etp8d, etp8e, etp8f, etp8g, etp8h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp8"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp8a", "etp8b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + } }, "Ethernet64": { "index": "9,9,9,9,9,9,9,9", "lanes": "64,65,66,67,68,69,70,71", - "alias_at_lanes": "etp9a, etp9b, etp9c, etp9d, etp9e, etp9f, etp9g, etp9h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp9"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp9a", "etp9b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + } }, "Ethernet72": { "index": "10,10,10,10,10,10,10,10", "lanes": "72,73,74,75,76,77,78,79", - "alias_at_lanes": "etp10a, etp10b, etp10c, etp10d, etp10e, etp10f, etp10g, etp10h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp10"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp10a", "etp10b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + } }, "Ethernet80": { "index": "11,11,11,11,11,11,11,11", "lanes": "80,81,82,83,84,85,86,87", - "alias_at_lanes": "etp11a, etp11b, etp11c, etp11d, etp11e, etp11f, etp11g, etp11h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp11"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp11a", "etp11b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + } }, "Ethernet88": { "index": "12,12,12,12,12,12,12,12", "lanes": "88,89,90,91,92,93,94,95", - "alias_at_lanes": "etp12a, etp12b, etp12c, etp12d, etp12e, etp12f, etp12g, etp12h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp12"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp12a", "etp12b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + } }, "Ethernet96": { "index": "13,13,13,13,13,13,13,13", "lanes": "96,97,98,99,100,101,102,103", - "alias_at_lanes": "etp13a, etp13b, etp13c, etp13d, etp13e, etp13f, etp13g, etp13h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp13"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp13a", "etp13b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + } }, "Ethernet104": { "index": "14,14,14,14,14,14,14,14", "lanes": "104,105,106,107,108,109,110,111", - "alias_at_lanes": "etp14a, etp14b, etp14c, etp14d, etp14e, etp14f, etp14g, etp14h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp14"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp14a", "etp14b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + } }, "Ethernet112": { "index": "15,15,15,15,15,15,15,15", "lanes": "112,113,114,115,116,117,118,119", - "alias_at_lanes": "etp15a, etp15b, etp15c, etp15d, etp15e, etp15f, etp15g, etp15h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp15"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp15a", "etp15b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + } }, "Ethernet120": { "index": "16,16,16,16,16,16,16,16", "lanes": "120,121,122,123,124,125,126,127", - "alias_at_lanes": "etp16a, etp16b, etp16c, etp16d, etp16e, etp16f, etp16g, etp16h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp16"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp16a", "etp16b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + } }, "Ethernet128": { "index": "17,17,17,17,17,17,17,17", "lanes": "128,129,130,131,132,133,134,135", - "alias_at_lanes": "etp17a, etp17b, etp17c, etp17d, etp17e, etp17f, etp17g, etp17h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp17"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp17a", "etp17b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + } }, "Ethernet136": { "index": "18,18,18,18,18,18,18,18", "lanes": "136,137,138,139,140,141,142,143", - "alias_at_lanes": "etp18a, etp18b, etp18c, etp18d, etp18e, etp18f, etp18g, etp18h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp18"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp18a", "etp18b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + } }, "Ethernet144": { "index": "19,19,19,19,19,19,19,19", "lanes": "144,145,146,147,148,149,150,151", - "alias_at_lanes": "etp19a, etp19b, etp19c, etp19d, etp19e, etp19f, etp19g, etp19h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp19"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp19a", "etp19b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + } }, "Ethernet152": { "index": "20,20,20,20,20,20,20,20", "lanes": "152,153,154,155,156,157,158,159", - "alias_at_lanes": "etp20a, etp20b, etp20c, etp20d, etp20e, etp20f, etp20g, etp20h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp20"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp20a", "etp20b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + } }, "Ethernet160": { "index": "21,21,21,21,21,21,21,21", "lanes": "160,161,162,163,164,165,166,167", - "alias_at_lanes": "etp21a, etp21b, etp21c, etp21d, etp21e, etp21f, etp21g, etp21h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp21"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp21a", "etp21b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + } }, "Ethernet168": { "index": "22,22,22,22,22,22,22,22", "lanes": "168,169,170,171,172,173,174,175", - "alias_at_lanes": "etp22a, etp22b, etp22c, etp22d, etp22e, etp22f, etp22g, etp22h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp22"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp22a", "etp22b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + } }, "Ethernet176": { "index": "23,23,23,23,23,23,23,23", "lanes": "176,177,178,179,180,181,182,183", - "alias_at_lanes": "etp23a, etp23b, etp23c, etp23d, etp23e, etp23f, etp23g, etp23h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp23"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp23a", "etp23b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + } }, "Ethernet184": { "index": "24,24,24,24,24,24,24,24", "lanes": "184,185,186,187,188,189,190,191", - "alias_at_lanes": "etp24a, etp24b, etp24c, etp24d, etp24e, etp24f, etp24g, etp24h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp24"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp24a", "etp24b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + } }, "Ethernet192": { "index": "25,25,25,25,25,25,25,25", "lanes": "192,193,194,195,196,197,198,199", - "alias_at_lanes": "etp25a, etp25b, etp25c, etp25d, etp25e, etp25f, etp25g, etp25h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp25"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp25a", "etp25b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + } }, "Ethernet200": { "index": "26,26,26,26,26,26,26,26", "lanes": "200,201,202,203,204,205,206,207", - "alias_at_lanes": "etp26a, etp26b, etp26c, etp26d, etp26e, etp26f, etp26g, etp26h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp26"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp26a", "etp26b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + } }, "Ethernet208": { "index": "27,27,27,27,27,27,27,27", "lanes": "208,209,210,211,212,213,214,215", - "alias_at_lanes": "etp27a, etp27b, etp27c, etp27d, etp27e, etp27f, etp27g, etp27h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp27"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp27a", "etp27b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + } }, "Ethernet216": { "index": "28,28,28,28,28,28,28,28", "lanes": "216,217,218,219,220,221,222,223", - "alias_at_lanes": "etp28a, etp28b, etp28c, etp28d, etp28e, etp28f, etp28g, etp28h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp28"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp28a", "etp28b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + } }, "Ethernet224": { "index": "29,29,29,29,29,29,29,29", "lanes": "224,225,226,227,228,229,230,231", - "alias_at_lanes": "etp29a, etp29b, etp29c, etp29d, etp29e, etp29f, etp29g, etp29h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp29"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp29a", "etp29b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + } }, "Ethernet232": { "index": "30,30,30,30,30,30,30,30", "lanes": "232,233,234,235,236,237,238,239", - "alias_at_lanes": "etp30a, etp30b, etp30c, etp30d, etp30e, etp30f, etp30g, etp30h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp30"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp30a", "etp30b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + } }, "Ethernet240": { "index": "31,31,31,31,31,31,31,31", "lanes": "240,241,242,243,244,245,246,247", - "alias_at_lanes": "etp31a, etp31b, etp31c, etp31d, etp31e, etp31f, etp31g, etp31h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp31"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp31a", "etp31b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + } }, "Ethernet248": { "index": "32,32,32,32,32,32,32,32", "lanes": "248,249,250,251,252,253,254,255", - "alias_at_lanes": "etp32a, etp32b, etp32c, etp32d, etp32e, etp32f, etp32g, etp32h", - "breakout_modes": "1x400G[200G,100G,50G,40G,25G,10G,1G],2x200G[100G,50G,40G,25G,10G,1G],4x100G[50G,40G,25G,10G,1G]" + "breakout_modes": { + "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp32"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp32a", "etp32b"], + "4x100G[50G,40G,25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + } } } -} \ No newline at end of file +} diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml b/device/nokia/armhf-nokia_ixs7215_52x-r0/pcie.yaml similarity index 100% rename from device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml rename to device/nokia/armhf-nokia_ixs7215_52x-r0/pcie.yaml diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_reboot b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_reboot new file mode 100644 index 000000000000..83fc5d8028f2 --- /dev/null +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_reboot @@ -0,0 +1,11 @@ +#!/bin/bash + +function SafePwrCycle() { + sync ; sync + umount -fa > /dev/null 2&>1 + + # Write CPLD register to initiate cold reboot + sudo i2cset -f -y 0 0x41 0x10 0x00 +} + +SafePwrCycle diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/port_config.ini b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/port_config.ini new file mode 100755 index 000000000000..823f53160c33 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed admin_status +Ethernet1 1 twentyfiveGigE0/1 0 25000 up +Ethernet2 2 twentyfiveGigE0/2 1 25000 up +Ethernet3 3 twentyfiveGigE0/3 2 25000 up +Ethernet4 4 twentyfiveGigE0/4 3 25000 up +Ethernet5 5 twentyfiveGigE0/5 4 25000 up +Ethernet6 6 twentyfiveGigE0/6 5 25000 up +Ethernet7 7 twentyfiveGigE0/7 6 25000 up +Ethernet8 8 twentyfiveGigE0/8 7 25000 up +Ethernet9 13 twentyfiveGigE0/9 8 25000 up +Ethernet10 14 twentyfiveGigE0/10 9 25000 up +Ethernet11 15 twentyfiveGigE0/11 10 25000 up +Ethernet12 16 twentyfiveGigE0/12 11 25000 up +Ethernet13 21 twentyfiveGigE0/13 12 25000 up +Ethernet14 22 twentyfiveGigE0/14 13 25000 up +Ethernet15 23 twentyfiveGigE0/15 14 25000 up +Ethernet16 24 twentyfiveGigE0/16 15 25000 up +Ethernet17 29 twentyfiveGigE0/17 16 25000 up +Ethernet18 30 twentyfiveGigE0/18 17 25000 up +Ethernet19 31 twentyfiveGigE0/19 18 25000 up +Ethernet20 32 twentyfiveGigE0/20 19 25000 up +Ethernet21 33 twentyfiveGigE0/21 20 25000 up +Ethernet22 34 twentyfiveGigE0/22 21 25000 up +Ethernet23 35 twentyfiveGigE0/23 22 25000 up +Ethernet24 36 twentyfiveGigE0/24 23 25000 up +Ethernet25 41 twentyfiveGigE0/25 24 25000 up +Ethernet26 42 twentyfiveGigE0/26 25 25000 up +Ethernet27 43 twentyfiveGigE0/27 26 25000 up +Ethernet28 44 twentyfiveGigE0/28 27 25000 up +Ethernet29 49 twentyfiveGigE0/29 28 25000 up +Ethernet30 50 twentyfiveGigE0/30 29 25000 up +Ethernet31 51 twentyfiveGigE0/31 30 25000 up +Ethernet32 52 twentyfiveGigE0/32 31 25000 up +Ethernet33 57 twentyfiveGigE0/33 32 25000 up +Ethernet34 58 twentyfiveGigE0/34 33 25000 up +Ethernet35 59 twentyfiveGigE0/35 34 25000 up +Ethernet36 60 twentyfiveGigE0/36 35 25000 up +Ethernet37 61 twentyfiveGigE0/37 36 25000 up +Ethernet38 62 twentyfiveGigE0/38 37 25000 up +Ethernet39 63 twentyfiveGigE0/39 38 25000 up +Ethernet40 64 twentyfiveGigE0/40 39 25000 up +Ethernet41 65 twentyfiveGigE0/41 40 25000 up +Ethernet42 66 twentyfiveGigE0/42 41 25000 up +Ethernet43 67 twentyfiveGigE0/43 42 25000 up +Ethernet44 68 twentyfiveGigE0/44 43 25000 up +Ethernet45 69 twentyfiveGigE0/45 44 25000 up +Ethernet46 70 twentyfiveGigE0/46 45 25000 up +Ethernet47 71 twentyfiveGigE0/47 46 25000 up +Ethernet48 72 twentyfiveGigE0/48 47 25000 up +Ethernet49 85,86,87,88 hundredGigE0/1 48 100000 up +Ethernet50 77,78,79,80 hundredGigE0/2 49 100000 up +Ethernet51 97,98,99,100 hundredGigE0/3 50 100000 up +Ethernet52 93,94,95,96 hundredGigE0/4 51 100000 up +Ethernet53 113,114,115,116 hundredGigE0/5 52 100000 up +Ethernet54 105,106,107,108 hundredGigE0/6 53 100000 up +Ethernet55 121,122,123,124 hundredGigE0/7 54 100000 up +Ethernet56 125,126,127,128 hundredGigE0/8 55 100000 up diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/sai.profile b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/sai.profile new file mode 100755 index 000000000000..042c8060d587 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm new file mode 100644 index 000000000000..69fd8c362987 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/B6510-48VS8CQ/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm @@ -0,0 +1,569 @@ +l2_mem_entries=32768 +l2xmsg_mode=0 +l3_max_ecmp_mode=1 +l3_mem_entries=49152 +l3_alpm_enable=0 +bcm_num_cos=8 +bcm_stat_interval=2000000 +cdma_timeout_usec=3000000 +core_clock_frequency=1525 +dpp_clock_ratio=2:3 +help_cli_enable=1 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +#lpm_scaling_enable=1 +max_vp_lags=0 +mem_cache_enable=0 +memlist_enable=1 +miim_intr_enable=0 +module_64ports=1 +oversubscribe_mode=1 +parity_enable=1 +pbmp_gport_stack.0=0x0000000000000000000000000000000000000000000000000000000000000000 +#pbmp_xport_xe.0=0x00000000000000000000000000000000888ffffffffffff9fffffffffffffffe +pbmp_xport_xe=0x488080808808087f9fe1e1e1fe1e1e1fe +phy_chain_rx_lane_map_physical{1.0}=0x1032 +phy_chain_tx_lane_map_physical{1.0}=0x0123 +phy_chain_rx_lane_map_physical{5.0}=0x1032 +phy_chain_tx_lane_map_physical{5.0}=0x0123 +phy_chain_rx_lane_map_physical{13.0}=0x1032 +phy_chain_tx_lane_map_physical{13.0}=0x0123 +phy_chain_rx_lane_map_physical{21.0}=0x1032 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_lane_map_physical{29.0}=0x1032 +phy_chain_tx_lane_map_physical{29.0}=0x0123 +phy_chain_rx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{33.0}=0x0123 +phy_chain_rx_lane_map_physical{41.0}=0x1032 +phy_chain_tx_lane_map_physical{41.0}=0x0123 +phy_chain_rx_lane_map_physical{49.0}=0x1032 +phy_chain_tx_lane_map_physical{49.0}=0x0123 +phy_chain_rx_lane_map_physical{57.0}=0x1032 +phy_chain_tx_lane_map_physical{57.0}=0x0123 +phy_chain_rx_lane_map_physical{61.0}=0x1032 +phy_chain_tx_lane_map_physical{61.0}=0x0123 +phy_chain_rx_lane_map_physical{65.0}=0x2301 +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{69.0}=0x2301 +phy_chain_tx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{77.0}=0x1032 +phy_chain_tx_lane_map_physical{77.0}=0x3210 +phy_chain_rx_lane_map_physical{85.0}=0x1032 +phy_chain_tx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_lane_map_physical{93.0}=0x1032 +phy_chain_tx_lane_map_physical{93.0}=0x3210 +phy_chain_rx_lane_map_physical{97.0}=0x1032 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_rx_lane_map_physical{105.0}=0x1032 +phy_chain_tx_lane_map_physical{105.0}=0x3210 +phy_chain_rx_lane_map_physical{113.0}=0x1032 +phy_chain_tx_lane_map_physical{113.0}=0x3210 +phy_chain_rx_lane_map_physical{121.0}=0x2031 +phy_chain_tx_lane_map_physical{121.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x1032 +phy_chain_tx_lane_map_physical{125.0}=0x1203 +phy_chain_tx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x1 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x1 +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{116.0}=0x1 +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x0 +phy_chain_rx_polarity_flip_physical{127.0}=0x0 +phy_chain_tx_polarity_flip_physical{128.0}=0x0 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 +port_flex_enable=1 +portmap_1=1:25 +portmap_2=2:25 +portmap_3=3:25 +portmap_4=4:25 +portmap_5=5:25 +portmap_6=6:25 +portmap_7=7:25 +portmap_8=8:25 +portmap_13=13:25 +portmap_14=14:25 +portmap_15=15:25 +portmap_16=16:25 +portmap_21=21:25 +portmap_22=22:25 +portmap_23=23:25 +portmap_24=24:25 +portmap_29=29:25 +portmap_30=30:25 +portmap_31=31:25 +portmap_32=32:25 +portmap_33=33:25 +portmap_34=34:25 +portmap_35=35:25 +portmap_36=36:25 +portmap_41=41:25 +portmap_42=42:25 +portmap_43=43:25 +portmap_44=44:25 +portmap_49=49:25 +portmap_50=50:25 +portmap_51=51:25 +portmap_52=52:25 +portmap_57=57:25 +portmap_58=58:25 +portmap_59=59:25 +portmap_60=60:25 +portmap_61=61:25 +portmap_62=62:25 +portmap_63=63:25 +portmap_64=64:25 +portmap_67=65:25 +portmap_68=66:25 +portmap_69=67:25 +portmap_70=68:25 +portmap_71=69:25 +portmap_72=70:25 +portmap_73=71:25 +portmap_74=72:25 +portmap_79=77:100 +portmap_87=85:100 +portmap_95=93:100 +portmap_99=97:100 +portmap_107=105:100 +portmap_115=113:100 +portmap_123=121:100 +portmap_127=125:100 + +dport_map_port_1=1 +dport_map_port_2=2 +dport_map_port_3=3 +dport_map_port_4=4 +dport_map_port_5=5 +dport_map_port_6=6 +dport_map_port_7=7 +dport_map_port_8=8 +dport_map_port_13=9 +dport_map_port_14=10 +dport_map_port_15=11 +dport_map_port_16=12 +dport_map_port_21=13 +dport_map_port_22=14 +dport_map_port_23=15 +dport_map_port_24=16 +dport_map_port_29=17 +dport_map_port_30=18 +dport_map_port_31=19 +dport_map_port_32=20 +dport_map_port_33=21 +dport_map_port_34=22 +dport_map_port_35=23 +dport_map_port_36=24 +dport_map_port_41=25 +dport_map_port_42=26 +dport_map_port_43=27 +dport_map_port_44=28 +dport_map_port_49=29 +dport_map_port_50=30 +dport_map_port_51=31 +dport_map_port_52=32 +dport_map_port_57=33 +dport_map_port_58=34 +dport_map_port_59=35 +dport_map_port_60=36 +dport_map_port_61=37 +dport_map_port_62=38 +dport_map_port_63=39 +dport_map_port_64=40 +dport_map_port_67=41 +dport_map_port_68=42 +dport_map_port_69=43 +dport_map_port_70=44 +dport_map_port_71=45 +dport_map_port_72=46 +dport_map_port_73=47 +dport_map_port_74=48 +dport_map_port_87=49 +dport_map_port_79=50 +dport_map_port_99=51 +dport_map_port_95=52 +dport_map_port_115=53 +dport_map_port_107=54 +dport_map_port_123=55 +dport_map_port_127=56 + +serdes_preemphasis_lane0_1=0x0f480d +serdes_preemphasis_lane1_1=0x0f480d +serdes_preemphasis_lane2_1=0x0f480d +serdes_preemphasis_lane3_1=0x0f480d +serdes_preemphasis_lane0_2=0x0f480d +serdes_preemphasis_lane1_2=0x0f480d +serdes_preemphasis_lane2_2=0x0f480d +serdes_preemphasis_lane3_2=0x0f480d +serdes_preemphasis_lane0_3=0x0f480d +serdes_preemphasis_lane1_3=0x0f480d +serdes_preemphasis_lane2_3=0x0f480d +serdes_preemphasis_lane3_3=0x0f480d +serdes_preemphasis_lane0_4=0x0f480d +serdes_preemphasis_lane1_4=0x0f480d +serdes_preemphasis_lane2_4=0x0f480d +serdes_preemphasis_lane3_4=0x0f480d +serdes_preemphasis_lane0_5=0x0f480d +serdes_preemphasis_lane1_5=0x0f480d +serdes_preemphasis_lane2_5=0x0f480d +serdes_preemphasis_lane3_5=0x0f480d +serdes_preemphasis_lane0_6=0x0f480d +serdes_preemphasis_lane1_6=0x0f480d +serdes_preemphasis_lane2_6=0x0f480d +serdes_preemphasis_lane3_6=0x0f480d +serdes_preemphasis_lane0_7=0x0d4b0c +serdes_preemphasis_lane1_7=0x0d4b0c +serdes_preemphasis_lane2_7=0x0d4b0c +serdes_preemphasis_lane3_7=0x0d4b0c +serdes_preemphasis_lane0_8=0x0d4b0c +serdes_preemphasis_lane1_8=0x0d4b0c +serdes_preemphasis_lane2_8=0x0d4b0c +serdes_preemphasis_lane3_8=0x0d4b0c +serdes_preemphasis_lane0_13=0x0d4b0c +serdes_preemphasis_lane1_13=0x0d4b0c +serdes_preemphasis_lane2_13=0x0d4b0c +serdes_preemphasis_lane3_13=0x0d4b0c +serdes_preemphasis_lane0_14=0x0d4b0c +serdes_preemphasis_lane1_14=0x0d4b0c +serdes_preemphasis_lane2_14=0x0d4b0c +serdes_preemphasis_lane3_14=0x0d4b0c +serdes_preemphasis_lane0_15=0x0d4b0c +serdes_preemphasis_lane1_15=0x0d4b0c +serdes_preemphasis_lane2_15=0x0d4b0c +serdes_preemphasis_lane3_15=0x0d4b0c +serdes_preemphasis_lane0_16=0x0d4b0c +serdes_preemphasis_lane1_16=0x0d4b0c +serdes_preemphasis_lane2_16=0x0d4b0c +serdes_preemphasis_lane3_16=0x0d4b0c +serdes_preemphasis_lane0_21=0x0d4b0c +serdes_preemphasis_lane1_21=0x0d4b0c +serdes_preemphasis_lane2_21=0x0d4b0c +serdes_preemphasis_lane3_21=0x0d4b0c +serdes_preemphasis_lane0_22=0x0d4b0c +serdes_preemphasis_lane1_22=0x0d4b0c +serdes_preemphasis_lane2_22=0x0d4b0c +serdes_preemphasis_lane3_22=0x0d4b0c +serdes_preemphasis_lane0_23=0x0d4b0c +serdes_preemphasis_lane1_23=0x0d4b0c +serdes_preemphasis_lane2_23=0x0d4b0c +serdes_preemphasis_lane3_23=0x0d4b0c +serdes_preemphasis_lane0_24=0x0d4b0c +serdes_preemphasis_lane1_24=0x0d4b0c +serdes_preemphasis_lane2_24=0x0d4b0c +serdes_preemphasis_lane3_24=0x0d4b0c +serdes_preemphasis_lane0_29=0x0d4b0c +serdes_preemphasis_lane1_29=0x0d4b0c +serdes_preemphasis_lane2_29=0x0d4b0c +serdes_preemphasis_lane3_29=0x0d4b0c +serdes_preemphasis_lane0_30=0x0d4b0c +serdes_preemphasis_lane1_30=0x0d4b0c +serdes_preemphasis_lane2_30=0x0d4b0c +serdes_preemphasis_lane3_30=0x0d4b0c +serdes_preemphasis_lane0_31=0x0d4b0c +serdes_preemphasis_lane1_31=0x0d4b0c +serdes_preemphasis_lane2_31=0x0d4b0c +serdes_preemphasis_lane3_31=0x0d4b0c +serdes_preemphasis_lane0_32=0x0d4b0c +serdes_preemphasis_lane1_32=0x0d4b0c +serdes_preemphasis_lane2_32=0x0d4b0c +serdes_preemphasis_lane3_32=0x0d4b0c +serdes_preemphasis_lane0_33=0x0d4b0c +serdes_preemphasis_lane1_33=0x0d4b0c +serdes_preemphasis_lane2_33=0x0d4b0c +serdes_preemphasis_lane3_33=0x0d4b0c +serdes_preemphasis_lane0_34=0x0d4b0c +serdes_preemphasis_lane1_34=0x0d4b0c +serdes_preemphasis_lane2_34=0x0d4b0c +serdes_preemphasis_lane3_34=0x0d4b0c +serdes_preemphasis_lane0_35=0x0d4b0c +serdes_preemphasis_lane1_35=0x0d4b0c +serdes_preemphasis_lane2_35=0x0d4b0c +serdes_preemphasis_lane3_35=0x0d4b0c +serdes_preemphasis_lane0_36=0x0d4b0c +serdes_preemphasis_lane1_36=0x0d4b0c +serdes_preemphasis_lane2_36=0x0d4b0c +serdes_preemphasis_lane3_36=0x0d4b0c +serdes_preemphasis_lane0_41=0x0d4b0c +serdes_preemphasis_lane1_41=0x0d4b0c +serdes_preemphasis_lane2_41=0x0d4b0c +serdes_preemphasis_lane3_41=0x0d4b0c +serdes_preemphasis_lane0_42=0x0d4b0c +serdes_preemphasis_lane1_42=0x0d4b0c +serdes_preemphasis_lane2_42=0x0d4b0c +serdes_preemphasis_lane3_42=0x0d4b0c +serdes_preemphasis_lane0_43=0x0d4b0c +serdes_preemphasis_lane1_43=0x0d4b0c +serdes_preemphasis_lane2_43=0x0d4b0c +serdes_preemphasis_lane3_43=0x0d4b0c +serdes_preemphasis_lane0_44=0x0d4b0c +serdes_preemphasis_lane1_44=0x0d4b0c +serdes_preemphasis_lane2_44=0x0d4b0c +serdes_preemphasis_lane3_44=0x0d4b0c +serdes_preemphasis_lane0_49=0x0d4b0c +serdes_preemphasis_lane1_49=0x0d4b0c +serdes_preemphasis_lane2_49=0x0d4b0c +serdes_preemphasis_lane3_49=0x0d4b0c +serdes_preemphasis_lane0_50=0x0d4b0c +serdes_preemphasis_lane1_50=0x0d4b0c +serdes_preemphasis_lane2_50=0x0d4b0c +serdes_preemphasis_lane3_50=0x0d4b0c +serdes_preemphasis_lane0_51=0x0d4b0c +serdes_preemphasis_lane1_51=0x0d4b0c +serdes_preemphasis_lane2_51=0x0d4b0c +serdes_preemphasis_lane3_51=0x0d4b0c +serdes_preemphasis_lane0_52=0x0d4b0c +serdes_preemphasis_lane1_52=0x0d4b0c +serdes_preemphasis_lane2_52=0x0d4b0c +serdes_preemphasis_lane3_52=0x0d4b0c +serdes_preemphasis_lane0_57=0x0d4b0c +serdes_preemphasis_lane1_57=0x0d4b0c +serdes_preemphasis_lane2_57=0x0d4b0c +serdes_preemphasis_lane3_57=0x0d4b0c +serdes_preemphasis_lane0_58=0x0d4b0c +serdes_preemphasis_lane1_58=0x0d4b0c +serdes_preemphasis_lane2_58=0x0d4b0c +serdes_preemphasis_lane3_58=0x0d4b0c +serdes_preemphasis_lane0_59=0x0d4b0c +serdes_preemphasis_lane1_59=0x0d4b0c +serdes_preemphasis_lane2_59=0x0d4b0c +serdes_preemphasis_lane3_59=0x0d4b0c +serdes_preemphasis_lane0_60=0x0d4b0c +serdes_preemphasis_lane1_60=0x0d4b0c +serdes_preemphasis_lane2_60=0x0d4b0c +serdes_preemphasis_lane3_60=0x0d4b0c +serdes_preemphasis_lane0_61=0x0d4b0c +serdes_preemphasis_lane1_61=0x0d4b0c +serdes_preemphasis_lane2_61=0x0d4b0c +serdes_preemphasis_lane3_61=0x0d4b0c +serdes_preemphasis_lane0_62=0x0d4b0c +serdes_preemphasis_lane1_62=0x0d4b0c +serdes_preemphasis_lane2_62=0x0d4b0c +serdes_preemphasis_lane3_62=0x0d4b0c +serdes_preemphasis_lane0_63=0x0d4b0c +serdes_preemphasis_lane1_63=0x0d4b0c +serdes_preemphasis_lane2_63=0x0d4b0c +serdes_preemphasis_lane3_63=0x0d4b0c +serdes_preemphasis_lane0_64=0x0d4b0c +serdes_preemphasis_lane1_64=0x0d4b0c +serdes_preemphasis_lane2_64=0x0d4b0c +serdes_preemphasis_lane3_64=0x0d4b0c +serdes_preemphasis_lane0_67=0x0d4b0c +serdes_preemphasis_lane1_67=0x0d4b0c +serdes_preemphasis_lane2_67=0x0d4b0c +serdes_preemphasis_lane3_67=0x0d4b0c +serdes_preemphasis_lane0_68=0x0d4b0c +serdes_preemphasis_lane1_68=0x0d4b0c +serdes_preemphasis_lane2_68=0x0d4b0c +serdes_preemphasis_lane3_68=0x0d4b0c +serdes_preemphasis_lane0_69=0x0d4b0c +serdes_preemphasis_lane1_69=0x0d4b0c +serdes_preemphasis_lane2_69=0x0d4b0c +serdes_preemphasis_lane3_69=0x0d4b0c +serdes_preemphasis_lane0_70=0x0d4b0c +serdes_preemphasis_lane1_70=0x0d4b0c +serdes_preemphasis_lane2_70=0x0d4b0c +serdes_preemphasis_lane3_70=0x0d4b0c +serdes_preemphasis_lane0_71=0x0d4b0c +serdes_preemphasis_lane1_71=0x0d4b0c +serdes_preemphasis_lane2_71=0x0d4b0c +serdes_preemphasis_lane3_71=0x0d4b0c +serdes_preemphasis_lane0_72=0x0d4b0c +serdes_preemphasis_lane1_72=0x0d4b0c +serdes_preemphasis_lane2_72=0x0d4b0c +serdes_preemphasis_lane3_72=0x0d4b0c +serdes_preemphasis_lane0_73=0x0d4b0c +serdes_preemphasis_lane1_73=0x0d4b0c +serdes_preemphasis_lane2_73=0x0d4b0c +serdes_preemphasis_lane3_73=0x0d4b0c +serdes_preemphasis_lane0_74=0x0d4b0c +serdes_preemphasis_lane1_74=0x0d4b0c +serdes_preemphasis_lane2_74=0x0d4b0c +serdes_preemphasis_lane3_74=0x0d4b0c +serdes_preemphasis_lane0_87=0x0d4b0c +serdes_preemphasis_lane1_87=0x0d4b0c +serdes_preemphasis_lane2_87=0x0d4b0c +serdes_preemphasis_lane3_87=0x0d4b0c +serdes_preemphasis_lane0_79=0x0d4b0c +serdes_preemphasis_lane1_79=0x0d4b0c +serdes_preemphasis_lane2_79=0x0d4b0c +serdes_preemphasis_lane3_79=0x0d4b0c +serdes_preemphasis_lane0_99=0x0d4b0c +serdes_preemphasis_lane1_99=0x0d4b0c +serdes_preemphasis_lane2_99=0x0d4b0c +serdes_preemphasis_lane3_99=0x0d4b0c +serdes_preemphasis_lane0_95=0x0d4b0c +serdes_preemphasis_lane1_95=0x0d4b0c +serdes_preemphasis_lane2_95=0x0d4b0c +serdes_preemphasis_lane3_95=0x0d4b0c +serdes_preemphasis_lane0_115=0x0f480d +serdes_preemphasis_lane1_115=0x0f480d +serdes_preemphasis_lane2_115=0x0f480d +serdes_preemphasis_lane3_115=0x0f480d +serdes_preemphasis_lane0_107=0x0f480d +serdes_preemphasis_lane1_107=0x0f480d +serdes_preemphasis_lane2_107=0x0f480d +serdes_preemphasis_lane3_107=0x0f480d +serdes_preemphasis_lane0_123=0x0f480d +serdes_preemphasis_lane1_123=0x0f480d +serdes_preemphasis_lane2_123=0x0f480d +serdes_preemphasis_lane3_123=0x0f480d +serdes_preemphasis_lane0_127=0x0f480d +serdes_preemphasis_lane1_127=0x0f480d +serdes_preemphasis_lane2_127=0x0f480d +serdes_preemphasis_lane3_127=0x0f480d + +reglist_enable=1 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/custom_led.bin b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/custom_led.bin new file mode 100644 index 000000000000..1fe5585e0779 Binary files /dev/null and b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/custom_led.bin differ diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/default_sku b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/default_sku new file mode 100644 index 000000000000..3f0585c6e5b5 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/default_sku @@ -0,0 +1 @@ +B6510-48VS8CQ t1 diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/dev.xml b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/dev.xml new file mode 100755 index 000000000000..f5e871564350 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/dev.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/installer.conf b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/installer.conf new file mode 100755 index 000000000000..5e62742c11bf --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/led_proc_init.soc b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/led_proc_init.soc new file mode 100755 index 000000000000..59238f5cdc94 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/led_proc_init.soc @@ -0,0 +1,7 @@ +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin + +led auto on + +led start + +linkscan SwPortBitMap=xe,ce diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/monitor.py b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/monitor.py new file mode 100755 index 000000000000..f9cbb31be401 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/monitor.py @@ -0,0 +1,244 @@ +#!/usr/bin/python3 +# -*- coding: UTF-8 -*- +""" +* onboard temperature sensors +* FAN trays +* PSU +""" +import os +import xml.etree.ElementTree as ET +import glob + +MAILBOX_DIR = "/sys/bus/i2c/devices/" +PORTS_DIR = "/sys/class/net/" +CONFIG_NAME = "dev.xml" + + +def getPMCreg(location): + retval = "ERR" + if not os.path.isfile(location): + return "%s %s notfound" % (retval, location) + try: + with open(location, "r") as fd: + retval = fd.read() + except Exception: + pass + # logging.error("Unable to open ", location, "file !") + + retval = retval.rstrip("\r\n") + retval = retval.lstrip(" ") + return retval + + +# Get a mailbox register +def get_pmc_register(reg_name): + retval = "ERR" + if reg_name[0:4] == "/rif" or reg_name[0:4] == "/ma1" or reg_name[0:4] == "/eth": + mb_reg_file = PORTS_DIR + reg_name + else: + mb_reg_file = MAILBOX_DIR + reg_name + filepath = glob.glob(mb_reg_file) + if len(filepath) == 0: + return "%s %s notfound" % (retval, mb_reg_file) + mb_reg_file = filepath[0] # use first found patch + if not os.path.isfile(mb_reg_file): + return "%s %s notfound" % (retval, mb_reg_file) + try: + with open(mb_reg_file, "r") as fd: + retval = fd.read() + except Exception: + pass + # logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip("\r\n") + retval = retval.lstrip(" ") + return retval + + +class checktype: + def __init__(self, test1): + self.test1 = test1 + + @staticmethod + def check(name, location, bit, value, tips, err1): + psu_status = int(get_pmc_register(location), 16) + val = (psu_status & (1 << bit)) >> bit + if val != value: + err1["errmsg"] = tips + err1["code"] = -1 + return -1 + else: + err1["errmsg"] = "none" + err1["code"] = 0 + return 0 + + @staticmethod + def getValue(location, bit, type): + value_t = get_pmc_register(location) + if value_t.startswith("ERR"): + return value_t + if type == 1: + return float(value_t) / 1000 + elif type == 2: + return float(value_t) / 100 + elif type == 3: + psu_status = int(value_t, 16) + return (psu_status & (1 << bit)) >> bit + elif type == 4: + return int(value_t, 10) + else: + return value_t + + # temperature + @staticmethod + def getTemp(self, name, location, ret_t): + ret2 = self.getValue(location + "temp1_input", " ", 1) + ret3 = self.getValue(location + "temp1_max", " ", 1) + ret4 = self.getValue(location + "temp1_max_hyst", " ", 1) + ret_t["temp1_input"] = ret2 + ret_t["temp1_max"] = ret3 + ret_t["temp1_max_hyst"] = ret4 + + @staticmethod + def getLM75(name, location, result): + c1 = checktype + r1 = {} + c1.getTemp(c1, name, location, r1) + result[name] = r1 + + +class status: + def __init__(self, productname): + self.productname = productname + + @staticmethod + def getETroot(filename): + tree = ET.parse(filename) + root = tree.getroot() + return root + + @staticmethod + def getDecodValue(collection, decode): + decodes = collection.find("decode") + testdecode = decodes.find(decode) + test = {} + for neighbor in testdecode.iter("code"): + test[neighbor.attrib["key"]] = neighbor.attrib["value"] + return test + + @staticmethod + def getfileValue(location): + return checktype.getValue(location, " ", " ") + + @staticmethod + def getETValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + prob_t = {} + prob_t = neighbor.attrib + prob_t["errcode"] = 0 + prob_t["errmsg"] = "" + for pros in neighbor.iter("property"): + ret = dict(neighbor.attrib.items() + pros.attrib.items()) + if "type" not in ret.keys(): + val = "0" + else: + val = ret["type"] + if "bit" not in ret.keys(): + bit = "0" + else: + bit = ret["bit"] + s = checktype.getValue(ret["location"], int(bit), int(val)) + if isinstance(s, str) and s.startswith("ERR"): + prob_t["errcode"] = -1 + prob_t["errmsg"] = s + if "default" in ret.keys(): + rt = status.getDecodValue(root, ret["decode"]) + prob_t["errmsg"] = rt[str(s)] + if str(s) != ret["default"]: + prob_t["errcode"] = -1 + break + else: + if "decode" in ret.keys(): + rt = status.getDecodValue(root, ret["decode"]) + if ( + ret["decode"] == "psutype" + and s.replace("\x00", "").rstrip() not in rt.keys() + ): # PSU type detect + prob_t["errcode"] = -1 + prob_t["errmsg"] = "%s" % ("The power type does not match, please check whether the power is correct!") + else: + s = rt[str(s).replace("\x00", "").rstrip()] + name = ret["name"] + prob_t[name] = str(s) + a.append(prob_t) + + @staticmethod + def getCPUValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + location = neighbor.attrib["location"] + L = [] + for dirpath, dirnames, filenames in os.walk(location): + for file in filenames: + if file.endswith("input"): + L.append(os.path.join(dirpath, file)) + L = sorted(L, reverse=False) + for i in range(len(L)): + prob_t = {} + prob_t["name"] = getPMCreg("%s/temp%d_label" % (location, i + 1)) + prob_t["temp"] = ( + float(getPMCreg("%s/temp%d_input" % (location, i + 1))) / 1000 + ) + prob_t["alarm"] = ( + float(getPMCreg("%s/temp%d_crit_alarm" % (location, i + 1))) / 1000 + ) + prob_t["crit"] = ( + float(getPMCreg("%s/temp%d_crit" % (location, i + 1))) / 1000 + ) + prob_t["max"] = float(getPMCreg("%s/temp%d_max" % (location, i + 1))) / 1000 + a.append(prob_t) + + @staticmethod + def getFileName(): + return os.path.dirname(os.path.realpath(__file__)) + "/" + CONFIG_NAME + + @staticmethod + def getFan(ret): + _filename = status.getFileName() + _tagname = "fan" + status.getvalue(ret, _filename, _tagname) + + @staticmethod + def checkFan(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "fan" + status.getETValue(ret, _filename, _tagname) + + @staticmethod + def getTemp(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "temp" + status.getETValue(ret, _filename, _tagname) + + @staticmethod + def getPsu(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "psu" + status.getETValue(ret, _filename, _tagname) + + @staticmethod + def getcputemp(ret): + _filename = status.getFileName() + _tagname = "cpus" + status.getCPUValue(ret, _filename, _tagname) + + @staticmethod + def getMgmtRx(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "mgmt_rx" + status.getETValue(ret, _filename, _tagname) diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pcie.yaml b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pcie.yaml new file mode 100644 index 000000000000..90ebf1740641 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pcie.yaml @@ -0,0 +1,429 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '01' + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '04' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '04' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '07' + dev: '00' + fn: '0' + id: b873 + name: 'Ethernet controller: Broadcom Limited Device b873 (rev 01)' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/platform_env.conf b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/platform_env.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/eeprom.py b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/eeprom.py new file mode 100755 index 000000000000..53f57c2a3625 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/eeprom.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +try: + 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/bus/i2c/devices/2-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, "", True) diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/psuutil.py b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/psuutil.py new file mode 100755 index 000000000000..e1513d14c4b2 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/psuutil.py @@ -0,0 +1,63 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + return 2 + + def get_psu_status(self, index): + if index != 1 and index != 2: + return False + + psu_path = "/sys/bus/i2c/devices/2-0037/psu_status" + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if index == 1 and (result & 0x2): + return True + + if index == 2 and (result & 0x20): + return True + + return False + + def get_psu_presence(self, index): + if index != 1 and index != 2: + return False + + psu_path = "/sys/bus/i2c/devices/2-0037/psu_status" + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if index == 1 and (result & 0x1) == 0: + return True + + if index == 2 and (result & 0x10) == 0: + return True + + return False diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/sfputil.py b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/sfputil.py new file mode 100755 index 000000000000..cfc294972e5b --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/plugins/sfputil.py @@ -0,0 +1,359 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + from ctypes import create_string_buffer + from sonic_sfp.sfputilbase import SfpUtilBase + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 55 + PORTS_IN_BLOCK = 56 + + EEPROM_OFFSET = 11 + SFP_DEVICE_TYPE = "optoe2" + QSFP_DEVICE_TYPE = "optoe1" + I2C_MAX_ATTEMPT = 3 + + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + QSFP_POWERMODE_OFFSET = 93 + QSFP_CONTROL_OFFSET = 86 + QSFP_CONTROL_WIDTH = 8 + + _port_to_eeprom_mapping = {} + port_to_i2cbus_mapping ={} + port_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(48, self.PORTS_IN_BLOCK) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + if self.get_presence(x): + self.port_dict[x] = self.SFP_STATUS_INSERTED + else: + self.port_dict[x] = self.SFP_STATUS_REMOVED + SfpUtilBase.__init__(self) + + def _sfp_read_file_path(self, file_path, offset, num_bytes): + attempts = 0 + while attempts < self.I2C_MAX_ATTEMPT: + try: + file_path.seek(offset) + read_buf = file_path.read(num_bytes) + except BaseException: + attempts += 1 + time.sleep(0.05) + else: + return True, read_buf + return False, None + + def _sfp_eeprom_present(self, sysfs_sfp_i2c_client_eeprompath, offset): + if not os.path.exists(sysfs_sfp_i2c_client_eeprompath): + return False + else: + with open(sysfs_sfp_i2c_client_eeprompath, "rb", buffering=0) as sysfsfile: + rv, buf = self._sfp_read_file_path(sysfsfile, offset, 1) + return rv + + def _add_new_sfp_device(self, sysfs_sfp_i2c_adapter_path, devaddr, devtype): + try: + sysfs_nd_path = "%s/new_device" % sysfs_sfp_i2c_adapter_path + + # Write device address to new_device file + nd_file = open(sysfs_nd_path, "w") + nd_str = "%s %s" % (devtype, hex(devaddr)) + nd_file.write(nd_str) + nd_file.close() + + except Exception as err: + print("Error writing to new device file: %s" % str(err)) + return 1 + else: + return 0 + + def _get_port_eeprom_path(self, port_num, devid): + sysfs_i2c_adapter_base_path = "/sys/class/i2c-adapter" + + if port_num in self.port_to_eeprom_mapping.keys(): + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[port_num] + else: + i2c_adapter_id = self._get_port_i2c_adapter_id(port_num) + if i2c_adapter_id is None: + print("Error getting i2c bus num") + return None + + # Get i2c virtual bus path for the sfp + sysfs_sfp_i2c_adapter_path = "%s/i2c-%s" % (sysfs_i2c_adapter_base_path, + str(i2c_adapter_id)) + + # If i2c bus for port does not exist + if not os.path.exists(sysfs_sfp_i2c_adapter_path): + print("Could not find i2c bus %s. Driver not loaded?" % sysfs_sfp_i2c_adapter_path) + return None + + sysfs_sfp_i2c_client_path = "%s/%s-00%s" % (sysfs_sfp_i2c_adapter_path, + str(i2c_adapter_id), + hex(devid)[-2:]) + + # If sfp device is not present on bus, Add it + if not os.path.exists(sysfs_sfp_i2c_client_path): + if port_num in self.qsfp_ports: + self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.QSFP_DEVICE_TYPE) + else: + ret = self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.SFP_DEVICE_TYPE) + if ret != 0: + print("Error adding sfp device") + return None + + sysfs_sfp_i2c_client_eeprom_path = "%s/eeprom" % sysfs_sfp_i2c_client_path + + return sysfs_sfp_i2c_client_eeprom_path + + def _read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + rv, raw = self._sfp_read_file_path(sysfsfile_eeprom, offset, num_bytes) + if rv == False: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except BaseException: + return None + + return eeprom_raw + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.IDENTITY_EEPROM_ADDR, 256) + + 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 + + if port_num <= 7: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence1" + elif port_num >= 8 and port_num <= 15: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence2" + elif port_num >= 16 and port_num <= 23: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence3" + elif port_num >= 24 and port_num <= 31: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence4" + elif port_num >= 32 and port_num <= 39: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence5" + elif port_num >= 40 and port_num <= 47: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence6" + elif port_num >= 48 and port_num <= 55: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence7" + else: + return False + + try: + data = open(presence_path, "rb") + except IOError: + return False + + presence_data = data.read(2) + if presence_data == "": + return False + result = int(presence_data, 16) + data.close() + + # ModPrsL is active low + if result & (1 << (port_num % 8)) == 0: + return True + + return False + + def set_power_override(self, port_num, power_override, power_set): + if port_num < self.port_start or port_num > self.port_end: + return False + if self.get_presence(port_num) is False: + return False + if port_num in self.qsfp_ports: + offset = 0 + try: + power_override_bit = 0 + if power_override: + power_override_bit |= 1 << 0 + + power_set_bit = 0 + if power_set: + power_set_bit |= 1 << 1 + + buffer = create_string_buffer(1) + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + sysfs_sfp_i2c_client_eeprom_path = self._get_port_eeprom_path(port_num, self.IDENTITY_EEPROM_ADDR) + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, "r+b") + sysfsfile_eeprom.seek(offset + self.QSFP_POWERMODE_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + else: + # SFP doesn't support this feature + return False + + def get_low_power_mode(self, port_num): + """ + Not support LPMode pin to control lpmde. + This function is affected by the Power_over-ride and Power_set software control bits (byte 93 bits 0,1) + """ + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num in self.qsfp_ports: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + sysfs_sfp_i2c_client_eeprom_path = self._get_port_eeprom_path(port_num, self.IDENTITY_EEPROM_ADDR) + with open(sysfs_sfp_i2c_client_eeprom_path, "rb", buffering=0) as sysfsfile: + dom_control_raw = self._read_eeprom_specific_bytes(sysfsfile, + offset + self.QSFP_CONTROL_OFFSET, self.QSFP_CONTROL_WIDTH) if self.get_presence(port_num) else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + lpmode = ('On' == dom_control_data['data']['PowerSet']['value']) + power_override = ('On' == dom_control_data['data']['PowerOverride']['value']) + if lpmode == power_override == True: + return True + else: + # SFP doesn't support this feature + return False + return False + + def set_low_power_mode(self, port_num, lpmode): + """ + Not support LPMode pin to control lpmde. + This function is affected by the Power_over-ride and Power_set software control bits (byte 93 bits 0,1) + """ + if port_num < self.port_start or port_num > self.port_end: + return False + if lpmode: + return self.set_power_override(port_num, True, lpmode) + else: + return self.set_power_override(port_num, False, lpmode) + + def reset(self, port_num): + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num in self.qsfp_ports: + reset_path = "/sys/bus/i2c/devices/1-0036/qsfp_reset" + try: + data = open(reset_path, "r+") + reset_data = data.read(2) + if reset_data == "": + return False + result = int(reset_data, 16) + result = result & (~(1 << (port_num % 8))) + data.seek(0) + sres = hex(result)[2:] + data.write(sres) + data.close() + + time.sleep(1) + + data = open(reset_path, "r+") + reset_data = data.read(2) + if reset_data == "": + return False + result = int(reset_data, 16) + data.seek(0) + result = result | (1 << (port_num % 8)) + sres = hex(result)[2:] + data.write(sres) + data.close() + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + return True + else: + # SFP doesn't support this feature + return False + + def get_transceiver_change_event(self, timeout=0): + + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print("get_transceiver_change_event: time wrap / invalid timeout value", timeout) + + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + if self.get_presence(x): + currernt_port_dict[x] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[x] = self.SFP_STATUS_REMOVED + if (currernt_port_dict == self.port_dict): + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + return True, self.port_dict + print("get_transceiver_change_event: Should not reach here.") + return False, {} diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pmon_daemon_control.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..590def37b276 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/pmon_daemon_control.json @@ -0,0 +1,5 @@ +{ + "skip_ledd": true, + "skip_xcvrd": false, + "skip_psud": false +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sensors.conf b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sensors.conf new file mode 100755 index 000000000000..9b0569d1541d --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sensors.conf @@ -0,0 +1,21 @@ +# libsensors configuration file +# ---------------------------------------------- +# + +bus "i2c-2" "i2c-0-mux (chan_id 0)" + +chip "lm75-i2c-2-48" + label temp1 "LM75_0 air_inlet" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "lm75-i2c-2-49" + label temp1 "LM75_1 air_outlet" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "lm75-i2c-2-4a" + label temp1 "LM75_2 hottest" + set temp1_max 80 + set temp1_max_hyst 75 + diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/chassis.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/chassis.json new file mode 100644 index 000000000000..c5ea46918ff2 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/chassis.json @@ -0,0 +1,3 @@ +{ + "eeprom": {"bus": 2, "loc": "0057"} +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/component.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/component.json new file mode 100644 index 000000000000..35f4b4586447 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/component.json @@ -0,0 +1,60 @@ +{ + "components": [ + { + "name": "CPLD1 (MAC Board A)", + "firmware_version": { + "bus": 2, + "addr": 51, + "offset": 0, + "size": 4, + "way": 1, + "format": 7, + "sep": "/" + }, + "desc": "Used for managing IO modules, SFP+ modules and system LEDs", + "slot": 0 + }, + { + "name": "CPLD2 (MAC Board B)", + "firmware_version": { + "bus": 2, + "addr": 53, + "offset": 0, + "size": 4, + "way": 1, + "format": 7, + "sep": "/" + }, + "desc": "Used for managing IO modules, SFP+ modules and system LEDs", + "slot": 0 + }, + { + "name": "CPLD3 (CONNECT Board A)", + "firmware_version": { + "bus": 2, + "addr": 55, + "offset": 0, + "size": 4, + "way": 1, + "format": 7, + "sep": "/" + }, + "desc": "Used for managing IO modules, SFP+ modules and system LEDs", + "slot": 0 + }, + { + "name": "CPLD4 (CPU Board)", + "firmware_version": { + "bus": 0, + "addr": 13, + "offset": 0, + "size": 4, + "way": 1, + "format": 7, + "sep": "/" + }, + "desc": "Used for managing IO modules, SFP+ modules and system LEDs", + "slot": 1 + } + ] +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/fan.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/fan.json new file mode 100644 index 000000000000..de7030ec1f90 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/fan.json @@ -0,0 +1,152 @@ +{ + "fans": [ + { + "name": "fan1", + "e2loc": {"bus": 3, "addr": 83, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": 2, + "bit": 0 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": 2, + "bit": 0 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/3-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/3-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan0_led", + "format": 6, + "mask": 11 + }, + "led_colors": { + "green": 9, + "red": 10, + "amber": 3 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan1_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": 23000 + } + ] + }, + { + "name": "fan2", + "e2loc": {"bus": 4, "addr": 83, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": 2, + "bit": 1 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": 2, + "bit": 1 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/4-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/4-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan1_led", + "format": 6, + "mask": 11 + }, + "led_colors": { + "green": 9, + "red": 10, + "amber": 3 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan2_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": 23000 + } + ] + }, + { + "name": "fan3", + "e2loc": {"bus": 3, "addr": 83, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": 2, + "bit": 2 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": 2, + "bit": 2 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/5-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/5-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan2_led", + "format": 6, + "mask": 11 + }, + "led_colors": { + "green": 9, + "red": 10, + "amber": 3 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan3_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": 23000 + } + ] + }, + { + "name": "fan4", + "e2loc": {"bus": 3, "addr": 83, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": 2, + "bit": 3 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": 2, + "bit": 3 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/6-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/6-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan3_led", + "format": 6, + "mask": 11 + }, + "led_colors":{ + "green": 9, + "red": 10, + "amber": 3 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan4_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": 23000 + } + ] + } + ] +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/psu.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/psu.json new file mode 100644 index 000000000000..c807b51fc4b6 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/psu.json @@ -0,0 +1,134 @@ +{ + "psus": [ + { + "name": "psu1", + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 0 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 1 + }, + "sn": {"loc": "/sys/bus/i2c/devices/7-0050/psu_sn"}, + "in_current": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/curr1_input", + "format": 4 + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/in1_input", + "format": 4 + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/in2_input", + "format": 4 + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/curr2_input", + "format": 4 + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/temp1_input", + "format": 4 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/7-0050/psu_hw"}, + "psu_type": {"loc": "/sys/bus/i2c/devices/7-0050/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/fan1_fault" + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 1 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/fan1_input" + }, + "speed_max": 28000 + } + ] + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/power1_input", + "format": 5 + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/power2_input", + "format": 5 + } + }, + { + "name": "psu2", + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 4 + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 5 + }, + "sn": {"loc": "/sys/bus/i2c/devices/8-0053/psu_sn"}, + "in_current": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/curr1_input", + "format": 4 + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/in1_input", + "format": 4 + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/in2_input", + "format": 4 + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/curr2_input", + "format": 4 + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/temp1_input", + "format": 4 + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/8-0053/psu_hw"}, + "psu_type": {"loc": "/sys/bus/i2c/devices/8-0053/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/fan1_fault" + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": 2, + "bit": 5 + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/fan1_input" + }, + "speed_max": 28000 + } + ] + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/power1_input", + "format": 5 + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/power2_input", + "format": 5 + } + } + ] +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/thermal.json b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/thermal.json new file mode 100644 index 000000000000..319336673534 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/sonic_platform_config/thermal.json @@ -0,0 +1,130 @@ +{"thermals": [ + { + "name": "INLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/*/temp1_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": null, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/*/temp1_input", + "format": 4 + } + }, + { + "name": "OUTLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-0049/hwmon/*/temp1_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": null, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-0049/hwmon/*/temp1_input", + "format": 4 + } + }, + { + "name": "BOARD TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-004a/hwmon/*/temp1_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": null, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-004a/hwmon/*/temp1_input", + "format": 4 + } + }, + { + "name": "PHYSICAL ID 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_crit", + "format": 4 + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp1_input", + "format": 4 + } + }, + { + "name": "CPU CORE 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_crit", + "format": 4 + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp2_input", + "format": 4 + } + }, + { + "name": "CPU CORE 1", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_crit", + "format": 4 + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp3_input", + "format": 4 + } + }, + { + "name": "CPU CORE 2", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_crit", + "format": 4 + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp4_input", + "format": 4 + } + }, + { + "name": "CPU CORE 3", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_max", + "format": 4 + }, + "low": null, + "crit_low": null, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_crit", + "format": 4 + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp5_input", + "format": 4 + } + } + ] +} \ No newline at end of file diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/systest.py b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/systest.py new file mode 100644 index 000000000000..e1972959f951 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/systest.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +""" +* onboard temperature sensors +* FAN trays +* PSU +""" +import time +import datetime +from monitor import status + +def doWork(): + a=[]; + ''' + return: [{'status': '1', 'hw_version': '1.00', 'errcode': 0, 'fan_type': 'M6510-FAN-F', 'errmsg': 'OK', 'Speed': '9778', 'id': 'fan1', 'present': '0', 'sn': '1000000000014'}, + {'id': 'fan2', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan3', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan4', 'errmsg': 'not present', 'errcode': -1} + ] + description: 1.get id + 2.errcode equal 0 : dev normal + not equal 0 : get errmsg + 3.other message add when all check success + ''' + status.checkFan(a) + #status.getTemp(a) + #status.getPsu(a) + + nowTime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + print(nowTime) + print(a) +def run(interval): + while True: + try: + time_remaining = interval - time.time()%interval + time.sleep(time_remaining) + doWork() + except Exception as e: + print(e) + +if __name__ == '__main__': + interval = 1 + run(interval) diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers.json.j2 similarity index 52% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 rename to device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers.json.j2 index 1083a6210fc9..b67cf577ab75 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers.json.j2 @@ -1,2 +1,3 @@ -{%- set default_topo = 't0' %} +{%- set default_topo = 't1' %} {%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_def.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t0.j2 @@ -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 %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t1.j2 similarity index 64% rename from device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 rename to device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t1.j2 index cc7a687514ce..38e34eb571e8 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/buffers_defaults_t1.j2 @@ -1,37 +1,28 @@ - {%- set default_cable = '300m' %} -{%- set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '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 %} + {% 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": "10875072", + "size": "12766208", "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", "mode": "dynamic" }, "egress_lossless_pool": { - "size": "15982720", + "size": "12766208", "type": "egress", "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" } }, "BUFFER_PROFILE": { @@ -42,8 +33,8 @@ }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", - "static_th":"15982720" + "size":"0", + "static_th":"12766208" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/lanemap.ini new file mode 100644 index 000000000000..d2b9e31ecadb --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/lanemap.ini @@ -0,0 +1,8 @@ +eth1:1,2,3,4 +eth2:5,6,7,8 +eth3:9,10,11,12 +eth4:13,14,15,16 +eth5:17,18,19,20 +eth6:21,22,23,24 +eth7:25,26,27,28 +eth8:29,30,31,32 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/port_config.ini new file mode 100644 index 000000000000..8132f1c73dbf --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/port_config.ini @@ -0,0 +1,9 @@ +# name lanes alias index asic_port_name role +Ethernet0 1,2,3,4 Ethernet1/1 0 Eth0-ASIC0 Ext +Ethernet4 5,6,7,8 Ethernet1/2 1 Eth1-ASIC0 Ext +Ethernet8 9,10,11,12 Ethernet1/3 2 Eth2-ASIC0 Ext +Ethernet12 13,14,15,16 Ethernet1/4 3 Eth3-ASIC0 Ext +Ethernet-BP0 17,18,19,20 Eth4-ASIC0 0 Eth4-ASIC0 Int +Ethernet-BP4 21,22,23,24 Eth5-ASIC0 1 Eth5-ASIC0 Int +Ethernet-BP8 25,26,27,28 Eth6-ASIC0 2 Eth6-ASIC0 Int +Ethernet-BP12 29,30,31,32 Eth7-ASIC0 3 Eth7-ASIC0 Int diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/sai.profile new file mode 100644 index 000000000000..0a2df177f1c5 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/sai.profile @@ -0,0 +1,3 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..0e25b4d4232d --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/0/td2-s6000-32x40G.config.bcm @@ -0,0 +1,646 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=10 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_def.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t0.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/buffers_defaults_t1.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/lanemap.ini new file mode 100644 index 000000000000..d2b9e31ecadb --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/lanemap.ini @@ -0,0 +1,8 @@ +eth1:1,2,3,4 +eth2:5,6,7,8 +eth3:9,10,11,12 +eth4:13,14,15,16 +eth5:17,18,19,20 +eth6:21,22,23,24 +eth7:25,26,27,28 +eth8:29,30,31,32 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/port_config.ini new file mode 100644 index 000000000000..cf9982d91716 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/port_config.ini @@ -0,0 +1,9 @@ +# name lanes alias index asic_port_name role +Ethernet16 1,2,3,4 Ethernet1/5 4 Eth0-ASIC1 Ext +Ethernet20 5,6,7,8 Ethernet1/6 5 Eth1-ASIC1 Ext +Ethernet24 9,10,11,12 Ethernet1/7 6 Eth2-ASIC1 Ext +Ethernet28 13,14,15,16 Ethernet1/8 7 Eth3-ASIC1 Ext +Ethernet-BP16 17,18,19,20 Eth4-ASIC1 4 Eth4-ASIC1 Int +Ethernet-BP20 21,22,23,24 Eth5-ASIC1 5 Eth5-ASIC1 Int +Ethernet-BP24 25,26,27,28 Eth6-ASIC1 6 Eth6-ASIC1 Int +Ethernet-BP28 29,30,31,32 Eth7-ASIC1 7 Eth7-ASIC1 Int diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/sai.profile new file mode 100644 index 000000000000..0a2df177f1c5 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/sai.profile @@ -0,0 +1,3 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..0e25b4d4232d --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/1/td2-s6000-32x40G.config.bcm @@ -0,0 +1,646 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=10 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_def.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t0.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/buffers_defaults_t1.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/lanemap.ini new file mode 100644 index 000000000000..d2b9e31ecadb --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/lanemap.ini @@ -0,0 +1,8 @@ +eth1:1,2,3,4 +eth2:5,6,7,8 +eth3:9,10,11,12 +eth4:13,14,15,16 +eth5:17,18,19,20 +eth6:21,22,23,24 +eth7:25,26,27,28 +eth8:29,30,31,32 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/port_config.ini new file mode 100644 index 000000000000..a4361c7b78d6 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/port_config.ini @@ -0,0 +1,9 @@ +# name lanes alias index asic_port_name role +Ethernet-BP32 1,2,3,4 Eth0-ASIC2 8 Eth0-ASIC2 Int +Ethernet-BP36 5,6,7,8 Eth1-ASIC2 9 Eth1-ASIC2 Int +Ethernet-BP40 9,10,11,12 Eth2-ASIC2 10 Eth2-ASIC2 Int +Ethernet-BP44 13,14,15,16 Eth3-ASIC2 11 Eth3-ASIC2 Int +Ethernet-BP48 17,18,19,20 Eth4-ASIC2 12 Eth4-ASIC2 Int +Ethernet-BP52 21,22,23,24 Eth5-ASIC2 13 Eth5-ASIC2 Int +Ethernet-BP56 25,26,27,28 Eth6-ASIC2 14 Eth6-ASIC2 Int +Ethernet-BP60 29,30,31,32 Eth7-ASIC2 15 Eth7-ASIC2 Int diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/sai.profile new file mode 100644 index 000000000000..0a2df177f1c5 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/sai.profile @@ -0,0 +1,3 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..0e25b4d4232d --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/2/td2-s6000-32x40G.config.bcm @@ -0,0 +1,646 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=10 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_def.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t0.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/buffers_defaults_t1.j2 @@ -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 %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/lanemap.ini new file mode 100644 index 000000000000..d2b9e31ecadb --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/lanemap.ini @@ -0,0 +1,8 @@ +eth1:1,2,3,4 +eth2:5,6,7,8 +eth3:9,10,11,12 +eth4:13,14,15,16 +eth5:17,18,19,20 +eth6:21,22,23,24 +eth7:25,26,27,28 +eth8:29,30,31,32 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/port_config.ini new file mode 100644 index 000000000000..e97ded4527b3 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/port_config.ini @@ -0,0 +1,9 @@ +# name lanes alias index asic_port_name role +Ethernet-BP64 1,2,3,4 Eth0-ASIC3 16 Eth0-ASIC3 Int +Ethernet-BP68 5,6,7,8 Eth1-ASIC3 17 Eth1-ASIC3 Int +Ethernet-BP72 9,10,11,12 Eth2-ASIC3 18 Eth2-ASIC3 Int +Ethernet-BP76 13,14,15,16 Eth3-ASIC3 19 Eth3-ASIC3 Int +Ethernet-BP80 17,18,19,20 Eth4-ASIC3 20 Eth4-ASIC3 Int +Ethernet-BP84 21,22,23,24 Eth5-ASIC3 21 Eth5-ASIC3 Int +Ethernet-BP92 25,26,27,28 Eth6-ASIC3 22 Eth6-ASIC3 Int +Ethernet-BP96 29,30,31,32 Eth7-ASIC3 23 Eth7-ASIC3 Int diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/sai.profile new file mode 100644 index 000000000000..0a2df177f1c5 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/sai.profile @@ -0,0 +1,3 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..0e25b4d4232d --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/3/td2-s6000-32x40G.config.bcm @@ -0,0 +1,646 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=10 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/topology.sh b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/topology.sh new file mode 100755 index 000000000000..d7f370fdf39f --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_four_asic_vs/topology.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# Topolgy script for 4 ASIC PLATFORM +# 2 frontend asic , 2 backend asic. +# 8 front-panel interfaces. +FIRST_FRONTEND_ASIC=0 +LAST_FRONTEND_ASIC=1 +FIRST_BACKEND_ASIC=2 +LAST_BACKEND_ASIC=3 +NUM_INTERFACES_PER_ASIC=8 + +start () { + # Move external links into assigned frontend namespaces + # eth0 - eth15: asic2 + # eth16 - eth31: asic3 + # eth32 - eth47: asic4 + # eth48 - eth63: asic5 + for ASIC in `seq $FIRST_FRONTEND_ASIC $LAST_FRONTEND_ASIC`; do + for NUM in `seq 1 4`; do + ORIG="eth$((4 * $ASIC + $NUM))" + TEMP="ethTemp999" + NEW="eth$(($NUM))" + echo "$ASIC : $NEW old $ORIG" + ip link set dev $ORIG down + ip link set dev $ORIG name $TEMP # rename to prevent conflicts before renaming in new namespace + ip link set dev $TEMP netns asic$ASIC + sudo ip netns exec asic$ASIC ip link set $TEMP name $NEW # rename too final interface name + sudo ip netns exec asic$ASIC ip link set dev $NEW mtu 9100 + sudo ip netns exec asic$ASIC ip link set $NEW up + done + done + + # Connect all backend namespaces to frontend namespaces + for BACKEND in `seq $FIRST_BACKEND_ASIC $LAST_BACKEND_ASIC`; do + for FRONTEND in `seq $FIRST_FRONTEND_ASIC $LAST_FRONTEND_ASIC`; do + for LINK in `seq 1 2`; do + FRONT_NAME="eth$((2 * $(($BACKEND - $FIRST_BACKEND_ASIC)) + $LINK + 4))" + BACK_NAME="eth$((2 * $FRONTEND + $LINK))" + echo "$FRONTEND:$FRONT_NAME - $BACKEND:$BACK_NAME" + TEMP_BACK="ethBack999" + TEMP_FRONT="ethFront999" + ip link add $TEMP_BACK type veth peer name $TEMP_FRONT # temporary name to prevent conflicts between interfaces + ip link set dev $TEMP_BACK netns asic$BACKEND + ip link set dev $TEMP_FRONT netns asic$FRONTEND + + sudo ip netns exec asic$BACKEND ip link set $TEMP_BACK name $BACK_NAME + sudo ip netns exec asic$FRONTEND ip link set $TEMP_FRONT name $FRONT_NAME + + sudo ip netns exec asic$BACKEND ip link set dev $BACK_NAME mtu 9100 + sudo ip netns exec asic$BACKEND ip link set $BACK_NAME up + sudo ip netns exec asic$FRONTEND ip link set dev $FRONT_NAME mtu 9100 + sudo ip netns exec asic$FRONTEND ip link set $FRONT_NAME up + done + done + done +} +stop() { + for ASIC in `seq $FIRST_FRONTEND_ASIC $LAST_FRONTEND_ASIC`; do + for NUM in `seq 1 4`; do + TEMP="eth999" + OLD="eth$(($NUM))" + NAME="eth$((4 * $ASIC + $NUM))" + sudo ip netns exec asic$ASIC ip link set dev $OLD down + sudo ip netns exec asic$ASIC ip link set dev $OLD name $TEMP + sudo ip netns exec asic$ASIC ip link set dev $TEMP netns 1 + ip link set dev $TEMP name $NAME + ip link set dev $NAME up + done + done + + for ASIC in `seq $FIRST_BACKEND_ASIC $LAST_BACKEND_ASIC`; do + for NUM in `seq 1 4`; do + sudo ip netns exec asic$ASIC ip link set dev eth$NUM down + sudo ip netns exec asic$ASIC ip link delete dev eth$NUM + done + done +} + +case "$1" in + start|stop) + $1 + ;; + *) + echo "Usage: $0 {start|stop}" + ;; +esac diff --git a/device/virtual/x86_64-kvm_x86_64-r0/msft_multi_asic_vs/topology.sh b/device/virtual/x86_64-kvm_x86_64-r0/msft_multi_asic_vs/topology.sh index cf70f3063189..c4140ededb25 100755 --- a/device/virtual/x86_64-kvm_x86_64-r0/msft_multi_asic_vs/topology.sh +++ b/device/virtual/x86_64-kvm_x86_64-r0/msft_multi_asic_vs/topology.sh @@ -8,10 +8,10 @@ NUM_INTERFACES_PER_ASIC=32 start () { # Move external links into assigned frontend namespaces - # eth0 - eth15: asic2 - # eth16 - eth31: asic3 - # eth32 - eth47: asic4 - # eth48 - eth63: asic5 + # eth1 - eth16: asic0 + # eth17 - eth32: asic1 + # eth33 - eth48: asic2 + # eth49 - eth64: asic3 for ASIC in `seq $FIRST_FRONTEND_ASIC $LAST_FRONTEND_ASIC`; do for NUM in `seq 1 16`; do ORIG="eth$((16 * $ASIC + $NUM))" @@ -22,6 +22,7 @@ start () { ip link set dev $ORIG name $TEMP # rename to prevent conflicts before renaming in new namespace ip link set dev $TEMP netns asic$ASIC sudo ip netns exec asic$ASIC ip link set $TEMP name $NEW # rename to final interface name + sudo ip netns exec asic$ASIC ip link set dev $NEW mtu 9100 sudo ip netns exec asic$ASIC ip link set $NEW up done done @@ -43,7 +44,9 @@ start () { sudo ip netns exec asic$BACKEND ip link set $TEMP_BACK name $BACK_NAME sudo ip netns exec asic$FRONTEND ip link set $TEMP_FRONT name $FRONT_NAME + sudo ip netns exec asic$BACKEND ip link set dev $BACK_NAME mtu 9100 sudo ip netns exec asic$BACKEND ip link set $BACK_NAME up + sudo ip netns exec asic$FRONTEND ip link set dev $FRONT_NAME mtu 9100 sudo ip netns exec asic$FRONTEND ip link set $FRONT_NAME up done done @@ -54,8 +57,8 @@ stop() { for ASIC in `seq $FIRST_FRONTEND_ASIC $LAST_FRONTEND_ASIC`; do for NUM in `seq 1 16`; do TEMP="eth999" - OLD="eth$((16 * $ASIC + $NUM))" - NAME="eth$((16 * $ASIC + $NUM - 1))" + OLD="eth$(($NUM))" + NAME="eth$((16 * $ASIC + $NUM))" sudo ip netns exec asic$ASIC ip link set dev $OLD down sudo ip netns exec asic$ASIC ip link set dev $OLD name $TEMP sudo ip netns exec asic$ASIC ip link set dev $TEMP netns 1 diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 360d64a12b82..42df1c6f38f8 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -53,6 +53,7 @@ COPY ["snmp.conf", "/etc/snmp/frr.conf"] COPY ["TSA", "/usr/bin/TSA"] COPY ["TSB", "/usr/bin/TSB"] COPY ["TSC", "/usr/bin/TSC"] +COPY ["TS", "/usr/bin/TS"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["zsocket.sh", "/usr/bin/"] RUN chmod a+x /usr/bin/TSA && \ diff --git a/dockers/docker-fpm-frr/TS b/dockers/docker-fpm-frr/TS new file mode 100755 index 000000000000..78ba24d5db63 --- /dev/null +++ b/dockers/docker-fpm-frr/TS @@ -0,0 +1,40 @@ +#!/bin/bash + +# Check whether the routemap is for internal BGP sessions. +function is_internal_route_map() +{ + [[ "$1" =~ .*"_INTERNAL_".* ]] +} + +function check_not_installed() +{ + c=0 + config=$(vtysh -c "show run") + for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6'); + do + is_internal_route_map $route_map_name && continue + echo "$config" | egrep -q "^route-map $route_map_name permit 20$" + c=$((c+$?)) + echo "$config" | egrep -q "^route-map $route_map_name deny 30$" + c=$((c+$?)) + done + return $c +} + +function check_installed() +{ + c=0 + e=0 + config=$(vtysh -c "show run") + for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6'); + do + is_internal_route_map $route_map_name && continue + echo "$config" | egrep -q "^route-map $route_map_name permit 20$" + c=$((c+$?)) + e=$((e+1)) + echo "$config" | egrep -q "^route-map $route_map_name deny 30$" + c=$((c+$?)) + e=$((e+1)) + done + return $((e-c)) +} diff --git a/dockers/docker-fpm-frr/TSA b/dockers/docker-fpm-frr/TSA index 524e4297d1c0..6312bf0ba5e6 100755 --- a/dockers/docker-fpm-frr/TSA +++ b/dockers/docker-fpm-frr/TSA @@ -1,18 +1,7 @@ #!/bin/bash -function check_not_installed() -{ - c=0 - config=$(vtysh -c "show run") - for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p'); - do - echo "$config" | egrep -q "^route-map $route_map_name permit 20$" - c=$((c+$?)) - echo "$config" | egrep -q "^route-map $route_map_name deny 30$" - c=$((c+$?)) - done - return $c -} +# Load the common functions +source /usr/bin/TS check_not_installed not_installed=$? @@ -21,6 +10,7 @@ then TSA_FILE=$(mktemp) for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p'); do + is_internal_route_map $route_map_name && continue case "$route_map_name" in *V4*) ip_version=V4 diff --git a/dockers/docker-fpm-frr/TSB b/dockers/docker-fpm-frr/TSB index 8592ad76cf69..44f9b15aea27 100755 --- a/dockers/docker-fpm-frr/TSB +++ b/dockers/docker-fpm-frr/TSB @@ -1,21 +1,7 @@ #!/bin/bash -function check_installed() -{ - c=0 - e=0 - config=$(vtysh -c "show run") - for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p'); - do - echo "$config" | egrep -q "^route-map $route_map_name permit 20$" - c=$((c+$?)) - e=$((e+1)) - echo "$config" | egrep -q "^route-map $route_map_name deny 30$" - c=$((c+$?)) - e=$((e+1)) - done - return $((e-c)) -} +# Load the common functions +source /usr/bin/TS check_installed installed=$? @@ -24,6 +10,7 @@ then TSB_FILE=$(mktemp) for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p'); do + is_internal_route_map $route_map_name && continue case "$route_map_name" in *V4*) ;; diff --git a/dockers/docker-fpm-frr/TSC b/dockers/docker-fpm-frr/TSC index c7fd8a2ff157..a0e908439e41 100755 --- a/dockers/docker-fpm-frr/TSC +++ b/dockers/docker-fpm-frr/TSC @@ -1,37 +1,7 @@ #!/bin/bash -function check_not_installed() -{ - c=0 - config=$(vtysh -c "show run") - for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6'); - do - echo "$config" | egrep -q "^route-map $route_map_name permit 20$" - c=$((c+$?)) - echo "$config" | egrep -q "^route-map $route_map_name deny 30$" - c=$((c+$?)) - done - return $c -} - -function check_installed() -{ - c=0 - e=0 - config=$(vtysh -c "show run") - for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6'); - do - echo "$config" | egrep -q "^route-map $route_map_name permit 20$" - c=$((c+$?)) - e=$((e+1)) - echo "$config" | egrep -q "^route-map $route_map_name deny 30$" - c=$((c+$?)) - e=$((e+1)) - done - return $((e-c)) -} - -echo "Traffic Shift Check:" +# Load the common functions +source /usr/bin/TS check_not_installed not_installed=$? @@ -48,5 +18,3 @@ then else echo "System Mode: Not consistent" fi - -echo diff --git a/dockers/docker-fpm-frr/base_image_files/TS b/dockers/docker-fpm-frr/base_image_files/TS new file mode 100755 index 000000000000..de1e50b7a306 --- /dev/null +++ b/dockers/docker-fpm-frr/base_image_files/TS @@ -0,0 +1,29 @@ +#!/bin/bash + +# read SONiC immutable variables +[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment + +PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} + +# Parse the device specific asic conf file, if it exists +ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf +[ -f $ASIC_CONF ] && . $ASIC_CONF + +if [[ ($NUM_ASIC -gt 1) ]]; then + asic=0 + NAMESPACE_PREFIX='asic' + + while [ $asic -lt $NUM_ASIC ] + do + # Run TSA/TSB/TSC scripts in BGP instance for frontend ASICs. + sub_role=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['sub_role']" -n $NAMESPACE_PREFIX$asic` + if [ $sub_role == 'FrontEnd' ] + then + echo -e "BGP"$asic" : \c" + docker exec -i bgp$asic /usr/bin/$1 + fi + asic=$[$asic+1] + done +else + docker exec -i bgp /usr/bin/$1 +fi diff --git a/dockers/docker-fpm-frr/base_image_files/TSA b/dockers/docker-fpm-frr/base_image_files/TSA index 95c7957f7dc1..e96c76dd67b2 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSA +++ b/dockers/docker-fpm-frr/base_image_files/TSA @@ -1,3 +1,3 @@ #!/bin/bash -docker exec -i bgp /usr/bin/TSA +/usr/bin/TS TSA diff --git a/dockers/docker-fpm-frr/base_image_files/TSB b/dockers/docker-fpm-frr/base_image_files/TSB index f292d2031db3..176b10c684c8 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSB +++ b/dockers/docker-fpm-frr/base_image_files/TSB @@ -1,3 +1,3 @@ #!/bin/bash -docker exec -i bgp /usr/bin/TSB +/usr/bin/TS TSB diff --git a/dockers/docker-fpm-frr/base_image_files/TSC b/dockers/docker-fpm-frr/base_image_files/TSC index b8136ae4f4c3..09d1409c50c7 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSC +++ b/dockers/docker-fpm-frr/base_image_files/TSC @@ -1,5 +1,5 @@ #!/bin/bash -docker exec -i bgp /usr/bin/TSC +/usr/bin/TS TSC portstat -p 5 diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index 9568d4821547..cf0b0f0077c6 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -33,6 +33,7 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} route-map HIDE_INTERNAL permit 10 set community local-AS +{% set multi_asic = True %} ! {% endif %} ! @@ -54,7 +55,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} ! {# set router-id #} -{% if multi_asic() %} +{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }} {% else %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }} @@ -62,7 +63,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {# advertise loopback #} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 -{% if multi_asic() %} +{% if multi_asic is defined %} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL {% endif %} ! @@ -71,7 +72,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64 exit-address-family {% endif %} -{% if multi_asic() %} +{% if multi_asic is defined %} {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %} address-family ipv6 network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/64 route-map HIDE_INTERNAL diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 index e0e23b7f60c8..198c4bffc318 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 @@ -10,6 +10,7 @@ neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V4 ! {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} + neighbor {{ neighbor_addr }} next-hop-self force neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V4 in {% endif %} ! @@ -18,6 +19,7 @@ neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V6 ! {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} + neighbor {{ neighbor_addr }} next-hop-self force neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V6 in {% endif %} {% endif %} @@ -26,7 +28,6 @@ neighbor {{ neighbor_addr }} route-reflector-client {% endif %} ! - neighbor {{ neighbor_addr }} next-hop-self force ! neighbor {{ neighbor_addr }} activate exit-address-family diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 index 323c13447ed0..c0ee4d99b796 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 @@ -8,6 +8,7 @@ neighbor INTERNAL_PEER_V4 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V4 allowas-in 1 neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out exit-address-family @@ -16,6 +17,7 @@ neighbor INTERNAL_PEER_V6 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V6 allowas-in 1 neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out exit-address-family diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/policies.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/policies.conf.j2 index 81d3b0041179..855a68635653 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/policies.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/policies.conf.j2 @@ -2,6 +2,7 @@ ! template: bgpd/templates/internal/policies.conf.j2 ! ! +{% from "common/functions.conf.j2" import get_ipv4_loopback_address %} ! route-map FROM_BGP_INTERNAL_PEER_V4 permit 100 ! @@ -9,8 +10,8 @@ route-map TO_BGP_INTERNAL_PEER_V4 permit 100 ! ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 1 - on-match next set ipv6 next-hop prefer-global + on-match next ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 100 ! @@ -18,10 +19,10 @@ route-map TO_BGP_INTERNAL_PEER_V6 permit 100 ! {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} route-map FROM_BGP_INTERNAL_PEER_V4 permit 2 - set originator-id {{ loopback0_ipv4 | ip }} + set originator-id {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }} ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 2 - set originator-id {{ loopback0_ipv4 | ip }} + set originator-id {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }} {% endif %} ! ! end of template: bgpd/templates/internal/policies.conf.j2 diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index bf8db48079e0..9bbfd69e8d5b 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -26,5 +26,6 @@ COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +COPY ["etc/wpa_supplicant.conf", "/etc/wpa_supplicant.conf"] -# ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-macsec/critical_processes b/dockers/docker-macsec/critical_processes index e69de29bb2d1..e11933a7547f 100644 --- a/dockers/docker-macsec/critical_processes +++ b/dockers/docker-macsec/critical_processes @@ -0,0 +1 @@ +program:macsecmgrd diff --git a/dockers/docker-macsec/etc/wpa_supplicant.conf b/dockers/docker-macsec/etc/wpa_supplicant.conf new file mode 100644 index 000000000000..a49bf6767d8a --- /dev/null +++ b/dockers/docker-macsec/etc/wpa_supplicant.conf @@ -0,0 +1,3 @@ +eapol_version=3 +ap_scan=0 +fast_reauth=1 \ No newline at end of file diff --git a/dockers/docker-macsec/supervisord.conf b/dockers/docker-macsec/supervisord.conf index e69de29bb2d1..5bd0af35887b 100644 --- a/dockers/docker-macsec/supervisord.conf +++ b/dockers/docker-macsec/supervisord.conf @@ -0,0 +1,38 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[eventlistener:dependent-startup] +command=python3 -m supervisord_dependent_startup +autostart=true +autorestart=unexpected +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE +buffer_size=25 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name macsec +events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING +autostart=true +autorestart=unexpected + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true + +[program:macsecmgrd] +command=/usr/bin/macsecmgrd +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running \ No newline at end of file diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py index 6c938230d210..5455f5923571 100755 --- a/dockers/docker-orchagent/enable_counters.py +++ b/dockers/docker-orchagent/enable_counters.py @@ -34,6 +34,7 @@ def enable_counters(): enable_counter_group(db, 'QUEUE') enable_counter_group(db, 'PFCWD') enable_counter_group(db, 'PG_WATERMARK') + enable_counter_group(db, 'PG_DROP') enable_counter_group(db, 'QUEUE_WATERMARK') enable_counter_group(db, 'BUFFER_POOL_WATERMARK') enable_counter_group(db, 'PORT_BUFFER_DROP') diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 538f251c2621..af68c8c38ab7 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -87,7 +87,7 @@ dependent_startup_wait_for=swssconfig:exited command=/usr/bin/coppmgrd priority=6 autostart=false -autorestart=unexpected +autorestart=false startretries=0 startsecs=0 stdout_logfile=syslog diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 index 5cbfd60322e1..9312a1a20c14 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -40,15 +40,18 @@ dependent_startup_wait_for=rsyslogd:running {# Router advertiser should only run on ToR (T0) devices which have #} {# at least one VLAN interface which has an IPv6 address asigned #} +{# But not for specific deployment_id #} {%- set vlan_v6 = namespace(count=0) -%} -{%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} - {%- if VLAN_INTERFACE -%} - {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} - {# If this VLAN has an IPv6 address... #} - {%- if prefix | ipv6 -%} - {%- set vlan_v6.count = vlan_v6.count + 1 -%} - {%- endif -%} - {%- endfor -%} +{%- if DEVICE_METADATA.localhost.deployment_id != "8" -%} + {%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} + {%- if VLAN_INTERFACE -%} + {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} + {# If this VLAN has an IPv6 address... #} + {%- if prefix | ipv6 -%} + {%- set vlan_v6.count = vlan_v6.count + 1 -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} {%- endif -%} {%- endif -%} diff --git a/dockers/docker-sonic-telemetry/telemetry.sh b/dockers/docker-sonic-telemetry/telemetry.sh index 0fd80fcbfcc8..1f92657e3b8f 100755 --- a/dockers/docker-sonic-telemetry/telemetry.sh +++ b/dockers/docker-sonic-telemetry/telemetry.sh @@ -46,13 +46,12 @@ elif [ -n "$X509" ]; then TELEMETRY_ARGS+=" --ca_crt $CA_CRT" fi else - TELEMETRY_ARGS+=" --insecure" + TELEMETRY_ARGS+=" --noTLS" fi # If no configuration entry exists for TELEMETRY, create one default port if [ -z "$GNMI" ]; then PORT=8080 - sonic-db-cli CONFIG_DB hset "TELEMETRY|gnmi" port $PORT else PORT=$(echo $GNMI | jq -r '.port') fi diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index ee4c61b710d0..1e77a934ba1d 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -511,6 +511,14 @@ write_platform_specific_cmdline() { aboot_machine=arista_7050cx3_32s flash_size=3700 fi + if [ "$sid" = "Marysville" ]; then + aboot_machine=arista_7050sx3_48yc8 + flash_size=7382 + fi + if [ "$sid" = "Marysville10" ]; then + aboot_machine=arista_7050sx3_48c8 + flash_size=7382 + fi if [ "$sid" = "BlackhawkO" ]; then aboot_machine=arista_7060px4_32 flash_size=28000 @@ -521,19 +529,21 @@ write_platform_specific_cmdline() { fi if [ "$sid" = "Smartsville" ]; then aboot_machine=arista_7280cr3_32p4 - flash_size=7382 fi if [ "$sid" = "SmartsvilleBK" ]; then aboot_machine=arista_7280cr3k_32p4 - flash_size=7382 + fi + if [ "$sid" = "SmartsvilleBkMs" ] || [ "$sid" = "SmartsvilleBkMsTpm" ]; then + aboot_machine=arista_7280cr3mk_32p4 fi if [ "$sid" = "SmartsvilleDD" ]; then aboot_machine=arista_7280cr3_32d4 - flash_size=7382 fi if [ "$sid" = "SmartsvilleDDBK" ]; then aboot_machine=arista_7280cr3k_32d4 - flash_size=7382 + fi + if [ "$sid" = "SmartsvilleDDBkMs" ] || [ "$sid" = "SmartsvilleDDBkMsTpm" ]; then + aboot_machine=arista_7280cr3mk_32d4 fi if [ "$sid" = "Clearwater2" ]; then aboot_machine=arista_7800r3_48cq2_lc @@ -548,6 +558,10 @@ write_platform_specific_cmdline() { flash_size=30000 sonic_mode=$supervisor_mode fi + if [ "$sid" = "SmartsvilleBkMs" ]; then + aboot_machine=arista_7280cr3mk_32p4 + flash_size=7382 + fi if in_array "$platform" "rook" "magpie" "woodpecker" "sprucefish"; then cmdline_add tsc=reliable cmdline_add pcie_ports=native diff --git a/files/apt/sources.list.amd64 b/files/apt/sources.list.amd64 index 4a94e3161ab1..45902be1078c 100644 --- a/files/apt/sources.list.amd64 +++ b/files/apt/sources.list.amd64 @@ -6,3 +6,8 @@ deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster mai deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster-backports main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ buster_updates main contrib non-free +deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ buster_updates main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-backports main contrib non-free diff --git a/files/apt/sources.list.arm64 b/files/apt/sources.list.arm64 index dd82c744de1d..58b84978d023 100644 --- a/files/apt/sources.list.arm64 +++ b/files/apt/sources.list.arm64 @@ -6,3 +6,8 @@ deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free deb [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free deb-src [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free deb [arch=arm64] http://ftp.debian.org/debian buster-backports main +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free +deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-backports main diff --git a/files/apt/sources.list.armhf b/files/apt/sources.list.armhf index 760906188a94..eb6fe3be6889 100644 --- a/files/apt/sources.list.armhf +++ b/files/apt/sources.list.armhf @@ -6,3 +6,8 @@ deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free deb [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free deb-src [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free deb [arch=armhf] http://ftp.debian.org/debian buster-backports main +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free +deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-backports main diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index d501a663feba..b7b590a1036a 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -2,6 +2,8 @@ Description=DHCP relay container Requires=updategraph.service After=updategraph.service swss.service syncd.service teamd.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -15,4 +17,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/gbsyncd.service.j2 b/files/build_templates/gbsyncd.service.j2 index e1080ae7d526..b33dfea6b00d 100644 --- a/files/build_templates/gbsyncd.service.j2 +++ b/files/build_templates/gbsyncd.service.j2 @@ -5,6 +5,8 @@ ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json After=database.service updategraph.service After=interfaces-config.service After=swss.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service [Service] @@ -15,4 +17,4 @@ ExecStart=/usr/local/bin/gbsyncd.sh wait ExecStop=/usr/local/bin/gbsyncd.sh stop [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/iccpd.service.j2 b/files/build_templates/iccpd.service.j2 index 979c45de72c5..d78407a87be3 100644 --- a/files/build_templates/iccpd.service.j2 +++ b/files/build_templates/iccpd.service.j2 @@ -2,6 +2,8 @@ Description=ICCPD container Requires=updategraph.service swss.service After=updategraph.service swss.service +BindsTo=sonic.target +After=sonic.target [Service] User={{ sonicadmin_user }} @@ -10,4 +12,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] -WantedBy=multi-user.target swss.service +WantedBy=sonic.target swss.service diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 0cf85cd8ab06..b8ed7c1453e7 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -34,6 +34,7 @@ {%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %} {%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %} {%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", false, "enabled")) %}{% endif %} +{%- if include_macsec == "y" %}{% do features.append(("macsec", "disabled", false, "enabled")) %}{% endif %} {%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %} "FEATURE": { {# has_timer field if set, will start the feature systemd .timer unit instead of .service unit #} diff --git a/files/build_templates/macsec.service.j2 b/files/build_templates/macsec.service.j2 new file mode 100644 index 000000000000..85229d1aea10 --- /dev/null +++ b/files/build_templates/macsec.service.j2 @@ -0,0 +1,17 @@ +[Unit] +Description=MACsec container +Requires=swss.service +After=swss.service syncd.service +StartLimitIntervalSec=1200 +StartLimitBurst=3 + +[Service] +User=root +ExecStartPre=/usr/bin/macsec.sh start +ExecStart=/usr/bin/macsec.sh wait +ExecStop=/usr/bin/macsec.sh stop +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/files/build_templates/mgmt-framework.service.j2 b/files/build_templates/mgmt-framework.service.j2 index 883711aa82eb..1eb983a897fb 100644 --- a/files/build_templates/mgmt-framework.service.j2 +++ b/files/build_templates/mgmt-framework.service.j2 @@ -2,6 +2,8 @@ Description=Management Framework container Requires=database.service After=database.service swss.service syncd.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service [Service] @@ -9,4 +11,3 @@ User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop - diff --git a/files/build_templates/mgmt-framework.timer b/files/build_templates/mgmt-framework.timer index 62ab8ef1bd58..37389fbc6db5 100644 --- a/files/build_templates/mgmt-framework.timer +++ b/files/build_templates/mgmt-framework.timer @@ -1,9 +1,11 @@ [Unit] Description=Delays management framework container until SONiC has started +PartOf=mgmt-framework.service [Timer] +OnUnitActiveSec=0 sec OnBootSec=3min 30 sec Unit=mgmt-framework.service [Install] -WantedBy=timers.target +WantedBy=timers.target sonic.target diff --git a/files/build_templates/nat.service.j2 b/files/build_templates/nat.service.j2 index 1d267cfe9302..10dc7cadf18c 100644 --- a/files/build_templates/nat.service.j2 +++ b/files/build_templates/nat.service.j2 @@ -2,6 +2,8 @@ Description=NAT container Requires=updategraph.service After=updategraph.service swss.service syncd.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -15,5 +17,5 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/pcie-check.timer b/files/build_templates/pcie-check.timer deleted file mode 100644 index 4ad5c6481861..000000000000 --- a/files/build_templates/pcie-check.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Start the pcie-check.service 10 seconds after boot - -[Timer] -OnBootSec=10sec -Unit=pcie-check.service - -[Install] -WantedBy=timers.target diff --git a/files/build_templates/per_namespace/bgp.service.j2 b/files/build_templates/per_namespace/bgp.service.j2 index 9f3c72e20db5..5ba49ffc441a 100644 --- a/files/build_templates/per_namespace/bgp.service.j2 +++ b/files/build_templates/per_namespace/bgp.service.j2 @@ -4,6 +4,8 @@ Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service After=database{% if multi_instance == 'true' %}@%i{% endif %}.service Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -18,4 +20,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/lldp.service.j2 b/files/build_templates/per_namespace/lldp.service.j2 index b48675b03202..fca84462934b 100644 --- a/files/build_templates/per_namespace/lldp.service.j2 +++ b/files/build_templates/per_namespace/lldp.service.j2 @@ -6,6 +6,10 @@ After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service After=syncd{% if multi_instance == 'true' %}@%i{% endif %}.service Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -19,4 +23,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/swss.service.j2 b/files/build_templates/per_namespace/swss.service.j2 index 352d1593a60b..5fb86929d3ba 100644 --- a/files/build_templates/per_namespace/swss.service.j2 +++ b/files/build_templates/per_namespace/swss.service.j2 @@ -12,7 +12,9 @@ Requires=opennsl-modules.service Requires=updategraph.service After=updategraph.service After=interfaces-config.service -Before=ntp-config.service +BindsTo=sonic.target +After=sonic.target +Before=ntp-config.service pmon.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -26,4 +28,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/syncd.service.j2 b/files/build_templates/per_namespace/syncd.service.j2 index 8e0029a29421..9acf97c29fd4 100644 --- a/files/build_templates/per_namespace/syncd.service.j2 +++ b/files/build_templates/per_namespace/syncd.service.j2 @@ -17,6 +17,8 @@ After=nps-modules.service Requires=updategraph.service After=updategraph.service After=interfaces-config.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service [Service] @@ -30,4 +32,4 @@ TimeoutStartSec=480 {% endif %} [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/teamd.service.j2 b/files/build_templates/per_namespace/teamd.service.j2 index f5936baa6a79..7dff23fb83e9 100644 --- a/files/build_templates/per_namespace/teamd.service.j2 +++ b/files/build_templates/per_namespace/teamd.service.j2 @@ -7,6 +7,8 @@ After=topology.service {% endif %} Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -20,4 +22,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index 9195b4d38ad6..59d9e6c3319a 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -5,6 +5,8 @@ After=database.service updategraph.service {% if sonic_asic_platform == 'mellanox' %} After=syncd.service {% endif %} +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -18,4 +20,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 5cf25a21046d..0427b7e60505 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -3,6 +3,8 @@ Description=Router advertiser container Requires=updategraph.service After=updategraph.service swss.service syncd.service Before=ntp-config.service +BindsTo=sonic.target +After=sonic.target StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -15,4 +17,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/restapi.service.j2 b/files/build_templates/restapi.service.j2 index df1a50eb56c7..edc18167e93a 100644 --- a/files/build_templates/restapi.service.j2 +++ b/files/build_templates/restapi.service.j2 @@ -2,6 +2,8 @@ Description=RestAPI container Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service [Service] @@ -13,4 +15,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=sonic.target diff --git a/files/build_templates/sflow.service.j2 b/files/build_templates/sflow.service.j2 index e9d5a871432d..3d6a3c7f569d 100644 --- a/files/build_templates/sflow.service.j2 +++ b/files/build_templates/sflow.service.j2 @@ -2,6 +2,8 @@ Description=sFlow container Requisite=swss.service After=swss.service syncd.service hostcfgd.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -15,4 +17,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 4997ab737e37..a510aac5571d 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -3,8 +3,9 @@ Description=SNMP container Requires=updategraph.service Requisite=swss.service After=updategraph.service swss.service syncd.service +BindsTo=sonic.target +After=sonic.target Before=ntp-config.service -Conflicts=snmp.timer StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -14,4 +15,3 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop Restart=always RestartSec=30 - diff --git a/files/build_templates/snmp.timer b/files/build_templates/snmp.timer index 1b3ccf633ce4..abbcb67f6dee 100644 --- a/files/build_templates/snmp.timer +++ b/files/build_templates/snmp.timer @@ -1,6 +1,6 @@ [Unit] Description=Delays snmp container until SONiC has started -Conflicts=snmp.service +PartOf=snmp.service After=swss.service [Timer] diff --git a/files/build_templates/sonic.target b/files/build_templates/sonic.target new file mode 100644 index 000000000000..4070e21a080e --- /dev/null +++ b/files/build_templates/sonic.target @@ -0,0 +1,5 @@ +[Unit] +Description=SONiC services target. + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 1589ba708bd7..54c428b8ee95 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -389,12 +389,23 @@ sudo cp $IMAGE_CONFIGS/corefile_uploader/core_analyzer.rc.json $FILESYSTEM_ROOT_ sudo chmod og-rw $FILESYSTEM_ROOT_ETC_SONIC/core_analyzer.rc.json sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libffi-dev libssl-dev + +if [[ $CONFIGURED_ARCH == armhf ]]; then + # The azure-storage package depends on the cryptography package. Newer + # versions of cryptography require the rust compiler, the correct version + # for which is not readily available in buster. Hence we pre-install an + # older version here to satisfy the azure-storage dependency. + # Note: This is not a problem for other architectures as pre-built versions + # of cryptography are available for those. This sequence can be removed + # after upgrading to debian bullseye. + sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install cryptography==3.3.1 +fi sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install azure-storage==0.36.0 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchdog==0.10.3 {% if include_kubernetes == "y" %} # Install remote Container mgmt package -# Required even if include_kubernetes != y, as it contains the +# Required even if include_kubernetes != y, as it contains the # the container wrapper for docker start/stop/wait commands. # SONIC_CTRMGMT_WHEEL_NAME=$(basename {{sonic_ctrmgmt_py3_wheel_path}}) @@ -418,7 +429,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ctrmgrd.service # kubelet service is controlled by ctrmgrd daemon. sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable kubelet.service {% else %} -# container script for docker commands, which is required as +# container script for docker commands, which is required as # all docker commands are replaced with container commands. # So just copy that file only. # @@ -496,10 +507,6 @@ sudo cp $IMAGE_CONFIGS/constants/constants.yml $FILESYSTEM_ROOT/etc/sonic/ sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ sudo cp $IMAGE_CONFIGS/sudoers/sudoers.lecture $FILESYSTEM_ROOT/etc/ -# Copy systemd timer configuration -sudo cp $BUILD_TEMPLATES/pcie-check.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable pcie-check.timer - # Copy pcie-check service files sudo cp $IMAGE_CONFIGS/pcie-check/pcie-check.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM echo "pcie-check.service" | sudo tee -a $GENERATED_SERVICE_FILE @@ -591,6 +598,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS ta {% endif %} {% endfor %} +# Copy docker_image_ctl.j2 for SONiC Package Manager +sudo cp $BUILD_TEMPLATES/docker_image_ctl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/docker_image_ctl.j2 + {% if include_kubernetes == "y" %} ## Pull in kubernetes docker images echo "pulling universal k8s images ..." @@ -675,6 +685,9 @@ sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_S echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE {% endif %} +sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python-dev python3-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index 43fa039156d7..aa02e75ac07b 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -3,6 +3,8 @@ Description=Telemetry container Requires=database.service After=database.service swss.service syncd.service Before=ntp-config.service +BindsTo=sonic.target +After=sonic.target StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -13,4 +15,3 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop Restart=always RestartSec=30 - diff --git a/files/build_templates/telemetry.timer b/files/build_templates/telemetry.timer index e08f1c09eac6..4a605b8c50cb 100644 --- a/files/build_templates/telemetry.timer +++ b/files/build_templates/telemetry.timer @@ -1,9 +1,11 @@ [Unit] Description=Delays telemetry container until SONiC has started +PartOf=telemetry.service [Timer] +OnUnitActiveSec=0 sec OnBootSec=3min 30 sec Unit=telemetry.service [Install] -WantedBy=timers.target +WantedBy=timers.target sonic.target diff --git a/files/image_config/hostname/hostname-config.service b/files/image_config/hostname/hostname-config.service index c23ae10227a4..c82c2d0bf54e 100644 --- a/files/image_config/hostname/hostname-config.service +++ b/files/image_config/hostname/hostname-config.service @@ -2,10 +2,13 @@ Description=Update hostname based on configdb Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=oneshot +RemainAfterExit=yes ExecStart=/usr/bin/hostname-config.sh [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 71178affdee8..a3f715764616 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -2,10 +2,13 @@ Description=Update interfaces configuration Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=oneshot +RemainAfterExit=yes ExecStart=/usr/bin/interfaces-config.sh [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index a22a0331045d..5639b04520e0 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -2,12 +2,15 @@ Description=Update NTP configuration Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target Before=ntp.service StartLimitIntervalSec=0 [Service] Type=oneshot +RemainAfterExit=yes ExecStart=/usr/bin/ntp-config.sh [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/image_config/ntp/ntp.service b/files/image_config/ntp/ntp.service index acfd7e17266a..32a55dea892e 100644 --- a/files/image_config/ntp/ntp.service +++ b/files/image_config/ntp/ntp.service @@ -3,6 +3,8 @@ Description=Network Time Service Documentation=man:ntpd(8) After=network.target Conflicts=systemd-timesyncd.service +BindsTo=sonic.target +After=sonic.target StartLimitIntervalSec=0 [Service] diff --git a/files/image_config/pcie-check/pcie-check.service b/files/image_config/pcie-check/pcie-check.service index fbf3cfd3f19d..9df04ea840bc 100644 --- a/files/image_config/pcie-check/pcie-check.service +++ b/files/image_config/pcie-check/pcie-check.service @@ -5,3 +5,6 @@ After=rc.local.service database.service [Service] Type=simple ExecStart=/usr/bin/pcie-check.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/pcie-check/pcie-check.sh b/files/image_config/pcie-check/pcie-check.sh index 4257a2544c4a..01a952d01374 100755 --- a/files/image_config/pcie-check/pcie-check.sh +++ b/files/image_config/pcie-check/pcie-check.sh @@ -19,7 +19,7 @@ function check_and_rescan_pcie_devices() PCIE_CHK_CMD='sudo pcieutil check | grep "$RESULTS"' PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - if [ ! -f /usr/share/sonic/device/$PLATFORM/plugins/pcie.yaml ]; then + if [ ! -f /usr/share/sonic/device/$PLATFORM/pcie.yaml ]; then debug "pcie.yaml does not exist! Can't check PCIe status!" exit fi diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index ee62a36ccf2d..34c56fb0e00b 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -2,10 +2,13 @@ Description=Update rsyslog configuration Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=oneshot +RemainAfterExit=yes ExecStart=/usr/bin/rsyslog-config.sh [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 8ec8799c7cca..fbe4cf1f7f91 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -20,6 +20,7 @@ Defaults lecture_file = /etc/sudoers.lecture # Cmnd alias specification # Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC Cmnd_Alias READ_ONLY_CMDS = /bin/cat /var/log/syslog*, \ + /bin/ip netns identify [0-9]*, \ /sbin/brctl show, \ /usr/bin/docker exec snmp cat /etc/snmp/snmpd.conf, \ /usr/bin/docker exec bgp cat /etc/quagga/bgpd.conf, \ @@ -33,13 +34,13 @@ Cmnd_Alias READ_ONLY_CMDS = /bin/cat /var/log/syslog*, \ /usr/bin/vtysh -n [0-9] -c show *, \ /usr/local/bin/decode-syseeprom, \ /usr/local/bin/generate_dump, \ + /usr/local/bin/ipintutil, \ /usr/local/bin/lldpshow, \ /usr/local/bin/pcieutil *, \ /usr/local/bin/psuutil *, \ /usr/local/bin/sonic-installer list, \ - /usr/local/bin/sfputil show *, \ - /bin/ip netns identify [0-9]* - + /usr/local/bin/sfputil show * + Cmnd_Alias PASSWD_CMDS = /usr/local/bin/config tacacs passkey *, \ /usr/sbin/chpasswd * diff --git a/files/image_config/topology/topology.sh b/files/image_config/topology/topology.sh index aba7565c8213..2f038095be62 100755 --- a/files/image_config/topology/topology.sh +++ b/files/image_config/topology/topology.sh @@ -1,21 +1,49 @@ #!/bin/bash # This script is invoked by topology.service only -# for multi-asic virtual platform. For multi-asic platform -# multiple Database instances are present +# for multi-asic virtual platform. For multi-asic platform +# multiple Database instances are present # and HWKSU information is retrieved from first database instance. # +get_hwsku() { + # Get HWSKU from config_db. If HWSKU is not available in config_db + # get HWSKU from minigraph.xml if minigraph file exists. + HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]' 2>&1` + if [[ $? -ne 0 || $HWSKU == "" ]]; then + if [[ -f "/etc/sonic/minigraph.xml" ]]; then + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']" 2>&1` + if [[ $? -ne 0 || $HWSKU == "" ]]; then + HWSKU="" + fi + else + HWSKU="" + fi + fi + echo "${HWSKU}" +} + start() { TOPOLOGY_SCRIPT="topology.sh" - PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} - HWSKU=${HWSKU:-`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`} - /usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT start + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` + HWSKU=`get_hwsku` + if [[ $HWSKU != "" ]]; then + /usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT start + else + echo "Failed to get HWSKU" + exit 1 + fi } + stop() { TOPOLOGY_SCRIPT="topology.sh" - PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} - HWSKU=${HWSKU:-`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`} - usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT stop + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` + HWSKU=`get_hwsku` + if [[ $HWSKU != "" ]]; then + /usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT stop + else + echo "Failed to get HWSKU" + exit 1 + fi } # read SONiC immutable variables diff --git a/files/scripts/supervisor-proc-exit-listener b/files/scripts/supervisor-proc-exit-listener index e8565b4d52f2..7bf3059b5e9a 100755 --- a/files/scripts/supervisor-proc-exit-listener +++ b/files/scripts/supervisor-proc-exit-listener @@ -8,6 +8,7 @@ import signal import sys import syslog import time +from collections import defaultdict import swsssdk @@ -64,7 +65,7 @@ def get_critical_group_and_process_list(): return critical_group_list, critical_process_list -def generate_alerting_message(process_name): +def generate_alerting_message(process_name, dead_minutes): """ @summary: If a critical process was not running, this function will determine it resides in host or in a specific namespace. Then an alerting message will be written into syslog. @@ -77,7 +78,8 @@ def generate_alerting_message(process_name): else: namespace = namespace_prefix + namespace_id - syslog.syslog(syslog.LOG_ERR, "Process '{}' is not running in namespace '{}'.".format(process_name, namespace)) + syslog.syslog(syslog.LOG_ERR, "Process '{}' is not running in namespace '{}' ({} minutes)." + .format(process_name, namespace, dead_minutes)) def get_autorestart_state(container_name): @@ -118,7 +120,7 @@ def main(argv): critical_group_list, critical_process_list = get_critical_group_and_process_list() - process_under_alerting = {} + process_under_alerting = defaultdict(dict) # Transition from ACKNOWLEDGED to READY childutils.listener.ready() @@ -145,7 +147,8 @@ def main(argv): syslog.syslog(syslog.LOG_INFO, msg) os.kill(os.getppid(), signal.SIGTERM) else: - process_under_alerting[process_name] = time.time() + process_under_alerting[process_name]["last_alerted"] = time.time() + process_under_alerting[process_name]["dead_minutes"] = 0 # Handle the PROCESS_STATE_RUNNING event elif headers['eventname'] == 'PROCESS_STATE_RUNNING': @@ -162,11 +165,14 @@ def main(argv): childutils.listener.ready() # Check whether we need write alerting messages into syslog - for process in process_under_alerting.keys(): + for process_name in process_under_alerting.keys(): epoch_time = time.time() - if epoch_time - process_under_alerting[process] >= ALERTING_INTERVAL_SECS: - process_under_alerting[process] = epoch_time - generate_alerting_message(process) + elapsed_secs = epoch_time - process_under_alerting[process_name]["last_alerted"] + if elapsed_secs >= ALERTING_INTERVAL_SECS: + elapsed_mins = elapsed_secs // 60 + process_under_alerting[process_name]["last_alerted"] = epoch_time + process_under_alerting[process_name]["dead_minutes"] += elapsed_mins + generate_alerting_message(process_name, process_under_alerting[process_name]["dead_minutes"]) if __name__ == "__main__": diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 1c54aefb0c0b..97e50cb975e7 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -110,14 +110,6 @@ start_peer_and_dependent_services() { stop_peer_and_dependent_services() { # if warm/fast start enabled or peer lock exists, don't stop peer service docker if [[ x"$WARM_BOOT" != x"true" ]] && [[ x"$FAST_BOOT" != x"true" ]]; then - if [[ ! -z $DEV ]]; then - /bin/systemctl stop ${PEER}@$DEV - else - /bin/systemctl stop ${PEER} - fi - for dep in ${DEPENDENT}; do - /bin/systemctl stop ${dep} - done for dep in ${MULTI_INST_DEPENDENT}; do if [[ ! -z $DEV ]]; then /bin/systemctl stop ${dep}@$DEV @@ -125,7 +117,14 @@ stop_peer_and_dependent_services() { /bin/systemctl stop ${dep} fi done - + for dep in ${DEPENDENT}; do + /bin/systemctl stop ${dep} + done + if [[ ! -z $DEV ]]; then + /bin/systemctl stop ${PEER}@$DEV + else + /bin/systemctl stop ${PEER} + fi fi } @@ -147,7 +146,7 @@ start() { $SONIC_DB_CLI ASIC_DB FLUSHDB $SONIC_DB_CLI COUNTERS_DB FLUSHDB $SONIC_DB_CLI FLEX_COUNTER_DB FLUSHDB - clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*'" + clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*', '*MUX_CABLE_TABLE*'" fi # start service docker diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk index 1db534775acd..5abcd3fe4655 100644 --- a/platform/barefoot/bfn-platform.mk +++ b/platform/barefoot/bfn-platform.mk @@ -1,4 +1,4 @@ -BFN_PLATFORM = bfnplatform_20201228_deb10.deb +BFN_PLATFORM = bfnplatform_20210219_deb10.deb $(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_PLATFORM)" SONIC_ONLINE_DEBS += $(BFN_PLATFORM) diff --git a/platform/barefoot/bfn-sai.mk b/platform/barefoot/bfn-sai.mk index 4f6322239d05..54285aa32cd9 100644 --- a/platform/barefoot/bfn-sai.mk +++ b/platform/barefoot/bfn-sai.mk @@ -1,4 +1,4 @@ -BFN_SAI = bfnsdk_20201228_deb10.deb +BFN_SAI = bfnsdk_20210219_deb10.deb $(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_SAI)" $(BFN_SAI)_DEPENDS += $(LIBNL_GENL3_DEV) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 937ea8abc1de..86f7b81834a1 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 937ea8abc1de457b26b7bb7a5208dab6ce40f4a1 +Subproject commit 86f7b81834a1093d1df644b09232ddacb40784ef diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules index b04234a0df1b..4070b66dfdac 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules @@ -6,7 +6,6 @@ SCRIPT_SRC := $(shell pwd)/scripts CONFIGS_SRC := $(shell pwd)/configs BUILD_DIR := $(shell pwd)/build WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel -PLUGINS_DIR := $(shell pwd)/plugins %: dh $@ @@ -24,8 +23,6 @@ override_dh_auto_install: cp -r $(CONFIGS_SRC)/network/interfaces.d/* debian/$(PACKAGE_NAME)/etc/network/interfaces.d/ dh_installdirs -p$(PACKAGE_NAME) usr/share/sonic/device/$(PLATFORM_NAME)/ cp -r $(WHEEL_BUILD_DIR)/* debian/$(PACKAGE_NAME)/usr/share/sonic/device/$(PLATFORM_NAME)/ - dh_installdirs -p$(PACKAGE_NAME) usr/share/sonic/device/$(PLATFORM_NAME)/plugins - cp -r $(PLUGINS_DIR)/* debian/$(PACKAGE_NAME)/usr/share/sonic/device/$(PLATFORM_NAME)/plugins/ override_dh_usrlocal: diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-fancontrol b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-fancontrol new file mode 100755 index 000000000000..7407c2d7241d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-fancontrol @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -m sonic_platform.bfn_extensions.platform_fancontrol "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-sfputil b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-sfputil deleted file mode 100755 index 3df67614e499..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-sfputil +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd sfputil "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom deleted file mode 100755 index 07d98556cbbf..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd eeprom "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol deleted file mode 100755 index 515fcbdd69da..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd fancontrol "$@" - diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info deleted file mode 100755 index 38c9d3330414..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd ps_info "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors index 07af6955321e..5f06a9c99b05 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors @@ -7,6 +7,5 @@ if [ -t 1 ] ; then DOCKER_EXEC_FLAGS+="t" fi -docker exec -$DOCKER_EXEC_FLAGS syncd sensors "$@" - - +python3 -m sonic_platform.bfn_extensions.platform_sensors "$@" +docker exec -$DOCKER_EXEC_FLAGS pmon sensors "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test deleted file mode 100755 index 38327722c91f..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test +++ /dev/null @@ -1 +0,0 @@ -echo "test" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/setup.py b/platform/barefoot/sonic-platform-modules-bfn-montara/setup.py index fc14c94ac4a0..14e1bb6b6c02 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/setup.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/setup.py @@ -12,7 +12,8 @@ maintainer_email='', packages=[ 'sonic_platform', - 'sonic_platform/pltfm_mgr_rpc' + 'sonic_platform/pltfm_mgr_rpc', + 'sonic_platform/bfn_extensions', ], package_data = {'sonic_platform':['logging.conf']}, classifiers=[ diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/__init__.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/__init__.py new file mode 100644 index 000000000000..67517a64e886 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/__init__.py @@ -0,0 +1,4 @@ +__all__ = [ + 'platform_sensors', + 'platform_fancontrol', +] diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_fancontrol.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_fancontrol.py new file mode 100644 index 000000000000..43a700c21dcb --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_fancontrol.py @@ -0,0 +1,59 @@ +import sys + +from sonic_platform.platform_thrift_client import thrift_try + +_MAX_FAN = 10 + +def fan_speed_set(fan, percent): + def set_fan_speed(client): + return client.pltfm_mgr.pltfm_mgr_fan_speed_set(fan, percent) + return thrift_try(set_fan_speed) + +def fan_speed_info_get(): + for fan_num in range(1, _MAX_FAN + 1): + def get_data(client, fan_num=fan_num): + return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num) + fan_info = thrift_try(get_data) + if fan_info.fan_num == fan_num: + yield fan_info + +if __name__ == '__main__': + def print_usage(): + print("Usage: platform_fancontrol.py ", file=sys.stderr) + print(" function: fan_speed_set ", file=sys.stderr) + print(" fan_speed_info_get ", file=sys.stderr) + + argc = len(sys.argv) + if argc == 1: + print_usage() + exit(0) + + if sys.argv[1] == "fan_speed_set": + if argc != 4: + print_usage() + exit(0) + + fan = int(sys.argv[2]) + percent = int(sys.argv[3]) + + if (fan > _MAX_FAN) | (fan < 0): + print("Invalid value for fan #.\n", file=sys.stderr) + print_usage() + exit(0) + + if (percent > 100) | (percent < 0): + print("Invalid value for precent\n", file=sys.stderr) + print_usage() + exit(0) + + fan_speed_set(fan, percent) + exit(0) + + if sys.argv[1] == "fan_speed_info_get": + for fan_info in fan_speed_info_get(): + print("fan number: %d front rpm: %d rear rpm: %d percent: %d%% " % + (fan_info.fan_num, fan_info.front_rpm, fan_info.rear_rpm, fan_info.percent)) + + exit(0) + + print_usage() diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_sensors.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_sensors.py new file mode 100644 index 000000000000..330884ca733b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/bfn_extensions/platform_sensors.py @@ -0,0 +1,26 @@ +import sys +import codecs +import urllib + +from sonic_platform.platform_thrift_client import thrift_try + +def platform_sensors_get(args): + options = "" + if len(args)!=0: + options = urllib.quote(" ".join(args)) + def get_data(client): + return client.pltfm_mgr.pltfm_mgr_sensor_info_get(options) + raw_out = thrift_try(get_data) + raw_list = raw_out.split('\"') + if len(raw_list) >= 2: + sensors_out = raw_list[1] + sensors_out = codecs.decode(sensors_out, "unicode_escape") + return sensors_out + return None + +if __name__ == '__main__': + data = platform_sensors_get(sys.argv[1:]) + if data: + print(data) + else: + print("No sensors info available", file=sys.stderr) diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/configs/network/interfaces.d/eth2 b/platform/barefoot/sonic-platform-modules-bfn-newport/configs/network/interfaces.d/eth2 index 725bc89e0ebb..aded25af63b7 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/configs/network/interfaces.d/eth2 +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/configs/network/interfaces.d/eth2 @@ -1,4 +1,4 @@ # eth cpu port auto eth2 iface eth2 inet -up ifconfig eth2 promisc mtu 9000 +up ifconfig eth2 promisc mtu 9216 diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules index 962a1de8204e..da70905cb239 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules @@ -10,7 +10,6 @@ SCRIPT_SRC := $(shell pwd)/scripts CONFIGS_SRC := $(shell pwd)/configs BUILD_DIR := $(shell pwd)/build WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel -PLUGINS_DIR := $(shell pwd)/plugins MODULE_NAMES := as9516 as9516bf %: @@ -33,8 +32,6 @@ override_dh_auto_install: cp -r $(CONFIGS_SRC)/network/interfaces.d/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/network/interfaces.d/; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/; \ cp -r $(WHEEL_BUILD_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/plugins; \ - cp -r $(PLUGINS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/plugins/; \ done) override_dh_usrlocal: diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts new file mode 120000 index 000000000000..14008f061862 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts @@ -0,0 +1 @@ +../sonic-platform-modules-bfn-montara/scripts \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/bf-sfputil b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/bf-sfputil deleted file mode 100755 index 3df67614e499..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/bf-sfputil +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd sfputil "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/eeprom b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/eeprom deleted file mode 100755 index 07d98556cbbf..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/eeprom +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd eeprom "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/fancontrol b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/fancontrol deleted file mode 100755 index 515fcbdd69da..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/fancontrol +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd fancontrol "$@" - diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/ps_info b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/ps_info deleted file mode 100755 index 38c9d3330414..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/ps_info +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd ps_info "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/sensors b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/sensors deleted file mode 100755 index 07af6955321e..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/sensors +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd sensors "$@" - - diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/test b/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/test deleted file mode 100755 index 38327722c91f..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/scripts/test +++ /dev/null @@ -1 +0,0 @@ -echo "test" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts b/platform/barefoot/sonic-platform-modules-bfn/scripts new file mode 120000 index 000000000000..14008f061862 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts @@ -0,0 +1 @@ +../sonic-platform-modules-bfn-montara/scripts \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/bf-sfputil b/platform/barefoot/sonic-platform-modules-bfn/scripts/bf-sfputil deleted file mode 100755 index 3df67614e499..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/bf-sfputil +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd sfputil "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom b/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom deleted file mode 100755 index 07d98556cbbf..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd eeprom "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol b/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol deleted file mode 100755 index 515fcbdd69da..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd fancontrol "$@" - diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info b/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info deleted file mode 100755 index 38c9d3330414..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd ps_info "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors b/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors deleted file mode 100755 index 07af6955321e..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS syncd sensors "$@" - - diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/test b/platform/barefoot/sonic-platform-modules-bfn/scripts/test deleted file mode 100755 index 38327722c91f..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/scripts/test +++ /dev/null @@ -1 +0,0 @@ -echo "test" diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index f557f17c7cea..e5b3bd7fef96 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -29,6 +29,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS6712_32X_PLATFORM_MODULE) \ $(ACCTON_AS7726_32X_PLATFORM_MODULE) \ $(ACCTON_AS4630_54PE_PLATFORM_MODULE) \ + $(ACCTON_AS4630_54TE_PLATFORM_MODULE) \ $(ACCTON_MINIPACK_PLATFORM_MODULE) \ $(ACCTON_AS5812_54X_PLATFORM_MODULE) \ $(ACCTON_AS5812_54T_PLATFORM_MODULE) \ @@ -62,7 +63,8 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(JUNIPER_QFX5210_PLATFORM_MODULE) \ $(CEL_SILVERSTONE_PLATFORM_MODULE) \ $(JUNIPER_QFX5200_PLATFORM_MODULE) \ - $(DELTA_AGC032_PLATFORM_MODULE) + $(DELTA_AGC032_PLATFORM_MODULE) \ + $(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 395040d7561d..3ccf2d675cbd 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -10,6 +10,7 @@ ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS6712_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7726_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS4630_54PE_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS4630_54TE_PLATFORM_MODULE_VERSION = 1.1 ACCTON_MINIPACK_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION = 1.1 @@ -29,6 +30,7 @@ export ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION export ACCTON_AS6712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS7726_32X_PLATFORM_MODULE_VERSION export ACCTON_AS4630_54PE_PLATFORM_MODULE_VERSION +export ACCTON_AS4630_54TE_PLATFORM_MODULE_VERSION export ACCTON_MINIPACK_PLATFORM_MODULE_VERSION export ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION export ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION @@ -84,6 +86,10 @@ ACCTON_AS4630_54PE_PLATFORM_MODULE = sonic-platform-accton-as4630-54pe_$(ACCTON_ $(ACCTON_AS4630_54PE_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as4630_54pe-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS4630_54PE_PLATFORM_MODULE))) +ACCTON_AS4630_54TE_PLATFORM_MODULE = sonic-platform-accton-as4630-54te_$(ACCTON_AS4630_54TE_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS4630_54TE_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as4630_54te-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS4630_54TE_PLATFORM_MODULE))) + ACCTON_MINIPACK_PLATFORM_MODULE = sonic-platform-accton-minipack_$(ACCTON_MINIPACK_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_MINIPACK_PLATFORM_MODULE)_PLATFORM = x86_64-accton_minipack-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_MINIPACK_PLATFORM_MODULE))) diff --git a/platform/broadcom/platform-modules-ruijie.dep b/platform/broadcom/platform-modules-ruijie.dep new file mode 100644 index 000000000000..8910bfcf2e82 --- /dev/null +++ b/platform/broadcom/platform-modules-ruijie.dep @@ -0,0 +1,8 @@ +MPATH := $($(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/broadcom/platform-modules-ruijie.mk platform/broadcom/platform-modules-ruijie.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(MPATH)) + +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_CACHE_MODE := GIT_CONTENT_SHA +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_DEP_FILES := $(DEP_FILES) diff --git a/platform/broadcom/platform-modules-ruijie.mk b/platform/broadcom/platform-modules-ruijie.mk new file mode 100644 index 000000000000..b712f67fec89 --- /dev/null +++ b/platform/broadcom/platform-modules-ruijie.mk @@ -0,0 +1,10 @@ +# Ruijie platform modules +RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE_VERSION = 1.0 +export RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE_VERSION + +RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE = platform-modules-ruijie-b6510-48vs8cq_$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE_VERSION)_amd64.deb +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ruijie +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE)_PLATFORM = x86_64-ruijie_b6510-48vs8cq-r0 +SONIC_DPKG_DEBS += $(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index fbe0dd689a2e..73bf93c3d7f4 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -12,6 +12,7 @@ include $(PLATFORM_PATH)/platform-modules-quanta.mk #include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/platform-modules-juniper.mk include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk +include $(PLATFORM_PATH)/platform-modules-ruijie.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk include $(PLATFORM_PATH)/docker-saiserver-brcm.mk diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py new file mode 100755 index 000000000000..121b8409a585 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 10/24/2019:Jostar craete for as4630_54te +# ------------------------------------------------------------------ + +try: + import logging +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 3 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + + FAN_NODE_NUM_OF_MAP = 4 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + FAN_NODE_DIR_IDX_OF_MAP = 2 + FAN_NODE_PRESENT_IDX_OF_MAP = 3 + FAN_NODE_SPEED_IDX_OF_MAP = 4 + + BASE_VAL_PATH = '/sys/bus/i2c/devices/3-0060/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/3-0060/fan_duty_cycle_percentage' + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_device_path_mapping = {} + + _fan_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan_fault_1', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan_direction_1', + (FAN_NUM_1_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan_present_1', + (FAN_NUM_1_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan1_input', + + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan_fault_2', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan_direction_2', + (FAN_NUM_2_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan_present_2', + (FAN_NUM_2_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan2_input', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan_fault_3', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan_direction_3', + (FAN_NUM_3_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan_present_3', + (FAN_NUM_3_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan3_input', + } + + def _get_fan_device_node(self, fan_num, node_num): + return self._fan_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except Exception: + logging.debug( + 'GET. unable to close file. device_path:%s', + device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except BaseException: + logging.debug( + 'GET. unable to close file. device_path:%s', + device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + for fan_num in range( + self.FAN_NUM_1_IDX, + self.FAN_NUM_ON_MAIN_BROAD + 1): + for node_num in range( + self.FAN_NODE_FAULT_IDX_OF_MAP, + self.FAN_NODE_NUM_OF_MAP + 1): + self._fan_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_device_node_mapping[(fan_num, node_num)]) + + def get_size_node_map(self): + return len(self._fan_device_node_mapping) + + def get_fan_device_path(self, fan_num, node_num): + return self._fan_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + def get_fan_present(self, fan_num): + return self._get_fan_node_val( + fan_num, self.FAN_NODE_PRESENT_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + + def set_fan_duty_cycle(self, val): + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + fan_file.write(str(val)) + fan_file.close() + return True + + def get_fan_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + if self.get_fan_fault( + fan_num) == 0 and self.get_fan_present(fan_num) > 0: + return 1 + else: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return 0 + + +def main(): + fan = FanUtil() + logging.debug('fan_duty_cycle=%d', fan.get_fan_duty_cycle()) + for i in range(1, 4): + logging.debug('fan-%d speed=%d', i, fan.get_fan_speed(i)) + logging.debug('fan-%d present=%d', i, fan.get_fan_present(i)) + logging.debug('fan-%d fault=%d', i, fan.get_fan_fault(i)) + logging.debug('fan-%d status=%d', i, fan.get_fan_status(i)) + + +if __name__ == '__main__': + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/thermalutil.py new file mode 100755 index 000000000000..15947da12ee3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/thermalutil.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 10/24/2019:Jostar craete for as4630_54te +# ------------------------------------------------------------------ + +try: + import logging + import glob +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + THERMAL_NUM_MAX = 4 + THERMAL_NUM_1_IDX = 1 + THERMAL_NUM_2_IDX = 2 + THERMAL_NUM_3_IDX = 3 + THERMAL_NUM_4_IDX = 4 + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + + thermal_sysfspath = { + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/24-004b/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/25-004a/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/class/hwmon/hwmon1/temp1_input"], + } + + def _get_thermal_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + content = val_file.readline().rstrip() + if content == '': + logging.debug( + 'GET. content is NULL. device_path:%s', + device_path) + return None + try: + val_file.close() + except BaseException: + logging.debug( + 'GET. unable to close file. device_path:%s', + device_path) + return None + + return int(content) + + return 0 + + def get_num_thermals(self): + return self.THERMAL_NUM_MAX + + def get_size_path_map(self): + return len(self.thermal_sysfspath) + + def get_thermal_path(self, thermal_num): + return self.thermal_sysfspath[thermal_num][0] + + +def main(): + ThermalUtil() + + +if __name__ == '__main__': + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/Makefile new file mode 100755 index 000000000000..1b5914d9e5aa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/Makefile @@ -0,0 +1,19 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= x86-64-accton-as4630-54te-cpld.o x86-64-accton-as4630-54te-psu.o \ + x86-64-accton-as4630-54te-leds.o ym2651y.o + +else +ifeq (,$(KERNEL_SRC)) +#$(error KERNEL_SRC is not defined) +KVERSION=3.16.0-8-amd64 +KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ +KERNELDIR:=$(KERNEL_DIR) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.mod.c *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c new file mode 100755 index 000000000000..98b855329c64 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c @@ -0,0 +1,1106 @@ +/* + * Copyright (C) Jostar yang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as4630_54te CPLD + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ +#define FAN_DUTY_CYCLE_REG_MASK 0x1F +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 114 // R.P.M value = read value x3.79*60/2 + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" +#define THERMAL_SENSORS_ADDRS {0x48, 0x4a, 0x4b} + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_type { + as4630_54te_cpld, +}; +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, +}; + +static const u8 fan_reg[] = { + 0x87, /* fan status, fan direction */ + 0x1A, /* fan PWM(for fan1 ,fan2) */ + 0x1B, /* fan PWM(for fan1 ,fan2) */ + 0x88, /* front fan1 speed(rpm) */ + 0x89, /* front fan2 speed(rpm) */ + 0x8A, /* front fan3 speed(rpm) */ + 0x20, /*fan fault*/ +}; + +struct as4630_54te_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_fan_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + + + +static const struct i2c_device_id as4630_54te_cpld_id[] = { + { "as4630_54te_cpld", as4630_54te_cpld}, + { } +}; +MODULE_DEVICE_TABLE(i2c, as4630_54te_cpld_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define FAN_SPEED_RPM_ATTR_ID(index) FAN_SPEED_RPM_##index +#define FAN_DIRECTION_ID(index) FAN_DIRECTION_##index +#define FAN_PRESENT_ATTR_ID(index) FAN_PRESENT_##index +#define FAN_FAULT_ATTR_ID(index) FAN_FAULT_##index + +enum as4630_54te_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + /* transceiver attributes */ + TRANSCEIVER_RXLOS_ATTR_ID(49), + TRANSCEIVER_RXLOS_ATTR_ID(50), + TRANSCEIVER_RXLOS_ATTR_ID(51), + TRANSCEIVER_RXLOS_ATTR_ID(52), + TRANSCEIVER_TXFAULT_ATTR_ID(49), + TRANSCEIVER_TXFAULT_ATTR_ID(50), + TRANSCEIVER_TXFAULT_ATTR_ID(51), + TRANSCEIVER_TXFAULT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_TXDISABLE_ATTR_ID(49), + TRANSCEIVER_TXDISABLE_ATTR_ID(50), + TRANSCEIVER_TXDISABLE_ATTR_ID(51), + TRANSCEIVER_TXDISABLE_ATTR_ID(52), + FAN_PRESENT_ATTR_ID(1), + FAN_PRESENT_ATTR_ID(2), + FAN_PRESENT_ATTR_ID(3), + FAN_SPEED_RPM_ATTR_ID(1), + FAN_SPEED_RPM_ATTR_ID(2), + FAN_SPEED_RPM_ATTR_ID(3), + FAN_DIRECTION_ID(1), + FAN_DIRECTION_ID(2), + FAN_DIRECTION_ID(3), + FAN_FAULT_ATTR_ID(1), + FAN_FAULT_ATTR_ID(2), + FAN_FAULT_ATTR_ID(3), + FAN_DUTY_CYCLE_PERCENTAGE, +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int as4630_54te_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as4630_54te_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/*fan sysfs*/ +static struct as4630_54te_cpld_data *as4630_54te_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); +//static ssize_t show_power(struct device *dev, struct device_attribute *da, + // char *buf); + + + +/* transceiver attributes */ +#define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index); + +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_present_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +#define DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index); + +#define DECLARE_QSFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_present_##index.dev_attr.attr + + +#define DECLARE_FAN_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_present_##index, S_IRUGO, fan_show_value, NULL, FAN_PRESENT_##index); \ + static SENSOR_DEVICE_ATTR(fan_fault_##index, S_IRUGO, fan_show_value, NULL, FAN_FAULT_##index); \ + static SENSOR_DEVICE_ATTR(fan_speed_rpm_##index, S_IRUGO, fan_show_value, NULL, FAN_SPEED_RPM_##index); \ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN_SPEED_RPM_##index);\ + static SENSOR_DEVICE_ATTR(fan_direction_##index, S_IRUGO, fan_show_value, NULL, FAN_DIRECTION_##index); + +#define DECLARE_FAN_ATTR(index) \ + &sensor_dev_attr_fan_present_##index.dev_attr.attr, \ + &sensor_dev_attr_fan_fault_##index.dev_attr.attr, \ + &sensor_dev_attr_fan_speed_rpm_##index.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan_direction_##index.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE); +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); + + + +/* transceiver attributes */ +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(49); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(50); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(51); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(52); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(53); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(54); +/* fan attributes */ +DECLARE_FAN_SENSOR_DEV_ATTR(1); +DECLARE_FAN_SENSOR_DEV_ATTR(2); +DECLARE_FAN_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); + +static struct attribute *as4630_54te_cpld_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + DECLARE_SFP_TRANSCEIVER_ATTR(49), + DECLARE_SFP_TRANSCEIVER_ATTR(50), + DECLARE_SFP_TRANSCEIVER_ATTR(51), + DECLARE_SFP_TRANSCEIVER_ATTR(52), + DECLARE_QSFP_TRANSCEIVER_ATTR(53), + DECLARE_QSFP_TRANSCEIVER_ATTR(54), + DECLARE_FAN_ATTR(1), + DECLARE_FAN_ATTR(2), + DECLARE_FAN_ATTR(3), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + NULL +}; + +static const struct attribute_group as4630_54te_cpld_group = { + .attrs = as4630_54te_cpld_attributes, +}; + + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) + { + case MODULE_RXLOS_49 ... MODULE_RXLOS_50: + reg=0x5; + mask = 0x1<< (attr->index==MODULE_RXLOS_49?4:0); + break; + case MODULE_TXFAULT_49 ... MODULE_TXFAULT_50: + reg=0x5; + mask=0x1 << (attr->index==MODULE_TXFAULT_49?5:1); + break; + case MODULE_PRESENT_49 ... MODULE_PRESENT_50: + reg=0x5; + mask=0x1 << (attr->index==MODULE_PRESENT_49?6:2); + break; + case MODULE_TXDISABLE_49 ... MODULE_TXDISABLE_50: + reg=0x5; + mask=0x1 << (attr->index==MODULE_TXFAULT_49?7:3); + break; + + case MODULE_RXLOS_51 ... MODULE_RXLOS_52: + reg=0x6; + mask = 0x1<< (attr->index==MODULE_RXLOS_51?4:0); + break; + case MODULE_TXFAULT_51 ... MODULE_TXFAULT_52: + reg=0x6; + mask=0x1 << (attr->index==MODULE_TXFAULT_51?5:1); + break; + case MODULE_PRESENT_51 ... MODULE_PRESENT_52: + reg=0x6; + mask=0x1 << (attr->index==MODULE_PRESENT_51?6:2); + break; + case MODULE_TXDISABLE_51 ... MODULE_TXDISABLE_52: + reg=0x6; + mask=0x1 << (attr->index==MODULE_TXFAULT_51?7:3); + break; + case MODULE_PRESENT_53 ... MODULE_PRESENT_54: + reg=0x21; + mask=0x1 << (attr->index==MODULE_PRESENT_53?0:4); + break; + default: + return 0; + } + + if( attr->index >= MODULE_PRESENT_49 && attr->index <= MODULE_PRESENT_54 ) + { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as4630_54te_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + reg = 0x9; + switch (attr->index) + { + case MODULE_TXDISABLE_49 ... MODULE_TXDISABLE_50: + reg=0x5; + mask=0x1 << (attr->index==MODULE_TXFAULT_49?7:3); + break; + case MODULE_TXDISABLE_51 ... MODULE_TXDISABLE_52: + reg=0x6; + mask=0x1 << (attr->index==MODULE_TXFAULT_51?7:3); + break; + + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as4630_54te_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + /* Update tx_disable status */ + if (disable) { + status &= ~mask; + } + else { + status |= mask; + } + status = as4630_54te_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as4630_54te_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void as4630_54te_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as4630_54te_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d\n", val); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val) * 625)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625); +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as4630_54te_cpld_write_internal(client, fan_reg[1], duty_cycle_to_reg_val(value)); + as4630_54te_cpld_write_internal(client, fan_reg[2], duty_cycle_to_reg_val(value)); + return count; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as4630_54te_cpld_data *data, enum fan_id id) +{ + u8 ret = 1; + + if(id > FAN3_ID) + return 1; + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_fan_val[id+3])) + { + + ret = 0; + } + + return ret; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static bool lm75_addr_mached(unsigned short addr) +{ + int i; + unsigned short addrs[] = THERMAL_SENSORS_ADDRS; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) + { + if( addr == addrs[i]) + return 1; + } + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as4630_54te_cpld_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + if (! lm75_addr_mached(client->addr)) + { + return 0; + } + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as4630_54te_cpld_data *data = as4630_54te_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = INT_MAX; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 duty_cycle; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as4630_54te_cpld_data *data = as4630_54te_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) + { + case FAN_PRESENT_1: + case FAN_PRESENT_2: + case FAN_PRESENT_3: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_fan_val[0], + attr->index - FAN_PRESENT_1)); + break; + case FAN_DUTY_CYCLE_PERCENTAGE: + duty_cycle = reg_val_to_duty_cycle(data->reg_fan_val[1]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + case FAN_SPEED_RPM_1: + case FAN_SPEED_RPM_2: + case FAN_SPEED_RPM_3: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_fan_val[attr->index-FAN_SPEED_RPM_1+3])); + break; + case FAN_FAULT_1: + case FAN_FAULT_2: + case FAN_FAULT_3: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN_FAULT_1)); + break; + case FAN_DIRECTION_1: + case FAN_DIRECTION_2: + case FAN_DIRECTION_3: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_fan_val[0], + attr->index - FAN_DIRECTION_1)); + break; + default: + break; + } + } + + return ret; +} + +static struct as4630_54te_cpld_data *as4630_54te_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as4630_54te_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_fan_val); i++) { + int status = as4630_54te_cpld_read_internal(client, fan_reg[i]); + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg 0x%x, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_fan_val[i] = status & 0xff; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +/* +static ssize_t show_power(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + reg=0xc; + mask=0x2; + mutex_lock(&data->update_lock); + status = as4630_54te_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} +*/ +/* + * I2C init/probing/exit functions + */ +static int as4630_54te_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct as4630_54te_cpld_data *data; + int ret = -ENODEV; +// int status; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; + + data = kzalloc(sizeof(struct as4630_54te_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->type = id->driver_data; + + /* Register sysfs hooks */ + switch (data->type) + { + case as4630_54te_cpld: + group = &as4630_54te_cpld_group; + break; + default: + break; + } + + if (group) + { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_free; + } + } + + as4630_54te_cpld_add_client(client); + + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + ret = PTR_ERR(data->hwmon_dev); + goto exit_free; + } + + + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int as4630_54te_cpld_remove(struct i2c_client *client) +{ + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + as4630_54te_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) + { + case as4630_54te_cpld: + group = &as4630_54te_cpld_group; + break; + default: + break; + } + + if (group) { + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, group); + } + + + kfree(data); + + return 0; +} + +static int as4630_54te_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as4630_54te_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as4630_54te_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as4630_54te_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as4630_54te_cpld_read); + +int as4630_54te_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as4630_54te_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as4630_54te_cpld_write); + +static struct i2c_driver as4630_54te_cpld_driver = { + .driver = { + .name = "as4630_54te_cpld", + .owner = THIS_MODULE, + }, + .probe = as4630_54te_cpld_probe, + .remove = as4630_54te_cpld_remove, + .id_table = as4630_54te_cpld_id, +}; + +static int __init as4630_54te_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as4630_54te_cpld_driver); +} + +static void __exit as4630_54te_cpld_exit(void) +{ + i2c_del_driver(&as4630_54te_cpld_driver); +} + +MODULE_AUTHOR("Jostar Yang "); +MODULE_DESCRIPTION("Accton I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as4630_54te_cpld_init); +module_exit(as4630_54te_cpld_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c new file mode 100755 index 000000000000..f4e2668348ff --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c @@ -0,0 +1,579 @@ +/* + * A LED driver for the accton_as4630_54te_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int as4630_54te_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as4630_54te_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +#define DRVNAME "accton_as4630_54te_led" + +struct accton_as4630_54te_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[2]; /* only 1 register*/ +}; + +static struct accton_as4630_54te_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x20|0x40|0x80) +#define LED_MODE_DIAG_GREEN_VALUE (0x20) +#define LED_MODE_DIAG_GREEN_BLINK_VALUE (0x60) +#define LED_MODE_DIAG_AMBER_VALUE (0x80) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x0) + +#define LED_TYPE_PRI_REG_MASK (0x8|0x4) +#define LED_MODE_PRI_GREEN_VALUE 0x4 +#define LED_MODE_PRI_AMBER_VALUE 0x8 +#define LED_MODE_PRI_OFF_VALUE 0x0 + +#define LED_TYPE_POE_REG_MASK (0x2|0x1) +#define LED_MODE_POE_GREEN_VALUE 0x1 +#define LED_MODE_POE_AMBER_VALUE 0x2 +#define LED_MODE_POE_OFF_VALUE 0x0 + +#define LED_TYPE_STK1_REG_MASK 0x20 +#define LED_MODE_STK1_GREEN_VALUE 0x0 +#define LED_MODE_STK1_OFF_VALUE 0x20 + +#define LED_TYPE_STK2_REG_MASK 0x10 +#define LED_MODE_STK2_GREEN_VALUE 0x0 +#define LED_MODE_STK2_OFF_VALUE 0x10 + +#define LED_TYPE_FAN_REG_MASK (0x20|0x10) +#define LED_MODE_FAN_AMBER_VALUE 0x20 +#define LED_MODE_FAN_GREEN_VALUE 0x10 +#define LED_MODE_FAN_OFF_VALUE (0x0) + +#define LED_TYPE_PSU2_REG_MASK (0x8|0x4) +#define LED_MODE_PSU2_AMBER_VALUE 0x8 +#define LED_MODE_PSU2_GREEN_VALUE 0x4 +#define LED_MODE_PSU2_OFF_VALUE (0x0) + +#define LED_TYPE_PSU1_REG_MASK (0x2|0x1) +#define LED_MODE_PSU1_AMBER_VALUE 0x2 +#define LED_MODE_PSU1_GREEN_VALUE 0x1 +#define LED_MODE_PSU1_OFF_VALUE (0x0) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_PRI, + LED_TYPE_POE, + LED_TYPE_STK1, + LED_TYPE_STK2, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as4630_54te_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as4630_54te_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as4630_54te_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !accton_getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + + reg_val = accton_as4630_54te_led_read_value(reg); + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + + accton_as4630_54te_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void accton_as4630_54te_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness accton_as4630_54te_led_diag_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as4630_54te_led_pri_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_PRI); +} + +static enum led_brightness accton_as4630_54te_led_pri_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PRI, ledctl->reg_val[0]); +} + +static void accton_as4630_54te_led_poe_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_POE); +} + +static enum led_brightness accton_as4630_54te_led_poe_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_POE, ledctl->reg_val[1]); +} + + +static void accton_as4630_54te_led_stk1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_STK1); +} + +static enum led_brightness accton_as4630_54te_led_stk1_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_STK1, ledctl->reg_val[1]); +} + +static void accton_as4630_54te_led_stk2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_STK2); +} + +static enum led_brightness accton_as4630_54te_led_stk2_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_STK2, ledctl->reg_val[1]); +} + +static void accton_as4630_54te_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_FAN); +} + +static enum led_brightness accton_as4630_54te_led_fan_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + +static void accton_as4630_54te_led_psu1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_PSU1); +} + +static enum led_brightness accton_as4630_54te_led_psu1_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[0]); +} + +static void accton_as4630_54te_led_psu2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as4630_54te_led_set(led_cdev, led_light_mode, LED_TYPE_PSU2); +} + +static enum led_brightness accton_as4630_54te_led_psu2_get(struct led_classdev *cdev) +{ + accton_as4630_54te_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[0]); +} + +static struct led_classdev accton_as4630_54te_leds[] = { + [LED_TYPE_DIAG] = { + .name = "diag", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_diag_set, + .brightness_get = accton_as4630_54te_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_GREEN, + }, + [LED_TYPE_PRI] = { + .name = "pri", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_pri_set, + .brightness_get = accton_as4630_54te_led_pri_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AMBER, + }, + [LED_TYPE_POE] = { + .name = "poe", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_poe_set, + .brightness_get = accton_as4630_54te_led_poe_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AMBER, + }, + [LED_TYPE_STK1] = { + .name = "stk1", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_stk1_set, + .brightness_get = accton_as4630_54te_led_stk1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_GREEN, + }, + [LED_TYPE_STK2] = { + .name = "stk2", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_stk2_set, + .brightness_get = accton_as4630_54te_led_stk2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_GREEN, + }, + [LED_TYPE_FAN] = { + .name = "fan", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_fan_set, + .brightness_get = accton_as4630_54te_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "psu1", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_psu1_set, + .brightness_get = accton_as4630_54te_led_psu1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "psu2", + .default_trigger = "unused", + .brightness_set = accton_as4630_54te_led_psu2_set, + .brightness_get = accton_as4630_54te_led_psu2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as4630_54te_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as4630_54te_leds); i++) { + led_classdev_suspend(&accton_as4630_54te_leds[i]); + } + + return 0; +} + +static int accton_as4630_54te_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as4630_54te_leds); i++) { + led_classdev_resume(&accton_as4630_54te_leds[i]); + } + + return 0; +} + +static int accton_as4630_54te_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as4630_54te_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as4630_54te_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as4630_54te_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as4630_54te_leds[i]); + } + } + + return ret; +} + +static int accton_as4630_54te_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as4630_54te_leds); i++) { + led_classdev_unregister(&accton_as4630_54te_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as4630_54te_led_driver = { + .probe = accton_as4630_54te_led_probe, + .remove = accton_as4630_54te_led_remove, + .suspend = accton_as4630_54te_led_suspend, + .resume = accton_as4630_54te_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as4630_54te_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as4630_54te_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as4630_54te_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as4630_54te_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as4630_54te_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as4630_54te_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as4630_54te_led_driver); + kfree(ledctl); +} + +module_init(accton_as4630_54te_led_init); +module_exit(accton_as4630_54te_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as4630_54te_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c new file mode 100755 index 000000000000..3a99f19a9cd2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c @@ -0,0 +1,320 @@ +/* + * An hwmon driver for accton as4630_54te Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MODEL_NAME 20 +#define MAX_SERIAL_NUMBER 18 + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as4630_54te_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as4630_54te_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as4630_54te_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[MAX_MODEL_NAME]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER]; +}; + +static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device *dev); + +enum as4630_54te_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); + + +static struct attribute *as4630_54te_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as4630_54te_psu_data *data = as4630_54te_psu_update_device(dev); + u8 status = 0; + + //printk("data->status=0x%x, attr->index=%d,data->index=%d \n", data->status, attr->index, data->index); + if (attr->index == PSU_PRESENT) { + if(data->index==0) + status = !( (data->status >> 5) & 0x1); + else + status = !( (data->status >> 1) & 0x1); + } + else { /* PSU_POWER_GOOD */ + if(data->index==0) + status = ( (data->status >> 6) & 0x1); + else + status = ( (data->status >> 2) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as4630_54te_psu_data *data = as4630_54te_psu_update_device(dev); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + switch (attr->index) { + case PSU_MODEL_NAME: + ptr = data->model_name; + break; + case PSU_SERIAL_NUMBER: + ptr = data->serial_number; + break; + default: + return -EINVAL; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group as4630_54te_psu_group = { + .attrs = as4630_54te_psu_attributes, +}; + +static int as4630_54te_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as4630_54te_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as4630_54te_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as4630_54te_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as4630_54te_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as4630_54te_psu_remove(struct i2c_client *client) +{ + struct as4630_54te_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as4630_54te_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as4630_54te_psu1, + as4630_54te_psu2 +}; + +static const struct i2c_device_id as4630_54te_psu_id[] = { + { "as4630_54te_psu1", as4630_54te_psu1 }, + { "as4630_54te_psu2", as4630_54te_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as4630_54te_psu_id); + +static struct i2c_driver as4630_54te_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as4630_54te_psu", + }, + .probe = as4630_54te_psu_probe, + .remove = as4630_54te_psu_remove, + .id_table = as4630_54te_psu_id, + .address_list = normal_i2c, +}; + +static int as4630_54te_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as4630_54te update\n"); + + /* Read psu status */ + status = as4630_54te_cpld_read(0x60, 0x22); + //printk("status=0x%x in %s\n", status, __FUNCTION__); + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + status = as4630_54te_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + printk("unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + + } + /* Read from offset 0x2e ~ 0x3d (16 bytes) */ + status = as4630_54te_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER); + if (status < 0) + { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + } + data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as4630_54te_psu_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as4630_54te_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-handle-mgmt-interface.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-handle-mgmt-interface.service new file mode 100644 index 000000000000..fa4e1cca61c3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-handle-mgmt-interface.service @@ -0,0 +1,11 @@ +[Unit] +Description=Accton AS4630-54TE Platform handle management interface service +After=sysinit.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/handle_mgmt_interface.sh + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-fan.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-fan.service new file mode 100644 index 000000000000..d7b8b8cb2d34 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-fan.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS4630-54TE Platform Monitoring FAN service +Before=pmon.service +After=as4630-54te-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as4630_54te_monitor_fan.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-psu.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-psu.service new file mode 100644 index 000000000000..a85a0918e290 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor-psu.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS4630-54TE Platform Monitoring PSU service +Before=pmon.service +After=as4630-54te-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as4630_54te_monitor_psu.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service new file mode 100644 index 000000000000..587e6a1cafa1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS4630-54TE Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as4630_54te_util.py install +ExecStart=/usr/local/bin/accton_as4630_54te_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/setup.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/setup.py new file mode 100755 index 000000000000..78b45368c791 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='as4630_54te', + version='1.0', + description='Module to initialize Accton AS4630-54TE platforms', + + packages=['as4630_54te'], + package_dir={'as4630_54te': 'as4630-54te/classes'}, +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/sonic_platform_setup.py new file mode 100644 index 000000000000..d256f7b3c1cd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/sonic_platform_setup.py @@ -0,0 +1,34 @@ +from setuptools import setup + +DEVICE_NAME = 'accton' +HW_SKU = 'x86_64-accton_as4630_54te-r0' + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + maintainer='Michael Shih', + maintainer_email='michael_shih@edge-core.com', + packages=[ + 'sonic_platform', + ], + package_dir={ + 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/README b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/README new file mode 100755 index 000000000000..65bad2200816 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/README @@ -0,0 +1,67 @@ +Copyright (C) 2019 Accton Networks, Inc. + +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 3 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, see . + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS4630-54te has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are at module dir. +2. A operational script, accton_as4630_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + Run "accton_as4630_util.py install" to install drivers. + +To initialize the system, run "accton_as4630_util.py install". +To clean up the drivers & devices, run "accton_as4630_util.py clean". +To dump information of sensors, run "accton_as4630_util.py show". +To dump SFP EEPROM, run "accton_as4630_util.py sff". +To set fan speed, run "accton_as4630_util.py set fan". +To enable/disable SFP emission, run "accton_as4630_util.py set sfp". +To set system LEDs' color, run "accton_as4630_util.py set led" +For more information, run "accton_as4630_util.py --help". + +==================================================================== +Besides applying accton_as4630_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 6 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py new file mode 100755 index 000000000000..8c704ac60e86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -* +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# HISTORY: +# mm/dd/yyyy (A.D.)# +# 10/24/2019:Jostar create for as4630_54te thermal plan +# ------------------------------------------------------------------ + +try: + import os + import sys + import getopt + import logging + import logging.config + import logging.handlers + import time + from as4630_54te.fanutil import FanUtil + from as4630_54te.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as4630_54te_monitor' + +# Temperature Policy +# If any fan fail , please set fan speed register to 16 +# The max value of fan speed register is 14 +# LM77(48)+LM75(4B)+LM75(4A) > 140, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) > 150, Set 12 +# LM77(48)+LM75(4B)+LM75(4A) > 160, Set 14 +# LM77(48)+LM75(4B)+LM75(4A) < 140, Set 8 +# LM77(48)+LM75(4B)+LM75(4A) < 150, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) < 160, Set 12 +# Reset DUT:LM77(48)>=70C +# +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +fan_policy_state = 0 +fan_fail = 0 +alarm_state = 0 # 0->default or clear, 1-->alarm detect +test_temp = 0 +test_temp_list = [0, 0, 0] +temp_test_data = 0 +test_temp_revert = 0 +# Make a class we can use to capture stdout and sterr in the log + + +class device_monitor(object): + # static temp var + temp = 0 + new_pwm = 0 + pwm = 0 + ori_pwm = 0 + default_pwm = 0x4 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S') + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter( + '%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler( + address='/dev/log') + sys_handler.setLevel(logging.WARNING) + logging.getLogger('').addHandler(sys_handler) + + def get_state_from_fan_policy(self, temp, policy): + state = 0 + for i in range(0, len(policy)): + if (temp > policy[i][2]): # temp_down + if temp <= policy[i][3]: # temp_up + state = i + + return state + + def manage_fans(self): + global fan_policy_state + global fan_fail + global test_temp + global test_temp_list + global alarm_state + global temp_test_data + global test_temp_revert + LEVEL_FAN_MIN = 0 + LEVEL_FAN_NORMAL = 1 + LEVEL_FAN_MID = 2 + LEVEL_FAN_HIGH = 3 + LEVEL_TEMP_CRITICAL = 4 + fan_policy = { + LEVEL_FAN_MIN: [50, 8, 0, 140000], + LEVEL_FAN_NORMAL: [62, 10, 140000, 150000], + LEVEL_FAN_MID: [75, 12, 150000, 160000], + LEVEL_FAN_HIGH: [88, 14, 160000, 240000], + LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000], + } + temp = [0, 0, 0] + thermal = ThermalUtil() + fan = FanUtil() + ori_duty_cycle = fan.get_fan_duty_cycle() + new_duty_cycle = 0 + + if test_temp == 0: + for i in range(0, 3): + temp[i] = thermal._get_thermal_val(i + 1) + if temp[i] == 0 or temp[i] is None: + logging.warning("Get temp-%d fail", i) + return False + else: + if test_temp_revert == 0: + temp_test_data = temp_test_data + 2000 + else: + temp_test_data = temp_test_data - 2000 + + for i in range(0, 3): + temp[i] = test_temp_list[i] + temp_test_data + fan_fail = 0 + + temp_val = 0 + for i in range(0, 3): + if temp[i] is None: + break + temp_val += temp[i] + + # Check Fan status + for i in range(fan.FAN_NUM_1_IDX, fan.FAN_NUM_ON_MAIN_BROAD + 1): + if fan.get_fan_status(i) == 0: + new_pwm = 100 + logging.warning('Fan_%d fail, set pwm to 100', i) + if test_temp == 0: + fan_fail = 1 + fan.set_fan_duty_cycle(new_pwm) + break + else: + fan_fail = 0 + + ori_state = fan_policy_state + fan_policy_state = self.get_state_from_fan_policy(temp_val, fan_policy) + + if fan_policy_state > LEVEL_TEMP_CRITICAL or fan_policy_state < LEVEL_FAN_MIN: + logging.error("Get error fan current_state\n") + return 0 + + # Decision : Decide new fan pwm percent. + if fan_fail == 0 and ori_duty_cycle != fan_policy[fan_policy_state][0]: + new_duty_cycle = fan_policy[fan_policy_state][0] + fan.set_fan_duty_cycle(new_duty_cycle) + + if temp[0] >= 70000: # LM75-48 + # critical case*/ + logging.critical( + 'Alarm-Critical for temperature critical is detected, reset DUT') + cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + time.sleep(2) + return_value = os.system(cmd_str) + logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0xE4, status is %d', return_value) + + #logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val) + + if ori_state < LEVEL_FAN_HIGH: + if fan_policy_state >= LEVEL_FAN_HIGH: + if alarm_state == 0: + logging.warning('Alarm for temperature high is detected') + alarm_state = 1 + + if fan_policy_state < LEVEL_FAN_MID: + if alarm_state == 1: + logging.info('Alarm for temperature high is cleared') + alarm_state = 0 + + return True + + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global test_temp + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + if sys.argv[1] == '-t': + if len(sys.argv) != 5: + print "temp test, need input three temp" + return 0 + + i = 0 + for x in range(2, 5): + test_temp_list[i] = int(sys.argv[x]) * 1000 + i = i + 1 + test_temp = 1 + log_level = logging.DEBUG + print test_temp_list + + fan = FanUtil() + fan.set_fan_duty_cycle(50) + print "set default fan speed to 50%" + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) # 10sec + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py new file mode 100755 index 000000000000..6d8ab0ea3c95 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Accton Technology Corporation +# +# 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 3 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, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 5/15/2019: Jostar create for as4630-54te +# ------------------------------------------------------------------ + +try: + import sys + import getopt + import logging + import logging.config + import logging.handlers + import time # this is only being used as part of the example + +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as4630_54te_monitor_fan' + + +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +fan_state = [2, 2, 2, 2] # init state=2, insert=1, remove=0 +fan_status_state = [2, 2, 2, 2] # init state=2, fault=1, normal=0 +# Make a class we can use to capture stdout and sterr in the log + + +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.fan_num = 3 + self.fan_path = "/sys/bus/i2c/devices/3-0060/" + self.present = { + 0: "fan_present_1", + 1: "fan_present_2", + 2: "fan_present_3", + } + + self.fault = { + 0: "fan_fault_1", + 1: "fan_fault_2", + 2: "fan_fault_3", + } + + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S') + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(logging.DEBUG) + formatter = logging.Formatter( + '%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address='/dev/log') + # sys_handler.setLevel(logging.WARNING) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fan(self): + + FAN_STATE_REMOVE = 0 + FAN_STATE_INSERT = 1 + + FAN_STATUS_FAULT = 1 + FAN_STATUS_NORMAL = 0 + + global fan_state + global fan_status_state + + for idx in range(0, self.fan_num): + node = self.fan_path + self.present[idx] + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_state[idx] != 1: + fan_state[idx] = FAN_STATE_INSERT + logging.info("FAN-%d present is detected", idx + 1) + else: + if fan_state[idx] != 0: + fan_state[idx] = FAN_STATE_REMOVE + logging.warning( + "Alarm for FAN-%d absent is detected", idx + 1) + + for idx in range(0, self.fan_num): + node = self.fan_path + self.fault[idx] + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_status_state[idx] != FAN_STATUS_FAULT: + if fan_state[idx] == FAN_STATE_INSERT: + logging.warning( + "Alarm for FAN-%d failed is detected", idx + 1) + fan_status_state[idx] = FAN_STATUS_FAULT + else: + fan_status_state[idx] = FAN_STATUS_NORMAL + + return True + + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdl:', ['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + monitor = device_monitor(log_file, log_level) + while True: + monitor.manage_fan() + time.sleep(3) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py new file mode 100755 index 000000000000..9bff640434bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Accton Technology Corporation +# +# 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 3 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, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 5/15/2019: Jostar create for as4630-54te +# ------------------------------------------------------------------ + +try: + import sys + import getopt + import logging + import logging.config + import logging.handlers + import time # this is only being used as part of the example + +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as4630_54te_monitor_psu' + + +psu_state = [2, 2] +psu_status_state = [2, 2] +# Make a class we can use to capture stdout and sterr in the log + + +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.psu_num = 2 + self.psu_path = "/sys/bus/i2c/devices/" + self.presence = "/psu_present" + self.oper_status = "/psu_power_good" + self.mapping = { + 0: "10-0050", + 1: "11-0051", + } + + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S') + # set up logging to console + + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter( + '%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address='/dev/log') + # sys_handler.setLevel(logging.WARNING) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_psu(self): + + PSU_STATE_REMOVE = 0 + PSU_STATE_INSERT = 1 + + PSU_STATUS_NO_POWER = 0 + PSU_STATUS_POWER_GOOD = 1 + PSU_STATUS_IDLE = 2 + + global psu_state + + for idx in range(0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.presence + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if psu_state[idx] != 1: + psu_state[idx] = PSU_STATE_INSERT + logging.info("PSU-%d present is detected", idx + 1) + # psu_status_state[idx]=PSU_STATUS_POWER_GOOD #when insert, + # assume power is good. If no_power, next code will find + # it. + else: + if psu_state[idx] != 0: + psu_state[idx] = PSU_STATE_REMOVE + logging.warning( + "Alarm for PSU-%d absent is detected", idx + 1) + psu_status_state[idx] = PSU_STATUS_IDLE + + for idx in range(0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.oper_status + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "0": + if psu_status_state[idx] != PSU_STATUS_NO_POWER: + if psu_state[idx] == PSU_STATE_INSERT: + logging.warning( + "Alarm for PSU-%d failed is detected", idx + 1) + psu_status_state[idx] = PSU_STATUS_NO_POWER + else: + if psu_state[idx] == PSU_STATE_INSERT: + if psu_status_state[idx] != PSU_STATUS_POWER_GOOD: + logging.info("PSU-%d power_good is detected", idx + 1) + psu_status_state[idx] = PSU_STATUS_POWER_GOOD + + return True + + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdl:', ['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_psu() + time.sleep(3) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py new file mode 100755 index 000000000000..172a9842a8bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py @@ -0,0 +1,681 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# 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 3 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, see . + +""" +Usage: %(scriptName)s [options] command object +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import commands +import getopt +import sys +import logging +import re +import time +import os + +PROJECT_NAME = 'as4630_54te' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = { + 'led': 5, + 'fan1': 1, + 'fan2': 1, + 'fan3': 1, + 'fan4': 1, + 'fan5': 1, + 'thermal': 3, + 'psu': 2, + 'sfp': 54} + + +led_prefix = '/sys/devices/platform/as4630_54te_led/leds/accton_' + \ + PROJECT_NAME + '_led::' +fan_prefix = '/sys/devices/platform/as4630_54te_' +hwmon_types = {'led': ['diag', 'fan', 'loc', 'psu1', 'psu2'], + 'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + } +hwmon_nodes = { + 'led': ['brightness'], + 'fan1': [ + 'fan_duty_cycle_percentage', + 'fan1_fault', + 'fan1_speed_rpm', + 'fan1_direction', + 'fanr1_fault', + 'fanr1_speed_rpm'], + 'fan2': [ + 'fan_duty_cycle_percentage', + 'fan2_fault', + 'fan2_speed_rpm', + 'fan2_direction', + 'fanr2_fault', + 'fanr2_speed_rpm'], + 'fan3': [ + 'fan_duty_cycle_percentage', + 'fan3_fault', + 'fan3_speed_rpm', + 'fan3_direction', + 'fanr3_fault', + 'fanr3_speed_rpm'], + 'fan4': [ + 'fan4_duty_cycle_percentage', + 'fan4_fault', + 'fan4_speed_rpm', + 'fan4_direction', + 'fanr4_fault', + 'fanr4_speed_rpm'], + 'fan5': [ + 'fan_duty_cycle_percentage', + 'fan5_fault', + 'fan5_speed_rpm', + 'fan5_direction', + 'fanr5_fault', + 'fanr5_speed_rpm'], +} +hwmon_prefix = {'led': led_prefix, + 'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['54-0066'], + 'thermal': ['54-004c', '55-0048', '55-0049', '55-004a', '55-004b'], + 'psu': ['49-0050', '50-0053'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'], + 'thermal': ['hwmon/hwmon*/temp1_input'], + 'psu': ['psu_present ', 'psu_power_good'], + 'sfp': ['module_present_ ', 'module_tx_disable_']} + +sfp_map = [18, 19, 20, 21, 22, 23] + +mknod = [ + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-3/new_device', + + 'echo as4630_54te_cpld 0x60 > /sys/bus/i2c/devices/i2c-3/new_device', + + 'echo lm77 0x48 > /sys/bus/i2c/devices/i2c-14/new_device', + 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-25/new_device', + 'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-24/new_device', + + + # PSU-1 + 'echo as4630_54te_psu1 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', + 'echo ype1200am 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', + + # PSU-2 + 'echo as4630_54te_psu2 0x51> /sys/bus/i2c/devices/i2c-11/new_device', + 'echo ype1200am 0x59 > /sys/bus/i2c/devices/i2c-11/new_device', + + # EERPOM + 'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +# Disable CPLD debug mode +cpld_set = [ + 'i2cset -y -f 3 0x60 0x2a 0xff', + 'i2cset -y -f 3 0x60 0x2b 0xff', + 'i2cset -y -f 3 0x60 0x86 0x89' +] + +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +# logging.basicConfig(level=logging.INFO) + + +def main(): + global DEBUG + global args + global FORCE + + if DEBUG: + print(sys.argv[0]) + print('ARGV : %s' % sys.argv[1:]) + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + print "TEST" + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args) != 2: + show_eeprom_help() + elif int(args[1]) == 0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args) < 3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + return 0 + + +def show_help(): + print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + sys.exit(0) + + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print cmd + " [led|sfp|fan]" + print " use \"" + cmd + " led 0-4 \" to set led color" + print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" + print " use \"" + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print " use \"" + cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + + +def my_log(txt): + if DEBUG: + print "[ACCTON DBG]: " + txt + return + + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + output = "" + status, output = commands.getstatusoutput(cmd) + my_log(cmd + "with result:" + str(status)) + my_log("cmd:" + cmd) + my_log(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print('Failed :' + cmd) + return status, output + + +def driver_inserted(): + ret, lsmod = log_os_system("ls /sys/module/*accton*", 0) + logging.info('mods:' + lsmod) + if ret: + return False + +#'modprobe cpr_4011_4mxx', + + +kos = [ + 'depmod -ae', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe ym2651y', + 'modprobe x86_64_accton_as4630_54te_cpld', + 'modprobe x86_64_accton_as4630_54te_leds', + 'modprobe x86_64_accton_as4630_54te_psu', + 'modprobe optoe'] + + +def driver_install(): + global FORCE + + my_log("rmmond i2cismt") + log_os_system("rmmod i2c_ismt", 1) + log_os_system("rmmod i2c_i801", 1) + log_os_system("modprobe i2c-i801", 1) + time.sleep(1) + log_os_system("modprobe i2c-ismt", 1) + + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + + return 0 + + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + lst = rm.split(" ") + print "lst=%s" % lst + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + +def device_install(): + global FORCE + + for i in range(0, len(mknod)): + # for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + print("Check SFP") + for i in range(0, len(sfp_map)): + if(i < 4): + opt = 'optoe2' + else: + opt = 'optoe1' + status, output = log_os_system("echo " + + str(opt) + + " 0x50 > /sys/bus/i2c/devices/i2c-" + + str(sfp_map[i]) + + "/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + status, output = log_os_system("echo port" + + str(i + + 49) + + " > /sys/bus/i2c/devices/" + + str(sfp_map[i]) + + "-0050/port_name", 1) + if status: + print output + if FORCE == 0: + return status + + return + + +def device_uninstall(): + global FORCE + + for i in range(0, len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-" + \ + str(sfp_map[i]) + "/delete_device" + status, output = log_os_system("echo 0x50 > " + target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i + 1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + + +def system_ready(): + if driver_inserted() == False: + return False + if not device_exist(): + print "not device_exist()" + return False + return True + +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print "Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) + return status + else: + print "Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + + +def do_install(): + if driver_inserted() == False: + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " drivers detected...." + if not device_exist(): + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper() + " devices detected...." + + for i in range(len(cpld_set)): + status, output = log_os_system(cpld_set[i], 1) + if status: + if FORCE == 0: + return status + + do_sonic_platform_install() + + return + + +def do_uninstall(): + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + do_sonic_platform_clean() + + return + + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key] = {} + for i in range(0, DEVICE_NO[key]): + ALL_DEVICE[key][key + str(i + 1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0, len(buses)): + for j in range(0, len(nodes)): + if 'fan' == key: + for k in range(0, DEVICE_NO[key]): + node = key + str(k + 1) + path = i2c_prefix + \ + buses[i] + "/fan" + str(k + 1) + "_" + nodes[j] + my_log(node + ": " + path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0, DEVICE_NO[key]): + node = key + str(k + 1) + path = i2c_prefix + \ + str(sfp_map[k]) + buses[i] + "/" + nodes[j] + my_log(node + ": " + path) + ALL_DEVICE[key][node].append(path) + else: + node = key + str(i + 1) + path = i2c_prefix + buses[i] + "/" + nodes[j] + my_log(node + ": " + path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0, len(itypes)): + for j in range(0, len(nodes)): + node = key + "_" + itypes[i] + path = hwmon_prefix[key] + itypes[i] + "/" + nodes[j] + my_log(node + ": " + path) + ALL_DEVICE[key][key + str(i + 1)].append(path) + + # show dict all in the order + if DEBUG: + for i in sorted(ALL_DEVICE.keys()): + print(i + ": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" " + j) + for k in (ALL_DEVICE[i][j]): + print(" " + " " + k) + return + + +def show_eeprom(index): + if system_ready() == False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE) == 0: + devices_info() + node = ALL_DEVICE['sfp']['sfp' + str(index)][0] + node = node.replace(node.split("/")[-1], 'eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + print "node=%s" % node + print node + ":" + ret, log = log_os_system("cat " + node + "| " + hex_cmd + " -C", 1) + if ret == 0: + print log + else: + print "**********device no found**********" + return + + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready() == False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE) == 0: + devices_info() + + if args[0] == 'led': + if int(args[1]) > 4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0, len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led' + str(i + 1)]): + ret, log = log_os_system("echo " + args[1] + " >" + k, 1) + if ret: + return ret + elif args[0] == 'fan': + if int(args[1]) > 100: + show_set_help() + return + #print ALL_DEVICE['fan'] + # fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan1']['fan11'][0] + node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') + ret, log = log_os_system("cat " + node, 1) + if ret == 0: + print ("Previous fan duty: " + log.strip() + "%") + ret, log = log_os_system("echo " + args[1] + " >" + node, 1) + if ret == 0: + print ("Current fan duty: " + args[1] + "%") + return ret + elif args[0] == 'sfp': + if int(args[1]) > DEVICE_NO[args[0]] or int(args[1]) == 0: + show_set_help() + return + if len(args) < 2: + show_set_help() + return + + if int(args[2]) > 1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0, len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0] + str(args[1])]: + if j.find('tx_disable') != -1: + ret, log = log_os_system("echo " + args[2] + " >" + j, 1) + if ret: + return ret + + return + +# get digits inside a string. +# Ex: 31 for "sfp31" + + +def get_value(input): + digit = re.findall(r'\d+', input) + return int(digit[0]) + + +def device_traversal(): + if system_ready() == False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE) == 0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper() + ": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " " + j + ":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat " + k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j + '_', '', func, 1) + func = re.sub(i.lower() + '_', '', func, 1) + if ret == 0: + print func + "=" + log + " ", + else: + print func + "=" + "X" + " ", + print + print("----------------------------------------------------------------") + + print + return + + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0077", 0) + ret2, log = log_os_system("ls " + i2c_prefix + "i2c-2", 0) + return not(ret1 or ret2) + + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh new file mode 100755 index 000000000000..82f4d5e02116 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +#Due to the hardware design, as4630-54te use "eth2" instead of "eth0" as management interface. +#Rename netdev "eth0" and "eth2" to swap original "eth2" to "eth0". +ifconfig eth0 down +ip link set eth0 name eth3 +ip link set eth2 name eth0 +ifconfig eth0 up diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index 2b3c1af3d80f..431e177cea48 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -45,6 +45,10 @@ Package: sonic-platform-accton-as4630-54pe Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp +Package: sonic-platform-accton-as4630-54te +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp + Package: sonic-platform-accton-minipack Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index e894b10f8234..a672ec655d41 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -21,7 +21,7 @@ KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS := as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x -MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe minipack as5812-54x +MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe as4630-54te minipack as5812-54x MODULE_DIRS += as5835-54x as9716-32d as5835-54t as7312-54xs as7315-27xb as5812-54t MODULE_DIR := modules UTILS_DIR := utils diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54te.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54te.install new file mode 100644 index 000000000000..fe4f35f1e2c1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54te.install @@ -0,0 +1,2 @@ +as4630-54te/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as4630_54te-r0 + diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 937ea8abc1de..86f7b81834a1 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 937ea8abc1de457b26b7bb7a5208dab6ce40f4a1 +Subproject commit 86f7b81834a1093d1df644b09232ddacb40784ef diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/script/udev_prefix.sh b/platform/broadcom/sonic-platform-modules-cel/haliburton/script/udev_prefix.sh index 20fa0a278808..c5842fab0a7e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/script/udev_prefix.sh +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/script/udev_prefix.sh @@ -3,21 +3,21 @@ PREV_REBOOT_CAUSE="/host/reboot-cause/" DEVICE="/usr/share/sonic/device" PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) -FILES=$DEVICE/$PLATFORM/plugins +PLATFORM_PATH=$DEVICE/$PLATFORM FILENAME="udevprefix.conf" if [ "$1" = "clear" ] then - if [ -e $FILES/$FILENAME ]; then - rm $FILES/$FILENAME + if [ -e $PLATFORM_PATH/$FILENAME ]; then + rm $PLATFORM_PATH/$FILENAME fi else - if [ -e $FILES/$FILENAME ]; then - : > $FILES/$FILENAME - echo -n "$1" > $FILES/$FILENAME + if [ -e $PLATFORM_PATH/$FILENAME ]; then + : > $PLATFORM_PATH/$FILENAME + echo -n "$1" > $PLATFORM_PATH/$FILENAME else - touch $FILES/$FILENMAE - echo -n "$1" > $FILES/$FILENAME + touch $PLATFORM_PATH/$FILENMAE + echo -n "$1" > $PLATFORM_PATH/$FILENAME fi fi diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install index d87efb31c488..e67a59485136 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -5,5 +5,8 @@ s6000/scripts/fancontrol.sh usr/local/bin s6000/systemd/platform-modules-s6000.service etc/systemd/system s6000/systemd/fancontrol.service etc/systemd/system common/io_rd_wr.py usr/local/bin +s6000/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 +s6000/scripts/platform_update_reboot_cause usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 +s6000/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d s6000/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py index 1022d0bb481b..356e69526d89 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py @@ -87,7 +87,6 @@ def __del__(self): # check for this event change for sfp / do we need to handle timeout/sleep def get_change_event(self, timeout=0): - from time import sleep """ Returns a nested dictionary containing all devices which have experienced a change at chassis level @@ -116,7 +115,6 @@ def get_change_event(self, timeout=0): if (now_ms - start_ms >= timeout): return True, change_dict - def get_sfp(self, index): """ Retrieves sfp represented by (0-based) index @@ -136,7 +134,7 @@ def get_sfp(self, index): # The index will start from 0 sfp = self._sfp_list[index-1] except IndexError: - sys.stderr.write("SFP index {} out of range (0-{})\n".format( + sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp @@ -223,6 +221,7 @@ def get_num_sfps(self): An integer represences the number of SFPs on the chassis. """ return self._num_sfps + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -259,4 +258,3 @@ def get_reboot_cause(self): return (self.REBOOT_CAUSE_HARDWARE_OTHER, "Reset Button Cold Reboot") else: return (self.REBOOT_CAUSE_NON_HARDWARE, None) - diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py index f7fcc94662c1..52f2bacd70aa 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py @@ -82,6 +82,7 @@ class Component(ComponentBase): ] def __init__(self, component_index = 0): + ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py index 1b624cb76eda..c634dc7d0d17 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py @@ -41,6 +41,7 @@ class Fan(FanBase): def __init__(self, fantray_index=1, fan_index=1, psu_fan=False, dependency=None): + FanBase.__init__(self) self.is_psu_fan = psu_fan if not self.is_psu_fan: # API index is starting from 0, DellEMC platform index is diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py index b2cceab9b08f..eed6dc7b03da 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py @@ -214,8 +214,13 @@ def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): return None try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + if isinstance(raw , str): + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except BaseException: eeprom.close() return None diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/thermal.py index d8c4ef14d5b2..2a6ff8927e0a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/thermal.py @@ -105,9 +105,9 @@ def get_high_threshold(self): Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_threshold = self.sensor.get_threshold("UpperCritical") + is_valid, high_threshold = self.sensor.get_threshold("UpperNonCritical") if not is_valid: - high_threshold = 0 + return super(Thermal, self).get_high_threshold() return float(high_threshold) @@ -134,12 +134,11 @@ def get_high_critical_threshold(self): thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_crit_threshold = self.sensor.get_threshold("UpperNonRecoverable") + is_valid, high_crit_threshold = self.sensor.get_threshold("UpperCritical") if not is_valid: - high_crit_threshold = 0 + return super(Thermal, self).get_high_critical_threshold() return float(high_crit_threshold) - def set_high_threshold(self, temperature): """ diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/watchdog.py index 878d5f4f952d..961bd8b3dbb4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/watchdog.py @@ -36,6 +36,7 @@ class Watchdog(WatchdogBase): CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] @@ -43,7 +44,7 @@ def __init__(self): def _get_command_result(self, cmdline): try: proc = subprocess.Popen(cmdline.split(), stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] proc.wait() result = stdout.rstrip('\n') @@ -207,4 +208,3 @@ def get_remaining_time(self): return self.timeout - diff_time return 0 - diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/override.conf b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/override.conf new file mode 100644 index 000000000000..4291afe0d249 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/override.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/platform_reboot_override diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_reboot_override b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_reboot_override new file mode 100755 index 000000000000..cae804f2cfb1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_reboot_override @@ -0,0 +1,27 @@ +#!/usr/bin/python3 + +import os +import struct + +PORT_RES = '/dev/port' +COLD_RESET = 0xE # Cold Reset +WARM_RESET = 0x6 # Warm Reset +RESET_REG = 0xCF9 + +def io_reg_write(resource, offset, val): + fd = os.open(resource, os.O_RDWR) + if(fd < 0): + print('file open failed %s" % resource') + return + if(os.lseek(fd, offset, os.SEEK_SET) != offset): + print('lseek failed on %s' % resource) + return + ret = os.write(fd, struct.pack('B', val)) + if(ret != 1): + print('write failed %d' % ret) + return + os.close(fd) + + +if __name__ == "__main__": + io_reg_write(PORT_RES, RESET_REG, COLD_RESET) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_update_reboot_cause b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_update_reboot_cause new file mode 100755 index 000000000000..ba6e3bbab539 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/platform_update_reboot_cause @@ -0,0 +1,25 @@ +#!/usr/bin/python3 + +import os +import struct + +NVRAM_RES = '/dev/nvram' +COLD_RESET = 0xE # Cold Reset +WARM_RESET = 0x6 # Warm Reset + +def io_reg_write(resource, offset, val): + fd = os.open(resource, os.O_RDWR) + if(fd < 0): + print('file open failed %s" % resource') + return + if(os.lseek(fd, offset, os.SEEK_SET) != offset): + print('lseek failed on %s' % resource) + return + ret = os.write(fd, struct.pack('B', val)) + if(ret != 1): + print('write failed %d' % ret) + return + os.close(fd) + +if __name__ == "__main__": + io_reg_write(NVRAM_RES, 0x49, COLD_RESET) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py index 7f6e9ec573f4..08c128d678bc 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py @@ -341,6 +341,9 @@ def get_change_event(self, timeout=0): return True, ret_dict return False, ret_dict + def initizalize_system_led(self): + return True + def set_status_led(self, color): """ Sets the state of the system LED diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/component.py index d9459be47c4f..92ae95fae4f6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/component.py @@ -34,6 +34,7 @@ class Component(ComponentBase): ] def __init__(self, component_index): + ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py index d5a4f379e90b..940c70cebede 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py @@ -33,6 +33,7 @@ class Fan(FanBase): def __init__(self, fantray_index=1, fan_index=1, psu_index=1, psu_fan=False, dependency=None): + FanBase.__init__(self) self.is_psu_fan = psu_fan self.is_driver_initialized = True diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py index ad089a8946a9..bfb1385a9f05 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py @@ -35,6 +35,7 @@ class Thermal(ThermalBase): def __init__(self, thermal_index, psu_index=1, psu_thermal=False, dependency=None): + ThermalBase.__init__(self) self.is_psu_thermal = psu_thermal self.dependency = dependency self.is_driver_initialized = True diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index f8e009cdbefd..4527f6947321 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -372,6 +372,9 @@ def get_change_event(self, timeout=0): return True, ret_dict + def initizalize_system_led(self): + return True + def set_status_led(self, color): """ Sets the state of the system LED diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py index bea180d440b5..2e916488123d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py @@ -41,6 +41,7 @@ class Component(ComponentBase): def __init__(self, component_index=0, is_module=False, iom_index=0, i2c_line=0, dependency=None): + ComponentBase.__init__(self) self.is_module_component = is_module self.dependency = dependency diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py index 5b3c8977ac0a..e95fceaff91d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py @@ -27,6 +27,7 @@ class Fan(FanBase): MAILBOX_DIR = HWMON_DIR + HWMON_NODE def __init__(self, fantray_index=1, psu_index=1, psu_fan=False, dependency=None): + FanBase.__init__(self) self.is_psu_fan = psu_fan if not self.is_psu_fan: self.fantrayindex = fantray_index diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/thermal.py index cac17f4b83aa..6b8ce0954c96 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/thermal.py @@ -26,6 +26,7 @@ class Thermal(ThermalBase): ) def __init__(self, thermal_index): + ThermalBase.__init__(self) self.is_cpu_thermal = False self.index = thermal_index + 1 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py index 0e5e102b7b52..177315ef1805 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py @@ -41,6 +41,7 @@ class Watchdog(WatchdogBase): CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/component.py index 52dee31a524e..d3822307e24b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/component.py @@ -39,6 +39,7 @@ class Component(ComponentBase): ] def __init__(self, component_index=0): + ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py index 31bda2f4cefb..e85f614a82e4 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py @@ -27,6 +27,7 @@ class Fan(FanBase): MAILBOX_DIR = HWMON_DIR + HWMON_NODE def __init__(self, fantray_index=1, fan_index=1, psu_fan=False): + FanBase.__init__(self) self.is_psu_fan = psu_fan if not self.is_psu_fan: # API index is starting from 0, DellEMC platform index is starting diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/psu.py index f76d0ac1bec6..d32cb8f7f3aa 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/psu.py @@ -25,6 +25,7 @@ class Psu(PsuBase): MAILBOX_DIR = HWMON_DIR + HWMON_NODE def __init__(self, psu_index): + PsuBase.__init__(self) # PSU is 1-based in DellEMC platforms self.index = psu_index + 1 self.psu_presence_reg = "psu{}_presence".format(self.index) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/thermal.py index 942934ed7638..72e6fff1e16b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/thermal.py @@ -26,6 +26,7 @@ class Thermal(ThermalBase): ) def __init__(self, thermal_index): + ThermalBase.__init__(self) self.is_cpu_thermal = False self.index = thermal_index + 1 diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py index 3f99cf503b3b..78e8dea999c8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py @@ -104,7 +104,7 @@ def _get_register(self, reg_file): try: with os.fdopen(os.open(reg_file, os.O_RDONLY)) as fd: retval = fd.read() - except: + except Exception: pass retval = retval.rstrip('\r\n') retval = retval.lstrip(" ") @@ -134,6 +134,8 @@ def get_change_event(self, timeout=0): port_dict = {} change_dict = {} change_dict['sfp'] = port_dict + if timeout != 0: + timeout = timeout / 1000 try: # We get notified when there is a MSI interrupt (vector 4/5)CVR # Open the sysfs file and register the epoll object @@ -174,7 +176,7 @@ def get_change_event(self, timeout=0): if (retval != 0): return False, change_dict return True, change_dict - except: + except Exception: return False, change_dict finally: if self.oir_fd != -1: @@ -183,7 +185,6 @@ def get_change_event(self, timeout=0): self.oir_fd.close() self.oir_fd = -1 self.epoll = -1 - return False, change_dict def get_sfp(self, index): """ @@ -281,7 +282,7 @@ def get_reboot_cause(self): try: with open(self.REBOOT_CAUSE_PATH) as fd: reboot_cause = int(fd.read(), 16) - except: + except Exception: return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/component.py index 6ead7ef524f2..aa09d730b5ce 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/component.py @@ -10,7 +10,6 @@ ######################################################################## try: - import os import re from sonic_platform_base.component_base import ComponentBase @@ -24,18 +23,20 @@ class Component(ComponentBase): CHASSIS_COMPONENTS = [ ["BIOS", ("Performs initialization of hardware components during " - "booting")], + "booting")], ["FPGA", ("Used for managing the system LEDs")], ["BMC", ("Platform management controller for on-board temperature " - "monitoring, in-chassis power, Fan and LED control")], + "monitoring, in-chassis power, Fan and LED control")], ["System CPLD", ("Used for managing the CPU power sequence and CPU states")], ["Slave CPLD 1", ("Used for managing QSFP/QSFP28 port transceivers (1-16)")], ["Slave CPLD 2", ("Used for managing QSFP/QSFP28 port transceivers (17-32)")], ["Slave CPLD 3", ("Used for managing QSFP/QSFP28 port transceivers (33-48)")], ["Slave CPLD 4", ("Used for managing QSFP/QSFP28 port transceivers (49-64) and SFP/SFP28 " - "port transceivers (65 and 66)")], - ] + "port transceivers (65 and 66)")], + ] + def __init__(self, component_index=0): + ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] @@ -48,7 +49,6 @@ def get_name(self): """ return self.name - def get_description(self): """ Retrieves the description of the component @@ -77,7 +77,7 @@ def get_firmware_version(self): if version: rv = version.group(1).strip() return rv - + def install_firmware(self, image_path): """ Installs firmware to the component @@ -87,5 +87,3 @@ def install_firmware(self, image_path): A boolean, True if install was successful, False if not """ return False - - diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py index 39307d453486..b7d990877daa 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py @@ -43,6 +43,7 @@ class Fan(FanBase): def __init__(self, fantray_index=1, fan_index=1, psu_fan=False, dependency=None): + FanBase.__init__(self) self.is_psu_fan = psu_fan if not self.is_psu_fan: # API index is starting from 0, DellEMC platform index is diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py index 225aef90e00a..d6d3e59b5891 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py @@ -12,11 +12,7 @@ import os import time import struct - import sys - import getopt - import select import mmap - from sonic_platform_base.chassis_base import ChassisBase from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom @@ -219,8 +215,13 @@ def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): return None try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + if isinstance(raw , str): + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except BaseException: eeprom.close() return None @@ -971,7 +972,7 @@ def reset(self): reg_value = reg_value & ~mask # Convert our register value back to a hex string and write back - status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) # Sleep 1 second to allow it to settle time.sleep(1) @@ -979,7 +980,7 @@ def reset(self): reg_value = reg_value | mask # Convert our register value back to a hex string and write back - status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) return True @@ -1011,7 +1012,7 @@ def set_lpmode(self, lpmode): reg_value = reg_value & ~mask # Convert our register value back to a hex string and write back - status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) return True @@ -1030,12 +1031,6 @@ def tx_disable_channel(self, channel, disable): """ return False - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - def set_power_override(self, power_override, power_set): """ Sets SFP power level using power_override and power_set diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/thermal.py index 1f3caaa02dd3..d6432f66bcab 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/thermal.py @@ -11,7 +11,7 @@ try: from sonic_platform_base.thermal_base import ThermalBase - from sonic_platform.ipmihelper import IpmiSensor, IpmiFru + from sonic_platform.ipmihelper import IpmiSensor except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -105,9 +105,9 @@ def get_high_threshold(self): Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_threshold = self.sensor.get_threshold("UpperCritical") + is_valid, high_threshold = self.sensor.get_threshold("UpperNonCritical") if not is_valid: - high_threshold = 0 + return super(Thermal, self).get_high_threshold() return float(high_threshold) @@ -135,9 +135,9 @@ def get_high_critical_threshold(self): thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_crit_threshold = self.sensor.get_threshold("UpperNonRecoverable") + is_valid, high_crit_threshold = self.sensor.get_threshold("UpperCritical") if not is_valid: - high_crit_threshold = 0 + return super(Thermal, self).get_high_critical_threshold() return float(high_crit_threshold) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/watchdog.py index d3363067db63..3ba9f671a9fc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/watchdog.py @@ -10,8 +10,6 @@ ######################################################################## try: - import sys - import struct import ctypes import subprocess from sonic_platform_base.watchdog_base import WatchdogBase @@ -38,6 +36,7 @@ class Watchdog(WatchdogBase): CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] @@ -45,7 +44,7 @@ def __init__(self): def _get_command_result(self, cmdline): try: proc = subprocess.Popen(cmdline.split(), stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] proc.wait() result = stdout.rstrip('\n') @@ -139,8 +138,6 @@ def arm(self, seconds): self.timeout = seconds return seconds - return -1 - def disarm(self): """ Disarm the hardware watchdog @@ -211,4 +208,3 @@ def get_remaining_time(self): return self.timeout - diff_time return 0 - diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py index cead0eb326ef..8ac97943cc09 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py @@ -200,7 +200,7 @@ def get_sfp(self, index): # The index will start from 0 sfp = self._sfp_list[index-1] except IndexError: - sys.stderr.write("SFP index {} out of range (0-{})\n".format( + sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index 58c944cd6eb3..b564c1664533 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -81,6 +81,7 @@ class Component(ComponentBase): ] def __init__(self, component_index = 0): + ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/fan.py index ff7a08bdd1ad..d7bc0fdd3924 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/fan.py @@ -38,6 +38,7 @@ class Fan(FanBase): PSU_FRU_MAPPING = { 1: 3, 2: 4 } def __init__(self, fantray_index=1, fan_index=1, psu_fan=False, dependency=None): + FanBase.__init__(self) self.is_psu_fan = psu_fan if not self.is_psu_fan: # API index is starting from 0, DellEMC platform index is diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/psu.py index 0d06c31fcf8f..afd9c5a26a64 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/psu.py @@ -113,7 +113,7 @@ def get_voltage(self): if not is_valid: return None - return "{:.1f}".format(voltage) + return float(voltage) def get_voltage_low_threshold(self): """ @@ -159,7 +159,7 @@ def get_current(self): if not is_valid: return None - return "{:.1f}".format(current) + return float(current) def get_power(self): """ @@ -173,7 +173,7 @@ def get_power(self): if not is_valid: return None - return "{:.1f}".format(power) + return float(power) def get_powergood_status(self): """ diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py index ef6a2c5d339a..efda0d13c63f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py @@ -283,8 +283,13 @@ def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): return None try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + if isinstance(raw , str): + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except BaseException: eeprom.close() return None @@ -296,7 +301,7 @@ def _get_eeprom_data(self, eeprom_key): eeprom_data = None page_offset = None - if(self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] eeprom_data_raw = self._read_eeprom_bytes( self.eeprom_path, @@ -351,7 +356,8 @@ def get_transceiver_info(self): compliance_code_dict = {} transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') self.media_type = self.set_media_type() - self.reinit_sfp_driver() + if self.reinit_sfp_driver() == False: + return transceiver_info_dict # BaseInformation try: @@ -362,7 +368,7 @@ def get_transceiver_info(self): rate_identifier = iface_data['data']['RateIdentifier']['value'] identifier = iface_data['data']['type']['value'] type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): bit_rate = str( iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) for key in qsfp_compliance_code_tup: @@ -459,7 +465,7 @@ def get_transceiver_threshold_info(self): try: # Module Threshold module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] @@ -492,7 +498,7 @@ def get_transceiver_threshold_info(self): except (ValueError, TypeError) : pass try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): channel_threshold_data = self._get_eeprom_data('ChannelThreshold') transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] @@ -659,7 +665,7 @@ def get_rx_los(self): """ rx_los = False try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): rx_los_data = self._get_eeprom_data('rx_los') # As the function expects a single boolean, if any one channel experience LOS, # is considered LOS for QSFP @@ -679,7 +685,7 @@ def get_tx_fault(self): """ tx_fault = False try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): tx_fault_data = self._get_eeprom_data('tx_fault') for tx_fault_id in ('Tx1Fault', 'Tx2Fault', 'Tx3Fault', 'Tx4Fault') : tx_fault |= (tx_fault_data['data'][tx_fault_id]['value'] is 'On') @@ -697,7 +703,7 @@ def get_tx_disable(self): """ tx_disable = False try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): tx_disable_data = self._get_eeprom_data('tx_disable') for tx_disable_id in ('Tx1Disable', 'Tx2Disable', 'Tx3Disable', 'Tx4Disable'): tx_disable |= (tx_disable_data['data'][tx_disable_id]['value'] is 'On') @@ -717,7 +723,7 @@ def get_tx_disable_channel(self): """ tx_disable_channel = 0 try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): tx_disable_data = self._get_eeprom_data('tx_disable') for tx_disable_id in ('Tx1Disable', 'Tx2Disable', 'Tx3Disable', 'Tx4Disable'): tx_disable_channel <<= 1 @@ -732,7 +738,7 @@ def get_lpmode(self): """ lpmode_state = False try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -753,7 +759,7 @@ def get_power_override(self): power_override_state = False try: - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): power_override_data = self._get_eeprom_data('power_override') power_override = power_override_data['data']['PowerOverRide']['value'] power_override_state = (power_override is 'On') @@ -791,7 +797,7 @@ def get_tx_bias(self): tx_bias_list = [] try: tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): for tx_bias_id in ('TX1Bias', 'TX2Bias', 'TX3Bias', 'TX4Bias') : tx_bias = tx_bias_data['data'][tx_bias_id]['value'] tx_bias_list.append(tx_bias) @@ -809,7 +815,7 @@ def get_rx_power(self): rx_power_list = [] try: rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): for rx_power_id in ('RX1Power', 'RX2Power', 'RX3Power', 'RX4Power'): rx_power = rx_power_data['data'][rx_power_id]['value'] rx_power_list.append(rx_power) @@ -826,7 +832,7 @@ def get_tx_power(self): """ tx_power_list = [] try: - if(self.media_type == 'QSFP' or self.media_type == 'QSFP-DD'): + if self.media_type.startswith('QSFP'): # QSFP capability byte parse, through this byte can know whether it support tx_power or not. # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, # need to add more code for determining the capability and version compliance @@ -1003,6 +1009,10 @@ def reinit_sfp_driver(self): driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self._port_to_i2c_mapping[self.index]) delete_device = "echo 0x50 >" + del_sfp_path + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + try: with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: driver_name = fd.read() diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/thermal.py index 86d5f9492d50..1c7fe59857a3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/thermal.py @@ -111,9 +111,9 @@ def get_high_threshold(self): Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_threshold = self.sensor.get_threshold("UpperCritical") + is_valid, high_threshold = self.sensor.get_threshold("UpperNonCritical") if not is_valid: - high_threshold = 0 + return super(Thermal, self).get_high_threshold() return float(high_threshold) @@ -140,9 +140,9 @@ def get_high_critical_threshold(self): thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - is_valid, high_crit_threshold = self.sensor.get_threshold("UpperNonRecoverable") + is_valid, high_crit_threshold = self.sensor.get_threshold("UpperCritical") if not is_valid: - high_crit_threshold = 0 + return super(Thermal, self).get_high_critical_threshold() return float(high_crit_threshold) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/watchdog.py index 265fab66d922..76a7584e91aa 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/watchdog.py @@ -36,6 +36,7 @@ class Watchdog(WatchdogBase): CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] diff --git a/platform/broadcom/sonic-platform-modules-ruijie/LICENSE b/platform/broadcom/sonic-platform-modules-ruijie/LICENSE new file mode 100755 index 000000000000..68463127d0bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Ruijie Network Corporation +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/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/LICENSE b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/LICENSE new file mode 100755 index 000000000000..68463127d0bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Ruijie Network Corporation +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/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/MAINTAINERS b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/MAINTAINERS new file mode 100755 index 000000000000..7b2f22c0328a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/MAINTAINERS @@ -0,0 +1,6 @@ +# This file describes the maintainers for sonic-platform-modules-ruijie +# See the SONiC project governance document for more information + +Name = "sonic_rd" +Email = "sonic_rd@ruijie.com.cn" +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/Makefile b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/Makefile new file mode 100755 index 000000000000..1b09fe02bf6e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/Makefile @@ -0,0 +1,22 @@ +PWD = $(shell pwd) +DIR_KERNEL_SRC = $(PWD)/modules/driver +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -Wall +SUB_BUILD_DIR = $(PWD)/build +INSTALL_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) +INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin + +KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +export KBUILD_EXTRA_SYMBOLS + +all: + $(MAKE) -C $(KBUILD_OUTPUT) M=$(DIR_KERNEL_SRC) modules + @if [ ! -d ${INSTALL_DIR} ]; then mkdir -p ${INSTALL_DIR} ;fi + cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_DIR) + @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi + cp -r $(PWD)/config/* $(INSTALL_SCRIPT_DIR) +clean: + rm -f ${DIR_KERNEL_SRC}/*.o ${DIR_KERNEL_SRC}/*.ko ${DIR_KERNEL_SRC}/*.mod.c ${DIR_KERNEL_SRC}/.*.cmd + rm -f ${DIR_KERNEL_SRC}/Module.markers ${DIR_KERNEL_SRC}/Module.symvers ${DIR_KERNEL_SRC}/modules.order + rm -rf ${DIR_KERNEL_SRC}/.tmp_versions + rm -rf $(SUB_BUILD_DIR) diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/README.md b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/README.md new file mode 100755 index 000000000000..b4dbacd5e466 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-ruijie +Device drivers for support of ruijie platform for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/config/x86_64_ruijie_b6510_48vs8cq_r0_config.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/config/x86_64_ruijie_b6510_48vs8cq_r0_config.py new file mode 100755 index 000000000000..23684230f6d7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/config/x86_64_ruijie_b6510_48vs8cq_r0_config.py @@ -0,0 +1,787 @@ +#!/usr/bin/python3 +# -*- coding: UTF-8 -*- + +fancontrol_loc = "/usr/local/bin" +fancontrol_config_loc = "/usr/local/bin" + +GLOBALCONFIG = "GLOBALCONFIG" +MONITOR_CONST = "MONITOR_CONST" + +RUIJIE_PART_NUMBER = "RJ000001" +RUIJIE_LABEL_REVISION = "R01" +RUIJIE_ONIE_VERSION = "2018.02" +RUIJIE_MAC_SIZE = 3 +RUIJIE_MANUF_NAME = "Ruijie" +RUIJIE_MANUF_COUNTRY = "CHN" +RUIJIE_VENDOR_NAME = "Ruijie" +RUIJIE_DIAG_VERSION = "0.1.0.15" +RUIJIE_SERVICE_TAG = "www.ruijie.com.cn" + +DEV_LEDS = {} +MEM_SLOTS = [] + +LOCAL_LED_CONTROL = { + "CLOSE":{}, + "OPEN":{} +} + +FIRMWARE_TOOLS = {} + +################################################################################################### +##### fan board ID reference +################################################################################################### +FANS_DEF = { + 0x8100:"M6500-FAN-F", + 0x8101:"M6510-FAN-F", + 0x8102:"M6520-FAN-F", + 0x8103:"M6510-FAN-R" +} + +factest_module = { + "sysinfo_showfanmsg":1, + "sysinfo_showPsumsg":1, + "sysinfo_showrestfanmsg":0, + "sysinfo_showrestpsumsg":0 +} + +MONITOR_MAC_SOURCE_SYSFS = 0 #1 get mac temperature from sysfs ,0 get mac temperature from bcmcmd +MONITOR_MAC_SOURCE_PATH = None #sysfs path + +################################################################### + +SLOT_MONITOR_PARAM = {} + +FAN_PROTECT = {"bus":0, "devno":0x32, "addr":0x19, "open":0x00, "close":0x0f} +rg_eeprom = "2-0057/eeprom" +E2_LOC = {"bus":2, "devno":0x57} +E2_PROTECT ={"bus":2, "devno":0x33, "addr":0xb0, "open":0, "close":1} +MAC_LED_RESET = {"pcibus": 8, "slot": 0, "fn": 0, "bar": 0, "offset": 64, "reset": 0x98} + +PCA9548START = -1 +PCA9548BUSEND = -2 + + +RUIJIE_CARDID = 0x00004040 +RUIJIE_PRODUCTNAME = "B6510-48VS8CQ" + +STARTMODULE = { + "fancontrol":1, + "avscontrol":1, + "dev_monitor":1 +} + +i2ccheck_params = {"busend":"i2c-66","retrytime":6} + +DEV_MONITOR_PARAM = { + "polling_time": 10, + "psus": [ + { + "name": "psu1", + "present": { + "gettype": "i2c", + "bus": 2, + "loc": 0x37, + "offset": 0x51, + "presentbit": 0, + "okval": 0, + }, + "device": [ + { + "id": "psu1pmbus", + "name": "dps550", + "bus": 7, + "loc": 0x58, + "attr": "hwmon", + }, + ], + }, + { + "name": "psu2", + "present": { + "gettype": "i2c", + "bus": 2, + "loc": 0x37, + "offset": 0x51, + "presentbit": 4, + "okval": 0, + }, + "device": [ + { + "id": "psu2pmbus", + "name": "dps550", + "bus": 8, + "loc": 0x5B, + "attr": "hwmon", + }, + ], + }, + ], +} + +fanlevel = { + "tips":["low","medium","high"], + "level":[51,150,255], + "low_speed":[500,7500,17000], + "high_speed":[11000,22500,28500] +} + +fanloc =[ {"name":"FAN1/FAN2/FAN3/FAN4", "location":"0-0032/fan_speed_set", + "childfans":[{"name":"FAN1", "location":"2-0037/hwmon/hwmon4/fan1_input"}, + {"name":"FAN2", "location":"2-0037/hwmon/hwmon4/fan2_input"}, + {"name":"FAN3", "location":"2-0037/hwmon/hwmon4/fan3_input"}, + {"name":"FAN4", "location":"2-0037/hwmon/hwmon4/fan4_input"} ]}, + ] + + +#################FAN-Speed-Adjustment-Parameters############################## +MONITOR_TEMP_MIN = 38 # temperature before speed-adjsutment +MONITOR_K = 11 # speed-adjustment algorithm +MONITOR_MAC_IN = 35 # temperature difference between mac and chip +MONITOR_DEFAULT_SPEED = 0x60 # default speed +MONITOR_MAX_SPEED = 0xFF # maximum speed +MONITOR_MIN_SPEED = 0x33 # minimum speed +MONITOR_MAC_ERROR_SPEED = 0XBB # MAC abnormal speed +MONITOR_FAN_TOTAL_NUM = 4 # 3+1 redundancy design, report to syslog if there exists a error +MONITOR_MAC_UP_TEMP = 50 # MAC compared with temperature inlet up +MONITOR_MAC_LOWER_TEMP = -50 # MAC compared with temperature outlet down +MONITOR_MAC_MAX_TEMP = 100 # + +MONITOR_FALL_TEMP = 4 # speed-adjustment reduced temperature +MONITOR_MAC_WARNING_THRESHOLD = 100 #100 +MONITOR_OUTTEMP_WARNING_THRESHOLD = 85 +MONITOR_BOARDTEMP_WARNING_THRESHOLD = 85 +MONITOR_CPUTEMP_WARNING_THRESHOLD = 85 +MONITOR_INTEMP_WARNING_THRESHOLD = 70 #70 + +MONITOR_MAC_CRITICAL_THRESHOLD = 105 #105 +MONITOR_OUTTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_BOARDTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_CPUTEMP_CRITICAL_THRESHOLD = 100 #100 +MONITOR_INTEMP_CRITICAL_THRESHOLD = 80 # 80 +MONITOR_CRITICAL_NUM = 3 #retry times +MONITOR_SHAKE_TIME = 20 #anti-shake intervals +MONITOR_INTERVAL = 60 + +MONITOR_SYS_LED = [ + {"bus":2,"devno":0x33, "addr":0xb2, "yellow":0x03, "red":0x02,"green":0x01}, + {"bus":2,"devno":0x37, "addr":0xb2, "yellow":0x03, "red":0x02,"green":0x01}] + +MONITOR_SYS_FAN_LED =[ + {"bus":2,"devno":0x33, "addr":0xb4, "yellow":0x06, "red":0x02,"green":0x04}, + ] +MONITOR_FANS_LED = [ + {"bus":2,"devno":0x32, "addr":0x23, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x24, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x25, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x26, "green":0x09, "red":0x0a}] + + +CPLDVERSIONS = [ + {"bus":2, "devno":0x33, "name":"MAC board CPLD-A"}, + {"bus":2, "devno":0x35, "name":"MAC board CPLD-B"}, + {"bus":2, "devno":0x37, "name":"CONNECT board CPLD-A"}, + {"bus":0, "devno":0x0d, "name":"CPU board CPLD"}, +] + +MONITOR_SYS_PSU_LED =[ + {"bus":2,"devno":0x33, "addr":0xb3, "yellow":0x06, "red":0x02,"green":0x04}, + ] + +MONITOR_FAN_STATUS = [ + {'status':'green', 'minOkNum':4,'maxOkNum':4}, + {'status':'yellow', 'minOkNum':3,'maxOkNum':3}, + {'status':'red' , 'minOkNum':0,'maxOkNum':2}, + ] + +MONITOR_PSU_STATUS = [ + {'status':'green', 'minOkNum':2,'maxOkNum':2}, + {'status':'yellow', 'minOkNum':1,'maxOkNum':1}, + {'status':'red' , 'minOkNum':0,'maxOkNum':0}, + ] + + +MONITOR_DEV_STATUS = { + "temperature": [ + {"name":"lm75in", "location":"/sys/bus/i2c/devices/2-0048/hwmon/*/temp1_input"}, + {"name":"lm75out", "location":"/sys/bus/i2c/devices/2-0049/hwmon/*/temp1_input"}, + {"name":"lm75hot", "location":"/sys/bus/i2c/devices/2-004a/hwmon/*/temp1_input"}, + {"name":"cpu", "location":"/sys/class/hwmon/hwmon0"}, + ], + "fans": [ + { + "name":"fan1", + "presentstatus":{"bus":2, "loc":0x37, "offset":0x30, 'bit':0}, + "rollstatus": [ + {"name":"motor1","bus":2, "loc":0x37, "offset":0x31, 'bit':0}, + ] + }, + { + "name":"fan2", + "presentstatus":{"bus":2, "loc":0x37, "offset":0x30, 'bit':1}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x37, "offset":0x31, 'bit':1}, + ] + }, + { + "name":"fan3", + "presentstatus":{"bus":2, "loc":0x37, "offset":0x30, 'bit':2}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x37, "offset":0x31, 'bit':2}, + ] + }, + { + "name":"fan4", + "presentstatus":{"bus":2, "loc":0x37, "offset":0x30, 'bit':3}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x37, "offset":0x31, 'bit':3}, + ] + }, + ], + "psus": [ + {"name":"psu1", "bus":2, "loc":0x37, "offset":0x51, "gettype":"i2c", 'presentbit': 0, 'statusbit':1,'alertbit':2}, + {"name":"psu2", "bus":2, "loc":0x37, "offset":0x51, "gettype":"i2c", 'presentbit': 4, 'statusbit':5,'alertbit':6}, + ], + "mac_temp" : { + "flag" : {"bus":2, "loc":0x33, "offset":0xd4, "gettype":"i2c", 'okbit': 0, 'okval':1}, + "loc" : [ + "2-0035/mac_temp_input", + ], + "try_bcmcmd" : 0, + }, +} + +MONITOR_DEV_STATUS_DECODE = { + 'fanpresent': {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'fanroll' : {0:'STALL' , 1:'ROLL', 'okval':1}, + 'psupresent': {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'psuoutput' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, + 'psualert' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, +} +################################################################### + + +#####################MAC-Voltage-Adjustment-Parameters(B6510)#################################### +MAC_AVS_PARAM ={ + 0x72:0x0384, + 0x73:0x037e, + 0x74:0x0378, + 0x75:0x0372, + 0x76:0x036b, + 0x77:0x0365, + 0x78:0x035f, + 0x79:0x0359, + 0x7a:0x0352, + 0x7b:0x034c, + 0x7c:0x0346, + 0x7d:0x0340, + 0x7e:0x0339, + 0x7f:0x0333, + 0x80:0x032d, + 0x81:0x0327, + 0x82:0x0320, + 0x83:0x031a, + 0x84:0x0314, + 0x85:0x030e, + 0x86:0x0307, + 0x87:0x0301, + 0x88:0x02fb, + 0x89:0x02f5, + 0x8A:0x02ee +} +# 6510 Default Configuration +MAC_DEFAULT_PARAM = { + "type": 1, # type 1 represents default if out of range / 0 represents no voltage-adjustment if out of range + "default":0x74, # should be used with type + "loopaddr":0x00, # AVS loop address + "loop":0x00, # AVS loop value + "open":0x00, # diasble write-protection value + "close":0x40, # enable write-protection value + "bus":2, # AVSI2C bus address + "devno":0x60, # AVS address + "addr":0x21, # AVS voltage-adjustment address + "protectaddr":0x10, # AVS write-protection address + "sdkreg":"TOP_AVS_SEL_REG", # SDK register name + "sdktype": 0, # type 0 represents no shift operation / 1 represents shift operation + "macregloc":24, # shift operation + "mask": 0xff # mask after shift +} +#####################MAC-Voltage-Adjustment-Parameters#################################### + +## Drivers List +## +DRIVERLISTS = [ + {"name":"i2c_dev", "delay":0}, + {"name":"i2c_gpio", "delay":0}, + {"name":"i2c_algo_bit","delay":0}, + {"name":"i2c_mux_pca9641", "delay":0}, + {"name":"i2c_mux_pca954x force_create_bus=1", "delay":0},# force_deselect_on_exit=1 + {"name":"i2c_mux", "delay":0}, + {"name":"lm75", "delay":0}, + {"name":"optoe", "delay":0}, + {"name":"at24", "delay":0}, + {"name":"ruijie_platform", "delay":0}, + {"name":"rg_cpld", "delay":0}, + {"name":"rg_fan", "delay":0}, + {"name":"rg_psu", "delay":0}, + {"name":"pmbus_core", "delay":0}, + {"name":"csu550", "delay":0}, + {"name":"rg_gpio_xeon", "delay":0}, + {"name":"ipmi_devintf", "delay":0}, + {"name":"ipmi_si", "delay":0}, + {"name":"ipmi_msghandler", "delay":0}, +] + +DEVICE = [ + {"name":"pca9541","bus":0,"loc":0x10 }, + {"name":"pca9548","bus":2,"loc":0x70 }, + {"name":"lm75","bus": 2, "loc":0x48 }, + {"name":"lm75","bus": 2, "loc":0x49 }, + {"name":"lm75","bus": 2, "loc":0x4a }, + {"name":"24c02","bus":2, "loc":0x57 }, + {"name":"rg_cpld","bus":0,"loc":0x32 }, + {"name":"rg_cpld","bus":1,"loc":0x34 }, + {"name":"rg_cpld","bus":1,"loc":0x36 }, + {"name":"rg_cpld","bus":2,"loc":0x33 }, + {"name":"rg_cpld","bus":2,"loc":0x35 }, + {"name":"rg_cpld","bus":2,"loc":0x37 }, + {"name":"pca9548","bus":1,"loc":0x70 }, + {"name":"pca9548","bus":1,"loc":0x71 }, + {"name":"pca9548","bus":1,"loc":0x72 }, + {"name":"pca9548","bus":1,"loc":0x73 }, + {"name":"pca9548","bus":1,"loc":0x74 }, + {"name":"pca9548","bus":1,"loc":0x75 }, + {"name":"pca9548","bus":1,"loc":0x76 }, + {"name":"rg_fan","bus":3,"loc":0x53 }, + {"name":"rg_fan","bus":4,"loc":0x53 }, + {"name":"rg_fan","bus":5,"loc":0x53 }, + {"name":"rg_fan","bus":6,"loc":0x53 }, + {"name":"rg_psu","bus":7,"loc":0x50 }, + {"name":"dps550","bus":7,"loc":0x58 }, + {"name":"rg_psu","bus":8,"loc":0x53 }, + {"name":"dps550","bus":8,"loc":0x5b }, +] + +INIT_PARAM = [ + {"loc":"1-0034/sfp_enable","value": "01"}, + {"loc":"2-0035/sfp_enable2","value":"ff"}, + {"loc":"2-0033/mac_led", "value":"ff"}, + {"loc":"1-0034/sfp_txdis1","value":"00"}, + {"loc":"1-0034/sfp_txdis2","value":"00"}, + {"loc":"1-0034/sfp_txdis3","value":"00"}, + {"loc":"1-0036/sfp_txdis4","value":"00"}, + {"loc":"1-0036/sfp_txdis5","value":"00"}, + {"loc":"1-0036/sfp_txdis6","value":"00"}, + {"loc":fanloc[0]["location"], "value":"80"}, + {"loc":"2-0033/sfp_led1_yellow","value":"ad"}, + {"loc":"2-0035/sfp_led2_yellow","value":"ad"}, +] + +INIT_COMMAND = [ +] + +## Driver List +## + +#####################FRU-Info-Adaption################################# +E2TYPE = {"1": "tlveeprom", + "2": "x86cpueeprom", + "3": "bmceeprom", + "4": "cpueeprom", + "5": "maceeprom", + "6": "sloteeprom", + "7": "fanconnecteeprom", + "8": "M1HFANI-F", + "9": "M1HFANI-R", + "A": "M2HFANI-F", + "B": "M2HFANI-R", + "C": "psu"} +FRULISTS = [] +################################Manufacturing-Test-Adaption-Area####################################################### +# need to export interface +fanlevel_6510 = { + "level":[51,150,255], + "low_speed":[500,7500,17000], + "high_speed":[11000,22500,28500] +} + +fanlevel_6520 = { + "level":[75,150,255], + "low_speed":[750,4250,6750], + "high_speed":[4500,7500,10000] +} + +TEMPIDCHANGE = { + "lm75in":"inlet", + "lm75out":"outlet", + "lm75hot":"hot-point", + "inlet":"lm75in", + "outlet":"lm75out", + "hot-point":"lm75hot", +} + +# Manufacturing-Test module +FACTESTMODULE = { } + +##################################Manufacturing-Test-Menu +item1 = {"name":"Single Test", "deal" :"test_signal", "childid":1} +test_sys_reload_item = {"name":"reset-system", "deal" :"test_sys_reload"} + +test_sys_item = { "name":"Product information test", "deal" :"test_sysinfo"} +test_temp_item = { "name":"temperature test", "deal" :"test_tempinfo"} +test_mem_item = { "name":"Memory test", "deal" :"test_cpumemoryinfo"} +test_hd_item = { "name":"Hard disk test", "deal" :"test_hard"} +test_rtc_item = { "name":"RTC test ", "deal" :"test_rtc"} +test_i2c_item = { "name":"I2c test ", "deal" :"test_i2c"} +test_cpld_item = { "name":"CPLD test", "deal" :"test_cpld"} +test_portframe_item = { "name":"Port transmit-receive frame test", "deal" :"test_portframe"} +test_sysled_item = { "name":"System led test", "deal" :"test_led"} +test_fan_item = { "name":"Fan status test", "deal" :"test_fan"} +test_power_item = { "name":"PSU status test", "deal" :"test_power"} +test_usb_item = { "name":"USB test", "deal" :"test_usb"} +test_prbs_item = { "name":"PRBS test", "deal" :"test_prbs"} +test_portbroadcast_item = { "name":"Port broadcast", "deal" :"test_portbroadcast"} + +test_debug_level = {"name":"Change debug level", "deal" :"test_setdebug"} +test_log_level = {"name":"Log output level", "deal" :"test_loginfolevel"} +test_setmac = {"name":"setmac", "deal" :"test_setmac"} +test_setrtc = {"name":"Set RTC", "deal" :"test_set_rtc"} + +log_level_critical = {"name":"CRITICAL", "deal" :"test_log_critical"} +log_level_debug = {"name":"DEBUG", "deal" :"test_log_debug"} +log_level_error = {"name":"ERROR", "deal" :"test_log_error"} +log_level_info = {"name":"INFO", "deal" :"test_log_info"} +log_level_notset = {"name":"NOTSET", "deal" :"test_log_notset"} +log_level_warning = {"name":"WARNING", "deal" :"test_log_warning"} + + +test_e2_setmac_item = {"name":"E2SETMAC", "deal" :"test_e2_setmac"} +test_bmc_setmac_item = {"name":"BMCSETMAC", "deal" :"test_bmc_setmac"} +test_fan_setmac_item = {"name":"fan SETMAC", "deal" :"test_fan_setmac"} + +alltest = [ + test_sys_item, + test_temp_item, + test_mem_item, + test_hd_item, + test_rtc_item, + test_i2c_item, + test_cpld_item, + test_portframe_item, + test_sysled_item, + test_fan_item, + test_power_item, + test_usb_item, + test_prbs_item, + test_portbroadcast_item + ] + +looptest = [ + test_sys_item, + test_temp_item, + test_mem_item, + test_hd_item, + test_rtc_item, + test_i2c_item, + test_cpld_item, + test_portframe_item, + test_fan_item, + test_power_item, + test_usb_item, + test_prbs_item, + test_portbroadcast_item , +] + +diagtestall = [ +] + +menuList =[ + { + "menuid":0, "value":[ + {"name":"Single test", "deal" :"test_signal", "childid":1}, + {"name":"All test", "deal" :"test_all"}, + {"name":"Loop test", "deal" :"test_loop"}, + #{"name":"Check loop-test result", "deal" :"test_loop_read"}, + #{"name":"Delete loop-test result", "deal" :"test_loop_delete"}, +# {"name":"Load configuration", "deal" :"test_config"}, + test_sys_reload_item, + {"name":"System Configuration", "deal" :"test_sysconfig","childid":2}, + ] + }, + { + "menuid":1, "parentid":0, "value":[ + test_sys_item , + test_temp_item , + test_mem_item , + test_hd_item , + test_rtc_item , + test_i2c_item , + test_cpld_item , + test_portframe_item , + test_sysled_item , + test_fan_item , + test_power_item , + test_usb_item , + test_prbs_item , + test_portbroadcast_item , + ]}, + { + "menuid":2, "parentid":0, "value":[ + test_debug_level, + test_log_level , + test_setmac , + test_setrtc , + ]}, + { + "menuid":3, "parentid":2, "value":[ + log_level_critical , + log_level_debug , + log_level_error , + log_level_info , + log_level_notset , + log_level_warning , + ]}, + { + "menuid":4, "parentid":2, "value":[ + test_e2_setmac_item , + test_bmc_setmac_item, + test_fan_setmac_item, + ]}, +] + + +TESTCASE={ + "CPLD":[ + {"name":"CONNECT BOARD CPLD-A" ,"cases":[ + {"name":"cpld32", "cmd":"grtd_test.py cpld_check 0 0x32 0xAA"}, + {"name":"cpld37", "cmd":"grtd_test.py cpld_check 2 0x37 0xAC"}, + ] + }, + {"name":"MAC BOARD CPLD-A" ,"cases":[ + {"name":"cpld33", "cmd":"grtd_test.py cpld_check 2 0x33 0xAB"}, + {"name":"cpld34", "cmd":"grtd_test.py cpld_check 1 0x34 0xAA"}, + ] + }, + {"name":"MAC BOARD CPLD-B" ,"cases":[ + {"name":"cpld36", "cmd":"grtd_test.py cpld_check 1 0x36 0xAA"}, + {"name":"cpld35", "cmd":"grtd_test.py cpld_check 2 0x35 0xAB"}, + ] + }, + ], + "TEMPERATURE":[ + { + "name":"-->temperature test" , "cases":[ + {"name":"inlet","cmd":"grtd_test.py temp 2-0048/hwmon/hwmon1/temp1_input"}, + {"name":"outlet","cmd":"grtd_test.py temp 2-0049/hwmon/hwmon2/temp1_input"}, + {"name":"hot-point","cmd":"grtd_test.py temp 2-004a/hwmon/hwmon3/temp1_input"}, + ] + } + ], + "MEMTORY":{ + "cases":[ + {"name":"->memory test 1M","cmd":"memtester 1M 1"}, + {"name":"->memory test 2M","cmd":"memtester 2M 1"}, + {"name":"->memory test 8M","cmd":"memtester 8M 1"}, +# {"name":"->memory test 16M","cmd":"memtester 16M 1"}, +# {"name":"->memory test 256M","cmd":"memtester 256M 1"}, + ] + }, + "SMARTCTLCMDS":{ + "cases":[ + {"name":"->Check Hard Disk Info", "cmd":"smartctl -i /dev/sda"}, + {"name":"->Check Hard Disk Monitor Status", "cmd":"smartctl -H /dev/sda"}, + ] + }, + "LED":[ + {"name":"Light Port Led test","cases":[ + {"name":"-> Red Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + {"name":"-> Red Led On", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff"}, + {"name":"-> Recovery Red Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + + {"name":"-> Yellow Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + {"name":"-> Yellow Led On", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff"}, + {"name":"-> Recovery Yellow Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + ] + }, + {"name":"fan 1 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x09"}, + ] + }, + {"name":"fan 2 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x09"}, + ] + }, + {"name":"fan 3 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x09"}, + ] + }, + {"name":"Front panel CPU Led", "cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x00"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x02"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x03"}, + {"name":"-> Green Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x11"}, + {"name":"-> Green Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x21"}, + {"name":"-> Green Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x41"}, + {"name":"-> Green Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x81"}, + {"name":"-> Red Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x12"}, + {"name":"-> Red Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x22"}, + {"name":"-> Red Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x42"}, + {"name":"-> Red Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x82"}, + {"name":"-> Yellow Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x13"}, + {"name":"-> Yellow Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x23"}, + {"name":"-> Yellow Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x43"}, + {"name":"-> Yellow Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x83"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x01"}, + ] + }, + {"name":"Front panel BMC Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x04"}, + ] + }, + {"name":"Front panel location Led" , "cases":[ + {"name":"-> LedOff","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xff"}, + {"name":"-> LedOn","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xfe"}, + {"name":"->Recovery LedOff","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xff"}, + ] + }, + + {"name":"Front panel pwr Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x04"}, + ] + }, + {"name":"Front panel fan Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x04"}, + ] + }, + + ], + "I2C":[ + ####type 1 represents value obtained compated with value + ####type 2 represents return True or False + {"name":"I2C device test" ,"cases":[ + {"name":" PCA9641 test", "cmd":"grtd_test.py dev_rd 0 10 0","deal_type":2}, + {"name":" cpld32 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld33 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld34 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld35 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld36 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld37 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" inlet LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" outlet LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" hot-point LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" EEPROM", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" Port 1", "cmd":"grtd_test.py dev_rd 11 0050 0","deal_type":2}, + {"name":" Port 2", "cmd":"grtd_test.py dev_rd 12 0050 0","deal_type":2}, + {"name":" Port 3", "cmd":"grtd_test.py dev_rd 13 0050 0","deal_type":2}, + {"name":" Port 4", "cmd":"grtd_test.py dev_rd 14 0050 0","deal_type":2}, + {"name":" Port 5", "cmd":"grtd_test.py dev_rd 15 0050 0","deal_type":2}, + {"name":" Port 6", "cmd":"grtd_test.py dev_rd 16 0050 0","deal_type":2}, + {"name":" Port 7", "cmd":"grtd_test.py dev_rd 17 0050 0","deal_type":2}, + {"name":" Port 8", "cmd":"grtd_test.py dev_rd 18 0050 0","deal_type":2}, + {"name":" Port 9", "cmd":"grtd_test.py dev_rd 19 0050 0","deal_type":2}, + {"name":" Port 10", "cmd":"grtd_test.py dev_rd 20 0050 0","deal_type":2}, + {"name":" Port 11", "cmd":"grtd_test.py dev_rd 21 0050 0","deal_type":2}, + {"name":" Port 12", "cmd":"grtd_test.py dev_rd 22 0050 0","deal_type":2}, + {"name":" Port 13", "cmd":"grtd_test.py dev_rd 23 0050 0","deal_type":2}, + {"name":" Port 14", "cmd":"grtd_test.py dev_rd 24 0050 0","deal_type":2}, + {"name":" Port 15", "cmd":"grtd_test.py dev_rd 25 0050 0","deal_type":2}, + {"name":" Port 16", "cmd":"grtd_test.py dev_rd 26 0050 0","deal_type":2}, + {"name":" Port 17", "cmd":"grtd_test.py dev_rd 27 0050 0","deal_type":2}, + {"name":" Port 18", "cmd":"grtd_test.py dev_rd 28 0050 0","deal_type":2}, + {"name":" Port 19", "cmd":"grtd_test.py dev_rd 29 0050 0","deal_type":2}, + {"name":" Port 20", "cmd":"grtd_test.py dev_rd 30 0050 0","deal_type":2}, + {"name":" Port 21", "cmd":"grtd_test.py dev_rd 31 0050 0","deal_type":2}, + {"name":" Port 22", "cmd":"grtd_test.py dev_rd 32 0050 0","deal_type":2}, + {"name":" Port 23", "cmd":"grtd_test.py dev_rd 33 0050 0","deal_type":2}, + {"name":" Port 24", "cmd":"grtd_test.py dev_rd 34 0050 0","deal_type":2}, + {"name":" Port 25", "cmd":"grtd_test.py dev_rd 35 0050 0","deal_type":2}, + {"name":" Port 26", "cmd":"grtd_test.py dev_rd 36 0050 0","deal_type":2}, + {"name":" Port 27", "cmd":"grtd_test.py dev_rd 37 0050 0","deal_type":2}, + {"name":" Port 28", "cmd":"grtd_test.py dev_rd 38 0050 0","deal_type":2}, + {"name":" Port 29", "cmd":"grtd_test.py dev_rd 39 0050 0","deal_type":2}, + {"name":" Port 30", "cmd":"grtd_test.py dev_rd 40 0050 0","deal_type":2}, + {"name":" Port 31", "cmd":"grtd_test.py dev_rd 41 0050 0","deal_type":2}, + {"name":" Port 32", "cmd":"grtd_test.py dev_rd 42 0050 0","deal_type":2}, + {"name":" Port 33", "cmd":"grtd_test.py dev_rd 43 0050 0","deal_type":2}, + {"name":" Port 34", "cmd":"grtd_test.py dev_rd 44 0050 0","deal_type":2}, + {"name":" Port 35", "cmd":"grtd_test.py dev_rd 45 0050 0","deal_type":2}, + {"name":" Port 36", "cmd":"grtd_test.py dev_rd 46 0050 0","deal_type":2}, + {"name":" Port 37", "cmd":"grtd_test.py dev_rd 47 0050 0","deal_type":2}, + {"name":" Port 38", "cmd":"grtd_test.py dev_rd 48 0050 0","deal_type":2}, + {"name":" Port 39", "cmd":"grtd_test.py dev_rd 49 0050 0","deal_type":2}, + {"name":" Port 40", "cmd":"grtd_test.py dev_rd 50 0050 0","deal_type":2}, + {"name":" Port 41", "cmd":"grtd_test.py dev_rd 51 0050 0","deal_type":2}, + {"name":" Port 42", "cmd":"grtd_test.py dev_rd 52 0050 0","deal_type":2}, + {"name":" Port 43", "cmd":"grtd_test.py dev_rd 53 0050 0","deal_type":2}, + {"name":" Port 44", "cmd":"grtd_test.py dev_rd 54 0050 0","deal_type":2}, + {"name":" Port 45", "cmd":"grtd_test.py dev_rd 55 0050 0","deal_type":2}, + {"name":" Port 46", "cmd":"grtd_test.py dev_rd 56 0050 0","deal_type":2}, + {"name":" Port 47", "cmd":"grtd_test.py dev_rd 57 0050 0","deal_type":2}, + {"name":" Port 48", "cmd":"grtd_test.py dev_rd 58 0050 0","deal_type":2}, + {"name":" Port 49", "cmd":"grtd_test.py dev_rd 59 0050 0","deal_type":2}, + {"name":" Port 50", "cmd":"grtd_test.py dev_rd 60 0050 0","deal_type":2}, + {"name":" Port 51", "cmd":"grtd_test.py dev_rd 61 0050 0","deal_type":2}, + {"name":" Port 52", "cmd":"grtd_test.py dev_rd 62 0050 0","deal_type":2}, + {"name":" Port 53", "cmd":"grtd_test.py dev_rd 63 0050 0","deal_type":2}, + {"name":" Port 54", "cmd":"grtd_test.py dev_rd 64 0050 0","deal_type":2}, + {"name":" Port 55", "cmd":"grtd_test.py dev_rd 65 0050 0","deal_type":2}, + {"name":" Port 56", "cmd":"grtd_test.py dev_rd 66 0050 0","deal_type":2}, + {"name":" Port 57", "cmd":"grtd_test.py dev_rd 67 0050 0","deal_type":2}, + {"name":" Port 58", "cmd":"grtd_test.py dev_rd 68 0050 0","deal_type":2}, + {"name":" Port 59", "cmd":"grtd_test.py dev_rd 69 0050 0","deal_type":2}, + {"name":" Port 60", "cmd":"grtd_test.py dev_rd 70 0050 0","deal_type":2}, + {"name":" Port 61", "cmd":"grtd_test.py dev_rd 71 0050 0","deal_type":2}, + {"name":" Port 62", "cmd":"grtd_test.py dev_rd 72 0050 0","deal_type":2}, + {"name":" Port 63", "cmd":"grtd_test.py dev_rd 73 0050 0","deal_type":2}, + {"name":" Port 64", "cmd":"grtd_test.py dev_rd 74 0050 0","deal_type":2}, + ] + }, + ], +} + +PCIe_DEV_LIST = [] +PCIe_SPEED_ITEM = [] + +################################Manufacturing-Test-Adaption-Area####################################################### diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/Makefile b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/Makefile new file mode 100755 index 000000000000..f10216ec4d5a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/Makefile @@ -0,0 +1 @@ +obj-m := rg_cpld.o diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/rg_cpld.c b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/rg_cpld.c new file mode 100755 index 000000000000..0d890d5ba23b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/modules/driver/rg_cpld.c @@ -0,0 +1,602 @@ +/* + * rg_cpld.c - A driver for cpld + * + * Copyright (c) 2019 + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* debug level */ +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +static int debuglevel = 0; +module_param(debuglevel, int, S_IRUGO); + +#define DBG_DEBUG(fmt, arg...) do { \ + if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else if ( debuglevel >= DBG_ERROR ) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else { } \ +} while (0) + +#define DBG_ERROR(fmt, arg...) do { \ + if ( debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } \ +} while (0) + +static const unsigned short rg_i2c_cpld[] = { 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, I2C_CLIENT_END }; + +#define CPLD_SIZE 256 +#define CPLD_I2C_RETRY_TIMES 3 +#define READ_TEMP_FAIL 1000000 + +struct cpld_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[CPLD_SIZE]; /* Register value */ +}; + +static s32 cpld_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_byte_data(client, command) ) >= 0 ) + break; + } + return ret; +} + +static s32 cpld_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, + u8 command, u8 length, u8 *values) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values) ) >= 0 ) + break; + } + return ret; +} + +static ssize_t show_fan_rpm_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + uint8_t size; + s32 status; + s32 ret_t; + + ret_t = 0; + status = -1; + size = 0; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[0] = status; + status = cpld_i2c_smbus_read_byte_data(client, index + 1); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[1] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index, data->data[0]); + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index + 1, data->data[1]); + ret_t = (data->data[1] << 8) + data->data[0] ; + if (ret_t == 0 ) { + size = snprintf(buf, CPLD_SIZE, "%d\n", ret_t); + } else if (ret_t == 0xffff) { + size = snprintf(buf, CPLD_SIZE, "%d\n", 0); + } else { + size = snprintf(buf, CPLD_SIZE, "%d\n", 15000000 / ret_t); + } + mutex_unlock(&data->update_lock); + return size; +} + +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + unsigned long val; + int err; + + err = kstrtoul(buf, 16, &val); + if (err) + return err; + if ((val < 0) || (val > 0xff)) { + DBG_ERROR("please enter 0x00 ~ 0xff\n"); + return -1; + } + mutex_lock(&data->update_lock); + data->data[0] = (u8)val; + DBG_DEBUG("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, data->data[0]); + i2c_smbus_write_byte_data(client, attr->index, data->data[0]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_i2c_block_data(client, 0, 4, data->data); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%02x %02x %02x %02x \n", data->data[0], data->data[1], data->data[2], + data->data[3]); +} + +static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, attr->index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[0] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%02x\n", attr->index, data->data[0]); + mutex_unlock(&data->update_lock); + return sprintf(buf, "%02x\n", data->data[0]); +} + +static ssize_t show_mac_temp_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + int tmp_value, value; + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + + status = cpld_i2c_smbus_read_byte_data(client, index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return snprintf(buf, CPLD_SIZE, "%d\n", -READ_TEMP_FAIL); + } + data->data[0] = status; + status = cpld_i2c_smbus_read_byte_data(client, index + 1); + if (status < 0) { + mutex_unlock(&data->update_lock); + return snprintf(buf, CPLD_SIZE, "%d\n", -READ_TEMP_FAIL); + } + data->data[1] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index, data->data[0]); + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index + 1, data->data[1]); + mutex_unlock(&data->update_lock); + + tmp_value = (data->data[1] << 8) + data->data[0]; + if (tmp_value == 0) { + DBG_ERROR("invalid cpld value : %d.\n", tmp_value); + return snprintf(buf, CPLD_SIZE, "%d\n", -READ_TEMP_FAIL); + } + + DBG_DEBUG("tmp_value = 0x%x\n", tmp_value); + value = 434100 - (12500000 / (tmp_value * 100 - 1) *535); + if ((value / 1000 < -70) || (value / 1000 > 200)) { + return snprintf(buf, CPLD_SIZE, "%d\n", -READ_TEMP_FAIL); + } + + return snprintf(buf, CPLD_SIZE, "%d\n", value); + +} + +/* common */ +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO | S_IWUSR, show_cpld_version, NULL, 0); + +/*0x37 hwmon*/ +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x21); + +/* 0x32 */ +static SENSOR_DEVICE_ATTR(fan_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(fan0_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x23); +static SENSOR_DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x24); +static SENSOR_DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x25); +static SENSOR_DEVICE_ATTR(fan3_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x26); + +/* 0x37 */ +static SENSOR_DEVICE_ATTR(fan_present, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, NULL, 0x30); +static SENSOR_DEVICE_ATTR(fan_status, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, NULL, 0x31); +static SENSOR_DEVICE_ATTR(psu_status, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, NULL, 0x51); +static SENSOR_DEVICE_ATTR(broad_back_lct, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x2a); +static SENSOR_DEVICE_ATTR(broad_back_sys, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xb2); + +/* 0x33 */ +static SENSOR_DEVICE_ATTR(mac_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa0); +static SENSOR_DEVICE_ATTR(broad_front_lct, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x2a); +static SENSOR_DEVICE_ATTR(broad_front_bmc, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xb1); +static SENSOR_DEVICE_ATTR(broad_front_cpu, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xb2); +static SENSOR_DEVICE_ATTR(broad_front_pwr, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xb3); +static SENSOR_DEVICE_ATTR(broad_front_fan, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xb4); +static SENSOR_DEVICE_ATTR(sfp_led1_yellow, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xad); +static SENSOR_DEVICE_ATTR(mac_temp_flag, S_IRUGO, show_cpld_sysfs_value, NULL, 0xd4); + +/* 0x34 */ +static SENSOR_DEVICE_ATTR(sfp_presence1, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, NULL, 0x30); +static SENSOR_DEVICE_ATTR(sfp_presence2, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, NULL, 0x31); +static SENSOR_DEVICE_ATTR(sfp_presence3, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, NULL, 0x32); + +static SENSOR_DEVICE_ATTR(sfp_enable, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa1); +static SENSOR_DEVICE_ATTR(sfp_led1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa2); +static SENSOR_DEVICE_ATTR(sfp_led2, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa3); +static SENSOR_DEVICE_ATTR(sfp_led3, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa4); +static SENSOR_DEVICE_ATTR(sfp_led_flash1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa5); +static SENSOR_DEVICE_ATTR(sfp_led_flash2, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa6); +static SENSOR_DEVICE_ATTR(sfp_led_flash3, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa7); +static SENSOR_DEVICE_ATTR(sfp_txdis1, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x60); +static SENSOR_DEVICE_ATTR(sfp_txdis2, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x61); +static SENSOR_DEVICE_ATTR(sfp_txdis3, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x62); + +static SENSOR_DEVICE_ATTR(port_speed1, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc0); +static SENSOR_DEVICE_ATTR(port_speed2, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc1); +static SENSOR_DEVICE_ATTR(port_speed3, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc2); +static SENSOR_DEVICE_ATTR(port_speed4, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc3); +static SENSOR_DEVICE_ATTR(port_speed5, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc4); +static SENSOR_DEVICE_ATTR(port_speed6, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc5); + +/* 0x35 */ +static SENSOR_DEVICE_ATTR(sfp_enable2, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa0); +static SENSOR_DEVICE_ATTR(sfp_led2_yellow, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xad); +static SENSOR_DEVICE_ATTR(mac_temp_input, S_IRUGO, show_mac_temp_value, NULL, 0xca); + +/* 0x36 */ +static SENSOR_DEVICE_ATTR(sfp_presence4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, NULL, 0x30); +static SENSOR_DEVICE_ATTR(sfp_presence5, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, NULL, 0x31); +static SENSOR_DEVICE_ATTR(sfp_presence6, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, NULL, 0x32); +static SENSOR_DEVICE_ATTR(sfp_presence7, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, NULL, 0x33); +static SENSOR_DEVICE_ATTR(sfp_led4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa2); +static SENSOR_DEVICE_ATTR(sfp_led5, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa3); +static SENSOR_DEVICE_ATTR(sfp_led6, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa4); +static SENSOR_DEVICE_ATTR(sfp_led7, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa5); +static SENSOR_DEVICE_ATTR(sfp_led_flash4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa6); +static SENSOR_DEVICE_ATTR(sfp_led_flash5, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa7); +static SENSOR_DEVICE_ATTR(sfp_led_flash6, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa8); +static SENSOR_DEVICE_ATTR(sfp_led_flash7, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa9); + +static SENSOR_DEVICE_ATTR(sfp_txdis4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x60); +static SENSOR_DEVICE_ATTR(sfp_txdis5, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x61); +static SENSOR_DEVICE_ATTR(sfp_txdis6, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x62); + +static SENSOR_DEVICE_ATTR(port_speed7, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc0); +static SENSOR_DEVICE_ATTR(port_speed8, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc1); +static SENSOR_DEVICE_ATTR(port_speed9, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc2); +static SENSOR_DEVICE_ATTR(port_speed10, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc3); +static SENSOR_DEVICE_ATTR(port_speed11, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc4); +static SENSOR_DEVICE_ATTR(port_speed12, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc5); +static SENSOR_DEVICE_ATTR(port_speed13, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc6); +static SENSOR_DEVICE_ATTR(port_speed14, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xc7); + +static struct attribute *cpld32_sysfs_attrs[] = { + &sensor_dev_attr_fan_speed_set.dev_attr.attr, + &sensor_dev_attr_fan0_led.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + NULL +}; + +static struct attribute *cpld37_sysfs_attrs[] = { + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_status.dev_attr.attr, + &sensor_dev_attr_psu_status.dev_attr.attr, + &sensor_dev_attr_broad_back_lct.dev_attr.attr, + &sensor_dev_attr_broad_back_sys.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + NULL +}; + +static struct attribute *cpld33_sysfs_attrs[] = { + &sensor_dev_attr_mac_led.dev_attr.attr, + &sensor_dev_attr_broad_front_lct.dev_attr.attr, + &sensor_dev_attr_broad_front_bmc.dev_attr.attr, + &sensor_dev_attr_broad_front_cpu.dev_attr.attr, + &sensor_dev_attr_broad_front_pwr.dev_attr.attr, + &sensor_dev_attr_broad_front_fan.dev_attr.attr, + &sensor_dev_attr_sfp_led1_yellow.dev_attr.attr, + &sensor_dev_attr_mac_temp_flag.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + NULL +}; + +static struct attribute *cpld34_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence1.dev_attr.attr, + &sensor_dev_attr_sfp_presence2.dev_attr.attr, + &sensor_dev_attr_sfp_presence3.dev_attr.attr, + &sensor_dev_attr_sfp_enable.dev_attr.attr, + &sensor_dev_attr_sfp_led1.dev_attr.attr, + &sensor_dev_attr_sfp_led2.dev_attr.attr, + &sensor_dev_attr_sfp_led3.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash1.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash2.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash3.dev_attr.attr, + &sensor_dev_attr_sfp_txdis1.dev_attr.attr, + &sensor_dev_attr_sfp_txdis2.dev_attr.attr, + &sensor_dev_attr_sfp_txdis3.dev_attr.attr, + &sensor_dev_attr_port_speed1.dev_attr.attr, + &sensor_dev_attr_port_speed2.dev_attr.attr, + &sensor_dev_attr_port_speed3.dev_attr.attr, + &sensor_dev_attr_port_speed4.dev_attr.attr, + &sensor_dev_attr_port_speed5.dev_attr.attr, + &sensor_dev_attr_port_speed6.dev_attr.attr, + NULL +}; + +static struct attribute *cpld36_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence4.dev_attr.attr, + &sensor_dev_attr_sfp_presence5.dev_attr.attr, + &sensor_dev_attr_sfp_presence6.dev_attr.attr, + &sensor_dev_attr_sfp_presence7.dev_attr.attr, + &sensor_dev_attr_sfp_led4.dev_attr.attr, + &sensor_dev_attr_sfp_led5.dev_attr.attr, + &sensor_dev_attr_sfp_led6.dev_attr.attr, + &sensor_dev_attr_sfp_led7.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash4.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash5.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash6.dev_attr.attr, + &sensor_dev_attr_sfp_led_flash7.dev_attr.attr, + &sensor_dev_attr_sfp_txdis4.dev_attr.attr, + &sensor_dev_attr_sfp_txdis5.dev_attr.attr, + &sensor_dev_attr_sfp_txdis6.dev_attr.attr, + &sensor_dev_attr_port_speed7.dev_attr.attr, + &sensor_dev_attr_port_speed8.dev_attr.attr, + &sensor_dev_attr_port_speed9.dev_attr.attr, + &sensor_dev_attr_port_speed10.dev_attr.attr, + &sensor_dev_attr_port_speed11.dev_attr.attr, + &sensor_dev_attr_port_speed12.dev_attr.attr, + &sensor_dev_attr_port_speed13.dev_attr.attr, + &sensor_dev_attr_port_speed14.dev_attr.attr, + NULL +}; + +static struct attribute *cpld35_sysfs_attrs[] = { + &sensor_dev_attr_sfp_enable2.dev_attr.attr, + &sensor_dev_attr_broad_front_lct.dev_attr.attr, + &sensor_dev_attr_broad_front_bmc.dev_attr.attr, + &sensor_dev_attr_broad_front_cpu.dev_attr.attr, + &sensor_dev_attr_broad_front_pwr.dev_attr.attr, + &sensor_dev_attr_broad_front_fan.dev_attr.attr, + &sensor_dev_attr_sfp_led2_yellow.dev_attr.attr, + &sensor_dev_attr_mac_temp_input.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + NULL +}; + +static const struct attribute_group cpld32_sysfs_group = { + .attrs = cpld32_sysfs_attrs, +}; + +static const struct attribute_group cpld37_sysfs_group = { + .attrs = cpld37_sysfs_attrs, +}; + +static const struct attribute_group cpld33_sysfs_group = { + .attrs = cpld33_sysfs_attrs, +}; + +static const struct attribute_group cpld34_sysfs_group = { + .attrs = cpld34_sysfs_attrs, +}; + +static const struct attribute_group cpld36_sysfs_group = { + .attrs = cpld36_sysfs_attrs, +}; + +static const struct attribute_group cpld35_sysfs_group = { + .attrs = cpld35_sysfs_attrs, +}; + +static struct attribute *cpld_hwmon_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + NULL +}; +ATTRIBUTE_GROUPS(cpld_hwmon); + +struct cpld_attr_match_group { + int bus_nr; /* I2C BUS */ + unsigned short addr; /* slave addr*/ + const struct attribute_group *attr_group_ptr; + const struct attribute_group *attr_hwmon_ptr; +}; + +static struct cpld_attr_match_group g_cpld_attr_match[] = { + {0, 0x32, &cpld32_sysfs_group, NULL}, + {2, 0x37, &cpld37_sysfs_group, (struct attribute_group *)cpld_hwmon_groups}, + {2, 0x33, &cpld33_sysfs_group, NULL}, + {1, 0x34, &cpld34_sysfs_group, NULL}, + {1, 0x36, &cpld36_sysfs_group, NULL}, + {2, 0x35, &cpld35_sysfs_group, NULL}, +}; + +static const struct attribute_group *cpld_get_attr_group(struct i2c_client *client, int is_hwmon) +{ + int i; + struct cpld_attr_match_group *group; + + for (i = 0; i < ARRAY_SIZE(g_cpld_attr_match); i++) { + group = &g_cpld_attr_match[i]; + DBG_DEBUG("is_hwmon %d i %d client(nr:%d,addr:0x%x), group(nr:%d,addr:0x0%x).\n", is_hwmon, + i, client->adapter->nr, client->addr, group->bus_nr, group->addr); + if ((client->addr == group->addr) && (client->adapter->nr == group->bus_nr)) { + DBG_DEBUG("is_hwmon %d i %d nr %d addr %d .\n", is_hwmon, i, client->adapter->nr, client->addr); + return (is_hwmon) ? (group->attr_hwmon_ptr) : (group->attr_group_ptr); + } + } + + DBG_DEBUG("is_hwmon %d nr %d addr %d dismatch, return NULL.\n", is_hwmon, client->adapter->nr, client->addr); + return NULL; +} + +static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + const struct attribute_group *sysfs_group, *hwmon_group; + + status = -1; + DBG_DEBUG("=========cpld_probe(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + status = sysfs_create_group(&client->dev.kobj, sysfs_group); + DBG_DEBUG("=========(addr:0x%x, nr:%d) sysfs_create_group status %d===========\n", client->addr, client->adapter->nr, status); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_create_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + data->hwmon_dev = hwmon_device_register_with_groups(&client->dev, client->name, data, (const struct attribute_group **)hwmon_group); + if (IS_ERR(data->hwmon_dev)) { + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + DBG_ERROR("hwmon_device_register_with_groups failed ret %ld.\n", PTR_ERR(data->hwmon_dev)); + return PTR_ERR(data->hwmon_dev); + } + DBG_DEBUG("=========(addr:0x%x, nr:%d) hwmon_device_register_with_groups success===========\n", client->addr, client->adapter->nr); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_register_with_groups \n", client->addr, client->adapter->nr); + } + +error: + return status; + +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *sysfs_group, *hwmon_group; + + DBG_DEBUG("=========cpld_remove(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do sysfs_remove_group \n", client->addr, client->adapter->nr); + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_remove_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do hwmon_device_unregister \n", client->addr, client->adapter->nr); + hwmon_device_unregister(data->hwmon_dev); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_unregister \n", client->addr, client->adapter->nr); + } + + return 0; +} + + +static const struct i2c_device_id cpld_id[] = { + { "rg_cpld", 0 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver rg_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "rg_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, +}; + +module_i2c_driver(rg_cpld_driver); + +MODULE_AUTHOR("sonic_rd "); +MODULE_DESCRIPTION("ruijie CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/scripts/b6510-48vs8cq_platform.sh b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/scripts/b6510-48vs8cq_platform.sh new file mode 100755 index 000000000000..c7833deeae19 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/scripts/b6510-48vs8cq_platform.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +#platform init script for B6510-48VS8CQ + +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) +} + +remove_python_api_package() { + rv=$(pip show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi +} + +if [[ "$1" == "init" ]]; then + echo "b6510 init" + install_python_api_package + +elif [[ "$1" == "deinit" ]]; then + remove_python_api_package +else + echo "B6510-48VS8CQ_PLATFORM : Invalid option !" +fi diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/setup.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/setup.py new file mode 100644 index 000000000000..2dfacd39b78a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/setup.py @@ -0,0 +1,34 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on RUIJIE B6510 Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='sonic_rd@ruijie.com.cn', + url='', + maintainer='RUIJIE B6510', + maintainer_email='', + packages=[ + 'sonic_platform', + 'plat_hal', + 'rjutil', + 'eepromutil', + 'sonic_pcie' + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/__init__.py new file mode 100644 index 000000000000..73e2a89c8d74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/__init__.py @@ -0,0 +1 @@ +__all__ = ["pcie_common"] \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/pcie_common.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/pcie_common.py new file mode 100644 index 000000000000..56e9d8664a23 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_pcie/pcie_common.py @@ -0,0 +1,107 @@ +# pcie_common.py +# Common PCIE check interfaces for SONIC +# + +import os +import yaml +import subprocess +import re +import sys +from copy import deepcopy +try: + from .pcie import PcieBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PcieUtil(PcieBase): + """Platform-specific PCIEutil class""" + # got the config file path + def __init__(self, path): + self.config_path = path + + # load the config file + def load_config_file(self): + config_file = self.config_path + "/" + "pcie.yaml" + try: + with open(config_file) as conf_file: + self.confInfo = yaml.load(conf_file) + except IOError as e: + print("Error: {}".format(str(e))) + print("Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]") + sys.exit() + + # load current PCIe device + def get_pcie_device(self): + pciDict = {} + pciList = [] + p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*" + p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*" + command1 = "sudo lspci" + command2 = "sudo lspci -n" + # run command 1 + proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output1 = proc1.stdout.readlines() + proc1.communicate() + # run command 2 + proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output2 = proc2.stdout.readlines() + proc2.communicate() + + if proc1.returncode > 0: + for line1 in output1: + print(line1.strip()) + return + elif proc2.returncode > 0: + for line2 in output2: + print(line2.strip()) + return + else: + for (line1, line2) in zip(output1, output2): + pciDict.clear() + match1 = re.search(p1, line1.strip()) + match2 = re.search(p2, line2.strip()) + if match1 and match2: + Bus = match1.group(1) + Dev = match1.group(2) + Fn = match1.group(3) + Name = match1.group(4) + Id = match2.group(1) + pciDict["name"] = Name + pciDict["bus"] = Bus + pciDict["dev"] = Dev + pciDict["fn"] = Fn + pciDict["id"] = Id + pciList.append(pciDict) + pciDict = deepcopy(pciDict) + else: + print("CAN NOT MATCH PCIe DEVICE") + return pciList + + # check the sysfs tree for each PCIe device + def check_pcie_sysfs(self, domain=0, bus=0, device=0, func=0): + dev_path = os.path.join('/sys/bus/pci/devices', '%04x:%02x:%02x.%d' % (domain, bus, device, func)) + if os.path.exists(dev_path): + return True + return False + + # check the current PCIe device with config file and return the result + def get_pcie_check(self): + self.load_config_file() + for item_conf in self.confInfo: + bus_conf = item_conf["bus"] + dev_conf = item_conf["dev"] + fn_conf = item_conf["fn"] + if self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16), func=int(fn_conf, base=16)): + item_conf["result"] = "Passed" + else: + item_conf["result"] = "Failed" + return self.confInfo + + # generate the config file with current pci device + def dump_conf_yaml(self): + curInfo = self.get_pcie_device() + with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file: + yaml.dump(curInfo, conf_file, default_flow_style=False) + return + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py new file mode 100644 index 000000000000..f6c1757b8374 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py @@ -0,0 +1 @@ +__all__ = ["platform", "chassis", "fan", "psu", "sfp", "thermal", "common"] diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/chassis.py new file mode 100644 index 000000000000..ea4048e19f6e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/chassis.py @@ -0,0 +1,448 @@ +# -*- coding: utf-8 -*- + +############################################################################# +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import time + import subprocess + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.common import Common + from sonic_platform.sfp import Sfp + from sonic_platform.sfp import PORT_START + from sonic_platform.sfp import PORTS_IN_BLOCK + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Chassis(ChassisBase): + """ + Ruijie B6510-48VS8CQ Platform-specific Chassis class + """ + def __init__(self): + ChassisBase.__init__(self) + self.CHASSIS_CONFIG = 'chassis.json' + self.THERMAL_CONFIG = 'thermal.json' + self.SFP_CONFIG = 'sfp.json' + self.PSU_CONFIG = 'psu.json' + self.FAN_CONFIG = 'fan.json' + self.COMPONENT_CONFIG = 'component.json' + + self.SFP_STATUS_INSERTED = "1" + self.SFP_STATUS_REMOVED = "0" + self.port_dict = {} + self.enable_read= "i2cset -f -y 2 0x35 0x2a 0x01" + self.disable_read = "i2cset -f -y 2 0x35 0x2a 0x00" + self.enable_write = "i2cset -f -y 2 0x35 0x2b 0x00" + self.disable_write = "i2cset -f -y 2 0x35 0x2b 0x01" + self.enable_erase = "i2cset -f -y 2 0x35 0x2c 0x01" + self.disable_erase = "i2cset -f -y 2 0x35 0x2c 0x00" + self.read_value = "i2cget -f -y 2 0x35 0x25" + self.write_value = "i2cset -f -y 2 0x35 0x21 0x0a" + self.set_sys_led_cmd = "i2cset -f -y 2 0x33 0xb2 " + self.get_sys_led_cmd = "i2cget -f -y 2 0x33 0xb2" + self.led_status = "red" + # Initialize SFP list + # sfp.py will read eeprom contents and retrive the eeprom data. + # It will also provide support sfp controls like reset and setting + # low power mode. + # We pass the eeprom path and sfp control path from chassis.py + # So that sfp.py implementation can be generic to all platforms + for index in range(PORT_START, PORTS_IN_BLOCK): + sfp_node = Sfp(index) + self._sfp_list.append(sfp_node) + if sfp_node.get_presence(): + self.port_dict[index] = self.SFP_STATUS_INSERTED + else: + self.port_dict[index] = self.SFP_STATUS_REMOVED + + self._api_common = Common() + config_path = self._api_common.get_config_path(self.CHASSIS_CONFIG) + self._config = self._api_common.load_json_file(config_path) + self.__initialize_eeprom() + + if self._api_common.is_host(): + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + else: + self.__initialize_components() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + from sonic_platform.fan_drawer import FanDrawer + + fan_config_path = self._api_common.get_config_path(self.FAN_CONFIG) + self.fan_config = self._api_common.load_json_file(fan_config_path)["fans"] + + if self.fan_config: + drawer_fan_list = [] + for index in range(0, len(self.fan_config)): + fan = Fan(index, config=self.fan_config[index]) + self._fan_list.append(fan) + drawer_fan_list.append(fan) + fan_drawer = FanDrawer(0, fan_list=drawer_fan_list) + self._fan_drawer_list.append(fan_drawer) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + + psu_config_path = self._api_common.get_config_path(self.PSU_CONFIG) + self.psu_config = self._api_common.load_json_file(psu_config_path)["psus"] + + if self.psu_config: + for index in range(0, len(self.psu_config)): + psu = Psu(index, config=self.psu_config[index]) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + + thermal_config_path = self._api_common.get_config_path(self.THERMAL_CONFIG) + self.thermal_config = self._api_common.load_json_file(thermal_config_path)['thermals'] + + if self.thermal_config: + for index in range(0, len(self.thermal_config)): + thermal = Thermal(index, config=self.thermal_config[index]) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Eeprom + self._eeprom = Eeprom(config=self._config["eeprom"]) + + + def __initialize_components(self): + from sonic_platform.component import Component + + component_config_path = self._api_common.get_config_path(self.COMPONENT_CONFIG) + self.component_config = self._api_common.load_json_file(component_config_path)['components'] + + if self.component_config: + for index in range(0, len(self.component_config)): + component = Component(index, config=self.component_config[index]) + self._component_list.append(component) + + def _init_standard_config(self, conflist, class_name, objlist): + for conf in conflist: + obj = globals()[class_name](conf.get("name"), config=conf) + objlist.append(obj) + + def _init_by_hal(self, hal_interface): + self.hal_interface = hal_interface + self.hal_interface.get_fans() + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis (Service tag) + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + try: + is_power_loss = False + # enable read + subprocess.getstatusoutput(self.disable_write) + subprocess.getstatusoutput(self.enable_read) + ret , log = subprocess.getstatusoutput(self.read_value) + if ret == 0 and "0x0a" in log: + is_power_loss = True + + # erase i2c and e2 + subprocess.getstatusoutput(self.enable_erase) + time.sleep(1) + subprocess.getstatusoutput(self.disable_erase) + # clear data + subprocess.getstatusoutput(self.enable_write) + subprocess.getstatusoutput(self.disable_read) + subprocess.getstatusoutput(self.disable_write) + subprocess.getstatusoutput(self.enable_read) + # enable write and set data + subprocess.getstatusoutput(self.enable_write) + subprocess.getstatusoutput(self.disable_read) + subprocess.getstatusoutput(self.write_value) + if is_power_loss: + return(self.REBOOT_CAUSE_POWER_LOSS, None) + except Exception as e: + logger.error(str(e)) + + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the format of + {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + Specifically for SFP event, besides SFP plug in and plug out, + there are some other error event could be raised from SFP, when + these error happened, SFP eeprom will not be avalaible, XCVRD shall + stop to read eeprom before SFP recovered from error status. + status='2' I2C bus stuck, + status='3' Bad eeprom, + status='4' Unsupported cable, + status='5' High Temperature, + status='6' Bad cable. + """ + change_event_dict = {"fan": {}, "sfp": {}} + sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) + change_event_dict["sfp"] = sfp_change_dict + if sfp_status is True: + return True, change_event_dict + + return False, {} + + def get_transceiver_change_event(self, timeout=0): + + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print( + "get_transceiver_change_event:" "time wrap / invalid timeout value", + timeout, + ) + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for index in range(PORT_START, PORTS_IN_BLOCK): + if self._sfp_list[index].get_presence(): + currernt_port_dict[index] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[index] = self.SFP_STATUS_REMOVED + if currernt_port_dict == self.port_dict: + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + print(self.port_dict) + return True, self.port_dict + print("get_transceiver_change_event: Should not reach here.") + return False, {} + + def get_all_components(self): + return self._component_list + + def get_all_fans(self): + return self._fan_list + + def get_all_psus(self): + return self._psu_list + + def get_all_thermals(self): + return self._thermal_list + + def get_supervisor_slot(self): + """ + Retrieves the physical-slot of the supervisor-module in the modular + chassis. On the supervisor or line-card modules, it will return the + physical-slot of the supervisor-module. + On the fixed-platforms, the API can be ignored. + Users of the API can catch the exception and return a default + ModuleBase.MODULE_INVALID_SLOT and bypass code for fixed-platforms. + Returns: + An integer, the vendor specific physical slot identifier of the + supervisor module in the modular-chassis. + """ + return 0 + + def get_my_slot(self): + """ + Retrieves the physical-slot of this module in the modular chassis. + On the supervisor, it will return the physical-slot of the supervisor + module. On the linecard, it will return the physical-slot of the + linecard module where this instance of SONiC is running. + On the fixed-platforms, the API can be ignored. + Users of the API can catch the exception and return a default + ModuleBase.MODULE_INVALID_SLOT and bypass code for fixed-platforms. + Returns: + An integer, the vendor specific physical slot identifier of this + module in the modular-chassis. + """ + return 0 + + def is_modular_chassis(self): + """ + Retrieves whether the sonic instance is part of modular chassis + Returns: + A bool value, should return False by default or for fixed-platforms. + Should return True for supervisor-cards, line-cards etc running as part + of modular-chassis. + """ + return True + + def init_midplane_switch(self): + """ + Initializes the midplane functionality of the modular chassis. For + example, any validation of midplane, populating any lookup tables etc + can be done here. The expectation is that the required kernel modules, + ip-address assignment etc are done before the pmon, database dockers + are up. + Returns: + A bool value, should return True if the midplane initialized + successfully. + """ + return True + + def get_module_index(self, module_name): + """ + Retrieves module index from the module name + Args: + module_name: A string, prefixed by SUPERVISOR, LINE-CARD or FABRIC-CARD + Ex. SUPERVISOR0, LINE-CARD1, FABRIC-CARD5 + Returns: + An integer, the index of the ModuleBase object in the module_list + """ + return 0 + + def set_status_led(self, color): + """ + Sets the state of the system LED + Args: + color: A string representing the color with which to set the + system LED + Returns: + bool: True if system LED state is set successfully, False if not + """ + colors = { + "amber" : "0x00", + "red" : "0x02", + "green" : "0x04" + } + regval = colors.get(color, None) + if regval is None: + print("Invaild color input.") + return False + ret , log = subprocess.getstatusoutput(self.set_sys_led_cmd + regval) + if ret != 0: + print("Cannot execute %s" % self.set_sys_led_cmd + regval) + return False + self.led_status = color + return True + + def get_status_led(self): + """ + Gets the state of the system LED + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + ret , log = subprocess.getstatusoutput(self.get_sys_led_cmd) + if ret != 0: + print("Cannot execute %s" % self.get_sys_led_cmd) + return False + colors = { + "0x00" : "amber", + "0x02" : "red", + "0x04" : "green" + } + color = colors.get(log, None) + if color is None: + return "Unknown color status" + self.led_status = color + return self.led_status + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/common.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/common.py new file mode 100644 index 000000000000..c1a85f618609 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/common.py @@ -0,0 +1,44 @@ +import os +import yaml + +from sonic_py_common import device_info + + +class Common: + + DEVICE_PATH = '/usr/share/sonic/device/' + PMON_PLATFORM_PATH = '/usr/share/sonic/platform/' + CONFIG_DIR = 'sonic_platform_config' + + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def load_json_file(self, path): + """ + Retrieves the json object from json file path + + Returns: + A json object + """ + with open(path, 'r') as f: + json_data = yaml.safe_load(f) + + return json_data + + def get_config_path(self, config_name): + """ + Retrieves the path to platform api config directory + + Args: + config_name: A string containing the name of config file. + + Returns: + A string containing the path to json file + """ + return os.path.join(self.DEVICE_PATH, self.platform, self.CONFIG_DIR, config_name) if self.is_host() else os.path.join(self.PMON_PLATFORM_PATH, self.CONFIG_DIR, config_name) + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/component.py new file mode 100644 index 000000000000..33ff6ef8b35d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/component.py @@ -0,0 +1,85 @@ +######################################################################## +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + """Ruijie Platform-specific Component class""" + + def __init__(self, index, config=None): + self.index = index + self.name = config.get("name") + self._reg_fm_ver = Reg(config.get("firmware_version")) + self.description = config.get("desc") + self.slot = config.get("slot") + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + try: + return self._reg_fm_ver.decode() + except Exception as e: + logger.error(str(e)) + + return "" + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + try: + successtips = "CPLD Upgrade succeeded!" + status, output = subprocess.getstatusoutput("which firmware_upgrade") + if status or len(output) <= 0: + logger.error("no upgrade tool.") + return False + cmdstr = "%s %s cpld %d cpld"%(output,image_path,self.slot) + ret, log = subprocess.getstatusoutput(cmdstr) + if ret == 0 and successtips in log: + return True + logger.error("upgrade failed. ret:%d, log:\n%s" % (ret, log)) + except Exception as e: + logger.error(str(e)) + return False + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/config.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/config.py new file mode 100644 index 000000000000..162f01680ad0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/config.py @@ -0,0 +1,558 @@ +# -*- coding: utf-8 -*- + +PSU_FAN_AIRFLOW = { + "CSU550AP-3-300": "F2B", + "AS-40FAN-01-F-RJ": "F2B", + "CSU550AP-3-500": "F2B", + "DPS-550AB-39 A": "F2B", + "DPS-1300AB-6 S": "F2B", + "FSP1200-20ERM": "F2B", + "CSU800AP-3-300": "F2B", + "CSU550AP-3-501": "B2F", + "DPS-550AB-40 A": "B2F", +} + +FAN_AIRFLOW = { + "AS-80FAN-01-F-RJ": "F2B", + "AS-40FAN-01-F-RJ": "F2B", + "AS-80FAN-01-R-RJ": "B2F", + "AS-40FAN-01-R-RJ": "B2F", +} + +psutypedecode = { + 0x00: "N/A", + 0x01: "AC", + 0x02: "DC", +} + + +class Unit: + Temperature = "C" + Voltage = "V" + Current = "A" + Power = "W" + Speed = "RPM" + + +class Threshold: + PSU_TEMP_MIN = -10 * 1000 + PSU_TEMP_MAX = 60 * 1000 + + PSU_FAN_SPEED_MIN = 2000 + PSU_FAN_SPEED_MAX = 28000 + + PSU_OUTPUT_VOLTAGE_MIN = 11 * 1000 + PSU_OUTPUT_VOLTAGE_MAX = 14 * 1000 + + PSU_AC_INPUT_VOLTAGE_MIN = 200 * 1000 + PSU_AC_INPUT_VOLTAGE_MAX = 240 * 1000 + + PSU_DC_INPUT_VOLTAGE_MIN = 190 * 1000 + PSU_DC_INPUT_VOLTAGE_MAX = 290 * 1000 + + ERR_VALUE = -9999999 + + PSU_OUTPUT_POWER_MIN = 10 * 1000 + PSU_OUTPUT_POWER_MAX = 1300 * 1000 + + PSU_INPUT_POWER_MIN = 10 * 1000 + PSU_INPUT_POWER_MAX = 1444 * 1000 + + PSU_OUTPUT_CURRENT_MIN = 2 * 1000 + PSU_OUTPUT_CURRENT_MAX = 107 * 1000 + + PSU_INPUT_CURRENT_MIN = 0.2 * 1000 + PSU_INPUT_CURRENT_MAX = 7 * 1000 + + FAN_SPEED_MAX = 23000 + FAN_SPEED_MIN = 500 + + +class DecodeFormat: + TEXT = 0 + DECIMAL = 1 + ONE_BIT_HEX = 2 + HUNDREDTH = 3 + THOUSANDTH = 4 + MILLIONTH = 5 + AND = 6 + JOIN = 7 + + +class DecodeMethod: + SYSFS = 0 + I2C = 1 + I2C_WORD = 2 + DEVMEM = 3 + SDK = 4 + + +class Description: + CPLD = "Used for managing IO modules, SFP+ modules and system LEDs" + BIOS = "Performs initialization of hardware components during booting" + FPGA = "Platform management controller for on-board temperature monitoring, in-chassis power, Fan and LED control" + + +FAN_LED_COLORS = { + "green": 0b1001, + "red": 0b1010, + "amber": 0b0011, +} + + +DEVICE_CONF = { + "eeprom": {"bus": 2, "loc": "0057"}, + "components": [ + { + "name": "CPLD1 (MAC Board A)", + "firmware_version": { + "bus": 2, + "addr": 0x33, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD2 (MAC Board B)", + "firmware_version": { + "bus": 2, + "addr": 0x35, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD3 (CONNECT Board A)", + "firmware_version": { + "bus": 2, + "addr": 0x37, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD4 (CPU Board)", + "firmware_version": { + "bus": 0, + "addr": 0x0D, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 1, + }, + ], + "thermals": [ + { + "name": "INLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "OUTLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-0049/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-0049/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "BOARD TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/2-004a/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/2-004a/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "PHYSICAL ID 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp2_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 1", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp3_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 2", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp4_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 3", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp5_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + ], + "fans": [ + { + "name": "fan1", + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/3-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/3-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan0_led", + "format": DecodeFormat.AND, + "mask": 0b1011, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan1_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": Threshold.FAN_SPEED_MAX, + } + ], + }, + { + "name": "fan2", + "e2loc": {"bus": 4, "addr": 0x53, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/4-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/4-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan1_led", + "format": DecodeFormat.AND, + "mask": 0b1011, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan2_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": Threshold.FAN_SPEED_MAX, + } + ], + }, + { + "name": "fan3", + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/5-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/5-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan2_led", + "format": DecodeFormat.AND, + "mask": 0b1011, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan3_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": Threshold.FAN_SPEED_MAX, + } + ], + }, + { + "name": "fan4", + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/6-0053/fan_hw_version"}, + "sn": {"loc": "/sys/bus/i2c/devices/6-0053/fan_sn"}, + "led": { + "loc": "/sys/bus/i2c/devices/0-0032/fan3_led", + "format": DecodeFormat.AND, + "mask": 0b1011, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-0037/hwmon/*/fan4_input" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/0-0032/fan_speed_set" + }, + "speed_max": Threshold.FAN_SPEED_MAX, + } + ], + }, + ], + "psus": [ + { + "name": "psu1", + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "sn": {"loc": "/sys/bus/i2c/devices/7-0050/psu_sn"}, + "in_current": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/7-0050/psu_hw"}, + "psu_type": {"loc": "/sys/bus/i2c/devices/7-0050/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/fan1_fault", + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/fan1_input" + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/7-0058/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + { + "name": "psu2", + "present": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + }, + "sn": {"loc": "/sys/bus/i2c/devices/8-0053/psu_sn"}, + "in_current": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": {"loc": "/sys/bus/i2c/devices/8-0053/psu_hw"}, + "psu_type": {"loc": "/sys/bus/i2c/devices/8-0053/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/fan1_fault", + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-0037/psu_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/fan1_input" + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/8-005b/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + ], +} diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/eeprom.py new file mode 100644 index 000000000000..5fe0561f6c46 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/eeprom.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- + +######################################################################## +# Ruijie B6510-48VS8CQ +# +# Module contains platform specific implementation of SONiC Platform +# Base API and provides the EEPROMs' information. +# +# The different EEPROMs available are as follows: +# - System EEPROM : Contains Serial number, Service tag, Base MA +# address, etc. in ONIE TlvInfo EEPROM format. +# - PSU EEPROM : Contains Serial number, Part number, Service Tag, +# PSU type, Revision. +# - Fan EEPROM : Contains Serial number, Part number, Service Tag, +# Fan type, Number of Fans in Fantray, Revision. +######################################################################## + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + def __init__(self, bus=2, loc="0057", config=None, iom_eeprom=False): + self.is_module = iom_eeprom + + if config: + bus = config.get("bus") + loc = config.get("loc") + + if bus and loc: + self.eeprom_path = "/sys/bus/i2c/devices/{}-{}/eeprom".format(bus, loc) + else: + raise ValueError( + "Eeprom location error, bus: {}, loc: {}, config: {}".format( + bus, loc, config + ) + ) + + super(Eeprom, self).__init__(self.eeprom_path, 0, "", True) + self.eeprom_tlv_dict = dict() + + try: + if self.is_module: + # TODO + pass + # self.write_eeprom("\x00\x00") + # self.eeprom_data = self.read_eeprom_bytes(256) + else: + self.eeprom_data = self.read_eeprom() + except Exception: + self.eeprom_data = "N/A" + if not self.is_module: + raise RuntimeError("Eeprom is not Programmed") + else: + eeprom = self.eeprom_data + + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = (eeprom[9] << 8) | eeprom[10] + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index : tlv_index + 2 + eeprom[tlv_index + 1]] + code = "0x%02X" % (tlv[0]) + + if tlv[0] == self._TLV_CODE_VENDOR_EXT: + value = str( + (tlv[2] << 24) + | (tlv[3] << 16) + | (tlv[4] << 8) + | tlv[5] + ) + value += str(tlv[6 : 6 + tlv[1]]) + else: + name, value = self.decoder(None, tlv) + + self.eeprom_tlv_dict[code] = value + if eeprom[tlv_index] == self._TLV_CODE_CRC_32: + break + + tlv_index += eeprom[tlv_index + 1] + 2 + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER + ) + if not is_valid: + return "N/A" + + return results[2] + + def base_mac_addr(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_MAC_BASE + ) + if not is_valid or results[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([hex(T) for T in results[2]]) + + def modelstr(self): + if self.is_module: + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PLATFORM_NAME + ) + else: + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PRODUCT_NAME + ) + if not is_valid: + return "N/A" + + return results[2] + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PART_NUMBER + ) + if not is_valid: + return "N/A" + + return results[2] + + def serial_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERVICE_TAG + ) + if not is_valid: + return "N/A" + + return results[2] + + def revision_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_DEVICE_VERSION + ) + if not is_valid: + return "N/A" + + return results[2] + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.eeprom_tlv_dict diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan.py new file mode 100644 index 000000000000..173c0529443a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan.py @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- + +######################################################################## +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fans' information which are available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_base import FanBase + from sonic_platform.regutil import Reg + from sonic_platform.rotor import Rotor + from sonic_platform.logger import logger + from math import ceil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(FanBase): + """Ruijie Platform-specific Fan class""" + + MAX_SPEED_CODE = 255 + + def __init__(self, index, config=None, hal_fan=None, is_psu_fan=False): + self.index = index + self.is_psu_fan = is_psu_fan + if config: + if self.is_psu_fan: + self.name = "Psu{}-{}".format(self.index, config.get("name")) + else: + self.name = config.get("name") + self.__reg_sn = Reg(config.get("sn")) + self.__reg_present = Reg(config.get("present")) + self.__reg_status = Reg(config.get("status")) + self.__reg_led = Reg(config.get("led")) + self.__reg_pn = Reg(config.get("pn")) + self.__led_colors = config.get("led_colors") + + # rotors + rotors = config.get("rotors") + if isinstance(rotors, list): + self.__rotors = [] + for rotor in rotors: + self.__rotors.append(Rotor(rotor)) + + self._hal_fan = hal_fan + + def _reg_setter(self, target, val): + if isinstance(val, dict): + target = Reg(val) + elif isinstance(val, Reg): + target = val + else: + raise ValueError + return target + + @property + def reg_sn(self): + return self.__reg_sn + + @reg_sn.setter + def reg_sn(self, val): + self._reg_setter(self.__reg_sn, val) + + @property + def reg_present(self): + return self.__reg_present + + @reg_present.setter + def reg_present(self, val): + self._reg_setter(self.__reg_present, val) + + @property + def reg_status(self): + return self.__reg_status + + @reg_status.setter + def reg_status(self, val): + self._reg_setter(self.__reg_status, val) + + @property + def reg_led(self): + return self.__reg_led + + @reg_led.setter + def reg_led(self, val): + self._reg_setter(self.__reg_led, val) + + def get_name(self): + """ + Retrieves the fan name + Returns: + string: The name of the device + """ + return self.name + + def get_model(self): + """ + Retrieves the part number of the FAN + Returns: + string: Part number of FAN + """ + if self._hal_fan: + return self._hal_fan.pn() + + try: + if isinstance(self.__reg_pn, Reg): + return self.__reg_pn.decode() + except Exception as e: + logger.error(str(e)) + + return "NA" + + def get_serial(self): + """ + Retrieves the serial number of the FAN + Returns: + string: Serial number of FAN + """ + if self._hal_fan: + return self._hal_fan.sn() + + try: + if isinstance(self.__reg_sn, Reg): + return self.__reg_sn.decode() + except Exception as e: + logger.error(str(e)) + + return "NA" + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if fan is present, False if not + """ + + # print self.fan_presence_reg.decode() + # return True if self.fan_presence_reg.decode() == 0 else False + if self._hal_fan: + return self._hal_fan.get_presence() + + try: + if isinstance(self.__reg_present, Reg): + present = self.__reg_present.decode() + if present == 0 or present == "0": + return True + except Exception as e: + logger.error(str(e)) + + return False + + def get_status(self): + """ + Retrieves the operational status of the FAN + Returns: + bool: True if FAN is operating properly, False if not + """ + + # return True if self.fan_status_reg.decode() == 1 else False + if self._hal_fan: + return self._hal_fan.get_status() + + try: + if isinstance(self.__reg_status, Reg): + status = self.__reg_status.decode() + if status == 1 or status == "1": + return True + except Exception as e: + pass + + return False + + def get_direction(self): + """ + Retrieves the fan airflow direction + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + + Notes: + - Forward/Exhaust : Air flows from Port side to Fan side. + - Reverse/Intake : Air flows from Fan side to Port side. + """ + + # TODO + return self.FAN_DIRECTION_EXHAUST + + def get_speed(self): + """ + Retrieves the speed of fan + Returns: + int: percentage of the max fan speed + """ + if self.get_presence(): + maxspeed = 0 + for r in self.__rotors: + speed = r.get_speed_percentage() + if speed > maxspeed: + maxspeed = speed + return maxspeed + else: + return 0 + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + # TODO + return 0 + + def set_speed(self, speed): + """ + Set fan speed to expected value + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + bool: True if set success, False if fail. + """ + if self.__rotors: + speed_code = hex(int(ceil(float(self.MAX_SPEED_CODE) / 100 * speed))) + return self.__rotors[0].set_speed(speed_code) + + return False + + def set_status_led(self, color): + """ + Set led to expected color + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if set success, False if fail. + """ + # TODO + if self.is_psu_fan: + # No LED available for PSU Fan + return False + try: + if color not in self.__led_colors: + logger.error("color:%s not defined." % color) + return False + val = hex(self.__led_colors[color]) + if isinstance(self.__reg_led, Reg): + return self.__reg_led.encode(val) + return ret + except Exception as e: + logger.error(str(e)) + return False + + + def get_status_led(self): + """ + Gets the state of the Fan status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings. + """ + # TODO + if self.is_psu_fan: + # No LED available for PSU Fan + return None + else: + try: + if isinstance(self.__reg_led, Reg) : + led_color = self.__reg_led.decode() + for color, code in self.__led_colors.items(): + if code ^ led_color == 0: + return color + except Exception as e: + logger.error(str(e)) + + return None + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + # TODO + return 0 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..692819a04339 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/fan_drawer.py @@ -0,0 +1,71 @@ +# +# fan_drawer_base.py +# +# Abstract base class for implementing a platform-specific class with which +# to interact with a fan drawer module in SONiC +# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(FanDrawerBase): + """ + Abstract base class for interfacing with a fan drawer + """ + # Device type definition. Note, this is a constant. + DEVICE_TYPE = "fan_drawer" + + def __init__(self, index, fan_list): + FanDrawerBase.__init__(self) + + self._fan_list = fan_list + self._index = index + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return "fan {}".format(self._index) + + def get_num_fans(self): + """ + Retrieves the number of fans available on this fan drawer + Returns: + An integer, the number of fan modules available on this fan drawer + """ + return len(self._fan_list) + + def get_all_fans(self): + """ + Retrieves all fan modules available on this fan drawer + Returns: + A list of objects derived from FanBase representing all fan + modules available on this fan drawer + """ + return self._fan_list + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + Args: + color: A string representing the color with which to set the + fan drawer status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return self._fan_list[self._index].set_status_led(color) + + def get_status_led(self, color): + """ + Gets the state of the fan drawer LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return self._fan_list[self._index].get_status_led(color) + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/logger.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/logger.py new file mode 100644 index 000000000000..5969781bf9a9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/logger.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging + + +def _init_logger(): + formatter = logging.Formatter( + "%(asctime)s %(levelname)s %(filename)s[%(funcName)s][%(lineno)s]: %(message)s" + ) + handler = logging.FileHandler("/var/log/syslog") + handler.setFormatter(formatter) + + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + logger.addHandler(handler) + return logger + + +logger = _init_logger() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/pcie.py new file mode 100644 index 000000000000..5a66997d33d0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/pcie.py @@ -0,0 +1,43 @@ +# +# pcie_base.py +# +# Abstract base class for implementing platform-specific +# PCIE functionality for SONiC +# + +try: + import abc + from sonic_pcie import PcieUtil +except ImportError as e: + raise ImportError (str(e) + " - required module not found") + +class PcieBase(object): + def __init__(self, path): + """ + Constructor + Args: + pcieutil file and config file path + """ + self.pcie_util = PcieUtil(path) + + + @abc.abstractmethod + def get_pcie_device(self): + """ + get current device pcie info + + Returns: + A list including pcie device info + """ + return self.pcie_util.get_pcie_device() + + + @abc.abstractmethod + def get_pcie_check(self): + """ + Check Pcie device with config file + Returns: + A list including pcie device and test result info + """ + return self.pcie_util.get_pcie_check() + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/platform.py new file mode 100644 index 000000000000..3aa7fe3f2605 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/platform.py @@ -0,0 +1,22 @@ +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """ + Ruijie Platform-specific class + """ + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/psu.py new file mode 100644 index 000000000000..65e27bc1cf76 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/psu.py @@ -0,0 +1,413 @@ +# -*- coding: utf-8 -*- + +######################################################################## +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs' information which are available in the platform +# +######################################################################## + + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.fan import Fan + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Psu(PsuBase): + """Ruijie Platform-specific PSU class""" + + # HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" + # HWMON_NODE = os.listdir(HWMON_DIR)[0] + # MAILBOX_DIR = HWMON_DIR + HWMON_NODE + + def __init__(self, index, config=None, hal_psu=None): + """ + "psus": [ + { + "name": "psu1", + "present": {"loc": "2-0037/psu_status", "format": DecodeFormat.ONE_BIT_HEX, "bit": 0}, + "status": {"loc": "2-0037/psu_status", "format": DecodeFormat.ONE_BIT_HEX, "bit": 1}, + "sn": {"loc": "7-0050/psu_sn"}, + "in_current": {"loc": "7-0058/hwmon/*/curr1_input", "format": DecodeFormat.THOUSANDTH}, + "in_voltage": {"loc": "7-0058/hwmon/*/in1_input", "format": DecodeFormat.THOUSANDTH}, + "out_voltage": {"loc": "7-0058/hwmon/*/in2_input", "format": DecodeFormat.THOUSANDTH}, + "out_current": {"loc": "7-0058/hwmon/*/curr2_input", "format": DecodeFormat.THOUSANDTH}, + "temperature": {"loc": "7-0058/hwmon/*/temp1_input", "format": DecodeFormat.THOUSANDTH}, + "hw_version": {"loc": "7-0050/psu_hw"}, + "psu_type": {"loc": "7-0050/psu_type"}, + "fans": [ + { + "rotor": { + "speed": {"loc": "7-0058/hwmon/*/fan1_input"}, + "speed_max": xx + } + } + ], + "in_power": {"loc": "7-0058/hwmon/*/power1_input", "format": DecodeFormat.MILLIONTH}, + "out_power": {"loc": "7-0058/hwmon/*/power2_input", "format": DecodeFormat.MILLIONTH}, + } + ] + """ + self._fan_list = [] + self.PSU_TEMP_MAX = 60 * 1000 + self.PSU_OUTPUT_POWER_MAX = 1300 * 1000 + self.PSU_OUTPUT_VOLTAGE_MIN = 11 * 1000 + self.PSU_OUTPUT_VOLTAGE_MAX = 14 * 1000 + self.index = index + if config is not None: + self.name = config.get("name") + self.__reg_sn = Reg(config.get("sn")) + self.__reg_present = Reg(config.get("present")) + self.__reg_status = Reg(config.get("status")) + self.__reg_out_vol = Reg(config.get("out_voltage")) + self.__reg_out_cur = Reg(config.get("out_current")) + self.__reg_out_pow = Reg(config.get("out_power")) + self.__reg_pn = Reg(config.get("pn")) + self.__reg_temperature = Reg(config.get("temperature")) + self._fan_list = config.get("fans") + self._psu_fan_parser(config.get("fans")) + + self._hal_psu = hal_psu + + def _psu_fan_parser(self, fans): + if not isinstance(fans, list): + raise TypeError("fan type error fans: {}".format(fans)) + for index in range(0,len(fans)): + if not isinstance(fans[index], dict): + raise TypeError("fan type must be a dict") + self._fan_list.append(Fan(index, config=fans[index], is_psu_fan=True)) + + def _reg_setter(self, target, val): + if isinstance(val, dict): + target = Reg(val) + elif isinstance(val, Reg): + target = val + else: + raise ValueError + return target + + @property + def reg_sn(self): + return self.__reg_sn + + @reg_sn.setter + def reg_sn(self, val): + self._reg_setter(self.__reg_sn, val) + + @property + def reg_present(self): + return self.__reg_present + + @reg_present.setter + def reg_present(self, val): + self._reg_setter(self.__reg_present, val) + + @property + def reg_status(self): + return self.__reg_status + + @reg_status.setter + def reg_status(self, val): + self._reg_setter(self.__reg_status, val) + + @property + def reg_out_vol(self): + return self.__reg_out_vol + + @reg_out_vol.setter + def reg_out_vol(self, val): + self._reg_setter(self.__reg_out_vol, val) + + @property + def reg_out_cur(self): + return self.__reg_out_cur + + @reg_out_cur.setter + def reg_out_cur(self, val): + self._reg_setter(self.__reg_out_cur, val) + + @property + def reg_out_pow(self): + return self.__reg_out_pow + + @reg_out_pow.setter + def reg_out_pow(self, val): + self._reg_setter(self.__reg_out_pow, val) + + def get_all_fans(self): + return self._fan_list + + def get_num_fans(self): + return len(self._fan_list) + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return self.name + + def get_presence(self): + """ + Retrieves the presence of the Power Supply Unit (PSU) + + Returns: + bool: True if PSU is present, False if not + """ + if self._hal_psu: + pass + + try: + if isinstance(self.__reg_present, Reg): + psu_presence = self.__reg_present.decode() + if psu_presence == 0 or psu_presence == "0": + return True + except Exception as e: + logger.error(str(e)) + + return False + + def get_model(self): + """ + Retrieves the part number of the PSU + + Returns: + string: Part number of PSU + """ + + if self._hal_psu: + return self._hal_psu.pn() + + try: + if isinstance(self.__reg_pn, Reg): + return self.__reg_pn.decode() + except Exception as e: + logger.error(str(e)) + + return "NA" + + def get_serial(self): + """ + Retrieves the serial number of the PSU + + Returns: + string: Serial number of PSU + """ + if self._hal_psu: + return self._hal_psu.sn() + + try: + if isinstance(self.__reg_sn, Reg): + return self.__reg_sn.decode() + except Exception as e: + logger.error(str(e)) + + return "NA" + + def get_status(self): + """ + Retrieves the operational status of the PSU + + Returns: + bool: True if PSU is operating properly, False if not + """ + # status = False + # psu_status = self._get_pmc_register(self.psu_presence_reg) + # if (psu_status != 'ERR'): + # psu_status = int(psu_status, 16) + # # Checking whether both bit 3 and bit 2 are not set + # if (~psu_status & 0b1000) and (~psu_status & 0b0100): + # status = True + + if self._hal_psu: + return self._hal_psu.get_status() + + try: + if isinstance(self.reg_status, Reg): + psu_status = self.reg_status.decode() + if psu_status == 1 or psu_status == "1": + return True + elif psu_status == 0 or psu_status == "0": + return False + except Exception as e: + logger.error(str(e)) + + return False + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + # psu_voltage = self._get_pmc_register(self.psu_voltage_reg) + # if (psu_voltage != 'ERR') and self.get_presence(): + # # Converting the value returned by driver which is in + # # millivolts to volts + # psu_voltage = float(psu_voltage) / 1000 + # else: + # psu_voltage = 0.0 + + if self._hal_psu: + pass + + try: + if isinstance(self.__reg_out_vol, Reg): + return self.__reg_out_vol.decode() + except Exception as e: + logger.error(str(e)) + + return 0.0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + # psu_current = self._get_pmc_register(self.psu_current_reg) + # if (psu_current != 'ERR') and self.get_presence(): + # # Converting the value returned by driver which is in + # # milliamperes to amperes + # psu_current = float(psu_current) / 1000 + # else: + # psu_current = 0.0 + + if self._hal_psu: + pass + + try: + if isinstance(self.__reg_out_cur, Reg): + return self.__reg_out_cur.decode() + except Exception as e: + logger.error(str(e)) + + return 0.0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, + e.g. 302.6 + """ + + if self._hal_psu: + pass + + try: + if isinstance(self.__reg_out_pow, Reg): + return self.__reg_out_pow.decode() + except Exception as e: + logger.error(str(e)) + + return 0.0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + + Returns: + A boolean, True if PSU has stablized its output voltages and + passed all its internal self-tests, False if not. + """ + if self._hal_psu: + pass + else: + if self.get_status() and self.get_presence(): + return True + + return False + + def get_status_led(self): + """ + Gets the state of the PSU status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings. + """ + # TODO + if self.get_powergood_status(): + return self.STATUS_LED_COLOR_GREEN + else: + return self.STATUS_LED_COLOR_RED + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the + PSU status LED + Returns: + bool: True if status LED state is set successfully, False if + not + """ + # not supported + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if self._hal_psu: + pass + + try: + if isinstance(self.__reg_temperature, Reg): + return self.__reg_temperature.decode() + except Exception as e: + logger.error(str(e)) + + return 0.0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return float(self.PSU_TEMP_MAX/1000) + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + return float(self.PSU_OUTPUT_VOLTAGE_MAX/1000) + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + return float(self.PSU_OUTPUT_VOLTAGE_MIN/1000) + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return float(self.PSU_OUTPUT_POWER_MAX/1000) + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/regutil.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/regutil.py new file mode 100644 index 000000000000..d216da9307b1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/regutil.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +from glob import glob +from plat_hal.osutil import osutil + +try: + from sonic_platform.config import DecodeFormat, DecodeMethod + + DECODE_FORMAT = DecodeFormat + DECODE_METHOD = DecodeMethod +except ImportError: + raise ImportError(str(e) + "- required module not found") + +ERR_CODE = "ERR" + + +class Reg(object): + """ + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c"} + "value": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/hwmon*/temp1_input", + "way": "sysfs", + + "InputsStatus": { + "bus": 8, + "addr": 0x5B, + "offset": 0x79, + "way": "i2cword", + "mask": 0x0200, + }, + """ + + def __new__(cls, *args): + if args[0] is None or not isinstance(args[0], dict): + return None + return super(Reg, cls).__new__(cls) + + def __init__(self, data): + + self.loc = None + self.way = DECODE_METHOD.SYSFS + self.addr = None + self.bus = None + self.offset = None + self.size = 1 + self.bit = None + self.mask = None + self.digit = None + self.sdk_type = None + self.sep = None + self.format = DECODE_FORMAT.TEXT + self.__dict__.update(data) + + def _read_reg_val(self): + ret = None + try: + if self.way == DECODE_METHOD.SYSFS: + ret = self.get_sysfs() + elif self.way == DECODE_METHOD.I2C: + ret = self.get_i2c() + elif self.way == DECODE_METHOD.I2C_WORD: + ret = self.get_i2cword() + elif self.way == DECODE_METHOD.DEVMEM: + ret = self.get_devmem() + elif self.way == DECODE_METHOD.SDK: + # TODO + pass + else: + pass + except Exception as e: + raise e + + return ret + + def _write_reg_val(self, val): + try: + if self.way == DECODE_METHOD.SYSFS: + return self._write_sysfs(val) + except Exception as e: + raise e + + return False + + def _write_sysfs(self, val): + try: + with open(glob(self.loc)[0], "w") as f: + f.write(val) + f.flush() + return True + except Exception as e: + raise e + + def _format_val(self, val): + try: + if isinstance(val, str): + val = val.strip() + if self.format == DECODE_FORMAT.THOUSANDTH: + return float("%.1f" % (float(val) / 1000)) + elif self.format == DECODE_FORMAT.HUNDREDTH: + return float("%.1f" % (float(val) / 100)) + elif self.format == DECODE_FORMAT.ONE_BIT_HEX: + return (int(val, 16) & (1 << self.bit)) >> self.bit + elif self.format == DECODE_FORMAT.DECIMAL: + return int(val, 10) + elif self.format == DECODE_FORMAT.MILLIONTH: + return float("%.1f" % (float(val) / 1000 / 1000)) + elif self.format == DECODE_FORMAT.AND: + return (int(val, 16)) & self.mask + elif isinstance(val, list): + if self.format == DECODE_FORMAT.JOIN: + return self.sep.join(val) + except Exception as e: + raise e + else: + return val + + def decode(self): + """ + get value by config way + way i2c/sysfs/lpc + """ + if self.way is None: + raise ValueError("cannot found way to deal") + + ret = self._read_reg_val() + + ret = self._format_val(ret) + return ret + + def encode(self, val): + if self.way is None: + raise ValueError("cannot found way to deal") + + return self._write_reg_val(val) + + def get_sdk(self): + # TODO + pass + + def get_sysfs(self): + if self.loc is None: + raise ValueError("Not Enough Attr: loc: {}".format(self.loc)) + + ret, val = osutil.readsysfs(self.loc) + + if not ret: + raise IOError(val) + + return val + + def get_devmem(self): + if self.addr is None or self.digit is None or self.mask is None: + raise ValueError( + "Not Enough Attr: addr: {}, digit: {}, mask: {}".format( + self.addr, self.digit, self.mask + ) + ) + + ret, val = osutil.getdevmem(self.addr, self.digit, self.mask) + + if not ret: + raise IOError(val) + + return val + + def get_i2cword(self): + if self.bus is None or self.addr is None or self.offset is None: + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + ret, val = osutil.geti2cword(self.bus, self.addr, self.offset) + + if not ret: + raise IOError(val) + + return val + + def get_i2c(self): + if ( + self.bus is None + or self.addr is None + or self.offset is None + or self.size is None + ): + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + value = [] + for i in range(self.size): + ofs = self.offset + i + ret, val = osutil.rji2cget(self.bus, self.addr, ofs) + + if not ret: + raise IOError(val) + else: + value.append(repr(chr(val)).translate(None, r"\\x").replace("'", "")) + + return value + + def set_i2cword(self, bus, addr, offset, byte): + return self.seti2cword(bus, addr, offset, byte) + + def seti2cword(self, bus, addr, offset, byte): + return osutil.seti2cword(bus, addr, offset, byte) + + def set_i2c(self, bus, addr, offset, byte): + return self.seti2c(bus, addr, offset, byte) + + def seti2c(self, bus, addr, offset, byte): + ret, val = osutil.rji2cset(bus, addr, offset, byte) + return ret, val + + def getbcmtemp(self): + try: + sta, ret = osutil.getmactemp() + if sta == True: + mac_aver = float(ret.get("average", self.__error_ret)) + #mac_max = float(ret.get("maximum", self.__error_ret)) + mac_aver = mac_aver * 1000 + #mac_max = mac_max * 1000 + else: + return False, ret + except AttributeError as e: + return False, str(e) + return True, mac_aver + + def getbcmreg(self, reg): + ret, val = osutil.getsdkreg(reg) + return ret, val + + def logger_debug(self, msg): + baseutil.logger_debug(msg) + + def command(self, cmd): + ret, output = osutil.command(cmd) + return ret, output + + def set_val(self, val): + # TODO + pass diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/rotor.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/rotor.py new file mode 100644 index 000000000000..3e5bcc5b9b9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/rotor.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +try: + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError: + raise ImportError(str(e) + "- required module not found") + +class Rotor: + def __init__(self, config): + if config is not None and isinstance(config, dict): + self.__reg_speed_getter = Reg(config.get("speed_getter")) + self.__reg_speed_setter = Reg(config.get("speed_setter")) + self.__speed_max = config.get("speed_max") + else: + raise ValueError("init rotor Error: {}".format(config)) + + def get_speed(self): + try: + return int(self.__reg_speed_getter.decode()) + except Exception as e: + logger.error(str(e)) + + return 0 + + def set_speed(self, speed): + try: + return self.__reg_speed_setter.encode(speed) + except Exception as e: + logger.error(str(e)) + + return False + + def get_speed_percentage(self): + try: + speed = self.get_speed() + return (100 * speed) / self.__speed_max + except Exception as e: + logger.error(str(e)) + + return 0 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py new file mode 100644 index 000000000000..41c2b63c05d8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py @@ -0,0 +1,1566 @@ +# -*- coding: utf-8 -* + +############################################################################# +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + import time + from ctypes import create_string_buffer + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +############################################################################# +# Ruijie B6510-48VS8CQ +PORT_START = 0 +PORT_END = 55 +PORTS_IN_BLOCK = 56 + +PORT_QSFP_START = 48 +PORT_QSFP_END = 56 + +EEPROM_OFFSET = 11 +############################################################################# + +IDENTITY_EEPROM_ADDR = 0x50 + +INFO_OFFSET = 128 +DOM_OFFSET = 0 +DOM_OFFSET1 = 384 + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" +OSFP_TYPE = "OSFP" + +# definitions of the offset and width for values in XCVR info eeprom +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 +XCVR_EXT_TYPE_OFFSET = 1 +XCVR_EXT_TYPE_WIDTH = 1 +XCVR_CONNECTOR_OFFSET = 2 +XCVR_CONNECTOR_WIDTH = 1 +XCVR_COMPLIANCE_CODE_OFFSET = 3 +XCVR_COMPLIANCE_CODE_WIDTH = 8 +XCVR_ENCODING_OFFSET = 11 +XCVR_ENCODING_WIDTH = 1 +XCVR_NBR_OFFSET = 12 +XCVR_NBR_WIDTH = 1 +XCVR_EXT_RATE_SEL_OFFSET = 13 +XCVR_EXT_RATE_SEL_WIDTH = 1 +XCVR_CABLE_LENGTH_OFFSET = 14 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_CABLE_LENGTH_WIDTH_SFP = 6 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_OSFP = 2 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 + +XCVR_INTERFACE_DATA_START = 0 +XCVR_INTERFACE_DATA_SIZE = 92 + +QSFP_DOM_BULK_DATA_START = 22 +QSFP_DOM_BULK_DATA_SIZE = 36 +SFP_DOM_BULK_DATA_START = 96 +SFP_DOM_BULK_DATA_SIZE = 10 + +# definitions of the offset for values in OSFP info eeprom +OSFP_TYPE_OFFSET = 0 +OSFP_VENDOR_NAME_OFFSET = 129 +OSFP_VENDOR_PN_OFFSET = 148 +OSFP_HW_REV_OFFSET = 164 +OSFP_VENDOR_SN_OFFSET = 166 + +# Offset for values in QSFP eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 2 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_MODULE_MONITOR_OFFSET = 0 +QSFP_MODULE_MONITOR_WIDTH = 9 +QSFP_POWERMODE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_POWERSET_BIT = 1 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 +QSFP_MODULE_UPPER_PAGE3_START = 384 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_MODULE_THRESHOLD_OFFSET = 128 +QSFP_CHANNL_THRESHOLD_OFFSET = 176 +QSFP_CHANNL_THRESHOLD_WIDTH = 24 + +SFP_MODULE_ADDRA2_OFFSET = 256 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 56 +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 + +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_CHANNL_MON_OFFSET = 100 +SFP_CHANNL_MON_WIDTH = 6 +SFP_CHANNL_STATUS_OFFSET = 110 +SFP_CHANNL_STATUS_WIDTH = 1 + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes', 'FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + +class Sfp(SfpBase): + """ + DELLEMC Platform-specific Sfp class + """ + + SFP_DEVICE_TYPE = "optoe2" + QSFP_DEVICE_TYPE = "optoe1" + port_to_i2cbus_mapping = {} + def __init__(self, index): + self.index = index + self.port_num = self.index + PORT_START + self.sfp_type = self.__get_sfp_info() + self.dom_supported = False + for x in range(PORT_START, PORTS_IN_BLOCK): + self.port_to_i2cbus_mapping[x] = (x + EEPROM_OFFSET) + + self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] + + self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'lp_mode', 'tx_disable', 'tx_disabled_channel', 'temperature', 'voltage', + 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] + + self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + self.__dom_capability_detect() + + @property + def qsfp_ports(self): + return range(PORT_QSFP_START, PORT_QSFP_END) + + def get_presence(self): + # Check for invalid self.port_num + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + + if self.port_num <= 7: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence1" + elif self.port_num >= 8 and self.port_num <= 15: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence2" + elif self.port_num >= 16 and self.port_num <= 23: + presence_path = "/sys/bus/i2c/devices/1-0034/sfp_presence3" + elif self.port_num >= 24 and self.port_num <= 31: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence4" + elif self.port_num >= 32 and self.port_num <= 39: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence5" + elif self.port_num >= 40 and self.port_num <= 47: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence6" + elif self.port_num >= 48 and self.port_num <= 55: + presence_path = "/sys/bus/i2c/devices/1-0036/sfp_presence7" + else: + return False + + try: + data = open(presence_path, "rb") + except IOError: + return False + + presence_data = data.read(2) + if presence_data == "": + return False + result = int(presence_data, 16) + data.close() + + # ModPrsL is active low + if result & (1 << (self.port_num % 8)) == 0: + return True + + return False + + def __get_sfp_info(self): + if PORT_START <= self.port_num <= PORT_END: + if self.port_num in self.qsfp_ports: + sfp_type = QSFP_TYPE + else: + sfp_type = SFP_TYPE + else: + return "port range error" + return sfp_type + + def __dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.qsfp_page3_available = False + self.calibration = 0 + return + + if self.sfp_type == "QSFP": + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) + qsfp_version_compliance = int( + qsfp_version_compliance_raw[0], 16) + dom_capability = sfpi_obj.parse_qsfp_dom_capability( + qsfp_dom_capability_raw, 0) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' + self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = True + + self.dom_supported = True + self.calibration = 1 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + qsfp_option_value_raw = self.__read_eeprom_specific_bytes( + QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) + if qsfp_option_value_raw is not None: + optional_capability = sfpd_obj.parse_option_params( + qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = optional_capability[ + 'data']['TxDisable']['value'] == 'On' + dom_status_indicator = sfpd_obj.parse_dom_status_indicator( + qsfp_version_compliance_raw, 1) + self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.qsfp_page3_available = False + + elif self.sfp_type == "SFP": + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = ( + int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def __add_new_sfp_device(self, sysfs_sfp_i2c_adapter_path, devaddr, devtype): + try: + sysfs_nd_path = "%s/new_device" % sysfs_sfp_i2c_adapter_path + + # Write device address to new_device file + nd_file = open(sysfs_nd_path, "w") + nd_str = "%s %s" % (devtype, hex(devaddr)) + nd_file.write(nd_str) + nd_file.close() + + except Exception as err: + print("Error writing to new device file: %s" % str(err)) + return 1 + else: + return 0 + + def __get_port_eeprom_path(self, port_num, devid): + if self.get_presence() is False: + print("port %d Not present" % port_num) + return None + + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050' + i2c_path = '/sys/bus/i2c/devices/i2c-{0}' + sysfs_sfp_i2c_client_path = eeprom_path.format(self.port_to_i2cbus_mapping[port_num]) + sysfs_sfp_i2c_adapter_path= i2c_path.format(self.port_to_i2cbus_mapping[port_num]) + # If sfp device is not present on bus, Add it + if not os.path.exists(sysfs_sfp_i2c_client_path): + if port_num in self.qsfp_ports: + ret = self.__add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.QSFP_DEVICE_TYPE) + else: + ret = self.__add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.SFP_DEVICE_TYPE) + if ret != 0: + print("Error adding sfp device") + return None + + sysfs_sfp_i2c_client_eeprom_path = "%s/eeprom" % sysfs_sfp_i2c_client_path + + return sysfs_sfp_i2c_client_eeprom_path + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.__get_port_eeprom_path(self.port_num, IDENTITY_EEPROM_ADDR) + if sysfs_sfp_i2c_client_eeprom_path is None: + return eeprom_raw + try: + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except IOError: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def __convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + hardware_rev |1*255VCHAR |hardware version of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + ======================================================================== + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + compliance_code_dict = {} + transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') + ''' + if not self.get_presence(): + return transceiver_info_dict + ''' + # ToDo: OSFP tranceiver info parsing not fully supported. + # in inf8628.py lack of some memory map definition + # will be implemented when the inf8628 memory map ready + #port_eeprom_path = self.sfputilbase.__get_port_eeprom_path(self.port_num, IDENTITY_EEPROM_ADDR) + if self.sfp_type == QSFP_TYPE: + offset = 128 + vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + else: + offset = 0 + vendor_rev_width = XCVR_HW_REV_WIDTH_SFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP + + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( + offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) + if sfp_interface_bulk_raw is None: + return None + + start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START + end = start + interface_info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_NAME_WIDTH + sfp_vendor_name_data = sfpi_obj.parse_vendor_name( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_PN_WIDTH + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START + end = start + vendor_rev_width + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_SN_WIDTH + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_OUI_WIDTH + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( + sfp_interface_bulk_raw[start: end], 0) + + start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_DATE_WIDTH + sfp_vendor_date_data = sfpi_obj.parse_vendor_date( + sfp_interface_bulk_raw[start: end], 0) + transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ + 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + if self.sfp_type == QSFP_TYPE: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) + else: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + self.__dom_capability_detect() + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + + if self.sfp_type == QSFP_TYPE: + offset = 128 + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + self.dom_supported = True + if not self.dom_supported: + return transceiver_dom_info_dict + + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_data_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_DOM_BULK_DATA_START), QSFP_DOM_BULK_DATA_SIZE) + if dom_data_raw is None: + return transceiver_dom_info_dict + + if self.dom_temp_supported: + start = QSFP_TEMPE_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature( + dom_data_raw[start: end], 0) + temp = self.__convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + if temp is not None: + transceiver_dom_info_dict['temperature'] = temp + + if self.dom_volt_supported: + start = QSFP_VOLT_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage( + dom_data_raw[start: end], 0) + volt = self.__convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + if volt is not None: + transceiver_dom_info_dict['voltage'] = volt + + start = QSFP_CHANNL_MON_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_data_raw[start: end], 0) + + if self.dom_tx_power_supported: + transceiver_dom_info_dict['tx1power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX1Power']['value']) + transceiver_dom_info_dict['tx2power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX2Power']['value']) + transceiver_dom_info_dict['tx3power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX3Power']['value']) + transceiver_dom_info_dict['tx4power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX4Power']['value']) + + if self.dom_rx_power_supported: + transceiver_dom_info_dict['rx1power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX1Power']['value']) + transceiver_dom_info_dict['rx2power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX2Power']['value']) + transceiver_dom_info_dict['rx3power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX3Power']['value']) + transceiver_dom_info_dict['rx4power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX4Power']['value']) + + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + + else: + if not self.dom_supported: + return transceiver_dom_info_dict + + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + sfpd_obj._calibration_type = self.calibration + + if sfpd_obj._calibration_type == 1: + dom_data_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_DOM_BULK_DATA_START), SFP_DOM_BULK_DATA_SIZE) + start = SFP_TEMPE_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature( + dom_data_raw[start: end], 0) + + start = SFP_VOLT_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage( + dom_data_raw[start: end], 0) + + start = SFP_CHANNL_MON_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_CHANNL_MON_WIDTH + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_data_raw[start: end], 0) + else: + dom_data_raw = self.__read_eeprom_specific_bytes( + (offset), offset + 256) + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw, 0) + + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw, 0) + + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_data_raw, 0) + + transceiver_dom_info_dict['temperature'] = self.__convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + transceiver_dom_info_dict['voltage'] = self.__convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + transceiver_dom_info_dict['rx1power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['RXPower']['value']) + transceiver_dom_info_dict['tx1bias'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TXBias']['value']) + transceiver_dom_info_dict['tx1power'] = self.__convert_string_to_num( + dom_channel_monitor_data['data']['TXPower']['value']) + + transceiver_dom_info_dict['rx_los'] = self.get_rx_los() + transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() + transceiver_dom_info_dict['reset_status'] = self.get_reset_status() + transceiver_dom_info_dict['tx_disable'] = self.get_tx_disable() + transceiver_dom_info_dict['tx_disabled_channel'] = self.get_tx_disable_channel() + transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + self.__dom_capability_detect() + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + transceiver_dom_threshold_info_dict = dict.fromkeys( + self.threshold_dict_keys, 'N/A') + + if self.sfp_type == OSFP_TYPE: + pass + + elif self.sfp_type == QSFP_TYPE: + if not self.dom_supported or not self.qsfp_page3_available: + return transceiver_dom_threshold_info_dict + + # Dom Threshold data starts from offset 384 + # Revert offset back to 0 once data is retrieved + offset = QSFP_MODULE_UPPER_PAGE3_START + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values( + dom_module_threshold_raw, 0) + + dom_channel_threshold_raw = self.__read_eeprom_specific_bytes((offset + QSFP_CHANNL_THRESHOLD_OFFSET), + QSFP_CHANNL_THRESHOLD_WIDTH) + if dom_channel_threshold_raw is None: + return transceiver_dom_threshold_info_dict + dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values( + dom_channel_threshold_raw, 0) + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_channel_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_channel_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_channel_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_channel_threshold_data['data']['TxPowerLowWarning']['value'] + + else: + offset = SFP_MODULE_ADDRA2_OFFSET + + if not self.dom_supported: + return transceiver_dom_threshold_info_dict + + sfpd_obj = sff8472Dom(None, self.calibration) + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + sfpd_obj._calibration_type = self.calibration + + if sfpd_obj._calibration_type == 1: + dom_module_threshold_raw = self.__read_eeprom_specific_bytes((offset + SFP_MODULE_THRESHOLD_OFFSET), + SFP_MODULE_THRESHOLD_WIDTH) + else: + dom_module_threshold_raw = self.__read_eeprom_specific_bytes( + (offset), offset + 256) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( + dom_module_threshold_raw, 0) + else: + return transceiver_dom_threshold_info_dict + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ + 'data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + return transceiver_dom_threshold_info_dict + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + + Returns: + An integer number of current temperature in Celsius + """ + transceiver_bulk_status = self.get_transceiver_bulk_status() + if transceiver_bulk_status is not None: + return transceiver_bulk_status.get("temperature", "N/A") + else: + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + + Returns: + An integer number of supply voltage in mV + """ + transceiver_bulk_status = self.get_transceiver_bulk_status() + if transceiver_bulk_status is not None: + return transceiver_bulk_status.get("voltage", "N/A") + else: + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + tx_bias_list = [] + if self.sfp_type == OSFP_TYPE: + # OSFP not supported on our platform yet. + return None + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + tx_bias_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX4Bias']['value'])) + else: + return None + else: + return None + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + tx_bias_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TXBias']['value'])) + else: + return None + else: + return None + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + rx_power_list = [] + if self.sfp_type == OSFP_TYPE: + # OSFP not supported on our platform yet. + return None + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + rx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['RX4Power']['value'])) + else: + return None + else: + return None + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + rx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['RXPower']['value'])) + else: + return None + else: + return None + + return rx_power_list + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + tx_power_list = [] + if self.sfp_type == OSFP_TYPE: + # OSFP not supported on our platform yet. + return None + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + tx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TX4Power']['value'])) + else: + return None + else: + return None + else: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + tx_power_list.append(self.__convert_string_to_num( + dom_channel_monitor_data['data']['TXPower']['value'])) + else: + return None + else: + return None + + return tx_power_list + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + if not self.dom_supported: + return None + + rx_los_list = [] + if self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + else: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x02 != 0) + else: + return None + + return rx_los_list + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + if not self.dom_supported: + return None + tx_fault_list = [] + if self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + else: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + else: + return None + + return tx_fault_list + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + # Check for invalid self.port_num + if self.port_num < PORT_START or self.port_num > PORT_END: + return None + if not self.dom_supported: + return None + + tx_disable_list = [] + + if self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + else: + if self.port_num <= 7: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis1" + elif self.port_num >= 8 and self.port_num <= 15: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis2" + elif self.port_num >= 16 and self.port_num <= 23: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis3" + elif self.port_num >= 24 and self.port_num <= 31: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis4" + elif self.port_num >= 32 and self.port_num <= 39: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis5" + elif self.port_num >= 40 and self.port_num <= 47: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis6" + else: + return None + try: + data = open(txdis_path, "rb") + except IOError: + return None + + txdis_data = data.read(2) + if txdis_data == "": + return None + result = int(txdis_data, 16) + data.close() + + # ModPrsL is active low + tx_disable_list.append(result & (1 << (self.port_num % 8)) != 0) + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + ''' + Not support LPMode pin to control lpmde. + This function is affected by the Power_over-ride and Power_set software control bits (byte 93 bits 0,1) + ''' + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + offset + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + lpmode = ('On' == dom_control_data['data']['PowerSet']['value']) + power_override = ('On' == dom_control_data['data']['PowerOverride']['value']) + if lpmode == power_override == True: + return True + elif self.sfp_type == SFP_TYPE: + # SFP doesn't support this feature + return False + return False + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + offset + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_override = ('On' == dom_control_data['data']['PowerOverride']['value']) + return power_override + elif self.sfp_type == SFP_TYPE: + # SFP doesn't support this feature + return False + return False + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + if self.port_num >= 48 and self.port_num <= 55: + reset_path = "/sys/bus/i2c/devices/1-0036/qsfp_reset" + else: + return False + try: + data = open(reset_path, "rb") + except IOError: + return None + + reset_data = data.read(2) + if reset_data == "": + return None + result = int(reset_data, 16) + data.close() + reset_status = result & (1 << (self.port_num % 8)) == 0 + return reset_status + + return False + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + offset = 0 + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfs_sfp_i2c_client_eeprom_path = self.__get_port_eeprom_path(self.port_num, IDENTITY_EEPROM_ADDR) + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, "r+b") + sysfsfile_eeprom.seek(offset + QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + elif self.sfp_type == SFP_TYPE: + if self.port_num <= 7: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis1" + elif self.port_num >= 8 and self.port_num <= 15: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis2" + elif self.port_num >= 16 and self.port_num <= 23: + txdis_path = "/sys/bus/i2c/devices/1-0034/sfp_txdis3" + elif self.port_num >= 24 and self.port_num <= 31: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis4" + elif self.port_num >= 32 and self.port_num <= 39: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis5" + elif self.port_num >= 40 and self.port_num <= 47: + txdis_path = "/sys/bus/i2c/devices/1-0036/sfp_txdis6" + else: + return False + try: + data = open(txdis_path, "r+") + txdis_data = data.read(2) + if txdis_data == "": + return False + result = int(txdis_data, 16) + if tx_disable: + result = result | (1 << (self.port_num % 8)) + else: + result = result & (~(1 << (self.port_num % 8))) + data.seek(0) + sres = hex(result)[2:] + data.write(sres) + data.close() + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return True + return False + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + + Returns: + A boolean, True if successful, False if not + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + offset = 0 + if 0 <= channel <= 15: + try: + channel_state = self.get_tx_disable_channel() + if disable: + tx_disable_ctl = channel_state | channel + else: + tx_disable_ctl = channel_state & (~channel) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfs_sfp_i2c_client_eeprom_path = self.__get_port_eeprom_path(self.port_num, IDENTITY_EEPROM_ADDR) + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, "r+b") + sysfsfile_eeprom.seek(offset + QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + elif self.sfp_type == SFP_TYPE: + # SFP doesn't support this feature + return False + return False + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + ''' + Not support LPMode pin to control lpmde. + This function is affected by the Power_over-ride and Power_set software control bits (byte 93 bits 0,1) + ''' + if lpmode: + return self.set_power_override(True, lpmode) + else: + return self.set_power_override(False, lpmode) + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + offset = 0 + try: + power_override_bit = 0 + if power_override: + power_override_bit |= 1 << 0 + + power_set_bit = 0 + if power_set: + power_set_bit |= 1 << 1 + + buffer = create_string_buffer(1) + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + sysfs_sfp_i2c_client_eeprom_path = self.__get_port_eeprom_path(self.port_num, IDENTITY_EEPROM_ADDR) + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, "r+b") + sysfsfile_eeprom.seek(offset + QSFP_POWERMODE_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + elif self.sfp_type == SFP_TYPE: + # SFP doesn't support this feature + return False + return False + + def reset(self, reset): + """ + Reset SFP and return all user module settings to their default srate. + + Returns: + A boolean, True if successful, False if not + """ + if self.port_num < PORT_START or self.port_num > PORT_END: + return False + if self.sfp_type == QSFP_TYPE: + if self.port_num >= 48 and self.port_num <= 55: + reset_path = "/sys/bus/i2c/devices/1-0036/qsfp_reset" + else: + return False + try: + data = open(reset_path, "r+") + reset_data = data.read(2) + if reset_data == "": + return False + result = int(reset_data, 16) + if reset: + result = result & (~(1 << (self.port_num % 8))) + else: + result = result | (1 << (self.port_num % 8)) + data.seek(0) + sres = hex(result)[2:] + data.write(sres) + data.close() + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return True + elif self.sfp_type == SFP_TYPE: + # SFP doesn't support this feature + return False + return False + + def read_eeprom(self, offset, num_bytes): + """ + read eeprom specfic bytes beginning from a random offset with size as num_bytes + Args: + offset : + Integer, the offset from which the read transaction will start + num_bytes: + Integer, the number of bytes to be read + Returns: + bytearray, if raw sequence of bytes are read correctly from the offset of size num_bytes + None, if the read_eeprom fails + """ + raise NotImplementedError + + def write_eeprom(self, offset, num_bytes, write_buffer): + """ + write eeprom specfic bytes beginning from a random offset with size as num_bytes + and write_buffer as the required bytes + Args: + offset : + Integer, the offset from which the read transaction will start + num_bytes: + Integer, the number of bytes to be written + write_buffer: + bytearray, raw bytes buffer which is to be written beginning at the offset + Returns: + a Boolean, true if the write succeeded and false if it did not succeed. + """ + raise NotImplementedError + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/thermal.py new file mode 100644 index 000000000000..49beb8e16339 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/thermal.py @@ -0,0 +1,217 @@ +######################################################################## +# Ruijie B6510-48VS8CQ +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Thermals' information which are available in the platform +# +######################################################################## + + +try: + from sonic_platform_base.thermal_base import ThermalBase + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + def __init__(self, index, config=None, hal_thermal=None): + self.index = index + if config: + self.name = config.get("name") + self.__reg_low_threshold = Reg(config.get("low")) + self.__reg_high_thresnold = Reg(config.get("high")) + self.__reg_crit_low_threshold = Reg(config.get("crit_low")) + self.__reg_crit_high_thresnold = Reg(config.get("crit_high")) + self.__reg_temperature = Reg(config.get("temperature")) + self.minimum_thermal = self.get_temperature() + self.maximum_thermal = self.get_temperature() + + def get_name(self): + """ + Retrieves the name of the thermal + + Returns: + string: The name of the thermal + """ + return self.name + + def get_presence(self): + """ + Retrieves the presence of the thermal + + Returns: + bool: True if thermal is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the Thermal + + Returns: + string: Model/part number of Thermal + """ + return "NA" + + def get_serial(self): + """ + Retrieves the serial number of the Thermal + + Returns: + string: Serial number of Thermal + """ + return "NA" + + def get_status(self): + """ + Retrieves the operational status of the thermal + + Returns: + A boolean value, True if thermal is operating properly, + False if not + """ + if self.get_temperature() == 0.0: + return False + + return True + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + try: + if isinstance(self.__reg_temperature, Reg): + return self.__reg_temperature.decode() + except Exception as e: + logger.error(str(e)) + + return None + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + try: + if isinstance(self.__reg_high_thresnold, Reg): + return float(self.__reg_high_thresnold.decode()) + except Exception as e: + logger.error(str(e)) + + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + try: + if isinstance(self.__reg_low_threshold, Reg): + return float(self.__reg_low_threshold.decode()) + except Exception as e: + logger.error(str(e)) + + return None + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + try: + if isinstance(self.__reg_high_thresnold, Reg): + temp_val = str(int(temperature * 1000)) + return self.__reg_high_thresnold.encode(temp_val) + except Exception as e: + logger.error(str(e)) + + return False + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + # not supported + return False + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + + Returns: + A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + try: + if isinstance(self.__reg_crit_high_thresnold, Reg): + return float(self.__reg_crit_high_thresnold.decode()) + except Exception as e: + logger.error(str(e)) + + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + try: + if isinstance(self.__reg_crit_low_threshold, Reg): + return float(self.__reg_crit_low_threshold.decode()) + except Exception as e: + logger.error(str(e)) + + return None + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + tmp = self.get_temperature() + if tmp < self.minimum_thermal: + self.minimum_thermal = tmp + raise self.minimum_thermal + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + tmp = self.get_temperature() + if tmp > self.maximum_thermal: + self.maximum_thermal = tmp + raise self.maximum_thermal + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/watchdog.py new file mode 100644 index 000000000000..6c3939c5a1ee --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/watchdog.py @@ -0,0 +1,70 @@ +######################################################################## +# +# Ruijie B6510-48VS8CQ +# +# Abstract base class for implementing a platform-specific class with +# which to interact with a hardware watchdog module in SONiC +# +######################################################################## + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Watchdog(WatchdogBase): + """ + Abstract base class for interfacing with a hardware watchdog module + """ + + def __init__(self): + print("INFO: Watchdog __init__") + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* available + value. + + Returns: + An integer specifying the *actual* number of seconds the watchdog + was armed with. On failure returns -1. + """ + print("ERROR: Platform did not implement arm()") + raise NotImplementedError + + def disarm(self): + """ + Disarm the hardware watchdog + + Returns: + A boolean, True if watchdog is disarmed successfully, False if not + """ + print("ERROR: Platform did not implement disarm()") + raise NotImplementedError + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + + Returns: + A boolean, True if watchdog is armed, False if not + """ + print("ERROR: Platform did not implement is_armed()") + raise NotImplementedError + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds remaining on + the watchdog timer + + Returns: + An integer specifying the number of seconds remaining on thei + watchdog timer. If the watchdog is not armed, returns -1. + """ + print("ERROR: Platform did not implement get_remaining_time()") + raise NotImplementedError diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/systemd/platform-modules-b6510-48vs8cq.service b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/systemd/platform-modules-b6510-48vs8cq.service new file mode 100644 index 000000000000..3b0e8a0005e8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/systemd/platform-modules-b6510-48vs8cq.service @@ -0,0 +1,13 @@ +[Unit] +Description=b6510-48vs8cq platform modules +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/b6510-48vs8cq_platform.sh init +ExecStop=/usr/local/bin/b6510-48vs8cq_platform.sh deinit +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile b/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile new file mode 100755 index 000000000000..205a32578e2a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile @@ -0,0 +1,37 @@ +PWD = $(shell pwd) +CC ?=gcc +INSTALL_MOD_DIR ?=extra +KVERSION ?= $(shell uname -r) +KERNEL_SRC ?= /lib/modules/$(KVERSION) +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -Wall +SUB_BUILD_DIR = $(PWD)/build +DIR_KERNEL_SRC = $(PWD)/modules +SCRIPT_DIR = $(PWD)/script +SERVICE_DIR = $(PWD)/service + +KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +export KBUILD_EXTRA_SYMBOLS + +INSTALL_MODULE_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) +INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin +INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system +INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.7/dist-packages + +all: + $(MAKE) -C $(KERNEL_SRC)/build M=$(DIR_KERNEL_SRC) modules + @if [ ! -d ${INSTALL_MODULE_DIR} ]; then mkdir -p ${INSTALL_MODULE_DIR} ;fi + @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi + @if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi + @if [ ! -d ${INSTALL_LIB_DIR} ]; then mkdir -p ${INSTALL_LIB_DIR} ;fi + @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi + @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR2} ;fi + cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_MODULE_DIR) + cp -r $(SCRIPT_DIR)/* $(INSTALL_SCRIPT_DIR) + cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR) + @if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi +clean: + rm -f ${DIR_KERNEL_SRC}/*.o ${DIR_KERNEL_SRC}/*.ko ${DIR_KERNEL_SRC}/*.mod.c ${DIR_KERNEL_SRC}/.*.cmd + rm -f ${DIR_KERNEL_SRC}/Module.markers ${DIR_KERNEL_SRC}/Module.symvers ${DIR_KERNEL_SRC}/modules.order + rm -rf ${DIR_KERNEL_SRC}/.tmp_versions + rm -rf $(SUB_BUILD_DIR) diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fantlv.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fantlv.py new file mode 100644 index 000000000000..2d434d1ad2a6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fantlv.py @@ -0,0 +1,212 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +class FantlvException(Exception): + def __init__(self, message='fantlverror', code=-100): + err = 'errcode: {0} message:{1}'.format(code, message) + Exception.__init__(self, err) + self.code = code + self.message = message + +class fan_tlv(object): + HEAD_INFO = "\x01\x7e\x01\xf1" + VERSION = 0x01 # E2PROM file init version is 0x01 + FLAG = 0x7E #new version E2PROM mark as 0x7E + HW_VER = 0X01 # consists of master version and revised version + TYPE = 0xf1 # hardware type define + TLV_LEN = 00 # vaild data length(16bit) + _FAN_TLV_HDR_LEN = 6 + _FAN_TLV_CRC_LEN = 2 + + _FAN_TLV_TYPE_NAME = 0x02 + _FAN_TLV_TYPE_SN = 0x03 + _FAN_TLV_TYPE_HW_INFO = 0x05 + _FAN_TLV_TYPE_DEV_TYPE = 0x06 + + _fandecodetime = 0 + + @property + def dstatus(self): + return self._dstatus + + @property + def typename(self): + return self._typename + + @property + def typesn(self): + return self._typesn + + @property + def typehwinfo(self): + return self._typehwinfo + + @property + def typedevtype(self): + return self._typedevtype + + @property + def fanbus(self): + return self._fanbus + + @property + def fanloc(self): + return self._fanloc + + @property + def fandecodetime(self): + return self._fandecodetime + + def __init__(self): + self._typename = "" + self._typesn = "" + self._typehwinfo = "" + self._typedevtype = "" + self._dstatus = 0 + + def strtoarr(self, str): + s = [] + if str is not None: + for index in range(len(str)): + s.append(str[index]) + return s + + def str_to_hex(self,rest_v): + value = 0 + for index in range(len(rest_v)): + value |= ord(rest_v[index]) << ((len(rest_v) - index - 1) * 8) + return value + + def hex_to_str(self,s): + len_t = len(s) + if len_t % 2 != 0: + return 0 + ret = "" + for t in range(0, int(len_t / 2)): + ret += chr(int(s[2 * t:2 * t + 2], 16)) + return ret + + def generate_fan_value(self): + bin_buffer = [chr(0xff)] * 256 + bin_buffer[0] = chr(self.VERSION) + bin_buffer[1] = chr(self.FLAG) + bin_buffer[2] = chr(self.HW_VER) + bin_buffer[3] = chr(self.TYPE) + + temp_t = "%08x" % self.typedevtype # handle devtype first + typedevtype_t = self.hex_to_str(temp_t) + total_len = len(self.typename) + len(self.typesn) + \ + len(self.typehwinfo) + len(typedevtype_t) + 8 + + bin_buffer[4] = chr(total_len >> 8) + bin_buffer[5] = chr(total_len & 0x00FF) + + index_start = 6 + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_NAME) + bin_buffer[index_start + 1] = chr(len(self.typename)) + bin_buffer[index_start + 2: index_start + 2 + + len(self.typename)] = self.strtoarr(self.typename) + index_start = index_start + 2 + len(self.typename) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_SN) + bin_buffer[index_start + 1] = chr(len(self.typesn)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typesn)] = self.strtoarr(self.typesn) + index_start = index_start + 2 + len(self.typesn) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_HW_INFO) + bin_buffer[index_start + 1] = chr(len(self.typehwinfo)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typehwinfo)] = self.strtoarr(self.typehwinfo) + index_start = index_start + 2 + len(self.typehwinfo) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_DEV_TYPE) + bin_buffer[index_start + 1] = chr(len(typedevtype_t)) + bin_buffer[index_start + 2:index_start + 2 + + len(typedevtype_t)] = self.strtoarr(typedevtype_t) + index_start = index_start + 2 + len(typedevtype_t) + + crcs = fan_tlv.fancrc(''.join(bin_buffer[0:index_start])) # 2bytes checking + bin_buffer[index_start] = chr(crcs >> 8) + bin_buffer[index_start + 1] = chr(crcs & 0x00ff) + # printvalue(bin_buffer) + return bin_buffer + + def decode(self, e2): + if e2[0:4] != self.HEAD_INFO: + raise FantlvException("Fan tlv head info error,not fan tlv type", -10) + ret = [] + self.VERSION = ord(e2[0]) + self.FLAG = ord(e2[1]) + self.HW_VER = ord(e2[2]) + self.TYPE = ord(e2[3]) + self.TLV_LEN = (ord(e2[4]) << 8) | ord(e2[5]) + + tlv_index = self._FAN_TLV_HDR_LEN + tlv_end = self._FAN_TLV_HDR_LEN + self.TLV_LEN + + # check sum + if len(e2) < self._FAN_TLV_HDR_LEN + self.TLV_LEN + 2: + raise FantlvException("Fan tlv eeprom len error!", -2) + sumcrc = fan_tlv.fancrc(e2[0:self._FAN_TLV_HDR_LEN + self.TLV_LEN]) + readcrc = ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN] + ) << 8 | ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN + 1]) + if sumcrc != readcrc: + raise FantlvException("Fan tlv eeprom checksum error!", -1) + else: + self._dstatus = 0 + while (tlv_index + 2) < len(e2) and tlv_index < tlv_end: + s = self.decoder( + e2[tlv_index:tlv_index + 2 + ord(e2[tlv_index + 1])]) + tlv_index += ord(e2[tlv_index + 1]) + 2 + ret.append(s) + + return ret + + @staticmethod + def fancrc(t): + sum = 0 + for index in range(len(t)): + sum += ord(t[index]) + return sum + + def decoder(self, t): + try: + name = "" + value = "" + if ord(t[0]) == self._FAN_TLV_TYPE_NAME: + name = "Product Name" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typename = value + elif ord(t[0]) == self._FAN_TLV_TYPE_SN: + name = "serial Number" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typesn = value + elif ord(t[0]) == self._FAN_TLV_TYPE_HW_INFO: + name = "hardware info" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typehwinfo = value + elif ord(t[0]) == self._FAN_TLV_TYPE_DEV_TYPE: + name = "dev type" + _len = ord(t[1]) + value = "0x" + for c in t[2:2 + ord(t[1])]: + value += "%02X" % (ord(c),) + self._typedevtype = int(value,16) + except Exception as e: + print(e) + return {"name": name, "code": ord(t[0]), "value": value,"lens": _len} + + def __str__(self): + formatstr = "VERSION : 0x%02x \n" \ + " FLAG : 0x%02x \n" \ + " HW_VER : 0x%02x \n" \ + " TYPE : 0x%02x \n" \ + "typename : %s \n" \ + "typesn : %s \n" \ + "typehwinfo : %s \n" + return formatstr % (self.VERSION, self.FLAG, self.HW_VER, self.TYPE, self.typename, self.typesn, self.typehwinfo) + + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fru.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fru.py new file mode 100644 index 000000000000..892d0619468b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/eepromutil/fru.py @@ -0,0 +1,954 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +import collections +from bitarray import bitarray +from datetime import datetime, timedelta +import sys + +__all__ = ["FruException", "FruUtil", "BaseArea", "BoardInfoArea", "ProductInfoArea", + "MultiRecordArea", "Field", "ipmifru"] + +__DEBUG__ = "N" + + +class FruException(Exception): + def __init__(self, message='fruerror', code=-100): + err = 'errcode: {0} message:{1}'.format(code, message) + Exception.__init__(self, err) + self.code = code + self.message = message + + +def e_print(err): + print("ERROR: " + err) + + +def d_print(debug_info): + if(__DEBUG__ == "Y"): + print(debug_info) + + +class FruUtil(): + @staticmethod + def decodeLength(value): + a = bitarray(8) + a.setall(True) + a[0:1] = 0 + a[1:2] = 0 + x = ord(a.tobytes()) + return x & ord(value) + + @staticmethod + def minToData(): + starttime = datetime(1996, 1, 1, 0, 0, 0) + endtime = datetime.now() + seconds = (endtime - starttime).total_seconds() + mins = seconds / 60 + m = int(round(mins)) + return m + + @staticmethod + def getTimeFormat(): + return datetime.now().strftime('%Y-%m-%d') + + @staticmethod + def getTypeLength(value): + if value is None: + return 0 + a = bitarray(8) + a.setall(False) + a[0:1] = 1 + a[1:2] = 1 + x = ord(a.tobytes()) + return x | len(value) + + @staticmethod + def checksum(b): + result = 0 + for i in range(len(b)): + result += ord(b[i]) + return (0x100 - (result & 0xff)) & 0xff + + +class BaseArea(object): + SUGGESTED_SIZE_COMMON_HEADER = 8 + SUGGESTED_SIZE_INTERNAL_USE_AREA = 72 + SUGGESTED_SIZE_CHASSIS_INFO_AREA = 32 + SUGGESTED_SIZE_BOARD_INFO_AREA = 80 + SUGGESTED_SIZE_PRODUCT_INFO_AREA = 80 + + INITVALUE = b'\x00' + resultvalue = INITVALUE * 256 + COMMON_HEAD_VERSION = b'\x01' + __childList = None + + def __init__(self, name="", size=0, offset=0): + self.__childList = [] + self._offset = offset + self.name = name + self._size = size + self._isPresent = False + self._data = b'\x00' * size + self.__dataoffset = 0 + + @property + def childList(self): + return self.__childList + + @childList.setter + def childList(self, value): + self.__childList = value + + @property + def offset(self): + return self._offset + + @offset.setter + def offset(self, value): + self._offset = value + + @property + def size(self): + return self._size + + @size.setter + def size(self, value): + self._size = value + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + self._data = value + + @property + def isPresent(self): + return self._isPresent + + @isPresent.setter + def isPresent(self, value): + self._isPresent = value + + +class InternalUseArea(BaseArea): + pass + + +class ChassisInfoArea(BaseArea): + pass + + +class BoardInfoArea(BaseArea): + _boardTime = None + _fields = None + _mfg_date = None + + def __str__(self): + formatstr = "version : %x\n" \ + "length : %d \n" \ + "language : %x \n" \ + "mfg_date : %s \n" \ + "boardManufacturer : %s \n" \ + "boardProductName : %s \n" \ + "boardSerialNumber : %s \n" \ + "boardPartNumber : %s \n" \ + "fruFileId : %s \n" + + tmpstr = formatstr % (ord(self.boardversion), self.size, + self.language, self.getMfgRealData(), + self.boardManufacturer, self.boardProductName, + self.boardSerialNumber, self.boardPartNumber, + self.fruFileId) + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + tmpstr += "boardextra%d : %s \n" % (i, valtmpval) + else: + break + + return tmpstr + + def todict(self): + dic = collections.OrderedDict() + dic["boardversion"] = ord(self.boardversion) + dic["boardlength"] = self.size + dic["boardlanguage"] = self.language + dic["boardmfg_date"] = self.getMfgRealData() + dic["boardManufacturer"] = self.boardManufacturer + dic["boardProductName"] = self.boardProductName + dic["boardSerialNumber"] = self.boardSerialNumber + dic["boardPartNumber"] = self.boardPartNumber + dic["boardfruFileId"] = self.fruFileId + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + dic[valtmp] = valtmpval + else: + break + return dic + + def decodedata(self): + index = 0 + self.areaversion = self.data[index] + index += 1 + d_print("decode length :%d class size:%d" % + ((ord(self.data[index]) * 8), self.size)) + index += 2 + + timetmp = self.data[index: index + 3] + self.mfg_date = ord(timetmp[0]) | ( + ord(timetmp[1]) << 8) | (ord(timetmp[2]) << 16) + d_print("decode getMfgRealData :%s" % self.getMfgRealData()) + index += 3 + + templen = FruUtil.decodeLength(self.data[index]) + self.boardManufacturer = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardManufacturer:%s" % self.boardManufacturer) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardProductName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardProductName:%s" % self.boardProductName) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardSerialNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardSerialNumber:%s" % self.boardSerialNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardPartNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardPartNumber:%s" % self.boardPartNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.fruFileId = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode fruFileId:%s" % self.fruFileId) + + + for i in range(1, 11): + valtmp = "boardextra%d" % i + if self.data[index] != chr(0xc1): + templen = FruUtil.decodeLength(self.data[index]) + tmpval = self.data[index + 1: index + templen + 1] + setattr(self, valtmp, tmpval) + index += templen + 1 + d_print("decode boardextra%d:%s" % (i, tmpval)) + else: + break + + def recalcute(self): + d_print("boardInfoArea version:%x" % ord(self.boardversion)) + d_print("boardInfoArea length:%d" % self.size) + d_print("boardInfoArea language:%x" % self.language) + self.mfg_date = FruUtil.minToData() + d_print("boardInfoArea mfg_date:%x" % self.mfg_date) + + self.data = chr(ord(self.boardversion)) + \ + chr(self.size / 8) + chr(self.language) + + self.data += chr(self.mfg_date & 0xFF) + self.data += chr((self.mfg_date >> 8) & 0xFF) + self.data += chr((self.mfg_date >> 16) & 0xFF) + + d_print("boardInfoArea boardManufacturer:%s" % self.boardManufacturer) + typelength = FruUtil.getTypeLength(self.boardManufacturer) + self.data += chr(typelength) + self.data += self.boardManufacturer + + d_print("boardInfoArea boardProductName:%s" % self.boardProductName) + self.data += chr(FruUtil.getTypeLength(self.boardProductName)) + self.data += self.boardProductName + + d_print("boardInfoArea boardSerialNumber:%s" % self.boardSerialNumber) + self.data += chr(FruUtil.getTypeLength(self.boardSerialNumber)) + self.data += self.boardSerialNumber + + d_print("boardInfoArea boardPartNumber:%s" % self.boardPartNumber) + self.data += chr(FruUtil.getTypeLength(self.boardPartNumber)) + self.data += self.boardPartNumber + + d_print("boardInfoArea fruFileId:%s" % self.fruFileId) + self.data += chr(FruUtil.getTypeLength(self.fruFileId)) + self.data += self.fruFileId + + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + d_print("boardInfoArea boardextra%d:%s" % (i, valtmpval)) + self.data += chr(FruUtil.getTypeLength(valtmpval)) + if valtmpval is None: + pass + else: + self.data += valtmpval + else: + break + + self.data += chr(0xc1) + + if len(self.data) > (self.size - 1): + incr = (len(self.data) - self.size) / 8 + 1 + self.size += incr * 8 + + self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] + d_print("self data:%d" % len(self.data)) + d_print("self size:%d" % self.size) + d_print("adjust size:%d" % (self.size - len(self.data) - 1)) + self.data = self.data.ljust((self.size - 1), self.INITVALUE) + + # checksum + checksum = FruUtil.checksum(self.data) + d_print("board info checksum:%x" % checksum) + self.data += chr(checksum) + + def getMfgRealData(self): + starttime = datetime(1996, 1, 1, 0, 0, 0) + mactime = starttime + timedelta(minutes=self.mfg_date) + return mactime + + @property + def language(self): + self._language = 25 + return self._language + + @property + def mfg_date(self): + return self._mfg_date + + @mfg_date.setter + def mfg_date(self, val): + self._mfg_date = val + + @property + def boardversion(self): + self._boardversion = self.COMMON_HEAD_VERSION + return self._boardversion + + @property + def fruFileId(self): + return self._FRUFileID + + @fruFileId.setter + def fruFileId(self, val): + self._FRUFileID = val + + @property + def boardPartNumber(self): + return self._boardPartNumber + + @boardPartNumber.setter + def boardPartNumber(self, val): + self._boardPartNumber = val + + @property + def boardSerialNumber(self): + return self._boardSerialNumber + + @boardSerialNumber.setter + def boardSerialNumber(self, val): + self._boardSerialNumber = val + + @property + def boardProductName(self): + return self._boradProductName + + @boardProductName.setter + def boardProductName(self, val): + self._boradProductName = val + + @property + def boardManufacturer(self): + return self._boardManufacturer + + @boardManufacturer.setter + def boardManufacturer(self, val): + self._boardManufacturer = val + + @property + def boardTime(self): + return self._boardTime + + @boardTime.setter + def boardTime(self, val): + self._boardTime = val + + @property + def fields(self): + return self._fields + + @fields.setter + def fields(self, val): + self._fields = val + + +class ProductInfoArea(BaseArea): + _productManufacturer = None + _productAssetTag = None + _FRUFileID = None + + def __str__(self): + formatstr = "version : %x\n" \ + "length : %d \n" \ + "language : %x \n" \ + "productManufacturer : %s \n" \ + "productName : %s \n" \ + "productPartModelName: %s \n" \ + "productVersion : %s \n" \ + "productSerialNumber : %s \n" \ + "productAssetTag : %s \n" \ + "fruFileId : %s \n" + + tmpstr = formatstr % (ord(self.areaversion), self.size, + self.language, self.productManufacturer, + self.productName, self.productPartModelName, + self.productVersion, self.productSerialNumber, + self.productAssetTag, self.fruFileId) + + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + tmpstr += "productextra%d : %s \n" % (i, valtmpval) + else: + break + + return tmpstr + + def todict(self): + dic = collections.OrderedDict() + dic["productversion"] = ord(self.areaversion) + dic["productlength"] = self.size + dic["productlanguage"] = self.language + dic["productManufacturer"] = self.productManufacturer + dic["productName"] = self.productName + dic["productPartModelName"] = self.productPartModelName + dic["productVersion"] = int(self.productVersion, 16) + dic["productSerialNumber"] = self.productSerialNumber + dic["productAssetTag"] = self.productAssetTag + dic["productfruFileId"] = self.fruFileId + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + dic[valtmp] = valtmpval + else: + break + return dic + + def decodedata(self): + index = 0 + self.areaversion = self.data[index] # 0 + index += 1 + d_print("decode length %d" % (ord(self.data[index]) * 8)) + d_print("class size %d" % self.size) + index += 2 + + templen = FruUtil.decodeLength(self.data[index]) + self.productManufacturer = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productManufacturer:%s" % self.productManufacturer) + + templen = FruUtil.decodeLength(self.data[index]) + self.productName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productName:%s" % self.productName) + + templen = FruUtil.decodeLength(self.data[index]) + self.productPartModelName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productPartModelName:%s" % self.productPartModelName) + + templen = FruUtil.decodeLength(self.data[index]) + self.productVersion = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productVersion:%s" % self.productVersion) + + templen = FruUtil.decodeLength(self.data[index]) + self.productSerialNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productSerialNumber:%s" % self.productSerialNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.productAssetTag = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productAssetTag:%s" % self.productAssetTag) + + templen = FruUtil.decodeLength(self.data[index]) + self.fruFileId = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode fruFileId:%s" % self.fruFileId) + + for i in range(1, 11): + valtmp = "productextra%d" % i + if self.data[index] != chr(0xc1) and index < self.size - 1: + templen = FruUtil.decodeLength(self.data[index]) + if templen == 0: + break + tmpval = self.data[index + 1: index + templen + 1] + d_print("decode boardextra%d:%s" % (i, tmpval)) + setattr(self, valtmp, tmpval) + index += templen + 1 + else: + break + + @property + def productVersion(self): + return self._productVersion + + @productVersion.setter + def productVersion(self, name): + self._productVersion = name + + @property + def areaversion(self): + self._areaversion = self.COMMON_HEAD_VERSION + return self._areaversion + + @areaversion.setter + def areaversion(self, name): + self._areaversion = name + + @property + def language(self): + self._language = 25 + return self._language + + @property + def productManufacturer(self): + return self._productManufacturer + + @productManufacturer.setter + def productManufacturer(self, name): + self._productManufacturer = name + + @property + def productName(self): + return self._productName + + @productName.setter + def productName(self, name): + self._productName = name + + @property + def productPartModelName(self): + return self._productPartModelName + + @productPartModelName.setter + def productPartModelName(self, name): + self._productPartModelName = name + + @property + def productSerialNumber(self): + return self._productSerialNumber + + @productSerialNumber.setter + def productSerialNumber(self, name): + self._productSerialNumber = name + + @property + def productAssetTag(self): + return self._productAssetTag + + @productAssetTag.setter + def productAssetTag(self, name): + self._productAssetTag = name + + @property + def fruFileId(self): + return self._FRUFileID + + @fruFileId.setter + def fruFileId(self, name): + self._FRUFileID = name + + def recalcute(self): + d_print("product version:%x" % ord(self.areaversion)) + d_print("product length:%d" % self.size) + d_print("product language:%x" % self.language) + self.data = chr(ord(self.areaversion)) + \ + chr(self.size / 8) + chr(self.language) + + typelength = FruUtil.getTypeLength(self.productManufacturer) + self.data += chr(typelength) + self.data += self.productManufacturer + + self.data += chr(FruUtil.getTypeLength(self.productName)) + self.data += self.productName + + self.data += chr(FruUtil.getTypeLength(self.productPartModelName)) + self.data += self.productPartModelName + + self.data += chr(FruUtil.getTypeLength(self.productVersion)) + self.data += self.productVersion + + self.data += chr(FruUtil.getTypeLength(self.productSerialNumber)) + self.data += self.productSerialNumber + + self.data += chr(FruUtil.getTypeLength(self.productAssetTag)) + if self.productAssetTag is not None: + self.data += self.productAssetTag + + self.data += chr(FruUtil.getTypeLength(self.fruFileId)) + self.data += self.fruFileId + + # 判断拓展字段是否存在, 拓展字段必须按顺序来 + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + d_print("boardInfoArea productextra%d:%s" % (i, valtmpval)) + self.data += chr(FruUtil.getTypeLength(valtmpval)) + if valtmpval is None: + pass + else: + self.data += valtmpval + else: + break + + self.data += chr(0xc1) + if len(self.data) > (self.size - 1): + incr = (len(self.data) - self.size) / 8 + 1 + self.size += incr * 8 + d_print("self.data:%d" % len(self.data)) + d_print("self.size:%d" % self.size) + + self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] + self.data = self.data.ljust((self.size - 1), self.INITVALUE) + checksum = FruUtil.checksum(self.data) + d_print("board info checksum:%x" % checksum) + self.data += chr(checksum) + + +class MultiRecordArea(BaseArea): + pass + + +class Field(object): + + def __init__(self, fieldType="ASCII", fieldData=""): + self.fieldData = fieldData + self.fieldType = fieldType + + @property + def data(self): + return self._data + + @property + def fieldType(self): + return self._fieldType + + @property + def fieldData(self): + return self._fieldData + + +class ipmifru(BaseArea): + _BoardInfoArea = None + _ProductInfoArea = None + _InternalUseArea = None + _ChassisInfoArea = None + _multiRecordArea = None + _productinfoAreaOffset = BaseArea.INITVALUE + _boardInfoAreaOffset = BaseArea.INITVALUE + _internalUserAreaOffset = BaseArea.INITVALUE + _chassicInfoAreaOffset = BaseArea.INITVALUE + _multiRecordAreaOffset = BaseArea.INITVALUE + _bindata = None + _bodybin = None + _version = BaseArea.COMMON_HEAD_VERSION + _zeroCheckSum = None + + def __str__(self): + tmpstr = "" + if self.boardInfoArea.isPresent: + tmpstr += "\nboardinfoarea: \n" + tmpstr += self.boardInfoArea.__str__() + if self.productInfoArea.isPresent: + tmpstr += "\nproductinfoarea: \n" + tmpstr += self.productInfoArea.__str__() + return tmpstr + + def decodeBin(self, eeprom): + commonHead = eeprom[0:8] + d_print("decode version %x" % ord(commonHead[0])) + if self.COMMON_HEAD_VERSION != commonHead[0]: + raise FruException("HEAD VERSION error,not Fru format!", -10) + if FruUtil.checksum(commonHead[0:7]) != ord(commonHead[7]): + strtemp = "check header checksum error [cal:%02x data:%02x]" % ( + FruUtil.checksum(commonHead[0:7]), ord(commonHead[7])) + raise FruException(strtemp, -3) + if commonHead[1] != self.INITVALUE: + d_print("Internal Use Area is present") + self.internalUseArea = InternalUseArea( + name="Internal Use Area", size=self.SUGGESTED_SIZE_INTERNAL_USE_AREA) + self.internalUseArea.isPresent = True + self.internalUserAreaOffset = ord(commonHead[1]) + self.internalUseArea.data = eeprom[self.internalUserAreaOffset * 8: ( + self.internalUserAreaOffset * 8 + self.internalUseArea.size)] + if commonHead[2] != self.INITVALUE: + d_print("Chassis Info Area is present") + self.chassisInfoArea = ChassisInfoArea( + name="Chassis Info Area", size=self.SUGGESTED_SIZE_CHASSIS_INFO_AREA) + self.chassisInfoArea.isPresent = True + self.chassicInfoAreaOffset = ord(commonHead[2]) + self.chassisInfoArea.data = eeprom[self.chassicInfoAreaOffset * 8: ( + self.chassicInfoAreaOffset * 8 + self.chassisInfoArea.size)] + if commonHead[3] != self.INITVALUE: + self.boardInfoArea = BoardInfoArea( + name="Board Info Area", size=self.SUGGESTED_SIZE_BOARD_INFO_AREA) + self.boardInfoArea.isPresent = True + self.boardInfoAreaOffset = ord(commonHead[3]) + self.boardInfoArea.size = ord( + eeprom[self.boardInfoAreaOffset * 8 + 1]) * 8 + d_print("Board Info Area is present size:%d" % + (self.boardInfoArea.size)) + self.boardInfoArea.data = eeprom[self.boardInfoAreaOffset * 8: ( + self.boardInfoAreaOffset * 8 + self.boardInfoArea.size)] + if FruUtil.checksum(self.boardInfoArea.data[:-1]) != ord(self.boardInfoArea.data[-1:]): + print("check boardInfoArea checksum error[cal:%02x data:%02x]" % \ + (FruUtil.checksum( + self.boardInfoArea.data[:-1]), ord(self.boardInfoArea.data[-1:]))) + sys.exit(-1) + self.boardInfoArea.decodedata() + if commonHead[4] != self.INITVALUE: + d_print("Product Info Area is present") + self.productInfoArea = ProductInfoArea( + name="Product Info Area ", size=self.SUGGESTED_SIZE_PRODUCT_INFO_AREA) + self.productInfoArea.isPresent = True + self.productinfoAreaOffset = ord(commonHead[4]) + d_print("length offset value: %02x" % + ord(eeprom[self.productinfoAreaOffset * 8 + 1])) + self.productInfoArea.size = ord( + eeprom[self.productinfoAreaOffset * 8 + 1]) * 8 + d_print("Product Info Area is present size:%d" % + (self.productInfoArea.size)) + + self.productInfoArea.data = eeprom[self.productinfoAreaOffset * 8: ( + self.productinfoAreaOffset * 8 + self.productInfoArea.size)] + if FruUtil.checksum(self.productInfoArea.data[:-1]) != ord(self.productInfoArea.data[-1:]): + strtmp = "check productInfoArea checksum error [cal:%02x data:%02x]" % ( + FruUtil.checksum(self.productInfoArea.data[:-1]), ord(self.productInfoArea.data[-1:])) + raise FruException(strtmp, -3) + self.productInfoArea.decodedata() + if commonHead[5] != self.INITVALUE: + self.multiRecordArea = MultiRecordArea( + name="MultiRecord record Area ") + d_print("MultiRecord record present") + self.multiRecordArea.isPresent = True + self.multiRecordAreaOffset = ord(commonHead[5]) + self.multiRecordArea.data = eeprom[self.multiRecordAreaOffset * 8: ( + self.multiRecordAreaOffset * 8 + self.multiRecordArea.size)] + + def initDefault(self): + self.version = self.COMMON_HEAD_VERSION + self.internalUserAreaOffset = self.INITVALUE + self.chassicInfoAreaOffset = self.INITVALUE + self.boardInfoAreaOffset = self.INITVALUE + self.productinfoAreaOffset = self.INITVALUE + self.multiRecordAreaOffset = self.INITVALUE + self.PAD = self.INITVALUE + self.zeroCheckSum = self.INITVALUE + self.offset = self.SUGGESTED_SIZE_COMMON_HEADER + self.productInfoArea = None + self.internalUseArea = None + self.boardInfoArea = None + self.chassisInfoArea = None + self.multiRecordArea = None + # self.recalcute() + + @property + def version(self): + return self._version + + @version.setter + def version(self, name): + self._version = name + + @property + def internalUserAreaOffset(self): + return self._internalUserAreaOffset + + @internalUserAreaOffset.setter + def internalUserAreaOffset(self, obj): + self._internalUserAreaOffset = obj + + @property + def chassicInfoAreaOffset(self): + return self._chassicInfoAreaOffset + + @chassicInfoAreaOffset.setter + def chassicInfoAreaOffset(self, obj): + self._chassicInfoAreaOffset = obj + + @property + def productinfoAreaOffset(self): + return self._productinfoAreaOffset + + @productinfoAreaOffset.setter + def productinfoAreaOffset(self, obj): + self._productinfoAreaOffset = obj + + @property + def boardInfoAreaOffset(self): + return self._boardInfoAreaOffset + + @boardInfoAreaOffset.setter + def boardInfoAreaOffset(self, obj): + self._boardInfoAreaOffset = obj + + @property + def multiRecordAreaOffset(self): + return self._multiRecordAreaOffset + + @multiRecordAreaOffset.setter + def multiRecordAreaOffset(self, obj): + self._multiRecordAreaOffset = obj + + @property + def zeroCheckSum(self): + return self._zeroCheckSum + + @zeroCheckSum.setter + def zeroCheckSum(self, obj): + self._zeroCheckSum = obj + + @property + def productInfoArea(self): + return self._ProductInfoArea + + @productInfoArea.setter + def productInfoArea(self, obj): + self._ProductInfoArea = obj + + @property + def internalUseArea(self): + return self._InternalUseArea + + @internalUseArea.setter + def internalUseArea(self, obj): + self.internalUseArea = obj + + @property + def boardInfoArea(self): + return self._BoardInfoArea + + @boardInfoArea.setter + def boardInfoArea(self, obj): + self._BoardInfoArea = obj + + @property + def chassisInfoArea(self): + return self._ChassisInfoArea + + @chassisInfoArea.setter + def chassisInfoArea(self, obj): + self._ChassisInfoArea = obj + + @property + def multiRecordArea(self): + return self._multiRecordArea + + @multiRecordArea.setter + def multiRecordArea(self, obj): + self._multiRecordArea = obj + + @property + def bindata(self): + return self._bindata + + @bindata.setter + def bindata(self, obj): + self._bindata = obj + + @property + def bodybin(self): + return self._bodybin + + @bodybin.setter + def bodybin(self, obj): + self._bodybin = obj + + def recalcuteCommonHead(self): + self.bindata = "" + self.offset = self.SUGGESTED_SIZE_COMMON_HEADER + d_print("common Header %d" % self.offset) + if self.internalUseArea is not None and self.internalUseArea.isPresent: + self.internalUserAreaOffset = self.offset / 8 + self.offset += self.internalUseArea.size + d_print("internalUseArea is present offset:%d" % self.offset) + + if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: + self.chassicInfoAreaOffset = self.offset / 8 + self.offset += self.chassisInfoArea.size + d_print("chassisInfoArea is present offset:%d" % self.offset) + + if self.boardInfoArea is not None and self.boardInfoArea.isPresent: + self.boardInfoAreaOffset = self.offset / 8 + self.offset += self.boardInfoArea.size + d_print("boardInfoArea is present offset:%d" % self.offset) + d_print("boardInfoArea is present size:%d" % + self.boardInfoArea.size) + + if self.productInfoArea is not None and self.productInfoArea.isPresent: + self.productinfoAreaOffset = self.offset / 8 + self.offset += self.productInfoArea.size + d_print("productInfoArea is present offset:%d" % self.offset) + + if self.multiRecordArea is not None and self.multiRecordArea.isPresent: + self.multiRecordAreaOffset = self.offset / 8 + d_print("multiRecordArea is present offset:%d" % self.offset) + + if self.internalUserAreaOffset == self.INITVALUE: + self.internalUserAreaOffset = 0 + if self.productinfoAreaOffset == self.INITVALUE: + self.productinfoAreaOffset = 0 + if self.chassicInfoAreaOffset == self.INITVALUE: + self.chassicInfoAreaOffset = 0 + if self.boardInfoAreaOffset == self.INITVALUE: + self.boardInfoAreaOffset = 0 + if self.multiRecordAreaOffset == self.INITVALUE: + self.multiRecordAreaOffset = 0 + + self.zeroCheckSum = (0x100 - ord(self.version) - self.internalUserAreaOffset - self.chassicInfoAreaOffset - self.productinfoAreaOffset + - self.boardInfoAreaOffset - self.multiRecordAreaOffset) & 0xff + d_print("zerochecksum:%x" % self.zeroCheckSum) + self.data = self.version + chr(self.internalUserAreaOffset) + chr(self.chassicInfoAreaOffset) + chr( + self.boardInfoAreaOffset) + chr(self.productinfoAreaOffset) + chr(self.multiRecordAreaOffset) + self.INITVALUE + chr(self.zeroCheckSum) + + self.bindata = self.data + self.bodybin + totallen = len(self.bindata) + d_print("totallen %d" % totallen) + if (totallen < 256): + self.bindata = self.bindata.ljust(256, self.INITVALUE) + else: + raise FruException('bin data more than 256', -2) + + def recalcutebin(self): + self.bodybin = "" + if self.internalUseArea is not None and self.internalUseArea.isPresent: + d_print("internalUseArea present") + self.bodybin += self.internalUseArea.data + if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: + d_print("chassisInfoArea present") + self.bodybin += self.chassisInfoArea.data + if self.boardInfoArea is not None and self.boardInfoArea.isPresent: + d_print("boardInfoArea present") + self.boardInfoArea.recalcute() + self.bodybin += self.boardInfoArea.data + if self.productInfoArea is not None and self.productInfoArea.isPresent: + d_print("productInfoAreapresent") + self.productInfoArea.recalcute() + self.bodybin += self.productInfoArea.data + if self.multiRecordArea is not None and self.multiRecordArea.isPresent: + d_print("multiRecordArea present") + self.bodybin += self.productInfoArea.data + + def recalcute(self): + self.recalcutebin() + self.recalcuteCommonHead() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/__init__.py new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/__init__.py @@ -0,0 +1 @@ + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/osutil.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/osutil.py new file mode 100644 index 000000000000..46f3089bbdbf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/plat_hal/osutil.py @@ -0,0 +1,222 @@ +####################################################### +# +# osutil.py +# Python implementation of the Class osutil +# Original author: sonic_rd@ruijie.com.cn +# +####################################################### + +import subprocess +import time +import glob +import re +#import chardet +from rjutil.smbus import SMBus +import time +from functools import wraps + + +def retry(maxretry =6, delay = 0.01): + ''' + maxretry: max retry times + delay : interval after last retry + ''' + def decorator(f): + @wraps(f) + def wrapper(*args, **kwargs): + time_retry = maxretry + time_delay = delay + result_msg = "" + while time_retry: + try: + val , result_msg = f(*args, **kwargs) + if val is False: + time_retry -=1 + time.sleep(time_delay) + continue + else: + return val, result_msg + except Exception as e: + time_retry -= 1 + result_msg = str(e) + time.sleep(time_delay) + return False, "max time retry last errmsg is {}".format(result_msg) + return wrapper + return decorator + +class osutil(object): + """ + osutil + """ + + @staticmethod + @retry(maxretry = 6) + def rji2cget_python(bus, addr, reg): + with SMBus(bus) as y: + val , ind = y.read_byte_data(addr, reg, True) + return val , ind + + + @staticmethod + @retry(maxretry = 6) + def rji2cset_python(bus, addr, reg, value): + with SMBus(bus) as y: + val , ind = y.write_byte_data(addr, reg, value, True) + return val , ind + + @staticmethod + @retry(maxretry = 6) + def rji2cgetword_python(bus, addr, reg): + with SMBus(bus) as y: + val , ind = y.read_word_data(addr, reg, True) + return val , ind + + @staticmethod + @retry(maxretry = 6) + def rji2csetword_python(bus, addr, reg, value): + with SMBus(bus) as y: + val , ind = y.write_word_data(addr, reg, value, True) + return val , ind + + @staticmethod + def command(cmdstr): + retcode, output = subprocess.getstatusoutput(cmdstr) + return retcode, output + + + @staticmethod + def geti2cword_i2ctool(bus, addr, offset): + command_line = "i2cget -f -y %d 0x%02x 0x%02x wp" % (bus, addr, offset) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = osutil.command(command_line) + if ret == 0: + return True, int(ret_t, 16) + time.sleep(0.1) + return False, ret_t + + + @staticmethod + def seti2cword_i2ctool(bus, addr, offset, val): + command_line = "i2cset -f -y %d 0x%02x 0x%0x 0x%04x wp" % (bus, addr, offset, val) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = osutil.command(command_line) + if ret == 0: + return True, ret_t + time.sleep(0.1) + return False, ret_t + + @staticmethod + def rji2cget_i2ctool(bus, devno, address): + command_line = "i2cget -f -y %d 0x%02x 0x%02x " % (bus, devno, address) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = osutil.command(command_line) + if ret == 0: + return True, int(ret_t, 16) + time.sleep(0.1) + return False, ret_t + + @staticmethod + def rji2cset_i2ctool(bus, devno, address, byte): + command_line = "i2cset -f -y %d 0x%02x 0x%02x 0x%02x" % ( + bus, devno, address, byte) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = osutil.command(command_line) + if ret == 0: + return True, ret_t + return False, ret_t + + @staticmethod + def geti2cword(bus, addr, offset): + return osutil.rji2cgetword_python(bus, addr, offset) + @staticmethod + def seti2cword(bus, addr, offset, val): + return osutil.rji2csetword_python(bus, addr, offset, val) + @staticmethod + def rji2cget(bus, devno, address): + return osutil.rji2cget_python(bus, devno, address) + @staticmethod + def rji2cset(bus, devno, address, byte): + return osutil.rji2cset_python(bus, devno, address, byte) + + @staticmethod + def byteTostr(val): + strtmp = '' + for i in range(len(val)): + strtmp += chr(val[i]) + return strtmp + + @staticmethod + def readsysfs(location): + try: + locations = glob.glob(location) + with open(locations[0], 'rb') as fd1: + retval = fd1.read() + retval = retval.strip() + except Exception as e: + return False, (str(e)+" location[%s]" % location) + return True, retval.decode("utf-8", "ignore") + + @staticmethod + def getdevmem(addr, digit, mask): + command_line = "devmem 0x%02x %d" %(addr, digit) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = osutil.command(command_line) + if ret == 0: + if mask != None: + ret_t = str(int(ret_t, 16) & mask) + return True, ret_t + return False, ret_t + + @staticmethod + def rj_os_system(cmd): + status, output = subprocess.getstatusoutput(cmd) + return status, output + + @staticmethod + def getsdkreg(reg): + try: + cmd = "bcmcmd -t 1 'getr %s ' < /dev/null" % reg + ret, result = osutil.rj_os_system(cmd) + result_t = result.strip().replace("\r", "").replace("\n", "") + if ret != 0 or "Error:" in result_t: + return False, result + patt = r"%s.(.*):(.*)>drivshell" % reg + rt = re.findall(patt, result_t, re.S) + test = re.findall("=(.*)", rt[0][0])[0] + except Exception as e: + return False, 'get sdk register error' + return True, test + + @staticmethod + def getmactemp(): + try: + result = {} + #waitForDocker() + #need to exec twice + osutil.rj_os_system("bcmcmd -t 1 \"show temp\" < /dev/null") + ret, log = osutil.rj_os_system("bcmcmd -t 1 \"show temp\" < /dev/null") + if ret: + return False, result + else: + logs = log.splitlines() + for line in logs: + if "average" in line: + b = re.findall(r'\d+.\d+', line) + result["average"] = b[0] + elif "maximum" in line: + b = re.findall(r'\d+.\d+', line) + result["maximum"] = b[0] + except Exception as e: + return False, str(e) + return True, result + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/baseutil.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/baseutil.py new file mode 100644 index 000000000000..1cf74d32d22f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/baseutil.py @@ -0,0 +1,23 @@ +# -*- coding: UTF-8 -*- +import os + +def get_machine_info(): + if not os.path.isfile('/host/machine.conf'): + return None + machine_vars = {} + with open('/host/machine.conf') as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars + +def get_platform_info(machine_info): + if machine_info != None: + if 'onie_platform' in machine_info: + return machine_info['onie_platform'] + elif 'aboot_platform' in machine_info: + return machine_info['aboot_platform'] + return None + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/smbus.py b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/smbus.py new file mode 100644 index 000000000000..f3651fe59a4a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/lib/rjutil/smbus.py @@ -0,0 +1,705 @@ +"""smbus2 - A drop-in replacement for smbus-cffi/smbus-python""" +# The MIT License (MIT) +# Copyright (c) 2017 Karl-Petter Lindegaard +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os +import sys +from fcntl import ioctl +from ctypes import c_uint32, c_uint8, c_uint16, c_char, POINTER, Structure, Array, Union, create_string_buffer, string_at + + +# Commands from uapi/linux/i2c-dev.h +I2C_SLAVE = 0x0703 # Use this slave address +I2C_SLAVE_FORCE = 0x0706 # Use this slave address, even if it is already in use by a driver! +I2C_FUNCS = 0x0705 # Get the adapter functionality mask +I2C_RDWR = 0x0707 # Combined R/W transfer (one STOP only) +I2C_SMBUS = 0x0720 # SMBus transfer. Takes pointer to i2c_smbus_ioctl_data + +# SMBus transfer read or write markers from uapi/linux/i2c.h +I2C_SMBUS_WRITE = 0 +I2C_SMBUS_READ = 1 + +# Size identifiers uapi/linux/i2c.h +I2C_SMBUS_QUICK = 0 +I2C_SMBUS_BYTE = 1 +I2C_SMBUS_BYTE_DATA = 2 +I2C_SMBUS_WORD_DATA = 3 +I2C_SMBUS_PROC_CALL = 4 +I2C_SMBUS_BLOCK_DATA = 5 # This isn't supported by Pure-I2C drivers with SMBUS emulation, like those in RaspberryPi, OrangePi, etc :( +I2C_SMBUS_BLOCK_PROC_CALL = 7 # Like I2C_SMBUS_BLOCK_DATA, it isn't supported by Pure-I2C drivers either. +I2C_SMBUS_I2C_BLOCK_DATA = 8 +I2C_SMBUS_BLOCK_MAX = 32 + +# To determine what functionality is present (uapi/linux/i2c.h) +try: + from enum import IntFlag +except ImportError: + IntFlag = int + + +class I2cFunc(IntFlag): + """ + These flags identify the operations supported by an I2C/SMBus device. + + You can test these flags on your `smbus.funcs` + + On newer python versions, I2cFunc is an IntFlag enum, but it + falls back to class with a bunch of int constants on older releases. + """ + I2C = 0x00000001 + ADDR_10BIT = 0x00000002 + PROTOCOL_MANGLING = 0x00000004 # I2C_M_IGNORE_NAK etc. + SMBUS_PEC = 0x00000008 + NOSTART = 0x00000010 # I2C_M_NOSTART + SLAVE = 0x00000020 + SMBUS_BLOCK_PROC_CALL = 0x00008000 # SMBus 2.0 + SMBUS_QUICK = 0x00010000 + SMBUS_READ_BYTE = 0x00020000 + SMBUS_WRITE_BYTE = 0x00040000 + SMBUS_READ_BYTE_DATA = 0x00080000 + SMBUS_WRITE_BYTE_DATA = 0x00100000 + SMBUS_READ_WORD_DATA = 0x00200000 + SMBUS_WRITE_WORD_DATA = 0x00400000 + SMBUS_PROC_CALL = 0x00800000 + SMBUS_READ_BLOCK_DATA = 0x01000000 + SMBUS_WRITE_BLOCK_DATA = 0x02000000 + SMBUS_READ_I2C_BLOCK = 0x04000000 # I2C-like block xfer + SMBUS_WRITE_I2C_BLOCK = 0x08000000 # w/ 1-byte reg. addr. + SMBUS_HOST_NOTIFY = 0x10000000 + + SMBUS_BYTE = 0x00060000 + SMBUS_BYTE_DATA = 0x00180000 + SMBUS_WORD_DATA = 0x00600000 + SMBUS_BLOCK_DATA = 0x03000000 + SMBUS_I2C_BLOCK = 0x0c000000 + SMBUS_EMUL = 0x0eff0008 + + +# i2c_msg flags from uapi/linux/i2c.h +I2C_M_RD = 0x0001 + +# Pointer definitions +LP_c_uint8 = POINTER(c_uint8) +LP_c_uint16 = POINTER(c_uint16) +LP_c_uint32 = POINTER(c_uint32) + + +############################################################# +# Type definitions as in i2c.h + + +class i2c_smbus_data(Array): + """ + Adaptation of the i2c_smbus_data union in ``i2c.h``. + + Data for SMBus messages. + """ + _length_ = I2C_SMBUS_BLOCK_MAX + 2 + _type_ = c_uint8 + + +class union_i2c_smbus_data(Union): + _fields_ = [ + ("byte", c_uint8), + ("word", c_uint16), + ("block", i2c_smbus_data) + ] + + +union_pointer_type = POINTER(union_i2c_smbus_data) + + +class i2c_smbus_ioctl_data(Structure): + """ + As defined in ``i2c-dev.h``. + """ + _fields_ = [ + ('read_write', c_uint8), + ('command', c_uint8), + ('size', c_uint32), + ('data', union_pointer_type)] + __slots__ = [name for name, type in _fields_] + + @staticmethod + def create(read_write=I2C_SMBUS_READ, command=0, size=I2C_SMBUS_BYTE_DATA): + u = union_i2c_smbus_data() + return i2c_smbus_ioctl_data( + read_write=read_write, command=command, size=size, + data=union_pointer_type(u)) + + +############################################################# +# Type definitions for i2c_rdwr combined transactions + + +class i2c_msg(Structure): + """ + As defined in ``i2c.h``. + """ + _fields_ = [ + ('addr', c_uint16), + ('flags', c_uint16), + ('len', c_uint16), + ('buf', POINTER(c_char))] + + def __iter__(self): + """ Iterator / Generator + + :return: iterates over :py:attr:`buf` + :rtype: :py:class:`generator` which returns int values + """ + idx = 0 + while idx < self.len: + yield ord(self.buf[idx]) + idx += 1 + + def __len__(self): + return self.len + + def __bytes__(self): + return string_at(self.buf, self.len) + + def __repr__(self): + return 'i2c_msg(%d,%d,%r)' % (self.addr, self.flags, self.__bytes__()) + + def __str__(self): + s = self.__bytes__() + if sys.version_info.major >= 3: + s = ''.join(map(chr, s)) + return s + + @staticmethod + def read(address, length): + """ + Prepares an i2c read transaction. + + :param address: Slave address. + :type: address: int + :param length: Number of bytes to read. + :type: length: int + :return: New :py:class:`i2c_msg` instance for read operation. + :rtype: :py:class:`i2c_msg` + """ + arr = create_string_buffer(length) + return i2c_msg( + addr=address, flags=I2C_M_RD, len=length, + buf=arr) + + @staticmethod + def write(address, buf): + """ + Prepares an i2c write transaction. + + :param address: Slave address. + :type address: int + :param buf: Bytes to write. Either list of values or str. + :type buf: list + :return: New :py:class:`i2c_msg` instance for write operation. + :rtype: :py:class:`i2c_msg` + """ + if sys.version_info.major >= 3: + if type(buf) is str: + buf = bytes(map(ord, buf)) + else: + buf = bytes(buf) + else: + if type(buf) is not str: + buf = ''.join([chr(x) for x in buf]) + arr = create_string_buffer(buf, len(buf)) + return i2c_msg( + addr=address, flags=0, len=len(arr), + buf=arr) + + +class i2c_rdwr_ioctl_data(Structure): + """ + As defined in ``i2c-dev.h``. + """ + _fields_ = [ + ('msgs', POINTER(i2c_msg)), + ('nmsgs', c_uint32) + ] + __slots__ = [name for name, type in _fields_] + + @staticmethod + def create(*i2c_msg_instances): + """ + Factory method for creating a i2c_rdwr_ioctl_data struct that can + be called with ``ioctl(fd, I2C_RDWR, data)``. + + :param i2c_msg_instances: Up to 42 i2c_msg instances + :rtype: i2c_rdwr_ioctl_data + """ + n_msg = len(i2c_msg_instances) + msg_array = (i2c_msg * n_msg)(*i2c_msg_instances) + return i2c_rdwr_ioctl_data( + msgs=msg_array, + nmsgs=n_msg + ) + + +############################################################# + + +class SMBus(object): + + def __init__(self, bus=None, force=False): + """ + Initialize and (optionally) open an i2c bus connection. + + :param bus: i2c bus number (e.g. 0 or 1) + or an absolute file path (e.g. `/dev/i2c-42`). + If not given, a subsequent call to ``open()`` is required. + :type bus: int or str + :param force: force using the slave address even when driver is + already using it. + :type force: boolean + """ + self.fd = None + self.funcs = I2cFunc(0) + if bus is not None: + self.open(bus) + self.address = None + self.force = force + self._force_last = None + + def __enter__(self): + """Enter handler.""" + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + """Exit handler.""" + self.close() + + def open(self, bus): + """ + Open a given i2c bus. + + :param bus: i2c bus number (e.g. 0 or 1) + or an absolute file path (e.g. '/dev/i2c-42'). + :type bus: int or str + :raise TypeError: if type(bus) is not in (int, str) + """ + if isinstance(bus, int): + filepath = "/dev/i2c-{}".format(bus) + elif isinstance(bus, str): + filepath = bus + else: + raise TypeError("Unexpected type(bus)={}".format(type(bus))) + + self.fd = os.open(filepath, os.O_RDWR) + self.funcs = self._get_funcs() + + def close(self): + """ + Close the i2c connection. + """ + if self.fd: + os.close(self.fd) + self.fd = None + + def _set_address(self, address, force=None): + """ + Set i2c slave address to use for subsequent calls. + + :param address: + :type address: int + :param force: + :type force: Boolean + """ + force = force if force is not None else self.force + if self.address != address or self._force_last != force: + if force is True: + ioctl(self.fd, I2C_SLAVE_FORCE, address) + else: + ioctl(self.fd, I2C_SLAVE, address) + self.address = address + self._force_last = force + + def _get_funcs(self): + """ + Returns a 32-bit value stating supported I2C functions. + + :rtype: int + """ + f = c_uint32() + ioctl(self.fd, I2C_FUNCS, f) + return f.value + + def write_quick(self, i2c_addr, force=None): + """ + Perform quick transaction. Throws IOError if unsuccessful. + :param i2c_addr: i2c address + :type i2c_addr: int + :param force: + :type force: Boolean + """ + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=0, size=I2C_SMBUS_QUICK) + ioctl(self.fd, I2C_SMBUS, msg) + + def read_byte(self, i2c_addr, force=None): + """ + Read a single byte from a device. + + :rtype: int + :param i2c_addr: i2c address + :type i2c_addr: int + :param force: + :type force: Boolean + :return: Read byte value + """ + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_READ, command=0, size=I2C_SMBUS_BYTE + ) + ioctl(self.fd, I2C_SMBUS, msg) + return msg.data.contents.byte + + def write_byte(self, i2c_addr, value, force=None): + """ + Write a single byte to a device. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param value: value to write + :type value: int + :param force: + :type force: Boolean + """ + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=value, size=I2C_SMBUS_BYTE + ) + ioctl(self.fd, I2C_SMBUS, msg) + + def read_byte_data(self, i2c_addr, register, force=None): + """ + Read a single byte from a designated register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to read + :type register: int + :param force: + :type force: Boolean + :return: Read byte value + :rtype: int + """ + val_t = -1 + returnmsg="" + try: + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_BYTE_DATA + ) + val_t = ioctl(self.fd, I2C_SMBUS, msg) + except Exception as e: + self.close() + returnmsg = str(e) + if val_t < 0: + return False, returnmsg + else: + return True, msg.data.contents.byte + + def write_byte_data(self, i2c_addr, register, value, force=None): + """ + Write a byte to a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to write to + :type register: int + :param value: Byte value to transmit + :type value: int + :param force: + :type force: Boolean + :rtype: None + """ + val_t = -1 + returnmsg = "" + try: + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BYTE_DATA + ) + msg.data.contents.byte = value + val_t = ioctl(self.fd, I2C_SMBUS, msg) + except Exception as e: + returnmsg = str(e) + self.close() + if val_t < 0: + return False, returnmsg or "" + else: + return True, "" + + def read_word_data(self, i2c_addr, register, force=None): + """ + Read a single word (2 bytes) from a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to read + :type register: int + :param force: + :type force: Boolean + :return: 2-byte word + :rtype: int + """ + val_t = -1 + returnmsg = "" + try: + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_WORD_DATA + ) + val_t = ioctl(self.fd, I2C_SMBUS, msg) + except Exception as e: + returnmsg = str(e) + self.close() + if val_t < 0: + return False, returnmsg or "" + else: + return True, msg.data.contents.word + + def write_word_data(self, i2c_addr, register, value, force=None): + """ + Write a byte to a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to write to + :type register: int + :param value: Word value to transmit + :type value: int + :param force: + :type force: Boolean + :rtype: None + """ + val_t = -1 + returnmsg = "" + try: + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_WORD_DATA + ) + msg.data.contents.word = value + val_t = ioctl(self.fd, I2C_SMBUS, msg) + except Exception as e: + returnmsg = str(e) + self.close() + if val_t < 0: + return False, returnmsg or "" + else: + return True, "" + + def process_call(self, i2c_addr, register, value, force=None): + """ + Executes a SMBus Process Call, sending a 16-bit value and receiving a 16-bit response + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to read/write to + :type register: int + :param value: Word value to transmit + :type value: int + :param force: + :type force: Boolean + :rtype: int + """ + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_PROC_CALL + ) + msg.data.contents.word = value + ioctl(self.fd, I2C_SMBUS, msg) + return msg.data.contents.word + + def read_block_data(self, i2c_addr, register, force=None): + """ + Read a block of up to 32-bytes from a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Start register + :type register: int + :param force: + :type force: Boolean + :return: List of bytes + :rtype: list + """ + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_BLOCK_DATA + ) + ioctl(self.fd, I2C_SMBUS, msg) + length = msg.data.contents.block[0] + return msg.data.contents.block[1:length + 1] + + def write_block_data(self, i2c_addr, register, data, force=None): + """ + Write a block of byte data to a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Start register + :type register: int + :param data: List of bytes + :type data: list + :param force: + :type force: Boolean + :rtype: None + """ + length = len(data) + if length > I2C_SMBUS_BLOCK_MAX: + raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BLOCK_DATA + ) + msg.data.contents.block[0] = length + msg.data.contents.block[1:length + 1] = data + ioctl(self.fd, I2C_SMBUS, msg) + + def block_process_call(self, i2c_addr, register, data, force=None): + """ + Executes a SMBus Block Process Call, sending a variable-size data + block and receiving another variable-size response + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Register to read/write to + :type register: int + :param data: List of bytes + :type data: list + :param force: + :type force: Boolean + :return: List of bytes + :rtype: list + """ + length = len(data) + if length > I2C_SMBUS_BLOCK_MAX: + raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BLOCK_PROC_CALL + ) + msg.data.contents.block[0] = length + msg.data.contents.block[1:length + 1] = data + ioctl(self.fd, I2C_SMBUS, msg) + length = msg.data.contents.block[0] + return msg.data.contents.block[1:length + 1] + + def read_i2c_block_data(self, i2c_addr, register, length, force=None): + """ + Read a block of byte data from a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Start register + :type register: int + :param length: Desired block length + :type length: int + :param force: + :type force: Boolean + :return: List of bytes + :rtype: list + """ + if length > I2C_SMBUS_BLOCK_MAX: + raise ValueError("Desired block length over %d bytes" % I2C_SMBUS_BLOCK_MAX) + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_I2C_BLOCK_DATA + ) + msg.data.contents.byte = length + ioctl(self.fd, I2C_SMBUS, msg) + return msg.data.contents.block[1:length + 1] + + def write_i2c_block_data(self, i2c_addr, register, data, force=None): + """ + Write a block of byte data to a given register. + + :param i2c_addr: i2c address + :type i2c_addr: int + :param register: Start register + :type register: int + :param data: List of bytes + :type data: list + :param force: + :type force: Boolean + :rtype: None + """ + length = len(data) + if length > I2C_SMBUS_BLOCK_MAX: + raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) + self._set_address(i2c_addr, force=force) + msg = i2c_smbus_ioctl_data.create( + read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_I2C_BLOCK_DATA + ) + msg.data.contents.block[0] = length + msg.data.contents.block[1:length + 1] = data + ioctl(self.fd, I2C_SMBUS, msg) + + def i2c_rdwr(self, *i2c_msgs): + """ + Combine a series of i2c read and write operations in a single + transaction (with repeated start bits but no stop bits in between). + + This method takes i2c_msg instances as input, which must be created + first with :py:meth:`i2c_msg.read` or :py:meth:`i2c_msg.write`. + + :param i2c_msgs: One or more i2c_msg class instances. + :type i2c_msgs: i2c_msg + :rtype: None + """ + ioctl_data = i2c_rdwr_ioctl_data.create(*i2c_msgs) + ioctl(self.fd, I2C_RDWR, ioctl_data) + + +class SMBusWrapper: + """ + Wrapper class around the SMBus. + Deprecated as of version 0.3.0. Please replace with :py:class:`SMBus`. + + Enables the user to wrap access to the :py:class:`SMBus` class in a + "with" statement. If auto_cleanup is True (default), the + :py:class:`SMBus` handle will be automatically closed + upon exit of the ``with`` block. + """ + def __init__(self, bus_number=0, auto_cleanup=True, force=False): + """ + :param auto_cleanup: Close bus when leaving scope. + :type auto_cleanup: Boolean + :param force: Force using the slave address even when driver is already using it. + :type force: Boolean + """ + self.bus_number = bus_number + self.auto_cleanup = auto_cleanup + self.force = force + + def __enter__(self): + self.bus = SMBus(bus=self.bus_number, force=self.force) + return self.bus + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.auto_cleanup: + self.bus.close() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/Makefile b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/Makefile new file mode 100755 index 000000000000..373027a26e00 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/Makefile @@ -0,0 +1,7 @@ +obj-m := rg-gpio-xeon.o +obj-m += rg_fan.o +obj-m += rg_psu.o +obj-m += ruijie_platform.o +obj-m += i2c-mux-pca9641.o +obj-m += i2c-mux-pca954x.o +obj-m += csu550.o diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/csu550.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/csu550.c new file mode 100755 index 000000000000..bb6a1588991e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/csu550.c @@ -0,0 +1,209 @@ +/* + * csu550.c - A driver for pmbus + * + * Copyright (c) 2010, 2011 Ericsson AB. + * Copyright (c) 2019 + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + + +/* + * Find sensor groups and status registers on each page. + */ +static void pmbus_find_sensor_groups(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int page; + + /* Sensors detected on page 0 only */ + if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN)) + info->func[0] |= PMBUS_HAVE_VIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN)) + info->func[0] |= PMBUS_HAVE_IIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN)) + info->func[0] |= PMBUS_HAVE_PIN; + if (info->func[0] && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) + info->func[0] |= PMBUS_HAVE_STATUS_INPUT; + if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && + pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { + info->func[0] |= PMBUS_HAVE_FAN12; + if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN12; + } + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) + info->func[0] |= PMBUS_HAVE_TEMP; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) + info->func[0] |= PMBUS_HAVE_TEMP2; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) + info->func[0] |= PMBUS_HAVE_TEMP3; + if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3) + && pmbus_check_byte_register(client, 0, PMBUS_STATUS_TEMPERATURE)) + info->func[0] |= PMBUS_HAVE_STATUS_TEMP; + + /* Sensors detected on all pages */ + for (page = 0; page < info->pages; page++) { + if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) { + info->func[page] |= PMBUS_HAVE_VOUT; + if (pmbus_check_byte_register(client, page, + PMBUS_STATUS_VOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_VOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) { + info->func[page] |= PMBUS_HAVE_IOUT; + if (pmbus_check_byte_register(client, 0, + PMBUS_STATUS_IOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_IOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_POUT)) + info->func[page] |= PMBUS_HAVE_POUT; + } +} + +/* + * Identify chip parameters. + */ +static int pmbus_identify(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int ret = 0; + + if (!info->pages) { + /* + * Check if the PAGE command is supported. If it is, + * keep setting the page number until it fails or until the + * maximum number of pages has been reached. Assume that + * this is the number of pages supported by the chip. + */ + if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { + int page; + + for (page = 1; page < PMBUS_PAGES; page++) { + if (pmbus_set_page(client, page) < 0) + break; + } + pmbus_set_page(client, 0); + info->pages = page; + } else { + info->pages = 1; + } + } + + if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { + int vout_mode; + + vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + switch (vout_mode >> 5) { + case 0: + break; + case 1: + info->format[PSC_VOLTAGE_OUT] = vid; + break; + case 2: + info->format[PSC_VOLTAGE_OUT] = direct; + break; + default: + ret = -ENODEV; + goto abort; + } + } + } + + /* + * We should check if the COEFFICIENTS register is supported. + * If it is, and the chip is configured for direct mode, we can read + * the coefficients from the chip, one set per group of sensor + * registers. + * + * To do this, we will need access to a chip which actually supports the + * COEFFICIENTS command, since the command is too complex to implement + * without testing it. Until then, abort if a chip configured for direct + * mode was detected. + */ + if (info->format[PSC_VOLTAGE_OUT] == direct) { + ret = -ENODEV; + goto abort; + } + + /* Try to find sensor groups */ + pmbus_find_sensor_groups(client, info); +abort: + return ret; +} + +static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct pmbus_driver_info *info; + struct pmbus_platform_data *pdata = NULL; + struct device *dev = &client->dev; + + info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + if (!strncmp(id->name, "dps460", sizeof("dps460")) || + !strncmp(id->name, "fsp1200", sizeof("fsp1200")) || !strncmp(id->name, "dps550", sizeof("dps550"))) { + pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL); + if (!pdata) { + kfree(info); + return -ENOMEM; + } + pdata->flags = PMBUS_SKIP_STATUS_CHECK; + } + + info->pages = id->driver_data; + info->identify = pmbus_identify; + dev->platform_data = pdata; + + return pmbus_do_probe(client, id, info); +} + +static const struct i2c_device_id pmbus_id[] = { + {"csu550", 0}, + {"csu800", 1}, + {"fsp1200", 1}, + {"dps550", 1}, + {} +}; +MODULE_DEVICE_TABLE(i2c, pmbus_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver pmbus_driver = { + .probe = pmbus_probe, + .remove = pmbus_do_remove, + .id_table = pmbus_id, + .driver = { + .name = "pmbus", + }, +}; + +module_i2c_driver(pmbus_driver); + +MODULE_AUTHOR("sonic_rd "); +MODULE_DESCRIPTION("ruijie psupmbus driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca954x.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca954x.c new file mode 100755 index 000000000000..cc2d12c8b263 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca954x.c @@ -0,0 +1,1763 @@ +/* + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * Copyright (c) 2019 + * + * I2C multiplexer + * + * This module supports the PCA954x series of I2C multiplexer/switch chips + * made by Philips Semiconductors. + * This includes the: + * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547 + * and PCA9548. + * + * These chips are all controlled via the I2C bus itself, and all have a + * single 8-bit register. The upstream "parent" bus fans out to two, + * four, or eight downstream busses or channels; which of these + * are selected is determined by the chip type and register contents. A + * mux can select only one sub-bus at a time; a switch can select any + * combination simultaneously. + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define PCA954X_MAX_NCHANS 8 + +#define PCA954X_IRQ_OFFSET 4 + +extern int pca9641_setmuxflag(int nr, int flag); + +int force_create_bus = 0; +module_param(force_create_bus, int, S_IRUGO | S_IWUSR); + +enum pca_type { + pca_9540, + pca_9542, + pca_9543, + pca_9544, + pca_9545, + pca_9546, + pca_9547, + pca_9548, +}; + +struct chip_desc { + u8 nchans; + u8 enable; /* used for muxes only */ + u8 has_irq; + enum muxtype { + pca954x_ismux = 0, + pca954x_isswi + } muxtype; +}; + + + + +struct pca954x { + const struct chip_desc *chip; + + u8 last_chan; /* last register value */ + u8 deselect; + struct i2c_client *client; + + struct irq_domain *irq; + unsigned int irq_mask; + raw_spinlock_t lock; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [pca_9540] = { + .nchans = 2, + .enable = 0x4, + .muxtype = pca954x_ismux, + }, + [pca_9542] = { + .nchans = 2, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + }, + [pca_9543] = { + .nchans = 2, + .has_irq = 1, + .muxtype = pca954x_isswi, + }, + [pca_9544] = { + .nchans = 4, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + }, + [pca_9545] = { + .nchans = 4, + .has_irq = 1, + .muxtype = pca954x_isswi, + }, + [pca_9546] = { + .nchans = 4, + .muxtype = pca954x_isswi, + }, + [pca_9547] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + }, + [pca_9548] = { + .nchans = 8, + .muxtype = pca954x_isswi, + }, +}; + +static const struct i2c_device_id pca954x_id[] = { + { "pca9540", pca_9540 }, + { "pca9542", pca_9542 }, + { "pca9543", pca_9543 }, + { "pca9544", pca_9544 }, + { "pca9545", pca_9545 }, + { "pca9546", pca_9546 }, + { "pca9547", pca_9547 }, + { "pca9548", pca_9548 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pca954x_id); + +#ifdef CONFIG_OF +static const struct of_device_id pca954x_of_match[] = { + { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,pca9548", .data = &chips[pca_9548] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca954x_of_match); +#endif + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int pca954x_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + int ret = -ENODEV; + + if (adap->algo->master_xfer) { + struct i2c_msg msg; + char buf[1]; + + msg.addr = client->addr; + msg.flags = 0; + msg.len = 1; + buf[0] = val; + msg.buf = buf; + ret = __i2c_transfer(adap, &msg, 1); + + if (ret >= 0 && ret != 1) + ret = -EREMOTEIO; + } else { + union i2c_smbus_data data; + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_WRITE, + val, I2C_SMBUS_BYTE, &data); + } + + return ret; +} + + static int pca954x_setmuxflag(struct i2c_client *client, int flag) + { + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + pca9641_setmuxflag(adap->nr, flag); + return 0; + } + +static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + const struct chip_desc *chip = data->chip; + u8 regval; + int ret = 0; + + /* we make switches look like muxes, not sure how to be smarter */ + if (chip->muxtype == pca954x_ismux) + regval = chan | chip->enable; + else + regval = 1 << chan; + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + pca954x_setmuxflag(client, 0); + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + return ret; +} + + +typedef void (*pca954x_hw_do_reset_func_t)(int busid, int addr); +pca954x_hw_do_reset_func_t g_notify_to_do_reset = NULL; + +void pca954x_hw_do_reset_func_register(void* func) +{ + if (func == NULL) { + return ; + } + g_notify_to_do_reset = func; + return; +} +EXPORT_SYMBOL(pca954x_hw_do_reset_func_register); + +static int pca954x_hw_do_reset(int busid, int addr) +{ + if (g_notify_to_do_reset != NULL) { + (*g_notify_to_do_reset)(busid, addr); + return 0; + } + + return 0; +} +/***************************************9548 reset*****************************************/ +#define DEV_TYPE 0x4040 /* BT2575 */ +#define PCA9548_MAX_CPLD_NUM (32) /* PCA9548 max number */ +#define PCA9548_MAX_CPLD_LAYER (8) /* PCA9548 max layer */ +#define DFD_PID_BUF_LEN (32) +#define DFD_PRODUCT_ID_LENGTH (8) +#define CPLD_PCA9548_RESET 0x023500b0 /* bus:2, addr:0x35, offset:0xb0 */ +#define B6510_32CQ_CPLD_PCA9548_RESET 0x060d0060 /* bus:6, addr:0x0d, offset:0x60 */ + +#define DFD_PUB_CARDTYPE_FILE "/sys/module/ruijie_common/parameters/dfd_my_type" +#define DFD_MAX_PRODUCT_NUM (32) + + +#define I2C_RETRY_TIMES 5 +#define I2C_RETRY_WAIT_TIMES 10 /*delay 10ms*/ + +#define PCA9548_I2C_GET_BUS(addr) (((addr) >> 24) & 0x00ff) +#define PCA9548_I2C_GET_CLIENT(addr) (((addr) >> 16) & 0x00ff) +#define PCA9548_I2C_GET_OFFSET(addr) (addr & 0xffff) + +typedef enum pca9548_reset_type { + PCA9548_RESET_FUNC = 0, + PCA9548_RESET_GPIO = 1, +} pca9548_reset_type_t; + +typedef void (*pca954x_hw_do_reset_func_t_new)(int io_port, u8 value); +typedef u8 (*pca954x_get_umask_func_t)(int io_port); + +void pca954x_hw_do_reset_by_i2c(int addr, u8 value); +u8 pca954x_get_umask_by_i2c(int addr); +void pca954x_hw_do_reset_by_lpc(int io_port, u8 value); +u8 pca954x_get_umask_by_lpc(int io_port); + + +typedef struct func_attr_s { + int cfg_offset[PCA9548_MAX_CPLD_LAYER]; + int umask[PCA9548_MAX_CPLD_LAYER]; + pca954x_hw_do_reset_func_t_new reset_func; /* 9548 reset function */ + pca954x_get_umask_func_t get_umask_func; /* get reset mask */ +} func_attr_t; + +typedef struct gpio_attr_s { + int gpio; + int gpio_init; + u8 reset_on; + u8 reset_off; +} gpio_attr_t; + +typedef struct pca9548_cfg_info_s { + int pca9548_reset_type; + int pca9548_bus; + int pca9548_addr; + int rst_delay_b; /* delay time before reset(us) */ + int rst_delay; /* reset time(us) */ + int rst_delay_a; /* delay time after reset(us) */ + union { + func_attr_t func_attr; + gpio_attr_t gpio_attr; + } attr; +} pca9548_cfg_info_t; + +typedef struct fpga_pcie_card_info_s { + int dev_type[DFD_MAX_PRODUCT_NUM]; /* dev type */ + pca9548_cfg_info_t pca9548_cfg_info[PCA9548_MAX_CPLD_NUM]; +} pca9548_card_info_t; + +static pca9548_card_info_t g_pca9548_card_info[] = { + { + .dev_type = {0x4040,0x4061,0x4071}, /*B6510,BT2575,TCS81*/ + .pca9548_cfg_info = { + /* psu fan */ + { + .pca9548_reset_type = PCA9548_RESET_GPIO, + .pca9548_bus = 2, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .gpio_attr.gpio = 7, + .gpio_attr.gpio_init = 0, + .gpio_attr.reset_on = 1, + .gpio_attr.reset_off = 0, + }, + }, + /* sff1 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + /* sff2 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + /* sff3 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + /* sff4 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + /* sff5 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x74, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(4), -1}, + }, + }, + /* sff6 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x75, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(5), -1}, + }, + }, + /* sff7 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x76, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(6), -1}, + }, + }, + }, + }, + { + .dev_type = {0x4041}, /*B6520*/ + .pca9548_cfg_info = { + /* psu fan */ + { + .pca9548_reset_type = PCA9548_RESET_GPIO, + .pca9548_bus = 2, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .gpio_attr.gpio = 7, + .gpio_attr.gpio_init = 0, + .gpio_attr.reset_on = 1, + .gpio_attr.reset_off = 0, + }, + }, + /* sff1 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + /* sff2 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + /* sff3 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + /* sff4 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + /* sff5 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x74, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(4), -1}, + }, + }, + /* sff6 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x75, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(5), -1}, + }, + }, + /* sff7 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x76, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(6), -1}, + }, + }, + /* sff8 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 1, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, + .func_attr.get_umask_func = pca954x_get_umask_by_i2c, + .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.umask = {BIT(7), -1}, + }, + }, + }, + }, + { + .dev_type = {0x4044,0x4072,0x4048}, /*B6920,TCS83,BS100R0*/ + .pca9548_cfg_info = { + /* һ��9548 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 2, + .pca9548_addr = 0x76, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x936, -1}, + .func_attr.umask = {BIT(4), -1}, + }, + }, + /* �װ� */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 8, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x917, -1}, + .func_attr.umask = {BIT(4), -1}, + }, + }, + /* �ӿ�1 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 9, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x917, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + /* �ӿ�2 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 12, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x917, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + /* �ӿ�3 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 11, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x917, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + /* �ӿ�4 */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 7, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x917, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + /* ����A */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 14, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb10, -1}, + .func_attr.umask = {BIT(5), -1}, + }, + }, + /* ����B */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 13, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb10, -1}, + .func_attr.umask = {BIT(7), -1}, + }, + }, + /* �ӿ�1 ��ģ�� */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 3, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 3, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 3, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 3, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + /* �ӿ�2 ��ģ�� */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 4, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 4, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 4, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 4, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + /* �ӿ�3 ��ģ�� */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 5, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 5, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 5, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 5, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(2), -1}, + }, + }, + /* �ӿ�4 ��ģ�� */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 6, + .pca9548_addr = 0x70, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 6, + .pca9548_addr = 0x71, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 6, + .pca9548_addr = 0x72, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 6, + .pca9548_addr = 0x73, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0xb17, -1}, + .func_attr.umask = {BIT(3), -1}, + }, + }, + }, + }, + { + .dev_type = {0x4058,0x4073}, /* B6510-32CQ, TCS82 */ + .pca9548_cfg_info = { + /* psu */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 4, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x960, -1}, + .func_attr.umask = {BIT(0), -1}, + }, + }, + /* fan */ + { + .pca9548_reset_type = PCA9548_RESET_FUNC, + .pca9548_bus = 2, + .pca9548_addr = 0x77, + .rst_delay_b = 0, + .rst_delay = 1000, + .rst_delay_a = 1000, + .attr = { + .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, + .func_attr.get_umask_func = pca954x_get_umask_by_lpc, + .func_attr.cfg_offset = {0x960, -1}, + .func_attr.umask = {BIT(1), -1}, + }, + }, + }, + }, +}; +int g_pca954x_debug = 0; +module_param(g_pca954x_debug, int, S_IRUGO | S_IWUSR); + +#define PCA954X_DEBUG(fmt, args...) do { \ + if (g_pca954x_debug) { \ + printk(KERN_ERR "[PCA95x][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +/* x86�豸��ȡ�忨���ͷ��� */ +static int dfd_get_my_dev_type_by_file(void) +{ + struct file *fp; + /* mm_segment_t fs;*/ + loff_t pos; + static int card_type; + char buf[DFD_PID_BUF_LEN]; + + if (card_type != 0) { + return card_type; + } + + fp= filp_open(DFD_PUB_CARDTYPE_FILE, O_RDONLY, 0); + if (IS_ERR(fp)) { + PCA954X_DEBUG("open file fail!\r\n"); + return -1; + } + /* fs = get_fs(); */ + /* set_fs(KERNEL_DS); */ + memset(buf, 0, DFD_PID_BUF_LEN); + pos = 0; + kernel_read(fp, pos, buf, DFD_PRODUCT_ID_LENGTH + 1 ); + if (pos < 0) { + PCA954X_DEBUG("read file fail!\r\n"); + goto exit; + } + + card_type = simple_strtoul(buf, NULL, 10); + PCA954X_DEBUG("card_type 0x%x.\n", card_type); + +exit: + /* set_fs(fs); */ + filp_close(fp, NULL); + return card_type; +} + +static int drv_get_my_dev_type(void) +{ + static int type = -1; + + if (type > 0) { + return type; + } + type = dfd_get_my_dev_type_by_file(); + PCA954X_DEBUG("ko board type %d\r\n", type); + + return type; +} + +pca9548_card_info_t* pca9548_get_card_info(int dev_type) +{ + int i, j; + int size; + + size = ARRAY_SIZE(g_pca9548_card_info); + + PCA954X_DEBUG("Enter dev_type 0x%x size %d.\n", dev_type, size); + for (i = 0; i < size; i++) { + for(j = 0; j < DFD_MAX_PRODUCT_NUM; j++) { + if (g_pca9548_card_info[i].dev_type[j] == dev_type) { + PCA954X_DEBUG("match dev_type 0x%x.\n", dev_type); + return &g_pca9548_card_info[i]; + } + } + } + + PCA954X_DEBUG("dismatch dev_type 0x%x.\n", dev_type); + return NULL; +} + +pca9548_cfg_info_t* get_pca9548_cfg_info(int bus, int addr) +{ + int dev_type; + pca9548_card_info_t *info; + pca9548_cfg_info_t *pca9548_cfg_info; + int i; + int size; + + dev_type = drv_get_my_dev_type(); + if (dev_type < 0) { + PCA954X_DEBUG("drv_get_my_dev_type failed ret %d.\n", dev_type); + return NULL; + } + + info = pca9548_get_card_info(dev_type); + if (info == NULL) { + PCA954X_DEBUG("fpga_pcie_get_card_info dev_type %d failed.\n", dev_type); + return NULL; + } + + size = PCA9548_MAX_CPLD_NUM; + for (i = 0; i < size; i++) { + pca9548_cfg_info = &(info->pca9548_cfg_info[i]); + if ((pca9548_cfg_info->pca9548_bus == bus) && (pca9548_cfg_info->pca9548_addr == addr)) { + PCA954X_DEBUG("match dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); + return pca9548_cfg_info; + } + } + + PCA954X_DEBUG("dismatch dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); + return NULL; +} + +static void pca9548_gpio_init(gpio_attr_t *gpio_attr) +{ + if (gpio_attr->gpio_init == 0) { + PCA954X_DEBUG("gpio%d init.\n", gpio_attr->gpio); + gpio_request(gpio_attr->gpio, "pca9548_reset"); + gpio_direction_output(gpio_attr->gpio, gpio_attr->reset_off); + gpio_attr->gpio_init = 1; + } +} + +static void pca9548_gpio_free(gpio_attr_t *gpio_attr) +{ + if (gpio_attr == NULL) { + PCA954X_DEBUG("pca9548_gpio_free,params error\n"); + return ; + } + if (gpio_attr->gpio_init == 1) { + PCA954X_DEBUG("gpio%d release.\n", gpio_attr->gpio); + gpio_free(gpio_attr->gpio); + gpio_attr->gpio_init = 0; + } +} + +static int pca954x_do_gpio_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, + struct i2c_client *client, u32 chan) +{ + struct pca954x *data = i2c_get_clientdata(client); + int ret = -1; + gpio_attr_t *tmp_gpio_attr; + int timeout; + int val; + struct i2c_adapter *adapter; + int adapter_timeout; + + if (cfg_info == NULL) { + PCA954X_DEBUG("pca9548 cfg info is null.\n"); + return ret; + } + + if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { + tmp_gpio_attr = &(cfg_info->attr.gpio_attr); + timeout = cfg_info->rst_delay_a; + + pca9548_gpio_init(tmp_gpio_attr); + udelay(cfg_info->rst_delay_b); + /* reset on */ + PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); + __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); + udelay(cfg_info->rst_delay); + /* reset off */ + PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); + __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); + + while (timeout > 0) { + udelay(1); + val = __gpio_get_value(tmp_gpio_attr->gpio); + if (val == tmp_gpio_attr->reset_off) { + adapter = adap; + /* get bus info */ + while(i2c_parent_is_i2c_adapter(adapter)){ + adapter = to_i2c_adapter(adapter->dev.parent); + } + + adapter_timeout = adapter->timeout; + adapter->timeout = msecs_to_jiffies(50); + pca954x_reg_write(adap, client, data->last_chan); + adapter->timeout = adapter_timeout; + ret = 0; + PCA954X_DEBUG("pca954x_do_gpio_reset success.\n"); + break; + } + + if (timeout >= 1000 && (timeout % 1000 == 0)) { + /* 1MS schedule*/ + schedule(); + } + timeout--; + } + + if (ret) { + PCA954X_DEBUG("pca954x_do_gpio_reset failed.\n"); + } + pca9548_gpio_free(&(cfg_info->attr.gpio_attr)); + } else { + PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_gpio_reset failed.\n"); + } + + return ret; +} + +static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, + struct i2c_client *client, u32 chan) +{ + struct pca954x *data = i2c_get_clientdata(client); + int ret = -1; + func_attr_t *tmp_func_attr; + int timeout; + int val; + struct i2c_adapter *adapter; + int adapter_timeout; + int i; + u8 old_value; + + if (cfg_info == NULL) { + PCA954X_DEBUG("pca9548 cfg info is null.\n"); + return ret; + } + + if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { + tmp_func_attr = &(cfg_info->attr.func_attr); + timeout = cfg_info->rst_delay_a; + + if ((tmp_func_attr->reset_func == NULL) || (tmp_func_attr->get_umask_func == NULL)) { + PCA954X_DEBUG("pca954x hw do reset func or get umask func is null.\n"); + return ret; + } + + for(i = 0; (i < PCA9548_MAX_CPLD_LAYER) && (tmp_func_attr->cfg_offset[i] != -1) + && (tmp_func_attr->umask[i] != -1); i++) { + old_value = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i]); + PCA954X_DEBUG("cfg info: offset:0x%x umask:0x%x, old_value:0x%x\n", + tmp_func_attr->cfg_offset[i], tmp_func_attr->umask[i],old_value); + (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value & ~tmp_func_attr->umask[i]); + udelay(cfg_info->rst_delay); + (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value | tmp_func_attr->umask[i]); + } + + while (timeout > 0) { + udelay(1); + val = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i - 1]); + val &= (tmp_func_attr->umask[i - 1]); + if (val == tmp_func_attr->umask[i - 1]) { + adapter = adap; + /* get bus info */ + while(i2c_parent_is_i2c_adapter(adapter)){ + adapter = to_i2c_adapter(adapter->dev.parent); + } + + adapter_timeout = adapter->timeout; + adapter->timeout = msecs_to_jiffies(50); + pca954x_reg_write(adap, client, data->last_chan); + adapter->timeout = adapter_timeout; + ret = 0; + PCA954X_DEBUG("pca954x_do_func_reset success.\n"); + break; + } + + if (timeout >= 1000 && (timeout % 1000 == 0)) { + /* 1MS schedule*/ + schedule(); + } + timeout--; + } + + if (ret) { + PCA954X_DEBUG("pca954x_do_func_reset failed.\n"); + } + } else { + PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_func_reset failed.\n"); + } + + return ret; +} + +static int pca9548_reset_ctrl(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, + struct i2c_client *client, u32 chan) +{ + int ret = -1; + + if (cfg_info == NULL) { + PCA954X_DEBUG("pca9548 cfg info is null.\n"); + return ret; + } + + if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { + ret = pca954x_do_func_reset(cfg_info, adap, client, chan); + } else if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { + ret = pca954x_do_gpio_reset(cfg_info, adap, client, chan); + } + + if (ret < 0) { + PCA954X_DEBUG("pca9548_reset_ctrl failed.\n"); + } + return ret; +} + +static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_addr, + unsigned char *buf, uint32_t size) +{ + struct file *fp; + /* mm_segment_t fs; */ + struct i2c_client client; + char i2c_path[32]; + int i ,j ; + int rv; + + rv = 0; + memset(i2c_path, 0, 32); + snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); + fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); + if (IS_ERR(fp)) { + PCA954X_DEBUG("i2c open fail.\n"); + return -1; + } + memcpy(&client, fp->private_data, sizeof(struct i2c_client)); + client.addr = addr; + /* fs = get_fs(); */ + /* set_fs(KERNEL_DS); */ + for (j = 0 ;j < size ;j++){ + for (i = 0; i < I2C_RETRY_TIMES; i++) { + rv = i2c_smbus_read_byte_data(&client, (offset_addr + j)); + if (rv < 0) { + PCA954X_DEBUG("i2c read failed, try again.\n"); + msleep(I2C_RETRY_WAIT_TIMES); + if (i >= (I2C_RETRY_TIMES - 1)) { + goto out; + } + continue; + } + *(buf + j) = (unsigned char)rv; + break; + } + } +out: + filp_close(fp, NULL); + /* set_fs(fs); */ + return rv; +} + +static int pca954x_reset_i2c_write(uint32_t bus, uint32_t dev_addr, uint32_t offset_addr, + uint8_t write_buf) +{ + struct file *fp; + /* mm_segment_t fs; */ + struct i2c_client client; + char i2c_path[32]; + int i; + int rv; + + rv = 0; + memset(i2c_path, 0, 32); + snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); + fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); + if (IS_ERR(fp)) { + PCA954X_DEBUG("i2c open fail.\n"); + return -1; + } + memcpy(&client, fp->private_data, sizeof(struct i2c_client)); + client.addr = dev_addr; + /* fs = get_fs(); */ + /* set_fs(KERNEL_DS); */ + for (i = 0; i < I2C_RETRY_TIMES; i++) { + rv = i2c_smbus_write_byte_data(&client, offset_addr, write_buf); + if (rv < 0) { + PCA954X_DEBUG("i2c write failed, try again.\n"); + msleep(I2C_RETRY_WAIT_TIMES); + if (i >= (I2C_RETRY_TIMES - 1)) { + goto out; + } + continue; + } + break; + } +out: + filp_close(fp, NULL); + /* set_fs(fs); */ + return rv; +} + +int pca954x_reset_reg_i2c_read_byte(int addr, u8 *value) +{ + int bus; + int client_addr; + int offset; + int ret; + + bus = PCA9548_I2C_GET_BUS(addr); + client_addr = PCA9548_I2C_GET_CLIENT(addr); + offset = PCA9548_I2C_GET_OFFSET(addr); + + ret = pca954x_reset_i2c_read(bus, client_addr, offset, value, 1); + if (ret < 0) { + PCA954X_DEBUG(" 0x%x read fail\r\n", addr); + goto end; + } +end: + return ret; +} + +int pca954x_reset_reg_i2c_write_byte(int addr, u8 value) +{ + int bus; + int client_addr; + int offset; + int ret; + + bus = PCA9548_I2C_GET_BUS(addr); + client_addr = PCA9548_I2C_GET_CLIENT(addr); + offset = PCA9548_I2C_GET_OFFSET(addr); + + ret = pca954x_reset_i2c_write(bus, client_addr, offset, value); + if (ret < 0) { + PCA954X_DEBUG(" 0x%x write fail\r\n", addr); + goto end; + } +end: + return ret; +} + +void pca954x_hw_do_reset_by_i2c(int addr, u8 value) +{ + int ret; + + PCA954X_DEBUG("write i2c cpld[0x%x], value[%d]\n", addr, value); + ret = pca954x_reset_reg_i2c_write_byte(addr, value); + if (ret < 0) { + PCA954X_DEBUG("write cpld pca9548 reset reg failed, ret = %d \n", ret); + } +} + +u8 pca954x_get_umask_by_i2c(int addr) +{ + u8 value = 0xFF; + int ret; + + ret = pca954x_reset_reg_i2c_read_byte(addr, &value); + PCA954X_DEBUG("read i2c cpld[0x%x], value[%d], ret = %d\n", addr, value, ret); + + return value; +} + +void pca954x_hw_do_reset_by_lpc(int io_port, u8 value) +{ + PCA954X_DEBUG("write lpc offset[0x%x], value[%d]\n", (u16)io_port, value); + outb(value, (u16)io_port); +} + +u8 pca954x_get_umask_by_lpc(int io_port) +{ + u8 value; + + value = inb(io_port); + PCA954X_DEBUG("read lpc offset[0x%x], value[%d]\n", (u16)io_port, value); + + return value; +} + +int pca954x_hw_do_reset_new(struct i2c_adapter *adap, + struct i2c_client *client, u32 chan) +{ + pca9548_cfg_info_t *cfg_info; + int ret = -1; + + cfg_info = get_pca9548_cfg_info(adap->nr, client->addr); + if (cfg_info == NULL && g_notify_to_do_reset == NULL) { + PCA954X_DEBUG("fpga_do_pca954x_reset_func do nothing.\n"); + return ret; + } + if(cfg_info != NULL) { + ret = pca9548_reset_ctrl(cfg_info, adap, client, chan); + } else { + ret = pca954x_hw_do_reset(adap->nr, client->addr); + } + if (ret < 0) { + PCA954X_DEBUG("pca954x_hw_do_reset failed.\n"); + } + return ret; +} +/******************************end 9548 reset***********************************/ + +static int pca954x_do_reset(struct i2c_adapter *adap, + void *client, u32 chan) +{ + struct i2c_client *new_client; + int ret = -1; + + PCA954X_DEBUG("do pca954x reset x86\n"); + new_client =(struct i2c_client *) client; + ret = pca954x_hw_do_reset_new(adap, new_client, chan); + if (ret < 0) { + PCA954X_DEBUG("pca954x_do_reset failed.\n"); + return ret; + } + + PCA954X_DEBUG("pca954x_do_reset success.\n"); + ret = 0; + return ret; +} +static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int ret, rv; + struct i2c_client * new_client; + + /* Deselect active channel */ + data->last_chan = 0; + + ret = pca954x_reg_write(muxc->parent, client, data->last_chan); + if (ret < 0) { + /* ʹ��i2c��ʽ�ر�ͨ��ʧ�ܣ�����ʹ��reset��ʽ */ + new_client =(struct i2c_client *) client; + dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n"); + rv = pca954x_do_reset(client->adapter, client, chan); + if (rv == 0) { + ret = 0; + } + + } + /*9641Ȩ����Ҫ��9548��λ֮���ͷţ����¹�һ��ͨ��ȷ��9641Ȩ�������ͷ�*/ + pca954x_setmuxflag(client, 1); + (void)pca954x_reg_write(muxc->parent, client, data->last_chan); + + return ret; + +} + +static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) +{ + struct pca954x *data = dev_id; + unsigned int child_irq; + int ret, i, handled = 0; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + for (i = 0; i < data->chip->nchans; i++) { + if (ret & BIT(PCA954X_IRQ_OFFSET + i)) { + child_irq = irq_linear_revmap(data->irq, i); + handle_nested_irq(child_irq); + handled++; + } + } + return handled ? IRQ_HANDLED : IRQ_NONE; +} + +static void pca954x_irq_mask(struct irq_data *idata) +{ + struct pca954x *data = irq_data_get_irq_chip_data(idata); + unsigned int pos = idata->hwirq; + unsigned long flags; + + raw_spin_lock_irqsave(&data->lock, flags); + + data->irq_mask &= ~BIT(pos); + if (!data->irq_mask) + disable_irq(data->client->irq); + + raw_spin_unlock_irqrestore(&data->lock, flags); +} + +static void pca954x_irq_unmask(struct irq_data *idata) +{ + struct pca954x *data = irq_data_get_irq_chip_data(idata); + unsigned int pos = idata->hwirq; + unsigned long flags; + + raw_spin_lock_irqsave(&data->lock, flags); + + if (!data->irq_mask) + enable_irq(data->client->irq); + data->irq_mask |= BIT(pos); + + raw_spin_unlock_irqrestore(&data->lock, flags); +} + +static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) +{ + if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) + return -EINVAL; + return 0; +} + +static struct irq_chip pca954x_irq_chip = { + .name = "i2c-mux-pca954x", + .irq_mask = pca954x_irq_mask, + .irq_unmask = pca954x_irq_unmask, + .irq_set_type = pca954x_irq_set_type, +}; + +static int pca954x_irq_setup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int c, err, irq; + + if (!data->chip->has_irq || client->irq <= 0) + return 0; + + raw_spin_lock_init(&data->lock); + + data->irq = irq_domain_add_linear(client->dev.of_node, + data->chip->nchans, + &irq_domain_simple_ops, data); + if (!data->irq) + return -ENODEV; + + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_create_mapping(data->irq, c); + irq_set_chip_data(irq, data); + irq_set_chip_and_handler(irq, &pca954x_irq_chip, + handle_simple_irq); + } + + err = devm_request_threaded_irq(&client->dev, data->client->irq, NULL, + pca954x_irq_handler, + IRQF_ONESHOT | IRQF_SHARED, + "pca954x", data); + if (err) + goto err_req_irq; + + disable_irq(data->client->irq); + + return 0; +err_req_irq: + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + + return err; +} + +/* + * I2C init/probing/exit functions + */ +static int pca954x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device_node *of_node = client->dev.of_node; + bool idle_disconnect_dt; + struct gpio_desc *gpio; + int num, force, class; + struct i2c_mux_core *muxc; + struct pca954x *data; + const struct of_device_id *match; + int ret; + + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, &client->dev, + PCA954X_MAX_NCHANS, sizeof(*data), 0, + pca954x_select_chan, pca954x_deselect_mux); + if (!muxc) + return -ENOMEM; + data = i2c_mux_priv(muxc); + + i2c_set_clientdata(client, muxc); + data->client = client; + + /* Get the mux out of reset if a reset GPIO is specified. */ + gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + + /* Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to disconnected state. + */ + if ((i2c_smbus_write_byte(client, 0) < 0) && (force_create_bus == 0)) { + dev_warn(&client->dev, "probe failed\n"); + return -ENODEV; + } + + match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); + if (match) + data->chip = of_device_get_match_data(&client->dev); + else + data->chip = &chips[id->driver_data]; + + data->last_chan = 0; /* force the first selection */ + + idle_disconnect_dt = of_node && + of_property_read_bool(of_node, "i2c-mux-idle-disconnect"); + + ret = pca954x_irq_setup(muxc); + if (ret) + goto fail_del_adapters; + + /* Now create an adapter for each channel */ + for (num = 0; num < data->chip->nchans; num++) { + bool idle_disconnect_pd = false; + + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + if (pdata) { + if (num < pdata->num_modes) { + /* force static number */ + force = pdata->modes[num].adap_id; + class = pdata->modes[num].class; + } else + /* discard unconfigured channels */ + break; + idle_disconnect_pd = pdata->modes[num].deselect_on_exit; + } + data->deselect |= (idle_disconnect_pd || + idle_disconnect_dt) << num; + + ret = i2c_mux_add_adapter(muxc, force, num, class); + if (ret) + goto fail_del_adapters; + } + + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s %s\n", + num, data->chip->muxtype == pca954x_ismux + ? "mux" : "switch", client->name); + + return 0; + +fail_del_adapters: + i2c_mux_del_adapters(muxc); + return ret; +} + +static int pca954x_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int c, irq; + + if (data->irq) { + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + } + + i2c_mux_del_adapters(muxc); + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int pca954x_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + + data->last_chan = 0; + return i2c_smbus_write_byte(client, 0); +} +#endif + +static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); + +static struct i2c_driver pca954x_driver = { + .driver = { + .name = "pca954x", + .pm = &pca954x_pm, + .of_match_table = of_match_ptr(pca954x_of_match), + }, + .probe = pca954x_probe, + .remove = pca954x_remove, + .id_table = pca954x_id, +}; + +module_i2c_driver(pca954x_driver); + +MODULE_AUTHOR("sonic_rd sonic_rd@ruijie.com.cn"); +MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca9641.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca9641.c new file mode 100755 index 000000000000..bb2af837df31 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/i2c-mux-pca9641.c @@ -0,0 +1,645 @@ +/* + * I2C multiplexer driver for PCA9541 bus master selector + * + * Copyright (c) 2010 Ericsson AB. + * Copyright (c) 2019 + * Author: Guenter Roeck + * + * Derived from: + * pca954x.c + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * The PCA9541 is a bus master selector. It supports two I2C masters connected + * to a single slave bus. + * + * Before each bus transaction, a master has to acquire bus ownership. After the + * transaction is complete, bus ownership has to be released. This fits well + * into the I2C multiplexer framework, which provides select and release + * functions for this purpose. For this reason, this driver is modeled as + * single-channel I2C bus multiplexer. + * + * This driver assumes that the two bus masters are controlled by two different + * hosts. If a single host controls both masters, platform code has to ensure + * that only one of the masters is instantiated at any given time. + */ + +#define PCA9541_CONTROL 0x01 +#define PCA9541_ISTAT 0x02 + +#define PCA9541_CTL_MYBUS (1 << 0) +#define PCA9541_CTL_NMYBUS (1 << 1) +#define PCA9541_CTL_BUSON (1 << 2) +#define PCA9541_CTL_NBUSON (1 << 3) +#define PCA9541_CTL_BUSINIT (1 << 4) +#define PCA9541_CTL_TESTON (1 << 6) +#define PCA9541_CTL_NTESTON (1 << 7) +#define PCA9541_ISTAT_INTIN (1 << 0) +#define PCA9541_ISTAT_BUSINIT (1 << 1) +#define PCA9541_ISTAT_BUSOK (1 << 2) +#define PCA9541_ISTAT_BUSLOST (1 << 3) +#define PCA9541_ISTAT_MYTEST (1 << 6) +#define PCA9541_ISTAT_NMYTEST (1 << 7) +#define PCA9641_ID 0x00 +#define PCA9641_ID_MAGIC 0x38 +#define PCA9641_CONTROL 0x01 +#define PCA9641_STATUS 0x02 +#define PCA9641_TIME 0x03 +#define PCA9641_CTL_LOCK_REQ BIT(0) +#define PCA9641_CTL_LOCK_GRANT BIT(1) +#define PCA9641_CTL_BUS_CONNECT BIT(2) +#define PCA9641_CTL_BUS_INIT BIT(3) +#define PCA9641_CTL_SMBUS_SWRST BIT(4) +#define PCA9641_CTL_IDLE_TIMER_DIS BIT(5) +#define PCA9641_CTL_SMBUS_DIS BIT(6) +#define PCA9641_CTL_PRIORITY BIT(7) +#define PCA9641_STS_OTHER_LOCK BIT(0) +#define PCA9641_STS_BUS_INIT_FAIL BIT(1) +#define PCA9641_STS_BUS_HUNG BIT(2) +#define PCA9641_STS_MBOX_EMPTY BIT(3) +#define PCA9641_STS_MBOX_FULL BIT(4) +#define PCA9641_STS_TEST_INT BIT(5) +#define PCA9641_STS_SCL_IO BIT(6) +#define PCA9641_STS_SDA_IO BIT(7) +#define PCA9641_RES_TIME 0x03 +#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) +#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) +#define mybus(x) (!((x) & MYBUS) || ((x) & MYBUS) == MYBUS) +#define busoff(x) (!((x) & BUSON) || ((x) & BUSON) == BUSON) +#define BUSOFF(x, y) (!((x) & PCA9641_CTL_LOCK_GRANT) && \ + !((y) & PCA9641_STS_OTHER_LOCK)) +#define other_lock(x) ((x) & PCA9641_STS_OTHER_LOCK) +#define lock_grant(x) ((x) & PCA9641_CTL_LOCK_GRANT) + +#define PCA9641_RETRY_TIME 8 + +typedef struct i2c_muxs_struct_flag +{ + int nr; + char name[48]; + struct mutex update_lock; + int flag; +}i2c_mux_flag; + +i2c_mux_flag pca_flag = { + .flag = -1, +}; + +int pca9641_setmuxflag(int nr, int flag) +{ + if (pca_flag.nr == nr) { + pca_flag.flag = flag; + } + return 0; +} +EXPORT_SYMBOL(pca9641_setmuxflag); + +int g_debug = 0; +module_param(g_debug, int, S_IRUGO | S_IWUSR); + +#define PCA_DEBUG(fmt, args...) do { \ + if (g_debug) { \ + printk(KERN_ERR "[pca9641][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + + +/* arbitration timeouts, in jiffies */ +#define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ +#define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */ + +/* arbitration retry delays, in us */ +#define SELECT_DELAY_SHORT 50 +#define SELECT_DELAY_LONG 1000 + +struct pca9541 { + struct i2c_client *client; + unsigned long select_timeout; + unsigned long arb_timeout; +}; + +static const struct i2c_device_id pca9541_id[] = { + {"pca9541", 0}, + {"pca9641", 1}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, pca9541_id); + +#ifdef CONFIG_OF +static const struct of_device_id pca9541_of_match[] = { + { .compatible = "nxp,pca9541" }, + { .compatible = "nxp,pca9641" }, + {} +}; +MODULE_DEVICE_TABLE(of, pca9541_of_match); +#endif + + +/* + * Write to chip register. Don't use i2c_transfer()/i2c_smbus_xfer() + * as they will try to lock the adapter a second time. + */ +static int pca9541_reg_write(struct i2c_client *client, u8 command, u8 val) +{ + struct i2c_adapter *adap = client->adapter; + int ret; + + if (adap->algo->master_xfer) { + struct i2c_msg msg; + char buf[2]; + + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + buf[0] = command; + buf[1] = val; + msg.buf = buf; + ret = __i2c_transfer(adap, &msg, 1); + } else { + union i2c_smbus_data data; + + data.byte = val; + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_WRITE, + command, + I2C_SMBUS_BYTE_DATA, &data); + } + + return ret; +} + +/* + * Read from chip register. Don't use i2c_transfer()/i2c_smbus_xfer() + * as they will try to lock adapter a second time. + */ +static int pca9541_reg_read(struct i2c_client *client, u8 command) +{ + struct i2c_adapter *adap = client->adapter; + int ret; + u8 val; + + if (adap->algo->master_xfer) { + struct i2c_msg msg[2] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = &command + }, + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = 1, + .buf = &val + } + }; + ret = __i2c_transfer(adap, msg, 2); + if (ret == 2) + ret = val; + else if (ret >= 0) + ret = -EIO; + } else { + union i2c_smbus_data data; + + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_READ, + command, + I2C_SMBUS_BYTE_DATA, &data); + if (!ret) + ret = data.byte; + } + return ret; +} + +/* + * Arbitration management functions + */ + +/* Release bus. Also reset NTESTON and BUSINIT if it was set. */ +static void pca9541_release_bus(struct i2c_client *client) +{ + int reg; + + reg = pca9541_reg_read(client, PCA9541_CONTROL); + if (reg >= 0 && !busoff(reg) && mybus(reg)) + pca9541_reg_write(client, PCA9541_CONTROL, + (reg & PCA9541_CTL_NBUSON) >> 1); +} + +/* + * Arbitration is defined as a two-step process. A bus master can only activate + * the slave bus if it owns it; otherwise it has to request ownership first. + * This multi-step process ensures that access contention is resolved + * gracefully. + * + * Bus Ownership Other master Action + * state requested access + * ---------------------------------------------------- + * off - yes wait for arbitration timeout or + * for other master to drop request + * off no no take ownership + * off yes no turn on bus + * on yes - done + * on no - wait for arbitration timeout or + * for other master to release bus + * + * The main contention point occurs if the slave bus is off and both masters + * request ownership at the same time. In this case, one master will turn on + * the slave bus, believing that it owns it. The other master will request + * bus ownership. Result is that the bus is turned on, and master which did + * _not_ own the slave bus before ends up owning it. + */ + +/* Control commands per PCA9541 datasheet */ +static const u8 pca9541_control[16] = { + 4, 0, 1, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 4, 5, 1 +}; + +/* + * Channel arbitration + * + * Return values: + * <0: error + * 0 : bus not acquired + * 1 : bus acquired + */ +static int pca9541_arbitrate(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca9541 *data = i2c_mux_priv(muxc); + int reg; + + reg = pca9541_reg_read(client, PCA9541_CONTROL); + if (reg < 0) + return reg; + + if (busoff(reg)) { + int istat; + /* + * Bus is off. Request ownership or turn it on unless + * other master requested ownership. + */ + istat = pca9541_reg_read(client, PCA9541_ISTAT); + if (!(istat & PCA9541_ISTAT_NMYTEST) + || time_is_before_eq_jiffies(data->arb_timeout)) { + /* + * Other master did not request ownership, + * or arbitration timeout expired. Take the bus. + */ + pca9541_reg_write(client, + PCA9541_CONTROL, + pca9541_control[reg & 0x0f] + | PCA9541_CTL_NTESTON); + data->select_timeout = SELECT_DELAY_SHORT; + } else { + /* + * Other master requested ownership. + * Set extra long timeout to give it time to acquire it. + */ + data->select_timeout = SELECT_DELAY_LONG * 2; + } + } else if (mybus(reg)) { + /* + * Bus is on, and we own it. We are done with acquisition. + * Reset NTESTON and BUSINIT, then return success. + */ + if (reg & (PCA9541_CTL_NTESTON | PCA9541_CTL_BUSINIT)) + pca9541_reg_write(client, + PCA9541_CONTROL, + reg & ~(PCA9541_CTL_NTESTON + | PCA9541_CTL_BUSINIT)); + return 1; + } else { + /* + * Other master owns the bus. + * If arbitration timeout has expired, force ownership. + * Otherwise request it. + */ + data->select_timeout = SELECT_DELAY_LONG; + if (time_is_before_eq_jiffies(data->arb_timeout)) { + /* Time is up, take the bus and reset it. */ + pca9541_reg_write(client, + PCA9541_CONTROL, + pca9541_control[reg & 0x0f] + | PCA9541_CTL_BUSINIT + | PCA9541_CTL_NTESTON); + } else { + /* Request bus ownership if needed */ + if (!(reg & PCA9541_CTL_NTESTON)) + pca9541_reg_write(client, + PCA9541_CONTROL, + reg | PCA9541_CTL_NTESTON); + } + } + return 0; +} + +static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int ret; + unsigned long timeout = jiffies + ARB2_TIMEOUT; + /* give up after this time */ + + data->arb_timeout = jiffies + ARB_TIMEOUT; + /* force bus ownership after this time */ + + do { + ret = pca9541_arbitrate(client); + if (ret) + return ret < 0 ? ret : 0; + + if (data->select_timeout == SELECT_DELAY_SHORT) + udelay(data->select_timeout); + else + msleep(data->select_timeout / 1000); + } while (time_is_after_eq_jiffies(timeout)); + + return -ETIMEDOUT; +} + +static int pca9541_release_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + pca9541_release_bus(client); + return 0; +} + +/* +* Arbitration management functions +*/ +static void pca9641_release_bus(struct i2c_client *client) +{ + pca9541_reg_write(client, PCA9641_CONTROL, 0x80); //master 0x80 +} + +/* +* Channel arbitration +* +* Return values: +* <0: error +* 0 : bus not acquired +* 1 : bus acquired +*/ +static int pca9641_arbitrate(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca9541 *data = i2c_mux_priv(muxc); + int reg_ctl, reg_sts; + + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + if (reg_ctl < 0) + return reg_ctl; + reg_sts = pca9541_reg_read(client, PCA9641_STATUS); + + if (BUSOFF(reg_ctl, reg_sts)) { + /* + * Bus is off. Request ownership or turn it on unless + * other master requested ownership. + */ + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + + if (lock_grant(reg_ctl)) { + /* + * Other master did not request ownership, + * or arbitration timeout expired. Take the bus. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT + | PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + data->select_timeout = SELECT_DELAY_SHORT; + + return 1; + } else { + /* + * Other master requested ownership. + * Set extra long timeout to give it time to acquire it. + */ + data->select_timeout = SELECT_DELAY_LONG * 2; + } + } else if (lock_grant(reg_ctl)) { + /* + * Bus is on, and we own it. We are done with acquisition. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT | PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + + return 1; + } else if (other_lock(reg_sts)) { + /* + * Other master owns the bus. + * If arbitration timeout has expired, force ownership. + * Otherwise request it. + */ + data->select_timeout = SELECT_DELAY_LONG; + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + } + return 0; +} + + +int pca9641_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int ret; + int result; + unsigned long timeout = jiffies + ARB2_TIMEOUT; + /* give up after this time */ + data->arb_timeout = jiffies + ARB_TIMEOUT; + /* force bus ownership after this time */ + for (result = 0 ; result < PCA9641_RETRY_TIME ; result ++) { + do { + ret = pca9641_arbitrate(client); + if (ret == 1) { + return 0; + } + if (data->select_timeout == SELECT_DELAY_SHORT) + udelay(data->select_timeout); + else + msleep(data->select_timeout / 1000); + } while (time_is_after_eq_jiffies(timeout)); + timeout = jiffies + ARB2_TIMEOUT; + } + return -ETIMEDOUT; +} +EXPORT_SYMBOL(pca9641_select_chan); + +static int pca9641_release_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + if (pca_flag.flag) { + pca9641_release_bus(client); + } + return 0; +} + +static int pca9641_detect_id(struct i2c_client *client) +{ + int reg; + + reg = pca9541_reg_read(client, PCA9641_ID); + if (reg == PCA9641_ID_MAGIC) + return 1; + else + return 0; +} + +/** + ** �޶�: 20180827 ֧��һ��PCA9641 + **/ +static int pca9641_recordflag(struct i2c_adapter *adap) { + if (pca_flag.flag != -1) { + pr_err(" %s %d has init already!!!", __func__, __LINE__); + return -1 ; + } + pca_flag.nr = adap->nr; + PCA_DEBUG(" adap->nr:%d\n", adap->nr); + snprintf(pca_flag.name, sizeof(pca_flag.name),adap->name); + return 0; +} + +static void i2c_lock_adapter(struct i2c_adapter *adapter){ + struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); + if (parent) + i2c_lock_adapter(parent); + else + rt_mutex_lock(&adapter->bus_lock); +} + +void i2c_unlock_adapter(struct i2c_adapter *adapter) +{ + struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); + + if (parent) + i2c_unlock_adapter(parent); + else + rt_mutex_unlock(&adapter->bus_lock); +} +/* + * I2C init/probing/exit functions + */ +static int pca9541_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = client->adapter; + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct i2c_mux_core *muxc; + struct pca9541 *data; + int force; + int ret = -ENODEV; + int detect_id; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) + return -ENODEV; + + detect_id = pca9641_detect_id(client); + + /* + * I2C accesses are unprotected here. + * We have to lock the adapter before releasing the bus. + */ + if (detect_id == 0) { + i2c_lock_adapter(adap); + pca9541_release_bus(client); + i2c_unlock_adapter(adap); + } else { + i2c_lock_adapter(adap); + pca9641_release_bus(client); + i2c_unlock_adapter(adap); + } + + /* Create mux adapter */ + + force = 0; + if (pdata) + force = pdata->modes[0].adap_id; + + if (detect_id == 0) { + muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), + I2C_MUX_ARBITRATOR, + pca9541_select_chan, pca9541_release_chan); + if (!muxc) + return -ENOMEM; + + data = i2c_mux_priv(muxc); + data->client = client; + + i2c_set_clientdata(client, muxc); + + ret = i2c_mux_add_adapter(muxc, force, 0, 0); + if (ret) + return ret; + } else { + muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), + I2C_MUX_ARBITRATOR, + pca9641_select_chan, pca9641_release_chan); + if (!muxc) + return -ENOMEM; + + data = i2c_mux_priv(muxc); + data->client = client; + + i2c_set_clientdata(client, muxc); + + ret = i2c_mux_add_adapter(muxc, force, 0, 0); + if (ret) + return ret; + } + pca9641_recordflag(muxc->adapter[0]); + + dev_info(&client->dev, "registered master selector for I2C %s\n", + client->name); + + return 0; + +} + +static int pca9541_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + + i2c_mux_del_adapters(muxc); + return 0; +} + +static struct i2c_driver pca9641_driver = { + .driver = { + .name = "pca9641", + .of_match_table = of_match_ptr(pca9541_of_match), + }, + .probe = pca9541_probe, + .remove = pca9541_remove, + .id_table = pca9541_id, +}; + +module_i2c_driver(pca9641_driver); + +MODULE_AUTHOR("sonic_rd sonic_rd@ruijie.com.cn"); +MODULE_DESCRIPTION("PCA9541 I2C master selector driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/pmbus.h new file mode 100755 index 000000000000..869a8d1558a4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/pmbus.h @@ -0,0 +1,424 @@ +/* + * pmbus.h - Common defines and structures for PMBus devices + * + * Copyright (c) 2010, 2011 Ericsson AB. + * Copyright (c) 2012 Guenter Roeck + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef PMBUS_H +#define PMBUS_H + +#include +#include + +/* + * Registers + */ +enum pmbus_regs { + PMBUS_PAGE = 0x00, + PMBUS_OPERATION = 0x01, + PMBUS_ON_OFF_CONFIG = 0x02, + PMBUS_CLEAR_FAULTS = 0x03, + PMBUS_PHASE = 0x04, + + PMBUS_CAPABILITY = 0x19, + PMBUS_QUERY = 0x1A, + + PMBUS_VOUT_MODE = 0x20, + PMBUS_VOUT_COMMAND = 0x21, + PMBUS_VOUT_TRIM = 0x22, + PMBUS_VOUT_CAL_OFFSET = 0x23, + PMBUS_VOUT_MAX = 0x24, + PMBUS_VOUT_MARGIN_HIGH = 0x25, + PMBUS_VOUT_MARGIN_LOW = 0x26, + PMBUS_VOUT_TRANSITION_RATE = 0x27, + PMBUS_VOUT_DROOP = 0x28, + PMBUS_VOUT_SCALE_LOOP = 0x29, + PMBUS_VOUT_SCALE_MONITOR = 0x2A, + + PMBUS_COEFFICIENTS = 0x30, + PMBUS_POUT_MAX = 0x31, + + PMBUS_FAN_CONFIG_12 = 0x3A, + PMBUS_FAN_COMMAND_1 = 0x3B, + PMBUS_FAN_COMMAND_2 = 0x3C, + PMBUS_FAN_CONFIG_34 = 0x3D, + PMBUS_FAN_COMMAND_3 = 0x3E, + PMBUS_FAN_COMMAND_4 = 0x3F, + + PMBUS_VOUT_OV_FAULT_LIMIT = 0x40, + PMBUS_VOUT_OV_FAULT_RESPONSE = 0x41, + PMBUS_VOUT_OV_WARN_LIMIT = 0x42, + PMBUS_VOUT_UV_WARN_LIMIT = 0x43, + PMBUS_VOUT_UV_FAULT_LIMIT = 0x44, + PMBUS_VOUT_UV_FAULT_RESPONSE = 0x45, + PMBUS_IOUT_OC_FAULT_LIMIT = 0x46, + PMBUS_IOUT_OC_FAULT_RESPONSE = 0x47, + PMBUS_IOUT_OC_LV_FAULT_LIMIT = 0x48, + PMBUS_IOUT_OC_LV_FAULT_RESPONSE = 0x49, + PMBUS_IOUT_OC_WARN_LIMIT = 0x4A, + PMBUS_IOUT_UC_FAULT_LIMIT = 0x4B, + PMBUS_IOUT_UC_FAULT_RESPONSE = 0x4C, + + PMBUS_OT_FAULT_LIMIT = 0x4F, + PMBUS_OT_FAULT_RESPONSE = 0x50, + PMBUS_OT_WARN_LIMIT = 0x51, + PMBUS_UT_WARN_LIMIT = 0x52, + PMBUS_UT_FAULT_LIMIT = 0x53, + PMBUS_UT_FAULT_RESPONSE = 0x54, + PMBUS_VIN_OV_FAULT_LIMIT = 0x55, + PMBUS_VIN_OV_FAULT_RESPONSE = 0x56, + PMBUS_VIN_OV_WARN_LIMIT = 0x57, + PMBUS_VIN_UV_WARN_LIMIT = 0x58, + PMBUS_VIN_UV_FAULT_LIMIT = 0x59, + + PMBUS_IIN_OC_FAULT_LIMIT = 0x5B, + PMBUS_IIN_OC_WARN_LIMIT = 0x5D, + + PMBUS_POUT_OP_FAULT_LIMIT = 0x68, + PMBUS_POUT_OP_WARN_LIMIT = 0x6A, + PMBUS_PIN_OP_WARN_LIMIT = 0x6B, + + PMBUS_STATUS_BYTE = 0x78, + PMBUS_STATUS_WORD = 0x79, + PMBUS_STATUS_VOUT = 0x7A, + PMBUS_STATUS_IOUT = 0x7B, + PMBUS_STATUS_INPUT = 0x7C, + PMBUS_STATUS_TEMPERATURE = 0x7D, + PMBUS_STATUS_CML = 0x7E, + PMBUS_STATUS_OTHER = 0x7F, + PMBUS_STATUS_MFR_SPECIFIC = 0x80, + PMBUS_STATUS_FAN_12 = 0x81, + PMBUS_STATUS_FAN_34 = 0x82, + + PMBUS_READ_VIN = 0x88, + PMBUS_READ_IIN = 0x89, + PMBUS_READ_VCAP = 0x8A, + PMBUS_READ_VOUT = 0x8B, + PMBUS_READ_IOUT = 0x8C, + PMBUS_READ_TEMPERATURE_1 = 0x8D, + PMBUS_READ_TEMPERATURE_2 = 0x8E, + PMBUS_READ_TEMPERATURE_3 = 0x8F, + PMBUS_READ_FAN_SPEED_1 = 0x90, + PMBUS_READ_FAN_SPEED_2 = 0x91, + PMBUS_READ_FAN_SPEED_3 = 0x92, + PMBUS_READ_FAN_SPEED_4 = 0x93, + PMBUS_READ_DUTY_CYCLE = 0x94, + PMBUS_READ_FREQUENCY = 0x95, + PMBUS_READ_POUT = 0x96, + PMBUS_READ_PIN = 0x97, + + PMBUS_REVISION = 0x98, + PMBUS_MFR_ID = 0x99, + PMBUS_MFR_MODEL = 0x9A, + PMBUS_MFR_REVISION = 0x9B, + PMBUS_MFR_LOCATION = 0x9C, + PMBUS_MFR_DATE = 0x9D, + PMBUS_MFR_SERIAL = 0x9E, + +/* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ + PMBUS_VIRT_BASE = 0x100, + PMBUS_VIRT_READ_TEMP_AVG, + PMBUS_VIRT_READ_TEMP_MIN, + PMBUS_VIRT_READ_TEMP_MAX, + PMBUS_VIRT_RESET_TEMP_HISTORY, + PMBUS_VIRT_READ_VIN_AVG, + PMBUS_VIRT_READ_VIN_MIN, + PMBUS_VIRT_READ_VIN_MAX, + PMBUS_VIRT_RESET_VIN_HISTORY, + PMBUS_VIRT_READ_IIN_AVG, + PMBUS_VIRT_READ_IIN_MIN, + PMBUS_VIRT_READ_IIN_MAX, + PMBUS_VIRT_RESET_IIN_HISTORY, + PMBUS_VIRT_READ_PIN_AVG, + PMBUS_VIRT_READ_PIN_MIN, + PMBUS_VIRT_READ_PIN_MAX, + PMBUS_VIRT_RESET_PIN_HISTORY, + PMBUS_VIRT_READ_POUT_AVG, + PMBUS_VIRT_READ_POUT_MIN, + PMBUS_VIRT_READ_POUT_MAX, + PMBUS_VIRT_RESET_POUT_HISTORY, + PMBUS_VIRT_READ_VOUT_AVG, + PMBUS_VIRT_READ_VOUT_MIN, + PMBUS_VIRT_READ_VOUT_MAX, + PMBUS_VIRT_RESET_VOUT_HISTORY, + PMBUS_VIRT_READ_IOUT_AVG, + PMBUS_VIRT_READ_IOUT_MIN, + PMBUS_VIRT_READ_IOUT_MAX, + PMBUS_VIRT_RESET_IOUT_HISTORY, + PMBUS_VIRT_READ_TEMP2_AVG, + PMBUS_VIRT_READ_TEMP2_MIN, + PMBUS_VIRT_READ_TEMP2_MAX, + PMBUS_VIRT_RESET_TEMP2_HISTORY, + + PMBUS_VIRT_READ_VMON, + PMBUS_VIRT_VMON_UV_WARN_LIMIT, + PMBUS_VIRT_VMON_OV_WARN_LIMIT, + PMBUS_VIRT_VMON_UV_FAULT_LIMIT, + PMBUS_VIRT_VMON_OV_FAULT_LIMIT, + PMBUS_VIRT_STATUS_VMON, +}; + +/* + * OPERATION + */ +#define PB_OPERATION_CONTROL_ON BIT(7) + +/* + * CAPABILITY + */ +#define PB_CAPABILITY_SMBALERT BIT(4) +#define PB_CAPABILITY_ERROR_CHECK BIT(7) + +/* + * VOUT_MODE + */ +#define PB_VOUT_MODE_MODE_MASK 0xe0 +#define PB_VOUT_MODE_PARAM_MASK 0x1f + +#define PB_VOUT_MODE_LINEAR 0x00 +#define PB_VOUT_MODE_VID 0x20 +#define PB_VOUT_MODE_DIRECT 0x40 + +/* + * Fan configuration + */ +#define PB_FAN_2_PULSE_MASK (BIT(0) | BIT(1)) +#define PB_FAN_2_RPM BIT(2) +#define PB_FAN_2_INSTALLED BIT(3) +#define PB_FAN_1_PULSE_MASK (BIT(4) | BIT(5)) +#define PB_FAN_1_RPM BIT(6) +#define PB_FAN_1_INSTALLED BIT(7) + +/* + * STATUS_BYTE, STATUS_WORD (lower) + */ +#define PB_STATUS_NONE_ABOVE BIT(0) +#define PB_STATUS_CML BIT(1) +#define PB_STATUS_TEMPERATURE BIT(2) +#define PB_STATUS_VIN_UV BIT(3) +#define PB_STATUS_IOUT_OC BIT(4) +#define PB_STATUS_VOUT_OV BIT(5) +#define PB_STATUS_OFF BIT(6) +#define PB_STATUS_BUSY BIT(7) + +/* + * STATUS_WORD (upper) + */ +#define PB_STATUS_UNKNOWN BIT(8) +#define PB_STATUS_OTHER BIT(9) +#define PB_STATUS_FANS BIT(10) +#define PB_STATUS_POWER_GOOD_N BIT(11) +#define PB_STATUS_WORD_MFR BIT(12) +#define PB_STATUS_INPUT BIT(13) +#define PB_STATUS_IOUT_POUT BIT(14) +#define PB_STATUS_VOUT BIT(15) + +/* + * STATUS_IOUT + */ +#define PB_POUT_OP_WARNING BIT(0) +#define PB_POUT_OP_FAULT BIT(1) +#define PB_POWER_LIMITING BIT(2) +#define PB_CURRENT_SHARE_FAULT BIT(3) +#define PB_IOUT_UC_FAULT BIT(4) +#define PB_IOUT_OC_WARNING BIT(5) +#define PB_IOUT_OC_LV_FAULT BIT(6) +#define PB_IOUT_OC_FAULT BIT(7) + +/* + * STATUS_VOUT, STATUS_INPUT + */ +#define PB_VOLTAGE_UV_FAULT BIT(4) +#define PB_VOLTAGE_UV_WARNING BIT(5) +#define PB_VOLTAGE_OV_WARNING BIT(6) +#define PB_VOLTAGE_OV_FAULT BIT(7) + +/* + * STATUS_INPUT + */ +#define PB_PIN_OP_WARNING BIT(0) +#define PB_IIN_OC_WARNING BIT(1) +#define PB_IIN_OC_FAULT BIT(2) + +/* + * STATUS_TEMPERATURE + */ +#define PB_TEMP_UT_FAULT BIT(4) +#define PB_TEMP_UT_WARNING BIT(5) +#define PB_TEMP_OT_WARNING BIT(6) +#define PB_TEMP_OT_FAULT BIT(7) + +/* + * STATUS_FAN + */ +#define PB_FAN_AIRFLOW_WARNING BIT(0) +#define PB_FAN_AIRFLOW_FAULT BIT(1) +#define PB_FAN_FAN2_SPEED_OVERRIDE BIT(2) +#define PB_FAN_FAN1_SPEED_OVERRIDE BIT(3) +#define PB_FAN_FAN2_WARNING BIT(4) +#define PB_FAN_FAN1_WARNING BIT(5) +#define PB_FAN_FAN2_FAULT BIT(6) +#define PB_FAN_FAN1_FAULT BIT(7) + +/* + * CML_FAULT_STATUS + */ +#define PB_CML_FAULT_OTHER_MEM_LOGIC BIT(0) +#define PB_CML_FAULT_OTHER_COMM BIT(1) +#define PB_CML_FAULT_PROCESSOR BIT(3) +#define PB_CML_FAULT_MEMORY BIT(4) +#define PB_CML_FAULT_PACKET_ERROR BIT(5) +#define PB_CML_FAULT_INVALID_DATA BIT(6) +#define PB_CML_FAULT_INVALID_COMMAND BIT(7) + +enum pmbus_sensor_classes { + PSC_VOLTAGE_IN = 0, + PSC_VOLTAGE_OUT, + PSC_CURRENT_IN, + PSC_CURRENT_OUT, + PSC_POWER, + PSC_TEMPERATURE, + PSC_FAN, + PSC_NUM_CLASSES /* Number of power sensor classes */ +}; + +#define PMBUS_PAGES 32 /* Per PMBus specification */ + +/* Functionality bit mask */ +#define PMBUS_HAVE_VIN BIT(0) +#define PMBUS_HAVE_VCAP BIT(1) +#define PMBUS_HAVE_VOUT BIT(2) +#define PMBUS_HAVE_IIN BIT(3) +#define PMBUS_HAVE_IOUT BIT(4) +#define PMBUS_HAVE_PIN BIT(5) +#define PMBUS_HAVE_POUT BIT(6) +#define PMBUS_HAVE_FAN12 BIT(7) +#define PMBUS_HAVE_FAN34 BIT(8) +#define PMBUS_HAVE_TEMP BIT(9) +#define PMBUS_HAVE_TEMP2 BIT(10) +#define PMBUS_HAVE_TEMP3 BIT(11) +#define PMBUS_HAVE_STATUS_VOUT BIT(12) +#define PMBUS_HAVE_STATUS_IOUT BIT(13) +#define PMBUS_HAVE_STATUS_INPUT BIT(14) +#define PMBUS_HAVE_STATUS_TEMP BIT(15) +#define PMBUS_HAVE_STATUS_FAN12 BIT(16) +#define PMBUS_HAVE_STATUS_FAN34 BIT(17) +#define PMBUS_HAVE_VMON BIT(18) +#define PMBUS_HAVE_STATUS_VMON BIT(19) + +enum pmbus_data_format { linear = 0, direct, vid }; +enum vrm_version { vr11 = 0, vr12, vr13 }; + +struct pmbus_driver_info { + int pages; /* Total number of pages */ + enum pmbus_data_format format[PSC_NUM_CLASSES]; + enum vrm_version vrm_version[PMBUS_PAGES]; + /* + * Support one set of coefficients for each sensor type + * Used for chips providing data in direct mode. + */ + int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ + int b[PSC_NUM_CLASSES]; /* offset */ + int R[PSC_NUM_CLASSES]; /* exponent */ + + u32 func[PMBUS_PAGES]; /* Functionality, per page */ + /* + * The following functions map manufacturing specific register values + * to PMBus standard register values. Specify only if mapping is + * necessary. + * Functions return the register value (read) or zero (write) if + * successful. A return value of -ENODATA indicates that there is no + * manufacturer specific register, but that a standard PMBus register + * may exist. Any other negative return value indicates that the + * register does not exist, and that no attempt should be made to read + * the standard register. + */ + int (*read_byte_data)(struct i2c_client *client, int page, int reg); + int (*read_word_data)(struct i2c_client *client, int page, int reg); + int (*write_word_data)(struct i2c_client *client, int page, int reg, + u16 word); + int (*write_byte)(struct i2c_client *client, int page, u8 value); + /* + * The identify function determines supported PMBus functionality. + * This function is only necessary if a chip driver supports multiple + * chips, and the chip functionality is not pre-determined. + */ + int (*identify)(struct i2c_client *client, + struct pmbus_driver_info *info); + + /* Regulator functionality, if supported by this chip driver. */ + int num_regulators; + const struct regulator_desc *reg_desc; +}; + +/* Regulator ops */ + +extern const struct regulator_ops pmbus_regulator_ops; + +/* Macro for filling in array of struct regulator_desc */ +#define PMBUS_REGULATOR(_name, _id) \ + [_id] = { \ + .name = (_name # _id), \ + .id = (_id), \ + .of_match = of_match_ptr(_name # _id), \ + .regulators_node = of_match_ptr("regulators"), \ + .ops = &pmbus_regulator_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + } + +/* Function declarations */ + +void pmbus_clear_cache(struct i2c_client *client); +int pmbus_set_page(struct i2c_client *client, u8 page); +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_byte(struct i2c_client *client, int page, u8 value); +int pmbus_write_byte_data(struct i2c_client *client, int page, u8 reg, + u8 value); +int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, + u8 mask, u8 value); +void pmbus_clear_faults(struct i2c_client *client); +bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); +bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); +int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info); +int pmbus_do_remove(struct i2c_client *client); +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client + *client); +#endif /* PMBUS_H */ diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg-gpio-xeon.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg-gpio-xeon.c new file mode 100644 index 000000000000..89043f377888 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg-gpio-xeon.c @@ -0,0 +1,357 @@ +/* + * GPIO interface for XEON Super I/O chip + * + * Author: sonic_rd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License 2 as published + * by the Free Software Foundation. + * + * 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; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GPIO_NAME "xeon-gpio" +#define GPIO_IOSIZE 7 +#define GPIO_BASE 0x500 + +#define GPIO_USE_SEL GPIO_BASE +#define GP_IO_SEL (GPIO_BASE+0x4) +#define GP_LVL (GPIO_BASE+0xC) + +#define GPIO_USE_SEL2 (GPIO_BASE+0x30) +#define GP_IO_SEL2 (GPIO_BASE+0x34) +#define GP_LVL2 (GPIO_BASE+0x38) + +#define GPIO_USE_SEL3 (GPIO_BASE+0x40) +#define GP_IO_SEL3 (GPIO_BASE+0x44) +#define GP_LVL3 (GPIO_BASE+0x48) + + +#define GPIO_BASE_ID 0 +#define BANKSIZE 32 + +#define GPIO_SDA 17 +#define GPIO_SCL 1 + +#define GPIO_XEON_SPIN_LOCK(lock, flags) spin_lock_irqsave(&(lock), (flags)) +#define GPIO_XEON_SPIN_UNLOCK(lock, flags) spin_unlock_irqrestore(&(lock), (flags)) +static DEFINE_SPINLOCK(sio_lock); + +/****************** i2c adapter with gpio ***********************/ + +static struct i2c_gpio_platform_data i2c_pdata = { + .timeout = 200, + .udelay = 10, + .scl_is_output_only = 0, + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, +}; + +static struct gpiod_lookup_table rg_gpio_lookup_table = { + .dev_id = "i2c-gpio", + .table = { + GPIO_LOOKUP(GPIO_NAME, GPIO_SDA, "sda", + GPIO_ACTIVE_HIGH), + GPIO_LOOKUP(GPIO_NAME, GPIO_SCL, "scl", + GPIO_ACTIVE_HIGH), + }, +}; + +static void i2c_gpio_release(struct device *dev) +{ + return; +} + +static struct platform_device i2c_gpio = { + .name = "i2c-gpio", + .num_resources = 0, + .id = -1, + + .dev = { + .platform_data = &i2c_pdata, + .release = i2c_gpio_release, + } +}; + +static int xeon_gpio_get(struct gpio_chip *gc, unsigned gpio_num) +{ + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + data = 0; + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_LVL) & (1 << offset); + if (data) { + data = 1; + } + } else if (bank == 1) { + data = inl(GP_LVL2) & (1 << offset); + if (data) { + data = 1; + } + } else if (bank == 2) { + data = inl(GP_LVL3) & (1 << offset); + if (data) { + data = 1; + } + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return data; +} + +static int xeon_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) +{ + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_IO_SEL); + data = data | (1 << offset); + outl(data, GP_IO_SEL); + } else if (bank == 1) { + data = inl(GP_IO_SEL2); + data = data | (1 << offset); + outl(data, GP_IO_SEL2); + } else if (bank == 2) { + data = inl(GP_IO_SEL3); + data = data | (1 << offset); + outl(data, GP_IO_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return 0; +} + +static void xeon_gpio_set(struct gpio_chip *gc, + unsigned gpio_num, int val) +{ + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_LVL); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL); + } else if (bank == 1) { + data = inl(GP_LVL2); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL2); + } else if (bank == 2) { + data = inl(GP_LVL3); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); +} + +static int xeon_gpio_direction_out(struct gpio_chip *gc, + unsigned gpio_num, int val) +{ + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_IO_SEL); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL); + + data = inl(GP_LVL); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL); + } else if (bank == 1) { + data = inl(GP_IO_SEL2); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL2); + + data = inl(GP_LVL2); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL2); + } else if (bank == 2) { + data = inl(GP_IO_SEL3); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL3); + + data = inl(GP_LVL3); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return 0; +} + +static int xeon_gpio_request(struct gpio_chip *chip, unsigned int offset) +{ + unsigned int data; + unsigned int bank, tmp_offset; + unsigned long flags; + + bank = offset / BANKSIZE; + tmp_offset = offset % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GPIO_USE_SEL); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL); + } else if (bank == 1) { + data = inl(GPIO_USE_SEL2); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL2); + } else if (bank == 2) { + data = inl(GPIO_USE_SEL3); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + return 0; +} + +static void xeon_gpio_free(struct gpio_chip *chip, unsigned int offset) +{ + unsigned int data; + unsigned int bank, tmp_offset; + unsigned long flags; + + bank = offset / BANKSIZE; + tmp_offset = offset % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GPIO_USE_SEL); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL); + } else if (bank == 1) { + data = inl(GPIO_USE_SEL2); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL2); + } else if (bank == 2) { + data = inl(GPIO_USE_SEL3); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); +} + +static struct gpio_chip xeon_gpio_chip = { + .label = GPIO_NAME, + .owner = THIS_MODULE, + .get = xeon_gpio_get, + .direction_input = xeon_gpio_direction_in, + .set = xeon_gpio_set, + .direction_output = xeon_gpio_direction_out, + .request = xeon_gpio_request, + .free = xeon_gpio_free, +}; + +static int __init xeon_gpio_init(void) +{ + int err; + if (!request_region(GPIO_BASE, GPIO_IOSIZE, GPIO_NAME)) + return -EBUSY; + + xeon_gpio_chip.base = GPIO_BASE_ID; + xeon_gpio_chip.ngpio = 96; + + err = gpiochip_add_data(&xeon_gpio_chip, NULL); + if (err < 0) + goto gpiochip_add_err; + gpiod_add_lookup_table(&rg_gpio_lookup_table); + err = platform_device_register(&i2c_gpio); + if (err < 0) { + goto i2c_get_adapter_err; + } + return 0; + +i2c_get_adapter_err: + gpiod_remove_lookup_table(&rg_gpio_lookup_table); + platform_device_unregister(&i2c_gpio); + gpiochip_remove(&xeon_gpio_chip); + +gpiochip_add_err: + release_region(GPIO_BASE, GPIO_IOSIZE); + return -1; +} + +static void __exit xeon_gpio_exit(void) +{ + gpiod_remove_lookup_table(&rg_gpio_lookup_table); + platform_device_unregister(&i2c_gpio); + mdelay(100); + gpiochip_remove(&xeon_gpio_chip); + release_region(GPIO_BASE, GPIO_IOSIZE); +} + +module_init(xeon_gpio_init); +module_exit(xeon_gpio_exit); + +MODULE_AUTHOR("sonic_rd "); +MODULE_DESCRIPTION("GPIO interface for XEON Super I/O chip"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_fan.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_fan.c new file mode 100755 index 000000000000..45c9e4ab4c3b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_fan.c @@ -0,0 +1,266 @@ +/* + * rg_fan.c - A driver for control rg_fan base on rg_fan.c + * + * Copyright (c) 1998, 1999 Frodo Looijaard + * Copyright (c) 2019 + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FAN_SIZE (256) +#define SYS_FAN_BUF_LEN (64) + +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +static int debuglevel = 0; + +#define DBG_DEBUG(fmt, arg...) \ + do { \ + if (debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:" fmt, \ + __FUNCTION__, __LINE__, ##arg); \ + } else if (debuglevel >= DBG_ERROR) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:" fmt, __FUNCTION__, \ + __LINE__, ##arg); \ + } else { \ + } \ + } while (0) + +#define DBG_ERROR(fmt, arg...) \ + do { \ + if (debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:" fmt, __FUNCTION__, \ + __LINE__, ##arg); \ + } \ + } while (0) + +extern s32 platform_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); +extern s32 platform_i2c_smbus_read_i2c_block_data( + const struct i2c_client *client, u8 command, u8 length, u8 *values); +extern s32 platform_i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); + +typedef enum dfd_dev_info_type_e { + DFD_DEV_INFO_TYPE_MAC = 1, + DFD_DEV_INFO_TYPE_NAME = 2, + DFD_DEV_INFO_TYPE_SN = 3, + DFD_DEV_INFO_TYPE_PWR_CONS = 4, + DFD_DEV_INFO_TYPE_HW_INFO = 5, + DFD_DEV_INFO_TYPE_DEV_TYPE = 6, +} dfd_dev_tlv_type_t; + +typedef struct dfd_dev_head_info_s { + uint8_t ver; /* define E2PROM version,default is 0x01 */ + uint8_t flag; /* flag is 0x7E in new version E2PROM */ + uint8_t hw_ver; /* consists of main version and revise version */ + uint8_t type; /* HW type */ + int16_t tlv_len; /* 16 bits */ +} dfd_dev_head_info_t; + +typedef struct dfd_dev_tlv_info_s { + uint8_t type; + uint8_t len; + uint8_t data[0]; +} dfd_dev_tlv_info_t; + +struct fan_data { + struct i2c_client *client; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated[8]; /* In jiffies */ + u8 data[FAN_SIZE]; /* Register value */ +}; + +static ssize_t show_fan_sysfs_tlv_value(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct fan_data *data = i2c_get_clientdata(client); + + dfd_dev_head_info_t info; + uint8_t tmp_tlv_len[sizeof(uint16_t)]; + uint8_t *tlv_data; + dfd_dev_tlv_info_t *tlv; + int type; + int buf_len = SYS_FAN_BUF_LEN - 1; + u8 sysfs_buf[SYS_FAN_BUF_LEN]; + int i; + int ret = 0; + + mutex_lock(&data->update_lock); + memset(sysfs_buf, 0, SYS_FAN_BUF_LEN); + ret = platform_i2c_smbus_read_i2c_block_data( + client, 0, sizeof(dfd_dev_head_info_t), (uint8_t *)&info); + if (ret != sizeof(dfd_dev_head_info_t)) { + DBG_ERROR("fan maybe not set mac or not present0"); + goto exit; + } + + /* transform TLV_LEN */ + memcpy(tmp_tlv_len, (uint8_t *)&info.tlv_len, sizeof(int16_t)); + info.tlv_len = (tmp_tlv_len[0] << 8) + tmp_tlv_len[1]; + + if ((info.tlv_len <= 0) || (info.tlv_len > 0xFF)) { + DBG_ERROR("fan maybe not set mac or not present1"); + goto exit; + } + + type = attr->index; + tlv_data = (uint8_t *)kmalloc(info.tlv_len, GFP_KERNEL); + memset(tlv_data, 0, info.tlv_len); + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + for (i = 0; i < info.tlv_len; i += 32) + if (platform_i2c_smbus_read_i2c_block_data(client, + sizeof(dfd_dev_head_info_t) + i, + 32, tlv_data + i) != 32) + break; + } + + DBG_DEBUG("TLV Len:%d\n", (int)sizeof(dfd_dev_tlv_info_t)); + for (tlv = (dfd_dev_tlv_info_t *)tlv_data; + (ulong)tlv < (ulong)tlv_data + info.tlv_len;) { + DBG_DEBUG( + "tlv: %p, tlv->type: 0x%x, tlv->len: 0x%x info->tlv_len: 0x%x\n", + tlv, tlv->type, tlv->len, info.tlv_len); + if (tlv->type == type && buf_len >= tlv->len) { + memcpy((uint8_t *)sysfs_buf, (uint8_t *)tlv->data, + tlv->len); + buf_len = (uint32_t)tlv->len; + break; + } + tlv = (dfd_dev_tlv_info_t *)((uint8_t *)tlv + + sizeof(dfd_dev_tlv_info_t) + + tlv->len); + } + + kfree(tlv_data); + DBG_DEBUG("value: %s \n", sysfs_buf); +exit: + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", sysfs_buf); +} + +static ssize_t show_fan_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct fan_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int i; + + mutex_lock(&data->update_lock); + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + for (i = 0; i < FAN_SIZE; i += 32) { + if (platform_i2c_smbus_read_i2c_block_data( + client, i, 32, data->data + i) != 32) + goto exit; + } + } else { + for (i = 0; i < FAN_SIZE; i += 2) { + int word = platform_i2c_smbus_read_word_data(client, i); + if (word < 0) + goto exit; + data->data[i] = word & 0xff; + data->data[i + 1] = word >> 8; + } + } + memcpy(buf, &data->data[0], FAN_SIZE); +exit: + mutex_unlock(&data->update_lock); + return FAN_SIZE; +} + +static SENSOR_DEVICE_ATTR(fan_hw_version, S_IRUGO, show_fan_sysfs_tlv_value, NULL, DFD_DEV_INFO_TYPE_HW_INFO); +static SENSOR_DEVICE_ATTR(fan_sn, S_IRUGO, show_fan_sysfs_tlv_value, NULL, DFD_DEV_INFO_TYPE_SN); +static SENSOR_DEVICE_ATTR(fan_type, S_IRUGO, show_fan_sysfs_tlv_value, NULL, DFD_DEV_INFO_TYPE_NAME); +static SENSOR_DEVICE_ATTR(fan, S_IRUGO, show_fan_value, NULL, 0); + +static struct attribute *fan_sysfs_attrs[] = { + &sensor_dev_attr_fan_hw_version.dev_attr.attr, + &sensor_dev_attr_fan_sn.dev_attr.attr, + &sensor_dev_attr_fan_type.dev_attr.attr, + &sensor_dev_attr_fan.dev_attr.attr, + NULL +}; + +static const struct attribute_group fan_sysfs_group = { + .attrs = fan_sysfs_attrs, +}; + +static int fan_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct fan_data *data; + int status; + + status = -1; + DBG_DEBUG("fan_probe(0x%02x)\n", client->addr); + data = devm_kzalloc(&client->dev, sizeof(struct fan_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + status = sysfs_create_group(&client->dev.kobj, &fan_sysfs_group); + if (status != 0) { + DBG_ERROR(" sysfs_create_group err\n"); + return status; + } + return 0; +} + +static int fan_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &fan_sysfs_group); + return 0; +} + +static const struct i2c_device_id fan_id[] = { { "rg_fan", 0 }, {} }; +MODULE_DEVICE_TABLE(i2c, fan_id); + +static struct i2c_driver rg_fan_driver = { + .driver = { + .name = "rg_fan", + }, + .probe = fan_probe, + .remove = fan_remove, + .id_table = fan_id, +}; + +module_i2c_driver(rg_fan_driver); +MODULE_AUTHOR("sonic_rd "); +MODULE_DESCRIPTION("ruijie fan driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_psu.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_psu.c new file mode 100755 index 000000000000..4b58a5102f24 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/rg_psu.c @@ -0,0 +1,340 @@ +/* + * rg_cpld.c - A driver for pmbus psu + * + * Copyright (c) 2019 + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAGIC_PSU_RATE (0xA7) +#define MAGIC_PSU_OUT_CURRENT (0x8C) +#define MAGIC_PSU_OUT_VOLTAGE (0x8B) +#define MAGIC_PSU_IN_VOLTAGE (0x88) +#define MAGIC_PSU_IN_CURRENT (0x89) +#define MAGIC_PSU_TEMP (0x8D) +#define MAGIC_PSU_TYPE (0x25) +#define MAGIC_PSU_SN (0x38) +#define MAGIC_PSU_HW (0x35) +#define PSU_SIZE (256) + +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +static int debuglevel = 0; + +#define DBG_DEBUG(fmt, arg...) \ + do { \ + if (debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:" fmt, \ + __FUNCTION__, __LINE__, ##arg); \ + } else if (debuglevel >= DBG_ERROR) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:" fmt, __FUNCTION__, \ + __LINE__, ##arg); \ + } else { \ + } \ + } while (0) + +#define DBG_INFO(fmt, arg...) \ + do { \ + if (debuglevel > DBG_KEY) { \ + printk(KERN_INFO "[INFO]:<%s, %d>:" fmt, __FUNCTION__, \ + __LINE__, ##arg); \ + } \ + } while (0) + +#define DBG_ERROR(fmt, arg...) \ + do { \ + if (debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:" fmt, __FUNCTION__, \ + __LINE__, ##arg); \ + } \ + } while (0) + +static const unsigned short rg_i2c_psu[] = { 0x50, 0x53, 0x58, 0x5b, I2C_CLIENT_END }; + +extern s32 platform_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); +extern s32 platform_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, + u8 command, u8 length, u8 *values); + +struct psu_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[PSU_SIZE]; /* Register value */ +}; + +static ssize_t show_psu_sysfs_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_sysfs_15_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_psu_value(struct device *dev, struct device_attribute *da, char *buf); + +static SENSOR_DEVICE_ATTR(psu_rate, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_RATE); +static SENSOR_DEVICE_ATTR(psu_out_current, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_OUT_CURRENT); +static SENSOR_DEVICE_ATTR(psu_out_voltage, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_OUT_VOLTAGE); +static SENSOR_DEVICE_ATTR(psu_in_voltage, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_IN_VOLTAGE); +static SENSOR_DEVICE_ATTR(psu_in_current, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_IN_CURRENT); +static SENSOR_DEVICE_ATTR(psu_temp, S_IRUGO, show_psu_sysfs_value, NULL, MAGIC_PSU_TEMP); +static SENSOR_DEVICE_ATTR(psu_type, S_IRUGO, show_sysfs_15_value, NULL, MAGIC_PSU_TYPE); +static SENSOR_DEVICE_ATTR(psu_sn, S_IRUGO, show_sysfs_15_value, NULL, MAGIC_PSU_SN); +static SENSOR_DEVICE_ATTR(psu_hw, S_IRUGO, show_psu_value, NULL, MAGIC_PSU_HW); + +static struct attribute *psu_pmbus_sysfs_attrs[] = { + &sensor_dev_attr_psu_rate.dev_attr.attr, + &sensor_dev_attr_psu_out_current.dev_attr.attr, + &sensor_dev_attr_psu_out_voltage.dev_attr.attr, + &sensor_dev_attr_psu_in_voltage.dev_attr.attr, + &sensor_dev_attr_psu_in_current.dev_attr.attr, + &sensor_dev_attr_psu_temp.dev_attr.attr, + NULL +}; + +static struct attribute *psu_fru_sysfs_attrs[] = { + &sensor_dev_attr_psu_type.dev_attr.attr, + &sensor_dev_attr_psu_sn.dev_attr.attr, + &sensor_dev_attr_psu_hw.dev_attr.attr, + NULL +}; + +static const struct attribute_group psu_pmbus_sysfs_attrs_group = { + .attrs = psu_pmbus_sysfs_attrs, +}; + +static const struct attribute_group psu_fru_sysfs_attrs_group = { + .attrs = psu_fru_sysfs_attrs, +}; + +static ssize_t show_psu_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psu_data *data = i2c_get_clientdata(client); + int ret; + char psu_buf[PSU_SIZE]; + memset(psu_buf, 0, PSU_SIZE); + mutex_lock(&data->update_lock); + ret = platform_i2c_smbus_read_i2c_block_data(client, attr->index, 2, psu_buf); + if (ret < 0) { + DBG_ERROR("Failed to read psu\n"); + } + DBG_DEBUG("cpld reg pos:0x%x value:0x%02x\n", attr->index, data->data[0]); + mutex_unlock(&data->update_lock); + return snprintf(buf, 3, "%s\n", psu_buf); +} + +static int linear_to_value(short reg, bool v_out) +{ + short exponent; + int mantissa; + long val; + + if (v_out) { + exponent = -9; + mantissa = reg; + } else { + exponent = reg >> 11; + mantissa = (((reg & 0x7ff) << 5)) >> 5; + } + val = mantissa; + val = val * 1000L; + if (exponent >= 0) { + val <<= exponent; + } else { + val >>= -exponent; + } + + return val; +} + +static ssize_t show_psu_sysfs_value(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psu_data *data = i2c_get_clientdata(client); + int ret; + u8 smbud_buf[PSU_SIZE]; + uint16_t value; + int result; + + ret = -1; + memset(smbud_buf, 0, PSU_SIZE); + mutex_lock(&data->update_lock); + DBG_DEBUG("ret:%d", ret); + ret = platform_i2c_smbus_read_i2c_block_data(client, attr->index, 2, smbud_buf); + if (ret < 0) { + DBG_ERROR("Failed to read psu \n"); + } + value = smbud_buf[1]; + value = value << 8; + value |= smbud_buf[0]; + + if (attr->index == 0x8b) { + result = linear_to_value(value, true); + } else { + result = linear_to_value(value, false); + } + mutex_unlock(&data->update_lock); + return snprintf(buf, PSU_SIZE, "%d\n", result); +} + +static ssize_t show_sysfs_15_value(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psu_data *data = i2c_get_clientdata(client); + int ret; + u8 smbud_buf[PSU_SIZE]; + + memset(smbud_buf, 0, PSU_SIZE); + mutex_lock(&data->update_lock); + ret = platform_i2c_smbus_read_i2c_block_data(client, attr->index, 15, smbud_buf); + if (ret < 0) { + DBG_ERROR("Failed to read psu\n"); + } + mutex_unlock(&data->update_lock); + return snprintf(buf, PSU_SIZE, "%s\n", smbud_buf); +} + +static ssize_t show_sysfs_13_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psu_data *data = i2c_get_clientdata(client); + int ret; + u8 smbud_buf[PSU_SIZE]; + + memset(smbud_buf, 0, PSU_SIZE); + mutex_lock(&data->update_lock); + ret = platform_i2c_smbus_read_i2c_block_data(client, attr->index, 13, smbud_buf); + if (ret < 0) { + DBG_ERROR("Failed to read psu \n"); + } + mutex_unlock(&data->update_lock); + return snprintf(buf, PSU_SIZE, "%s\n", smbud_buf); +} + +static int psu_detect(struct i2c_client *new_client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int conf; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + conf = platform_i2c_smbus_read_byte_data(new_client, 0); + if (!conf) + return -ENODEV; + + return 0; +} + +static int psu_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct psu_data *data; + int status; + + status = -1; + data = devm_kzalloc(&client->dev, sizeof(struct psu_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + switch (client->addr) { + case 0x50: + case 0x53: + status = sysfs_create_group(&client->dev.kobj, + &psu_fru_sysfs_attrs_group); + if (status != 0) { + DBG_ERROR("%s %d sysfs_create_group err\n", __func__, __LINE__); + } + break; + case 0x58: + case 0x5b: + status = sysfs_create_group(&client->dev.kobj, + &psu_pmbus_sysfs_attrs_group); + if (status != 0) { + DBG_ERROR("%s %d sysfs_create_group err\n", __func__, __LINE__); + break; + } + break; + default: + break; + } + + return status; +} + +static int psu_remove(struct i2c_client *client) +{ + switch (client->addr) { + case 0x50: + case 0x53: + sysfs_remove_group(&client->dev.kobj, &psu_fru_sysfs_attrs_group); + break; + case 0x58: + case 0x5b: + sysfs_remove_group(&client->dev.kobj, &psu_pmbus_sysfs_attrs_group); + break; + default: + break; + } + return 0; +} + +static const struct i2c_device_id psu_id[] = { + { "rg_psu", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, psu_id); + +static struct i2c_driver rg_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "rg_psu", + }, + .probe = psu_probe, + .remove = psu_remove, + .id_table = psu_id, + .detect = psu_detect, + .address_list = rg_i2c_psu, +}; + +module_i2c_driver(rg_psu_driver); + +MODULE_AUTHOR("sonic_rd "); +MODULE_DESCRIPTION("ruijie pmbus psu driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/modules/ruijie_platform.c b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/ruijie_platform.c new file mode 100755 index 000000000000..105e6f1d26cf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/modules/ruijie_platform.c @@ -0,0 +1,97 @@ +/* + * ruijie_platform.c - A driver for ruijie platform module + * + * Copyright (c) 2019 + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PLATFORM_I2C_RETRY_TIMES (3) + +s32 platform_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try ++) { + if ((ret = i2c_smbus_read_byte_data(client, command)) >= 0) + break; + } + return ret; +} +EXPORT_SYMBOL(platform_i2c_smbus_read_byte_data); + +s32 platform_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, + u8 command, u8 length, u8 *values) +{ + int try ; + s32 ret; + + ret = -1; + for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try ++) { + if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values)) >= 0) + break; + } + return ret; +} +EXPORT_SYMBOL(platform_i2c_smbus_read_i2c_block_data); + +s32 platform_i2c_smbus_read_word_data(const struct i2c_client *client, u8 command) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try ++) { + if ((ret = i2c_smbus_read_word_data(client, command)) >= 0) + break; + } + return ret; +} +EXPORT_SYMBOL(platform_i2c_smbus_read_word_data); + +static int __init ruijie_platform_init(void) +{ + return 0; +} + +static void __exit ruijie_platform_exit(void) +{ + return; +} + +module_init(ruijie_platform_init); +module_exit(ruijie_platform_exit); + +MODULE_DESCRIPTION("ruijie Platform Support"); +MODULE_AUTHOR("sonic_rd "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/avscontrol.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/avscontrol.py new file mode 100755 index 000000000000..c3461d7fcf67 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/avscontrol.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +import click +import time +import syslog +import traceback +from ruijieutil import waitForDocker, STARTMODULE, AVSUTIL +try: + from rest.rest import BMCMessage +except ImportError: + pass + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + +class AliasedGroup(click.Group): + def get_command(self, ctx, cmd_name): + rv = click.Group.get_command(self, ctx, cmd_name) + if rv is not None: + return rv + matches = [x for x in self.list_commands(ctx) + if x.startswith(cmd_name)] + if not matches: + return None + elif len(matches) == 1: + return click.Group.get_command(self, ctx, matches[0]) + ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) + +def avswarninglog(s): + s = s.decode('utf-8').encode('gb2312') + syslog.openlog("AVSCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_WARNING,s) + +def avscriticallog(s): + s = s.decode('utf-8').encode('gb2312') + syslog.openlog("AVSCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_CRIT,s) + +def avserror(s): + s = s.decode('utf-8').encode('gb2312') + syslog.openlog("AVSCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_ERR,s) + +def avsinfo(s): + syslog.openlog("AVSCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_INFO,s) + +def doAvsCtrol(): + index = 0 + url = "/xyz/openbmc_project/hostchannel/attr/MacRov" + while True: + if "avscontrol_restful" in STARTMODULE and STARTMODULE['avscontrol_restful'] == 1: + try: + #for alibmc rest.py has define get_macrov_value function + get_macrov_value = getattr(BMCMessage(), "get_macrov_value", None) + if callable(get_macrov_value): + macrov_value = int(get_macrov_value()) + else: + macrov_value = int(BMCMessage().getBmcValue(url)) + if macrov_value >= 0: + break + except Exception as e: + time.sleep(2) + continue + else: + if AVSUTIL.mac_adj(): + break + + index += 1 + if index >= 10: + avserror("%%DEV_MONITOR-AVS: MAC Voltage adjust failed.") + exit(-1) + avsinfo("%%AVSCONTROL success") + exit(0) + +def run(interval): + while True: + try: + if waitForDocker(timeout = 0) == True: + time.sleep(10) # w10s + doAvsCtrol() + time.sleep(interval) + except Exception as e: + traceback.print_exc() + print(e) + +@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) +def main(): + '''device operator''' + pass + +@main.command() +def start(): + '''start AVS control''' + avsinfo("%%AVSCONTROL start") + interval = 5 + run(interval) + +##device_i2c operation +if __name__ == '__main__': + main() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/device_i2c.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/device_i2c.py new file mode 100755 index 000000000000..35bca09c0206 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/device_i2c.py @@ -0,0 +1,336 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- + +import click +import os +import subprocess +import time +from ruijieconfig import GLOBALCONFIG, GLOBALINITPARAM, GLOBALINITCOMMAND, MAC_LED_RESET, STARTMODULE, i2ccheck_params + +from ruijieutil import rjpciwr + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + +class AliasedGroup(click.Group): + def get_command(self, ctx, cmd_name): + rv = click.Group.get_command(self, ctx, cmd_name) + if rv is not None: + return rv + matches = [x for x in self.list_commands(ctx) + if x.startswith(cmd_name)] + if not matches: + return None + elif len(matches) == 1: + return click.Group.get_command(self, ctx, matches[0]) + ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) + +def log_os_system(cmd): + u'''execute shell command''' + status, output = subprocess.getstatusoutput(cmd) + if status: + print(output) + return status, output + +def write_sysfs_value(reg_name, value): + u'''write sysfs file''' + mb_reg_file = "/sys/bus/i2c/devices/" + reg_name + if (not os.path.isfile(mb_reg_file)): + print(mb_reg_file, 'not found !') + return False + try: + with open(mb_reg_file, 'w') as fd: + fd.write(value) + except Exception as error: + return False + return True + +def check_driver(): + u'''whether there is driver start with rg''' + status, output = log_os_system("lsmod | grep rg | wc -l") + #System execution error + if status: + return False + if output.isdigit() and int(output) > 0: + return True + else: + return False + +def i2c_getPid(name): + ret = [] + for dirname in os.listdir('/proc'): + if dirname == 'curproc': + continue + try: + with open('/proc/{}/cmdline'.format(dirname), mode='r') as fd: + content = fd.read() + except Exception: + continue + if name in content: + ret.append(dirname) + return ret + +def startAvscontrol(): + cmd = "nohup avscontrol.py start >/dev/null 2>&1 &" + rets = i2c_getPid("avscontrol.py") + if len(rets) == 0: + os.system(cmd) + +def startFanctrol(): + if STARTMODULE['fancontrol'] == 1: + cmd = "nohup fancontrol.py start >/dev/null 2>&1 &" + rets = i2c_getPid("fancontrol.py") + if len(rets) == 0: + os.system(cmd) + +def starthal_fanctrl(): + if STARTMODULE.get('hal_fanctrl',0) == 1: + cmd = "nohup hal_fanctrl.py start >/dev/null 2>&1 &" + rets = i2c_getPid("hal_fanctrl.py") + if len(rets) == 0: + os.system(cmd) + +def starthal_ledctrl(): + if STARTMODULE.get('hal_ledctrl',0) == 1: + cmd = "nohup hal_ledctrl.py start >/dev/null 2>&1 &" + rets = i2c_getPid("hal_ledctrl.py") + if len(rets) == 0: + os.system(cmd) + +def startDevmonitor(): + if STARTMODULE.get('dev_monitor',0) == 1: + cmd = "nohup dev_monitor.py start >/dev/null 2>&1 &" + rets = i2c_getPid("dev_monitor.py") + if len(rets) == 0: + os.system(cmd) + +def startSlotmonitor(): + if STARTMODULE.get('slot_monitor',0) == 1: + cmd = "nohup slot_monitor.py start >/dev/null 2>&1 &" + rets = i2c_getPid("slot_monitor.py") + if len(rets) == 0: + os.system(cmd) + +def stopFanctrol(): + u'''disable fan timer service''' + if STARTMODULE['fancontrol'] == 1: + rets = i2c_getPid("fancontrol.py") # + for ret in rets: + cmd = "kill "+ ret + os.system(cmd) + return True + +def stophal_ledctrl(): + if STARTMODULE.get('hal_ledctrl',0) == 1: + rets = i2c_getPid("hal_ledctrl.py") + for ret in rets: + cmd = "kill "+ ret + os.system(cmd) + return True + + +def stopDevmonitor(): + u'''disable the fan timer service''' + if STARTMODULE.get('dev_monitor',0) == 1: + rets = i2c_getPid("dev_monitor.py") # + for ret in rets: + cmd = "kill "+ ret + os.system(cmd) + return True + +def stopSlotmonitor(): + u'''disable slot timer service''' + if STARTMODULE.get('slot_monitor',0) == 1: + rets = i2c_getPid("slot_monitor.py") # + for ret in rets: + cmd = "kill "+ ret + os.system(cmd) + return True + +def removeDev(bus, loc): + cmd = "echo 0x%02x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (loc, bus) + devpath = "/sys/bus/i2c/devices/%d-%04x"%(bus, loc) + if os.path.exists(devpath): + log_os_system(cmd) + +def addDev(name, bus, loc): + if name == "lm75": + time.sleep(0.1) + pdevpath = "/sys/bus/i2c/devices/i2c-%d/" % (bus) + for i in range(1, 100):#wait for mother-bus generation,maximum wait time is 10s + if os.path.exists(pdevpath) == True: + break + time.sleep(0.1) + if i % 10 == 0: + click.echo("%%DEVICE_I2C-INIT: %s not found, wait 0.1 second ! i %d " % (pdevpath,i)) + + cmd = "echo %s 0x%02x > /sys/bus/i2c/devices/i2c-%d/new_device" % (name, loc, bus) + devpath = "/sys/bus/i2c/devices/%d-%04x"%(bus, loc) + if os.path.exists(devpath) == False: + os.system(cmd) + +def removedevs(): + devs = GLOBALCONFIG["DEVS"] + for index in range(len(devs)-1, -1, -1 ): + removeDev(devs[index]["bus"] , devs[index]["loc"]) + +def adddevs(): + devs = GLOBALCONFIG["DEVS"] + for dev in range(0, devs.__len__()): + addDev(devs[dev]["name"], devs[dev]["bus"] , devs[dev]["loc"]) + +def checksignaldriver(name): + modisexistcmd = "lsmod | grep %s | wc -l" % name + status, output = log_os_system(modisexistcmd) + #System execution error + if status: + return False + if output.isdigit() and int(output) > 0: + return True + else: + return False + +def adddriver(name, delay): + cmd = "modprobe %s" % name + if delay != 0: + time.sleep(delay) + if checksignaldriver(name) != True: + log_os_system(cmd) + +def removedriver(name, delay): + realname = name.lstrip().split(" ")[0]; + cmd = "rmmod -f %s" % realname + if checksignaldriver(realname): + log_os_system(cmd) + +def removedrivers(): + u'''remove all drivers''' + if GLOBALCONFIG is None: + click.echo("%%DEVICE_I2C-INIT: load global config failed.") + return + drivers = GLOBALCONFIG.get("DRIVERLISTS", None) + if drivers is None: + click.echo("%%DEVICE_I2C-INIT: load driver list failed.") + return + for index in range(len(drivers)-1, -1, -1 ): + delay = 0 + name = "" + if type(drivers[index]) == dict and "delay" in drivers[index]: + name = drivers[index].get("name") + delay = drivers[index]["delay"] + else: + name = drivers[index] + removedriver(name, delay) + +def adddrivers(): + u'''add drivers''' + if GLOBALCONFIG is None: + click.echo("%%DEVICE_I2C-INIT: load global config failed.") + return + drivers = GLOBALCONFIG.get("DRIVERLISTS", None) + if drivers is None: + click.echo("%%DEVICE_I2C-INIT: load driver list failed.") + return + for index in range(0 ,len(drivers)): + delay = 0 + name = "" + if type(drivers[index]) == dict and "delay" in drivers[index]: + name = drivers[index].get("name") + delay = drivers[index]["delay"] + else: + name = drivers[index] + adddriver(name, delay) + +def otherinit(): + for index in GLOBALINITPARAM: + write_sysfs_value(index["loc"], index["value"]) + + for index in GLOBALINITCOMMAND: + log_os_system(index) + +def unload_driver(): + u'''remove devices and drivers''' + stopDevmonitor() # disable removable device driver monitors + stopFanctrol() # disable fan-control service + removedevs() # remove other devices + removedrivers() # remove drivers + +def reload_driver(): + u'''reload devices and drivers''' + removedevs() # remove other devices + removedrivers() # remove drivers + time.sleep(1) + adddrivers() + adddevs() + + +def i2c_check(bus,retrytime = 6): + try: + i2cpath = "/sys/bus/i2c/devices/" + bus + while retrytime and not os.path.exists(i2cpath): + click.echo("%%DEVICE_I2C-HA: i2c bus abnormal, last bus %s is not exist." % i2cpath) + reload_driver() + retrytime -= 1 + time.sleep(1) + except Exception as e: + click.echo("%%DEVICE_I2C-HA: %s" % str(e)) + return + +def MacLedSet(data): + '''write pci register''' + pcibus = MAC_LED_RESET.get("pcibus") + slot = MAC_LED_RESET.get("slot") + fn = MAC_LED_RESET.get("fn") + bar = MAC_LED_RESET.get("bar") + offset = MAC_LED_RESET.get("offset") + val = MAC_LED_RESET.get(data, None) + if val is None: + click.echo("%%DEVICE_I2C-INIT: MacLedSet wrong input") + return + rjpciwr(pcibus, slot, fn, bar, offset, val) + +def load_driver(): + u'''load devices and drivers''' + adddrivers() + adddevs() + if STARTMODULE.get("i2ccheck",0) == 1: #i2c HA + busend = i2ccheck_params.get("busend") + retrytime = i2ccheck_params.get("retrytime") + i2c_check(busend,retrytime) + startFanctrol() # enable fan + starthal_fanctrl() # enable fan control + starthal_ledctrl() # enable LED control + if STARTMODULE['avscontrol'] == 1: + startAvscontrol() # avs voltage-adjustment + startDevmonitor() # enable removable device driver monitors + startSlotmonitor() # slot insertion and removal initialization monitor + otherinit(); # other initialization, QSFP initialization + if STARTMODULE.get("macledreset",0) == 1: + MacLedSet("reset") + +@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) +def main(): + '''device operator''' + pass + + +@main.command() +def start(): + '''load device ''' + if check_driver(): + unload_driver() + load_driver() + +@main.command() +def stop(): + '''stop device ''' + unload_driver() + +@main.command() +def restart(): + '''restart device''' + unload_driver() + load_driver() + +if __name__ == '__main__': + u'''device_i2c operation''' + main() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/fancontrol.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/fancontrol.py new file mode 100755 index 000000000000..87fb01e5f6ac --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/fancontrol.py @@ -0,0 +1,838 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +import click +import os +import time +import syslog +from ruijieconfig import MONITOR_CONST, FANCTROLDEBUG, MONITOR_FANS_LED, DEV_LEDS, MONITOR_PSU_STATUS, \ + MONITOR_SYS_PSU_LED, MONITOR_DEV_STATUS, MONITOR_FAN_STATUS, MONITOR_DEV_STATUS_DECODE, \ + MONITOR_SYS_FAN_LED, MONITOR_SYS_LED, fanloc + +from ruijieutil import rji2cget, getMacTemp_sysfs, write_sysfs_value, get_sysfs_value, strtoint, \ + rji2cset + +import traceback +import glob + + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + +DEBUG_COMMON = 0x01 +DEBUG_LEDCONTROL = 0x02 +DEBUG_FANCONTROL = 0x04 + + +class AliasedGroup(click.Group): + def get_command(self, ctx, cmd_name): + rv = click.Group.get_command(self, ctx, cmd_name) + if rv is not None: + return rv + matches = [x for x in self.list_commands(ctx) + if x.startswith(cmd_name)] + if not matches: + return None + elif len(matches) == 1: + return click.Group.get_command(self, ctx, matches[0]) + ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) + +def fanwarninglog(s): + #s = s.decode('utf-8').encode('gb2312') + syslog.openlog("FANCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_WARNING,s) + +def fancriticallog(s): + #s = s.decode('utf-8').encode('gb2312') + syslog.openlog("FANCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_CRIT,s) + +def fanerror(s): + #s = s.decode('utf-8').encode('gb2312') + syslog.openlog("FANCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_ERR,s) + +def fanwarningdebuglog(debuglevel,s): + #s = s.decode('utf-8').encode('gb2312') + if FANCTROLDEBUG & debuglevel: + syslog.openlog("FANCONTROL",syslog.LOG_PID) + syslog.syslog(syslog.LOG_DEBUG,s) + + +class FanControl(object): + critnum = 0 + def __init__(self): + self._fanOKNum = 0 + self._psuOKNum = 0 + self._intemp = -100.0 + self._mac_aver = -100.0 + self._mac_max = -100.0 + self._preIntemp = -1000 # previous temperature + self._outtemp = -100 + self._boardtemp = -100 + self._cputemp = -1000 + + @property + def fanOKNum(self): + return self._fanOKNum; + + @property + def psuOKNum(self): + return self._psuOKNum; + + @property + def cputemp(self): + return self._cputemp; + + @property + def intemp(self): + return self._intemp; + + @property + def outtemp(self): + return self._outtemp; + + @property + def boardtemp(self): + return self._boardtemp; + + @property + def mac_aver(self): + return self._mac_aver; + + @property + def preIntemp(self): + return self._preIntemp; + + @property + def mac_max(self): + return self._mac_max; + + def sortCallback(self, element): + return element['id'] + + def gettemp(self,ret): + u'''get inlet, outlet, hot-point and cpu temperature''' + temp_conf = MONITOR_DEV_STATUS.get('temperature', None) + + if temp_conf is None: + fanerror("gettemp: config error") + return False + for item_temp in temp_conf: + try: + retval = "" + rval = None + name = item_temp.get('name') + location = item_temp.get('location') + if name == "cpu": + L=[] + for dirpath, dirnames, filenames in os.walk(location): + for file in filenames : + if file.endswith("input"): + L.append(os.path.join(dirpath, file)) + L =sorted(L,reverse=False) + for i in range(len(L)): + nameloc = "%s/temp%d_label"%(location,i+1) + valloc = "%s/temp%d_input"%(location,i+1) + with open(nameloc, 'r') as fd1: + retval2 = fd1.read() + with open(valloc, 'r') as fd2: + retval3 = fd2.read() + ret_t ={} + ret_t["name"] = retval2.strip() + ret_t["value"] = float(retval3)/1000 + ret.append(ret_t) + fanwarningdebuglog(DEBUG_COMMON,"gettemp %s : %f" % (ret_t["name"],ret_t["value"])) + else: + locations = glob.glob(location) + with open(locations[0], 'r') as fd1: + retval = fd1.read() + rval = float(retval)/1000 + ret_t ={} + ret_t["name"] = name + ret_t["value"] = rval + ret.append(ret_t) + fanwarningdebuglog(DEBUG_COMMON,"gettemp %s : %f" % (ret_t["name"],ret_t["value"])) + except Exception as e: + fanerror("gettemp error:name:%s" % name) + fanerror(str(e)) + return True + + def checkslot(self,ret): + u'''get slot present status''' + slots_conf = MONITOR_DEV_STATUS.get('slots', None) + slotpresent = MONITOR_DEV_STATUS_DECODE.get('slotpresent',None) + + if slots_conf is None or slotpresent is None: + return False + for item_slot in slots_conf: + totalerr = 0 + try: + ret_t = {} + ret_t["id"] = item_slot.get('name') + ret_t["status"] = "" + gettype = item_slot.get('gettype') + presentbit = item_slot.get('presentbit') + if gettype == "io": + io_addr = item_slot.get('io_addr') + val = io_rd(io_addr) + if val is not None: + retval = val + else: + totalerr -= 1 + fanerror(" %s %s" % (item_slot.get('name'), "lpc read failed")) + else: + bus = item_slot.get('bus') + loc = item_slot.get('loc') + offset = item_slot.get('offset') + ind, val = rji2cget(bus, loc,offset) + if ind == True: + retval = val + else: + totalerr -= 1 + fanerror(" %s %s" % (item_slot.get('name'), "i2c read failed")) + if totalerr < 0 : + ret_t["status"] = "NOT OK" + ret.append(ret_t) + continue + val_t = (int(retval,16) & (1<< presentbit)) >> presentbit + fanwarningdebuglog(DEBUG_COMMON,"%s present:%s" % (item_slot.get('name'),slotpresent.get(val_t))) + if val_t != slotpresent.get('okval'): + ret_t["status"] = "ABSENT" + else: + ret_t["status"] = "PRESENT" + except Exception as e: + ret_t["status"] = "NOT OK" + totalerr -= 1 + fanerror("checkslot error") + fanerror(str(e)) + ret.append(ret_t) + return True + + def checkpsu(self,ret): + u'''get psu status present, output and warning''' + psus_conf = MONITOR_DEV_STATUS.get('psus', None) + psupresent = MONITOR_DEV_STATUS_DECODE.get('psupresent',None) + psuoutput = MONITOR_DEV_STATUS_DECODE.get('psuoutput',None) + psualert = MONITOR_DEV_STATUS_DECODE.get('psualert',None) + + if psus_conf is None or psupresent is None or psuoutput is None: + fanerror("checkpsu: config error") + return False + for item_psu in psus_conf: + totalerr = 0 + try: + ret_t = {} + ret_t["id"] = item_psu.get('name') + ret_t["status"] = "" + gettype = item_psu.get('gettype') + presentbit = item_psu.get('presentbit') + statusbit = item_psu.get('statusbit') + alertbit = item_psu.get('alertbit') + if gettype == "io": + io_addr = item_psu.get('io_addr') + val = io_rd(io_addr) + if val is not None: + retval = val + else: + totalerr -= 1 + fanerror(" %s %s" % (item_psu.get('name'), "lpc read failed")) + else: + bus = item_psu.get('bus') + loc = item_psu.get('loc') + offset = item_psu.get('offset') + ind, val = rji2cget(bus, loc,offset) + if ind == True: + retval = val + else: + totalerr -= 1 + fanerror(" %s %s" % (item_psu.get('name'), "i2c read failed")) + if totalerr < 0 : + ret_t["status"] = "NOT OK" + ret.append(ret_t) + continue + val_t = (int(retval,16) & (1<< presentbit)) >> presentbit + val_status = (int(retval,16) & (1<< statusbit)) >> statusbit + val_alert = (int(retval,16) & (1<< alertbit)) >> alertbit + fanwarningdebuglog(DEBUG_COMMON,"%s present:%s output:%s alert:%s" % (item_psu.get('name'),psupresent.get(val_t),psuoutput.get(val_status),psualert.get(val_alert))) + if val_t != psupresent.get('okval') or val_status != psuoutput.get('okval') or val_alert != psualert.get('okval'): + totalerr -=1 + except Exception as e: + totalerr -= 1 + fanerror("checkpsu error") + fanerror(str(e)) + if totalerr < 0: + ret_t["status"] = "NOT OK" + else: + ret_t["status"] = "OK" + ret.append(ret_t) + return True + + def checkfan(self,ret): + u'''get fan status present and roll''' + fans_conf = MONITOR_DEV_STATUS.get('fans', None) + fanpresent = MONITOR_DEV_STATUS_DECODE.get('fanpresent',None) + fanroll = MONITOR_DEV_STATUS_DECODE.get('fanroll',None) + + if fans_conf is None or fanpresent is None or fanroll is None: + fanerror("checkfan: config error") + return False + for item_fan in fans_conf: + totalerr = 0 + try: + ret_t = {} + ret_t["id"] = item_fan.get('name') + ret_t["status"] = "" + presentstatus = item_fan.get('presentstatus') + presentbus = presentstatus.get('bus') + presentloc = presentstatus.get('loc') + presentaddr = presentstatus.get('offset') + presentbit = presentstatus.get('bit') + ind, val = rji2cget(presentbus, presentloc,presentaddr) + if ind == True: + val_t = (int(val,16) & (1<< presentbit)) >> presentbit + fanwarningdebuglog(DEBUG_COMMON,"checkfan:%s present status:%s" % (item_fan.get('name'),fanpresent.get(val_t))) + if val_t != fanpresent.get('okval'): + ret_t["status"] = "ABSENT" + ret.append(ret_t) + continue + else: + fanerror("checkfan: %s get present status error." % item_fan.get('name')) + motors = item_fan.get("rollstatus") + for motor in motors: + statusbus = motor.get('bus', None) + statusloc = motor.get('loc', None) + statusaddr = motor.get('offset', None) + statusbit = motor.get('bit', None) + ind, val = rji2cget(statusbus, statusloc, statusaddr) + if ind == True: + val_t = (int(val,16) & (1<< statusbit)) >> statusbit + fanwarningdebuglog(DEBUG_COMMON,"checkfan:%s roll status:%s" % (motor.get('name'),fanroll.get(val_t))) + if val_t != fanroll.get('okval'): + totalerr -= 1 + else: + totalerr -= 1 + fanerror("checkfan: %s " % item_fan.get('name')) + fanerror("get %s status error." % motor["name"]) + except Exception as e: + totalerr -= 1 + fanerror("checkfan error") + fanerror(str(e)) + if totalerr < 0: + ret_t["status"] = "NOT OK" + else: + ret_t["status"] = "OK" + ret.append(ret_t) + return True + + def getCurrentSpeed(self): + try: + loc = fanloc[0].get("location","") + sped = get_sysfs_value(loc) + value = strtoint(sped) + return value + except Exception as e: + fanerror("%%policy: get current speedlevel error") + fanerror(str(e)) + return None + + # guarantee the speed is lowest when speed lower than lowest value after speed-adjustment + def checkCurrentSpeedSet(self): + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy: guarantee the lowest speed after speed-adjustment") + value = self.getCurrentSpeed() + if value is None or value == 0: + raise Exception("%%policy: getCurrentSpeed None") + elif value < MONITOR_CONST.MIN_SPEED: + self.fanSpeedSet(MONITOR_CONST.MIN_SPEED) + + + def fanSpeedSet(self, level): + if level >= MONITOR_CONST.MAX_SPEED: + level = MONITOR_CONST.MAX_SPEED + for item in fanloc: + try: + loc = item.get("location","") + write_sysfs_value(loc, "0x%02x"% level ) + except Exception as e: + fanerror(str(e)) + fanerror("%%policy: config fan runlevel error") + self.checkCurrentSpeedSet() # guaranteed minimum + + def fanSpeedSetMax(self): + try: + self.fanSpeedSet(MONITOR_CONST.MAX_SPEED) + except Exception as e: + fanerror("%%policy:fanSpeedSetMax failed") + fanerror(str(e)) + + def fanStatusCheck(self): # fan status check , max speed if fan error + if self.fanOKNum < MONITOR_CONST.FAN_TOTAL_NUM: + fanwarninglog("%%DEV_MONITOR-FAN: Normal fan number: %d" % (self.fanOKNum)) + self.fanSpeedSetMax() + return False + return True + + def setFanAttr(self,val): + u'''set status of each fan''' + for item in val: + fanid = item.get("id") + fanattr = fanid + "status" + fanstatus = item.get("status") + setattr(FanControl,fanattr,fanstatus) + fanwarningdebuglog(DEBUG_COMMON,"fanattr:%s,fanstatus:%s"% (fanattr,fanstatus)) + + def getFanPresentNum(self,curFanStatus): + fanoknum = 0; + for item in curFanStatus: + if item["status"] == "OK": + fanoknum += 1 + self._fanOKNum = fanoknum + fanwarningdebuglog(DEBUG_COMMON,"fanOKNum = %d"% self._fanOKNum) + + def getFanStatus(self): + try: + curFanStatus = [] + ret = self.checkfan(curFanStatus) + if ret == True: + self.setFanAttr(curFanStatus) + self.getFanPresentNum(curFanStatus) + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getFanStatus success" ) + return 0 + except AttributeError as e: + fanerror(str(e)) + except Exception as e: + fanerror(str(e)) + return -1 + + def getPsuOkNum(self,curPsuStatus): + psuoknum = 0; + for item in curPsuStatus: + if item.get("status") == "OK": + psuoknum += 1 + self._psuOKNum = psuoknum + fanwarningdebuglog(DEBUG_COMMON,"psuOKNum = %d"% self._psuOKNum) + + def getPsuStatus(self): + try: + curPsuStatus = [] + ret = self.checkpsu(curPsuStatus) + if ret == True: + self.getPsuOkNum(curPsuStatus) + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getPsuStatus success" ) + return 0 + except AttributeError as e: + fanerror(str(e)) + except Exception as e: + fanerror(str(e)) + return -1 + + def getMonitorTemp(self, temp): + for item in temp: + if item.get('name') == "lm75in": + self._intemp = item.get('value',self._intemp) + if item.get('name') == "lm75out": + self._outtemp = item.get('value',self._outtemp) + if item.get('name') == "lm75hot": + self._boardtemp = item.get('value',self._boardtemp) + if item.get('name') == "Physical id 0": + self._cputemp = item.get('value',self._cputemp) + fanwarningdebuglog(DEBUG_COMMON,"intemp:%f, outtemp:%f, boadrtemp:%f, cputemp:%f"% (self._intemp,self._outtemp,self._boardtemp,self._cputemp)) + + def getTempStatus(self): + try: + monitortemp =[] + ret = self.gettemp(monitortemp) + if ret == True: + self.getMonitorTemp(monitortemp) + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getTempStatus success" ) + return 0 + except AttributeError as e: + fanerror(str(e)) + except Exception as e: + fanerror(str(e)) + return -1 + + def getMacStatus_bcmcmd(self): + try: + if waitForDocker(timeout = 0) == True : + sta, ret = getMacTemp() + if sta == True: + self._mac_aver = float(ret.get("average",self._mac_aver)) + self._mac_max = float(ret.get("maximum",self._mac_max)) + fanwarningdebuglog(DEBUG_COMMON,"mac_aver:%f, mac_max:%f" % (self.mac_aver,self._mac_max)) + else: + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getMacStatus_bcmcmd failed" ) + else: + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getMacStatus_bcmcmd SDK not OK" ) + return 0 + except AttributeError as e: + fanerror(str(e)) + return -1 + + def getMacStatus_sysfs(self,conf): + try: + sta, ret = getMacTemp_sysfs(conf) + if sta == True: + self._mac_aver = float(ret) / 1000 + self._mac_max = float(ret) / 1000 + fanwarningdebuglog(DEBUG_COMMON,"mac_aver:%f, mac_max:%f" % (self.mac_aver,self._mac_max)) + elif conf.get("try_bcmcmd", 0) == 1: + fanwarningdebuglog(DEBUG_COMMON,"get sysfs mac temp failed.try to use bcmcmd") + self.getMacStatus_bcmcmd() + else: + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getMacStatus_sysfs failed" ) + return 0 + except AttributeError as e: + fanerror(str(e)) + return -1 + + def getMacStatus(self): + try: + mactempconf = MONITOR_DEV_STATUS.get('mac_temp', None) + if mactempconf is not None: + self.getMacStatus_sysfs(mactempconf) + else: + self.getMacStatus_bcmcmd() + return 0 + except AttributeError as e: + fanerror(str(e)) + return -1 + + def settSlotAttr(self,val): + u'''set each slot present status attribute''' + for item in val: + slotid = item.get("id") + slotattr = slotid + "status" + slotstatus = item.get("status") + setattr(FanControl,slotattr,slotstatus) + fanwarningdebuglog(DEBUG_COMMON,"slotattr:%s,slotstatus:%s"% (slotattr,slotstatus)) + + def getSlotStatus(self): + try: + curSlotStatus = [] + ret = self.checkslot(curSlotStatus) + if ret == True: + self.settSlotAttr(curSlotStatus) + fanwarningdebuglog(DEBUG_COMMON,"%%policy:getSlotStatus success" ) + except AttributeError as e: + fanerror(str(e)) + return 0 + + def fanctrol(self): #fan speed-adjustment + try: + if self.preIntemp <= -1000: + self.preIntemp = self.intemp + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:previous temperature[%.2f] , current temperature[%.2f]" % (self.preIntemp,self.intemp)) + if self.intemp < MONITOR_CONST.TEMP_MIN: + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:inlet %.2f minimum temperature: %.2f" %(self.intemp,MONITOR_CONST.TEMP_MIN)) + self.fanSpeedSet(MONITOR_CONST.DEFAULT_SPEED) # default level + elif self.intemp >= MONITOR_CONST.TEMP_MIN and self.intemp > self.preIntemp: + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:increase temperature") + self.policySpeed(self.intemp) + elif self.intemp >= MONITOR_CONST.TEMP_MIN and (self.preIntemp - self.intemp) > MONITOR_CONST.MONITOR_FALL_TEMP: + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:temperature reduce over %d degree" % MONITOR_CONST.MONITOR_FALL_TEMP) + self.policySpeed(self.intemp) + else: + speed = self.getCurrentSpeed()# set according to current speed, prevent fan watch-dog + if speed is not None: + self.fanSpeedSet(speed) + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:change nothing") + except Exception as e: + fanerror("%%policy: fancontrol error") + + # start speed-adjustment + def startFanCtrol(self): + self.checkCrit() + if self.critnum == 0 and self.checkWarning() == False and self.fanStatusCheck() ==True: + self.fanctrol() + self.checkDevError() + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy: speed after speed-adjustment is %0x" % (self.getCurrentSpeed())) + + def policySpeed(self, temp): # fan speed-adjustment algorithm + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:fan speed-adjustment algorithm") + sped_level = MONITOR_CONST.DEFAULT_SPEED + MONITOR_CONST.K * (temp - MONITOR_CONST.TEMP_MIN) + self.fanSpeedSet(sped_level) + self.preIntemp = self.intemp + + def getBoardMonitorMsg(self,ledcontrol = False): + ret_t = 0 + try: + ret_t += self.getFanStatus() # get fan status, get number of fan which status is OK + ret_t += self.getTempStatus() # get inlet, outlet, hot-point temperature, CPU temperature + ret_t += self.getMacStatus() # get MAC highest and average temperature + if ledcontrol == True: + ret_t += self.getSlotStatus() # get slot present status + ret_t += self.getPsuStatus() # get psu status + if ret_t == 0: + return True + except Exception as e: + fanerror(str(e)) + return False + + # device error algorithm Tmac-Tin≥50℃, or Tmac-Tin≤-50℃ + def checkDevError(self): + try: + if (self.mac_aver - self.intemp) >= MONITOR_CONST.MAC_UP_TEMP or (self.mac_aver - self.intemp) <= MONITOR_CONST.MAC_LOWER_TEMP: + fanwarningdebuglog(DEBUG_FANCONTROL,"%%DEV_MONITOR-TEMP: MAC temp get failed.") + value = self.getCurrentSpeed() + if MONITOR_CONST.MAC_ERROR_SPEED >= value: + self.fanSpeedSet(MONITOR_CONST.MAC_ERROR_SPEED) + else: + self.fanSpeedSetMax() + else: + pass + except Exception as e: + fanerror("%%policy:checkDevError failed") + fanerror(str(e)) + + def checkTempWarning(self): + u'''check whether temperature above the normal alarm value''' + try: + if self._mac_aver >= MONITOR_CONST.MAC_WARNING_THRESHOLD \ + or self._outtemp >= MONITOR_CONST.OUTTEMP_WARNING_THRESHOLD \ + or self._boardtemp >= MONITOR_CONST.BOARDTEMP_WARNING_THRESHOLD \ + or self._cputemp>=MONITOR_CONST.CPUTEMP_WARNING_THRESHOLD \ + or self._intemp >=MONITOR_CONST.INTEMP_WARNING_THRESHOLD: + fanwarningdebuglog(DEBUG_COMMON,"check whether temperature above the normal alarm value") + return True + except Exception as e: + fanerror("%%policy: checkTempWarning failed") + fanerror(str(e)) + return False + + def checkTempCrit(self): + u'''check whether temperature above the critical alarm value''' + try: + if self._mac_aver >= MONITOR_CONST.MAC_CRITICAL_THRESHOLD \ + or ( self._outtemp >= MONITOR_CONST.OUTTEMP_CRITICAL_THRESHOLD \ + and self._boardtemp >= MONITOR_CONST.BOARDTEMP_CRITICAL_THRESHOLD \ + and self._cputemp>= MONITOR_CONST.CPUTEMP_CRITICAL_THRESHOLD \ + and self._intemp >= MONITOR_CONST.INTEMP_CRITICAL_THRESHOLD): + fanwarningdebuglog(DEBUG_COMMON,"temperature above the critical alarm value") + return True + except Exception as e: + fanerror("%%policy: checkTempCrit failed") + fanerror(str(e)) + return False + + def checkFanStatus(self): + u'''check fan status''' + for item in MONITOR_FAN_STATUS: + maxoknum = item.get('maxOkNum') + minoknum = item.get('minOkNum') + status = item.get('status') + if self.fanOKNum >= minoknum and self.fanOKNum <= maxoknum : + fanwarningdebuglog(DEBUG_COMMON,"checkFanStatus:fanOKNum:%d,status:%s" % (self.fanOKNum,status)) + return status + fanwarningdebuglog(DEBUG_COMMON,"checkFanStatus Error:fanOKNum:%d" % (self.fanOKNum)) + return None + + def checkPsuStatus(self): + u'''check psu status''' + for item in MONITOR_PSU_STATUS: + maxoknum = item.get('maxOkNum') + minoknum = item.get('minOkNum') + status = item.get('status') + if self.psuOKNum >= minoknum and self.psuOKNum <= maxoknum : + fanwarningdebuglog(DEBUG_COMMON,"checkPsuStatus:psuOKNum:%d,status:%s" % (self.psuOKNum,status)) + return status + fanwarningdebuglog(DEBUG_COMMON,"checkPsuStatus Error:psuOKNum:%d" % (self.psuOKNum)) + return None + + def dealSysLedStatus(self): + u'''set up SYSLED according to temperature, fan and psu status''' + try: + fanstatus = self.checkFanStatus() + psustatus = self.checkPsuStatus() + if self.checkTempCrit() == True or fanstatus == "red" or psustatus == "red": + status = "red" + elif self.checkTempWarning() == True or fanstatus == "yellow" or psustatus == "yellow": + status = "yellow" + else: + status = "green" + self.setSysLed(status) + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:dealSysLedStatus success, status:%s," % status) + except Exception as e: + fanerror(str(e)) + + def dealSysFanLedStatus(self): + u'''light panel fan led according to status''' + try: + status = self.checkFanStatus() + if status is not None: + self.setSysFanLed(status) + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:dealSysFanLedStatus success, status:%s," % status) + except Exception as e: + fanerror("%%ledcontrol:dealSysLedStatus error") + fanerror(str(e)) + + def dealPsuLedStatus(self): + u'''set up PSU-LED according to psu status''' + try: + status = self.checkPsuStatus() + if status is not None: + self.setSysPsuLed(status) + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:dealPsuLedStatus success, status:%s," % status) + except Exception as e: + fanerror("%%ledcontrol:dealPsuLedStatus error") + fanerror(str(e)) + + def dealLocFanLedStatus(self): + u'''light fan led according to fan status''' + for item in MONITOR_FANS_LED: + try: + index = MONITOR_FANS_LED.index(item) + 1 + fanattr = "fan%dstatus" % index + val_t = getattr(FanControl,fanattr,None) + if val_t == "NOT OK": + rji2cset(item["bus"],item["devno"],item["addr"], item["red"]) + elif val_t == "OK": + rji2cset(item["bus"],item["devno"],item["addr"], item["green"]) + else: + pass + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:dealLocFanLed success.fanattr:%s, status:%s"% (fanattr,val_t)) + except Exception as e: + fanerror("%%ledcontrol:dealLocFanLedStatus error") + fanerror(str(e)) + + def dealSlotLedStatus(self): + u'''light slot status led according to slot present status''' + slotLedList = DEV_LEDS.get("SLOTLED",[]) + for item in slotLedList: + try: + index = slotLedList.index(item) + 1 + slotattr = "slot%dstatus" % index + val_t = getattr(FanControl,slotattr,None) + if val_t == "PRESENT": + rji2cset(item["bus"],item["devno"],item["addr"], item["green"]) + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:dealSlotLedStatus success.slotattr:%s, status:%s"% (slotattr,val_t)) + except Exception as e: + fanerror("%%ledcontrol:dealSlotLedStatus error") + fanerror(str(e)) + + def dealBmcLedstatus(self,val): + pass + + def dealLctLedstatus(self,val): + pass + + def setled(self, item, color): + if item.get('type', 'i2c') == 'sysfs': + rjsysset(item["cmdstr"], item.get(color)) + else : + mask = item.get('mask', 0xff) + ind, val = rji2cget(item["bus"], item["devno"], item["addr"]) + if ind == True: + setval = (int(val,16) & ~mask) | item.get(color) + rji2cset(item["bus"], item["devno"], item["addr"], setval) + else: + fanerror("led %s" % "i2c read failed") + + def setSysLed(self,color): + for item in MONITOR_SYS_LED: + self.setled(item, color) + + def setSysFanLed(self,color): + for item in MONITOR_SYS_FAN_LED: + self.setled(item, color) + + def setSysPsuLed(self,color): + for item in MONITOR_SYS_PSU_LED: + self.setled(item, color) + + def checkWarning(self): + try: + if self.checkTempWarning() == True: + fanwarningdebuglog(DEBUG_FANCONTROL,"anti-shake start") + time.sleep(MONITOR_CONST.SHAKE_TIME) + fanwarningdebuglog(DEBUG_FANCONTROL,"anti-shake end") + self.getBoardMonitorMsg()# re-read + if self.checkTempWarning() == True: + fanwarninglog("%%DEV_MONITOR-TEMP:The temperature of device is over warning value.") + self.fanSpeedSetMax() # fan full speed + return True + except Exception as e: + fanerror("%%policy: checkWarning failed") + fanerror(str(e)) + return False + + def checkCrit(self): + try: + if self.checkTempCrit() == True: + fanwarningdebuglog(DEBUG_FANCONTROL,"anti-shake start") + time.sleep(MONITOR_CONST.SHAKE_TIME) + fanwarningdebuglog(DEBUG_FANCONTROL,"anti-shake end") + self.getBoardMonitorMsg()# re-read + if self.checkTempCrit() == True: + fancriticallog("%%DEV_MONITOR-TEMP:The temperature of device is over critical value.") + self.fanSpeedSetMax() # fan full speed + self.critnum += 1 # anti-shake + if self.critnum >= MONITOR_CONST.CRITICAL_NUM: + os.system("reboot") + fanwarningdebuglog(DEBUG_FANCONTROL,"crit次数:%d" % self.critnum) + else: + self.critnum = 0 + else: + self.critnum = 0 + except Exception as e: + fanerror("%%policy: checkCrit failed") + fanerror(str(e)) + + +def callback(): + pass + +def doFanCtrol(fanCtrol): + ret = fanCtrol.getBoardMonitorMsg() + if ret==True: + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:startFanCtrol") + fanCtrol.startFanCtrol() + else: + fanCtrol.fanSpeedSetMax() + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:getBoardMonitorMsg error") + +def doLedCtrol(fanCtrol): + fanCtrol.getBoardMonitorMsg(ledcontrol = True) # get status + fanCtrol.dealSysLedStatus() # light system led + fanCtrol.dealSysFanLedStatus() # light panel fan led + fanCtrol.dealLocFanLedStatus() # light fan led + fanCtrol.dealPsuLedStatus() # light psu led + fanCtrol.dealSlotLedStatus() # light slot status led + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:doLedCtrol success") + +def run(interval, fanCtrol): + loop = 0 + # waitForDocker() + while True: + try: + if loop % MONITOR_CONST.MONITOR_INTERVAL ==0: # fan speed-adjustment + fanwarningdebuglog(DEBUG_FANCONTROL,"%%policy:fanCtrol") + doFanCtrol(fanCtrol) + else: + fanwarningdebuglog(DEBUG_LEDCONTROL,"%%ledcontrol:start ledctrol")# LED control + doLedCtrol(fanCtrol) + time.sleep(interval) + loop += interval + except Exception as e: + traceback.print_exc() + fanerror(str(e)) + +@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) +def main(): + '''device operator''' + pass + +@main.command() +def start(): + '''start fan control''' + fanwarninglog("FANCTROL start") + fanCtrol = FanControl() + interval = MONITOR_CONST.MONITOR_INTERVAL /30 + run(interval, fanCtrol) + +@main.command() +def stop(): + '''stop fan control ''' + fanwarninglog("stop") + +##device_i2c operation +if __name__ == '__main__': + main() diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijiecommon.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijiecommon.py new file mode 100755 index 000000000000..53eac5ce1ce4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijiecommon.py @@ -0,0 +1,717 @@ +# -*- coding: UTF-8 -*- +#------------------------------------------------------------------------------- +# Name: Ruijie python common module +# Purpose: called by other modules +# +# Author: rd +# +# Created: 02/07/2018 +# Copyright: (c) rd 2018 +#------------------------------------------------------------------------------- + +################################driver-load-adaption####################################################### +# need to export interface +################################################################################################### + +__all__ = ["fancontrol_loc", "fancontrol_config_loc", "GLOBALCONFIG", "MONITOR_CONST", + "RUIJIE_PART_NUMBER", "RUIJIE_LABEL_REVISION", "RUIJIE_ONIE_VERSION", "RUIJIE_MAC_SIZE", + "RUIJIE_MANUF_NAME", "RUIJIE_MANUF_COUNTRY", "RUIJIE_VENDOR_NAME", "RUIJIE_DIAG_VERSION", + "RUIJIE_SERVICE_TAG", "DEV_LEDS", "MEM_SLOTS", "LOCAL_LED_CONTROL", "FIRMWARE_TOOLS", + "STARTMODULE", "i2ccheck_params", "FANS_DEF", "factest_module", "MONITOR_TEMP_MIN", + "MONITOR_K", "MONITOR_MAC_IN", "MONITOR_DEFAULT_SPEED", "MONITOR_MAX_SPEED", + "MONITOR_MIN_SPEED", "MONITOR_MAC_ERROR_SPEED","MONITOR_FAN_TOTAL_NUM", + "MONITOR_MAC_UP_TEMP", "MONITOR_MAC_LOWER_TEMP","MONITOR_MAC_MAX_TEMP", + "MONITOR_FALL_TEMP","MONITOR_MAC_WARNING_THRESHOLD", "MONITOR_OUTTEMP_WARNING_THRESHOLD", + "MONITOR_BOARDTEMP_WARNING_THRESHOLD", "MONITOR_CPUTEMP_WARNING_THRESHOLD", + "MONITOR_INTEMP_WARNING_THRESHOLD", "MONITOR_MAC_CRITICAL_THRESHOLD", + "MONITOR_OUTTEMP_CRITICAL_THRESHOLD", "MONITOR_BOARDTEMP_CRITICAL_THRESHOLD", + "MONITOR_CPUTEMP_CRITICAL_THRESHOLD", "MONITOR_INTEMP_CRITICAL_THRESHOLD", + "MONITOR_CRITICAL_NUM", "MONITOR_SHAKE_TIME", "MONITOR_INTERVAL", + "MONITOR_MAC_SOURCE_SYSFS", "MONITOR_MAC_SOURCE_PATH", "MAC_AVS_PARAM", + "MAC_DEFAULT_PARAM", "MONITOR_SYS_LED", "MONITOR_SYS_FAN_LED", "MONITOR_FANS_LED", + "MONITOR_SYS_PSU_LED", "MONITOR_FAN_STATUS", "MONITOR_PSU_STATUS", "MONITOR_DEV_STATUS", + "MONITOR_DEV_STATUS_DECODE", "DEV_MONITOR_PARAM", "SLOT_MONITOR_PARAM", "fanloc", + "PCA9548START", "PCA9548BUSEND", "RUIJIE_CARDID", "RUIJIE_PRODUCTNAME", "FAN_PROTECT", + "rg_eeprom", "E2_LOC", "E2_PROTECT", "MAC_LED_RESET", "INIT_PARAM", "INIT_COMMAND", + "CPLDVERSIONS", "DRIVERLISTS", "DEVICE", "E2TYPE", "FRULISTS", "fanlevel_6510", + "fanlevel_6520", "fanlevel", "TEMPIDCHANGE", "FACTESTMODULE", "item1", + "test_sys_reload_item", "test_sys_item", "test_temp_item", "test_mem_item", + "test_hd_item", "test_rtc_item", "test_i2c_item", "test_cpld_item", + "test_portframe_item", "test_sysled_item", "test_fan_item", "test_power_item", + "test_usb_item", "test_prbs_item", "test_portbroadcast_item", "test_debug_level", + "test_log_level", "test_setmac", "test_setrtc", "log_level_critical", "log_level_debug", + "log_level_error", "log_level_info", "log_level_notset", "log_level_warning", + "test_e2_setmac_item", "test_bmc_setmac_item", "test_fan_setmac_item", "alltest", + "looptest", "diagtestall", "menuList", "TESTCASE", "PCIe_DEV_LIST", "PCIe_SPEED_ITEM"] + +fancontrol_loc = "/usr/local/bin" +fancontrol_config_loc = "/usr/local/bin" + +GLOBALCONFIG = "GLOBALCONFIG" +MONITOR_CONST = "MONITOR_CONST" + +RUIJIE_PART_NUMBER = "RJ000001" +RUIJIE_LABEL_REVISION = "R01" +RUIJIE_ONIE_VERSION = "2018.02" +RUIJIE_MAC_SIZE = 3 +RUIJIE_MANUF_NAME = "Ruijie" +RUIJIE_MANUF_COUNTRY = "CHN" +RUIJIE_VENDOR_NAME = "Ruijie" +RUIJIE_DIAG_VERSION = "0.1.0.15" +RUIJIE_SERVICE_TAG = "www.ruijie.com.cn" + +DEV_LEDS = {} +MEM_SLOTS = [] + +LOCAL_LED_CONTROL = { + "CLOSE":{}, + "OPEN":{} +} + +FIRMWARE_TOOLS = {} +#start-up module +STARTMODULE = { + "fancontrol":1, + "avscontrol":1 + } + +i2ccheck_params = {"busend":"i2c-66","retrytime":6} + +################################################################################################### +##### fan board ID reference +################################################################################################### +FANS_DEF = { + 0x8100:"M6500-FAN-F", + 0x8101:"M6510-FAN-F", + 0x8102:"M6520-FAN-F", + 0x8103:"M6510-FAN-R" +} + +factest_module = { + "sysinfo_showfanmsg":1, + "sysinfo_showPsumsg":1, + "sysinfo_showrestfanmsg":0, + "sysinfo_showrestpsumsg":0 +} + +#################fan adjustment parameters ############################## +MONITOR_TEMP_MIN = 38 # temperature before speed-adjustment +MONITOR_K = 11 # adjustment algorithm +MONITOR_MAC_IN = 35 # temperature difference between mac and chip(backup) +MONITOR_DEFAULT_SPEED = 0x60 # default speed +MONITOR_MAX_SPEED = 0xFF # maximum speed +MONITOR_MIN_SPEED = 0x33 # minimum speed +MONITOR_MAC_ERROR_SPEED = 0XBB # MAC abnormal speed +MONITOR_FAN_TOTAL_NUM = 4 # 3+1 redundancy design, report to syslog if there is a error +MONITOR_MAC_UP_TEMP = 50 # MAC compared with inlet up +MONITOR_MAC_LOWER_TEMP = -50 # MAC compared with outlet down +MONITOR_MAC_MAX_TEMP = 100 # + +MONITOR_FALL_TEMP = 4 # adjustment reduced temperature +MONITOR_MAC_WARNING_THRESHOLD = 100 #100 +MONITOR_OUTTEMP_WARNING_THRESHOLD = 85 +MONITOR_BOARDTEMP_WARNING_THRESHOLD = 85 +MONITOR_CPUTEMP_WARNING_THRESHOLD = 85 +MONITOR_INTEMP_WARNING_THRESHOLD = 70 #70 + +MONITOR_MAC_CRITICAL_THRESHOLD = 105 #105 +MONITOR_OUTTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_BOARDTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_CPUTEMP_CRITICAL_THRESHOLD = 100 #100 +MONITOR_INTEMP_CRITICAL_THRESHOLD = 80 # 80 +MONITOR_CRITICAL_NUM = 3 #retry times +MONITOR_SHAKE_TIME = 20 #anti-shake times +MONITOR_INTERVAL = 60 + +MONITOR_MAC_SOURCE_SYSFS = 0 #1 get mac temperature from sysfs ,0 get mac temperature from bcmcmd +MONITOR_MAC_SOURCE_PATH = None #sysfs path + +################################################################### + + +#####################MAC调压parameters (B6510)#################################### +MAC_AVS_PARAM ={ + 0x72:0x0384 , + 0x73:0x037e , + 0x74:0x0378 , + 0x75:0x0372 , + 0x76:0x036b , + 0x77:0x0365 , + 0x78:0x035f , + 0x79:0x0359 , + 0x7a:0x0352 , + 0x7b:0x034c , + 0x7c:0x0346 , + 0x7d:0x0340 , + 0x7e:0x0339 , + 0x7f:0x0333 , + 0x80:0x032d , + 0x81:0x0327 , + 0x82:0x0320 , + 0x83:0x031a , + 0x84:0x0314 , + 0x85:0x030e , + 0x86:0x0307 , + 0x87:0x0301 , + 0x88:0x02fb , + 0x89:0x02f5 , + 0x8A:0x02ee +} + +# default 6520 configuration +MAC_DEFAULT_PARAM = { + "type": 1, # type 1 represents default if out of range / 0 represents no voltage-adjustment if out of range + "default":0x74, # should be used with type + "loopaddr":0x00, # AVS loop address + "loop":0x00, # AVS loop value + "open":0x00, # diasble write-protection value + "close":0x40, # enable write-protection value + "bus":2, # AVSI2C bus address + "devno":0x60, # AVS address + "addr":0x21, # AVS voltage-adjustment address + "protectaddr":0x10, # AVS write-protection address + "sdkreg":"DMU_PCU_OTP_CONFIG_8", # SDK register name + "sdktype": 1, # type 0 represents no shift operation / 1 represents shift operation + "macregloc":24 , # shift operation + "mask": 0xff # mask after shift +} + +MONITOR_SYS_LED = [ + {"bus":2,"devno":0x33, "addr":0xb2, "yellow":0x06, "red":0x02,"green":0x04}, + {"bus":2,"devno":0x32, "addr":0x72, "yellow":0x06, "red":0x02,"green":0x04}] + +MONITOR_SYS_FAN_LED =[ + {"bus":2,"devno":0x33, "addr":0xb4, "yellow":0x06, "red":0x02,"green":0x04}, + ] + +MONITOR_FANS_LED = [ + {"bus":2,"devno":0x32, "addr":0x23, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x24, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x25, "green":0x09, "red":0x0a}, + {"bus":2,"devno":0x32, "addr":0x26, "green":0x09, "red":0x0a}] + + +MONITOR_SYS_PSU_LED =[ + {"bus":2,"devno":0x33, "addr":0xb3, "yellow":0x06, "red":0x02,"green":0x04}, + ] + +MONITOR_FAN_STATUS = [ + {'status':'green' , 'minOkNum':4,'maxOkNum':4}, + {'status':'yellow', 'minOkNum':3,'maxOkNum':3}, + {'status':'red' , 'minOkNum':0,'maxOkNum':2}, + ] + +MONITOR_PSU_STATUS = [ + {'status':'green' , 'minOkNum':2,'maxOkNum':2}, + {'status':'yellow', 'minOkNum':1,'maxOkNum':1}, + {'status':'red' , 'minOkNum':0,'maxOkNum':0}, + ] + +MONITOR_DEV_STATUS = {} +MONITOR_DEV_STATUS_DECODE = {} +DEV_MONITOR_PARAM = {} +SLOT_MONITOR_PARAM = {} + + +fanloc = {"name":"fanset","location":"0-0032/fan_speed_set"} +#####################MAC-Voltage-Adjustment-Parameters#################################### + + +####================================Adaption-Area================================ +#### RUIJIE_COMMON common configuration head +#### “platform” specific configuration head +#### +PCA9548START = 11 +PCA9548BUSEND = 74 + +RUIJIE_CARDID = 0x00004040 +RUIJIE_PRODUCTNAME = "ruijie_b6510" + +FAN_PROTECT = {"bus":0, "devno":0x32, "addr":0x19, "open":0x00, "close":0x0f} +rg_eeprom = "2-0057/eeprom" +E2_LOC = {"bus":2, "devno":0x57} +E2_PROTECT ={"bus":2, "devno":0x33, "addr":0xb0, "open":0, "close":1} +MAC_LED_RESET = {"pcibus":8, "slot":0, "fn":0, "bar":0, "offset":64, "reset":0x98} + +INIT_PARAM = [ + {"loc":"1-0034/sfp_enable","value": "01"}, + {"loc":"2-0035/sfp_enable2","value":"ff"}, + {"loc":"2-0033/mac_led", "value":"ff"}, + {"loc":"1-0034/sfp_txdis1","value":"00"}, + {"loc":"1-0034/sfp_txdis2","value":"00"}, + {"loc":"1-0034/sfp_txdis3","value":"00"}, + {"loc":"1-0036/sfp_txdis4","value":"00"}, + {"loc":"1-0036/sfp_txdis5","value":"00"}, + {"loc":"1-0036/sfp_txdis6","value":"00"}, + {"loc":fanloc["location"], "value":"80"} +] + +INIT_COMMAND = [ +] + +CPLDVERSIONS = [ + {"loc":"2-0033/cpld_version","des":"MAC Board 上CPLDA"}, + {"loc":"2-0035/cpld_version","des":"MAC Board 上CPLDB"}, + {"loc":"2-0037/cpld_version","des":"CPU Board 上cpld"} +] + +## Driver List +## +DRIVERLISTS = [ + "i2c_dev", + "i2c_algo_bit", + "i2c_gpio", + "i2c_mux", + "i2c_mux_pca9641", + "i2c_mux_pca954x", # force_deselect_on_exit=1 + "eeprom", + "at24", + "ruijie_platform", + "rg_cpld", + "rg_fan", + "rg_psu", + "csu550", + "rg_gpio_xeon", + #IPMIdriver + "ipmi_msghandler", + "ipmi_devintf", + "ipmi_si", +] + +DEVICE = [ + {"name":"pca9641","bus":0 ,"loc":0x10 }, + {"name":"pca9548","bus":2 ,"loc":0x70 }, + {"name":"lm75","bus": 2, "loc":0x48 }, + {"name":"lm75","bus": 2, "loc":0x49 }, + {"name":"lm75","bus": 2, "loc":0x4a }, + {"name":"24c02","bus":2 , "loc":0x57 }, + {"name":"rg_cpld","bus":2 ,"loc":0x33 }, + {"name":"rg_cpld","bus":2 ,"loc":0x35 }, + {"name":"rg_cpld","bus":2 ,"loc":0x37 }, + {"name":"pca9548","bus":1,"loc":0x70 }, + {"name":"pca9548","bus":1,"loc":0x71 }, + {"name":"pca9548","bus":1,"loc":0x72 }, + {"name":"pca9548","bus":1,"loc":0x73 }, + {"name":"pca9548","bus":1,"loc":0x74 }, + {"name":"pca9548","bus":1,"loc":0x75 }, + {"name":"pca9548","bus":1,"loc":0x76 }, + {"name":"pca9548","bus":1,"loc":0x77 }, + {"name":"rg_fan","bus":3,"loc":0x53 }, + {"name":"rg_fan","bus":4,"loc":0x53 }, + {"name":"rg_fan","bus":5,"loc":0x53 }, + #{"name":"rg_fan","bus":6,"loc":0x53 }, #specific fan + {"name":"rg_psu","bus":7 ,"loc":0x50 }, + {"name":"csu550","bus":7 ,"loc":0x58 }, + {"name":"rg_psu","bus":8 ,"loc":0x53 }, + {"name":"csu550","bus":8 ,"loc":0x5b }, +] + +#####################FRU-Info-Adaption################################# +E2TYPE = {"1": "tlveeprom", + "2": "x86cpueeprom", + "3": "bmceeprom", + "4": "cpueeprom", + "5": "maceeprom", + "6": "sloteeprom", + "7": "fanconnecteeprom", + "8": "M1HFANI-F", + "9": "M1HFANI-R", + "A": "M2HFANI-F", + "B": "M2HFANI-R", + "C": "psu"} +FRULISTS = [] +################################Manufacturing-Test-Adaption-Area####################################################### +# need to export interface +fanlevel_6510 = { + "level":[51,150,255], + "low_speed":[500,7500,17000], + "high_speed":[11000,22500,28500] +} + +fanlevel_6520 = { + "level":[75,150,255], + "low_speed":[750,4250,6750], + "high_speed":[4500,7500,10000] +} + +fanlevel = fanlevel_6520 + +TEMPIDCHANGE = { + "lm75in":"inlet", + "lm75out":"outlet", + "lm75hot":"hot-point", + "inlet":"lm75in", + "outlet":"lm75out", + "hot-point":"lm75hot", +} + +# Manufacturing-Test module +FACTESTMODULE = { } + +##################################Manufacturing-Test-Menu +item1 = {"name":"Single Test", "deal" :"test_signal", "childid":1} +test_sys_reload_item = {"name":"reset-system", "deal" :"test_sys_reload"} + +test_sys_item = { "name":"Product information test", "deal" :"test_sysinfo"} +test_temp_item = { "name":"temperature test", "deal" :"test_tempinfo"} +test_mem_item = { "name":"Memory test", "deal" :"test_cpumemoryinfo"} +test_hd_item = { "name":"Hard disk test", "deal" :"test_hard"} +test_rtc_item = { "name":"RTC test ", "deal" :"test_rtc"} +test_i2c_item = { "name":"I2c test ", "deal" :"test_i2c"} +test_cpld_item = { "name":"CPLD test", "deal" :"test_cpld"} +test_portframe_item = { "name":"Port transmit-receive frame test", "deal" :"test_portframe"} +test_sysled_item = { "name":"System led test", "deal" :"test_led"} +test_fan_item = { "name":"Fan status test", "deal" :"test_fan"} +test_power_item = { "name":"PSU status test", "deal" :"test_power"} +test_usb_item = { "name":"USB test", "deal" :"test_usb"} +test_prbs_item = { "name":"PRBS test", "deal" :"test_prbs"} +test_portbroadcast_item = { "name":"Port broadcast", "deal" :"test_portbroadcast"} + +test_debug_level = {"name":"Change debug level", "deal" :"test_setdebug"} +test_log_level = {"name":"Log output level", "deal" :"test_loginfolevel"} +test_setmac = {"name":"setmac", "deal" :"test_setmac"} +test_setrtc = {"name":"Set RTC", "deal" :"test_set_rtc"} + +log_level_critical = {"name":"CRITICAL", "deal" :"test_log_critical"} +log_level_debug = {"name":"DEBUG", "deal" :"test_log_debug"} +log_level_error = {"name":"ERROR", "deal" :"test_log_error"} +log_level_info = {"name":"INFO", "deal" :"test_log_info"} +log_level_notset = {"name":"NOTSET", "deal" :"test_log_notset"} +log_level_warning = {"name":"WARNING", "deal" :"test_log_warning"} + + +test_e2_setmac_item = {"name":"E2SETMAC", "deal" :"test_e2_setmac"} +test_bmc_setmac_item = {"name":"BMCSETMAC", "deal" :"test_bmc_setmac"} +test_fan_setmac_item = {"name":"fan SETMAC", "deal" :"test_fan_setmac"} + +alltest = [ + test_sys_item, + test_temp_item, + test_mem_item, + test_hd_item, + test_rtc_item, + test_i2c_item, + test_cpld_item, + test_portframe_item, + test_sysled_item, + test_fan_item, + test_power_item, + test_usb_item, + test_prbs_item, + test_portbroadcast_item + ] + +looptest = [ + test_sys_item, + test_temp_item, + test_mem_item, + test_hd_item, + test_rtc_item, + test_i2c_item, + test_cpld_item, + test_portframe_item, + test_fan_item, + test_power_item, + test_usb_item, + test_prbs_item, + test_portbroadcast_item , +] + +diagtestall = [ +] + +menuList =[ + { + "menuid":0, "value":[ + {"name":"Single test", "deal" :"test_signal", "childid":1}, + {"name":"All test", "deal" :"test_all"}, + {"name":"Loop test", "deal" :"test_loop"}, + #{"name":"Check loop-test result", "deal" :"test_loop_read"}, + #{"name":"Delete loop-test result", "deal" :"test_loop_delete"}, +# {"name":"Load configuration", "deal" :"test_config"}, + test_sys_reload_item, + {"name":"System Configuration", "deal" :"test_sysconfig","childid":2}, + ] + }, + { + "menuid":1, "parentid":0, "value":[ + test_sys_item , + test_temp_item , + test_mem_item , + test_hd_item , + test_rtc_item , + test_i2c_item , + test_cpld_item , + test_portframe_item , + test_sysled_item , + test_fan_item , + test_power_item , + test_usb_item , + test_prbs_item , + test_portbroadcast_item , + ]}, + { + "menuid":2, "parentid":0, "value":[ + test_debug_level, + test_log_level , + test_setmac , + test_setrtc , + ]}, + { + "menuid":3, "parentid":2, "value":[ + log_level_critical , + log_level_debug , + log_level_error , + log_level_info , + log_level_notset , + log_level_warning , + ]}, + { + "menuid":4, "parentid":2, "value":[ + test_e2_setmac_item , + test_bmc_setmac_item, + test_fan_setmac_item, + ]}, +] + + +TESTCASE={ + "CPLD":[ + {"name":"CONNECT BOARD CPLD-A" ,"cases":[ + {"name":"cpld32", "cmd":"grtd_test.py cpld_check 0 0x32 0xAA"}, + {"name":"cpld37", "cmd":"grtd_test.py cpld_check 2 0x37 0xAC"}, + ] + }, + {"name":"MAC BOARD CPLD-A" ,"cases":[ + {"name":"cpld33", "cmd":"grtd_test.py cpld_check 2 0x33 0xAB"}, + {"name":"cpld34", "cmd":"grtd_test.py cpld_check 1 0x34 0xAA"}, + ] + }, + {"name":"MAC BOARD CPLD-B" ,"cases":[ + {"name":"cpld36", "cmd":"grtd_test.py cpld_check 1 0x36 0xAA"}, + {"name":"cpld35", "cmd":"grtd_test.py cpld_check 2 0x35 0xAB"}, + ] + }, + ], + "TEMPERATURE":[ + { + "name":"-->temperature test" , "cases":[ + {"name":"inlet","cmd":"grtd_test.py temp 2-0048/hwmon/hwmon1/temp1_input"}, + {"name":"outlet","cmd":"grtd_test.py temp 2-0049/hwmon/hwmon2/temp1_input"}, + {"name":"hot-point","cmd":"grtd_test.py temp 2-004a/hwmon/hwmon3/temp1_input"}, + ] + } + ], + "MEMTORY":{ + "cases":[ + {"name":"->memory test 1M","cmd":"memtester 1M 1"}, + {"name":"->memory test 2M","cmd":"memtester 2M 1"}, + {"name":"->memory test 8M","cmd":"memtester 8M 1"}, +# {"name":"->memory test 16M","cmd":"memtester 16M 1"}, +# {"name":"->memory test 256M","cmd":"memtester 256M 1"}, + ] + }, + "SMARTCTLCMDS":{ + "cases":[ + {"name":"->Check Hard Disk Info", "cmd":"smartctl -i /dev/sda"}, + {"name":"->Check Hard Disk Monitor Status", "cmd":"smartctl -H /dev/sda"}, + ] + }, + "LED":[ + {"name":"Light Port Led test","cases":[ + {"name":"-> Red Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + {"name":"-> Red Led On", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff"}, + {"name":"-> Recovery Red Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + + {"name":"-> Yellow Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + {"name":"-> Yellow Led On", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff"}, + {"name":"-> Recovery Yellow Led Off", "cmd":"grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"}, + ] + }, + {"name":"fan 1 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan0_led 0x09"}, + ] + }, + {"name":"fan 2 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan1_led 0x09"}, + ] + }, + {"name":"fan 3 Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0b"}, + {"name":"-> Red Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0a"}, + {"name":"-> Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x09"}, + {"name":"-> Yellow Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x08"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0e"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0d"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x0c"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 0-0032/fan2_led 0x09"}, + ] + }, + {"name":"Front panel CPU Led", "cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x00"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x02"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x03"}, + {"name":"-> Green Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x11"}, + {"name":"-> Green Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x21"}, + {"name":"-> Green Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x41"}, + {"name":"-> Green Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x81"}, + {"name":"-> Red Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x12"}, + {"name":"-> Red Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x22"}, + {"name":"-> Red Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x42"}, + {"name":"-> Red Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x82"}, + {"name":"-> Yellow Led 1/4sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x13"}, + {"name":"-> Yellow Led 1/2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x23"}, + {"name":"-> Yellow Led 1sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x43"}, + {"name":"-> Yellow Led 2sFlashing ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x83"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_cpu 0x01"}, + ] + }, + {"name":"Front panel BMC Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_bmc 0x04"}, + ] + }, + {"name":"Front panel location Led" , "cases":[ + {"name":"-> LedOff","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xff"}, + {"name":"-> LedOn","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xfe"}, + {"name":"->Recovery LedOff","cmd":"grtd_test.py led loc 2-0035/broad_front_lct 0xff"}, + ] + }, + + {"name":"Front panel pwr Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_pwr 0x04"}, + ] + }, + {"name":"Front panel fan Led" ,"cases":[ + {"name":"-> LedOff", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x00"}, + {"name":"-> Red Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x01"}, + {"name":"-> Red Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x02"}, + {"name":"-> Green Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x03"}, + {"name":"-> Green Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x04"}, + {"name":"-> Yellow Led Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x05"}, + {"name":"-> Yellow Led not Flashing", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x06"}, + {"name":"-> Recovery Green Led ", "cmd":"grtd_test.py led loc 2-0035/broad_front_fan 0x04"}, + ] + }, + + ], + "I2C":[ + ####type 1 represents value obtained compated with value + ####type 2 represents return True or False + {"name":"I2C device test" ,"cases":[ + {"name":" PCA9641 test", "cmd":"grtd_test.py dev_rd 0 10 0","deal_type":2}, + {"name":" cpld32 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld33 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld34 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld35 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld36 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" cpld37 test", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" inlet LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" outlet LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" hot-point LM75", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" EEPROM", "cmd":"grtd_test.py dev_rd 0 32 0","deal_type":2}, + {"name":" Port 1", "cmd":"grtd_test.py dev_rd 11 0050 0","deal_type":2}, + {"name":" Port 2", "cmd":"grtd_test.py dev_rd 12 0050 0","deal_type":2}, + {"name":" Port 3", "cmd":"grtd_test.py dev_rd 13 0050 0","deal_type":2}, + {"name":" Port 4", "cmd":"grtd_test.py dev_rd 14 0050 0","deal_type":2}, + {"name":" Port 5", "cmd":"grtd_test.py dev_rd 15 0050 0","deal_type":2}, + {"name":" Port 6", "cmd":"grtd_test.py dev_rd 16 0050 0","deal_type":2}, + {"name":" Port 7", "cmd":"grtd_test.py dev_rd 17 0050 0","deal_type":2}, + {"name":" Port 8", "cmd":"grtd_test.py dev_rd 18 0050 0","deal_type":2}, + {"name":" Port 9", "cmd":"grtd_test.py dev_rd 19 0050 0","deal_type":2}, + {"name":" Port 10", "cmd":"grtd_test.py dev_rd 20 0050 0","deal_type":2}, + {"name":" Port 11", "cmd":"grtd_test.py dev_rd 21 0050 0","deal_type":2}, + {"name":" Port 12", "cmd":"grtd_test.py dev_rd 22 0050 0","deal_type":2}, + {"name":" Port 13", "cmd":"grtd_test.py dev_rd 23 0050 0","deal_type":2}, + {"name":" Port 14", "cmd":"grtd_test.py dev_rd 24 0050 0","deal_type":2}, + {"name":" Port 15", "cmd":"grtd_test.py dev_rd 25 0050 0","deal_type":2}, + {"name":" Port 16", "cmd":"grtd_test.py dev_rd 26 0050 0","deal_type":2}, + {"name":" Port 17", "cmd":"grtd_test.py dev_rd 27 0050 0","deal_type":2}, + {"name":" Port 18", "cmd":"grtd_test.py dev_rd 28 0050 0","deal_type":2}, + {"name":" Port 19", "cmd":"grtd_test.py dev_rd 29 0050 0","deal_type":2}, + {"name":" Port 20", "cmd":"grtd_test.py dev_rd 30 0050 0","deal_type":2}, + {"name":" Port 21", "cmd":"grtd_test.py dev_rd 31 0050 0","deal_type":2}, + {"name":" Port 22", "cmd":"grtd_test.py dev_rd 32 0050 0","deal_type":2}, + {"name":" Port 23", "cmd":"grtd_test.py dev_rd 33 0050 0","deal_type":2}, + {"name":" Port 24", "cmd":"grtd_test.py dev_rd 34 0050 0","deal_type":2}, + {"name":" Port 25", "cmd":"grtd_test.py dev_rd 35 0050 0","deal_type":2}, + {"name":" Port 26", "cmd":"grtd_test.py dev_rd 36 0050 0","deal_type":2}, + {"name":" Port 27", "cmd":"grtd_test.py dev_rd 37 0050 0","deal_type":2}, + {"name":" Port 28", "cmd":"grtd_test.py dev_rd 38 0050 0","deal_type":2}, + {"name":" Port 29", "cmd":"grtd_test.py dev_rd 39 0050 0","deal_type":2}, + {"name":" Port 30", "cmd":"grtd_test.py dev_rd 40 0050 0","deal_type":2}, + {"name":" Port 31", "cmd":"grtd_test.py dev_rd 41 0050 0","deal_type":2}, + {"name":" Port 32", "cmd":"grtd_test.py dev_rd 42 0050 0","deal_type":2}, + {"name":" Port 33", "cmd":"grtd_test.py dev_rd 43 0050 0","deal_type":2}, + {"name":" Port 34", "cmd":"grtd_test.py dev_rd 44 0050 0","deal_type":2}, + {"name":" Port 35", "cmd":"grtd_test.py dev_rd 45 0050 0","deal_type":2}, + {"name":" Port 36", "cmd":"grtd_test.py dev_rd 46 0050 0","deal_type":2}, + {"name":" Port 37", "cmd":"grtd_test.py dev_rd 47 0050 0","deal_type":2}, + {"name":" Port 38", "cmd":"grtd_test.py dev_rd 48 0050 0","deal_type":2}, + {"name":" Port 39", "cmd":"grtd_test.py dev_rd 49 0050 0","deal_type":2}, + {"name":" Port 40", "cmd":"grtd_test.py dev_rd 50 0050 0","deal_type":2}, + {"name":" Port 41", "cmd":"grtd_test.py dev_rd 51 0050 0","deal_type":2}, + {"name":" Port 42", "cmd":"grtd_test.py dev_rd 52 0050 0","deal_type":2}, + {"name":" Port 43", "cmd":"grtd_test.py dev_rd 53 0050 0","deal_type":2}, + {"name":" Port 44", "cmd":"grtd_test.py dev_rd 54 0050 0","deal_type":2}, + {"name":" Port 45", "cmd":"grtd_test.py dev_rd 55 0050 0","deal_type":2}, + {"name":" Port 46", "cmd":"grtd_test.py dev_rd 56 0050 0","deal_type":2}, + {"name":" Port 47", "cmd":"grtd_test.py dev_rd 57 0050 0","deal_type":2}, + {"name":" Port 48", "cmd":"grtd_test.py dev_rd 58 0050 0","deal_type":2}, + {"name":" Port 49", "cmd":"grtd_test.py dev_rd 59 0050 0","deal_type":2}, + {"name":" Port 50", "cmd":"grtd_test.py dev_rd 60 0050 0","deal_type":2}, + {"name":" Port 51", "cmd":"grtd_test.py dev_rd 61 0050 0","deal_type":2}, + {"name":" Port 52", "cmd":"grtd_test.py dev_rd 62 0050 0","deal_type":2}, + {"name":" Port 53", "cmd":"grtd_test.py dev_rd 63 0050 0","deal_type":2}, + {"name":" Port 54", "cmd":"grtd_test.py dev_rd 64 0050 0","deal_type":2}, + {"name":" Port 55", "cmd":"grtd_test.py dev_rd 65 0050 0","deal_type":2}, + {"name":" Port 56", "cmd":"grtd_test.py dev_rd 66 0050 0","deal_type":2}, + {"name":" Port 57", "cmd":"grtd_test.py dev_rd 67 0050 0","deal_type":2}, + {"name":" Port 58", "cmd":"grtd_test.py dev_rd 68 0050 0","deal_type":2}, + {"name":" Port 59", "cmd":"grtd_test.py dev_rd 69 0050 0","deal_type":2}, + {"name":" Port 60", "cmd":"grtd_test.py dev_rd 70 0050 0","deal_type":2}, + {"name":" Port 61", "cmd":"grtd_test.py dev_rd 71 0050 0","deal_type":2}, + {"name":" Port 62", "cmd":"grtd_test.py dev_rd 72 0050 0","deal_type":2}, + {"name":" Port 63", "cmd":"grtd_test.py dev_rd 73 0050 0","deal_type":2}, + {"name":" Port 64", "cmd":"grtd_test.py dev_rd 74 0050 0","deal_type":2}, + ] + }, + ], +} + +PCIe_DEV_LIST = [] +PCIe_SPEED_ITEM = [] + +################################Manufacturing-Test-Adaption-Area####################################################### + + + + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieconfig.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieconfig.py new file mode 100755 index 000000000000..297e5af6db21 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieconfig.py @@ -0,0 +1,186 @@ +#!/usr/bin/python3 +# -*- coding: UTF-8 -*- +#------------------------------------------------------------------------------- +# Name: ruijieconfig.py +# Purpose: block the difference between various product/onie version for other module +# +# Author: rd +# +# Created: 02/07/2018 +# Copyright: (c) rd 2018 +#------------------------------------------------------------------------------- +import sys +import os +from rjutil.baseutil import get_machine_info +from rjutil.baseutil import get_platform_info + +__all__ = ["getdeviceplatform", "get_rjconfig_info", "MONITOR_CONST", "MAILBOX_DIR", "DEVICE", + "GLOBALCONFIG", "GLOBALINITPARAM", "GLOBALINITCOMMAND", "MAC_LED_RESET", "STARTMODULE", + "fanloc", "RUIJIE_CARDID", "RUIJIE_PRODUCTNAME", "RUIJIE_PART_NUMBER", + "RUIJIE_LABEL_REVISION", "RUIJIE_MAC_SIZE", "RUIJIE_MANUF_NAME", "RUIJIE_MANUF_COUNTRY", + "RUIJIE_VENDOR_NAME", "RUIJIE_DIAG_VERSION", "RUIJIE_SERVICE_TAG", "E2_PROTECT", + "E2_LOC", "FAN_PROTECT", "FANS_DEF", "MONITOR_FANS_LED", "MONITOR_SYS_FAN_LED", + "MONITOR_SYS_PSU_LED", "MONITOR_FAN_STATUS", "MONITOR_PSU_STATUS", "MONITOR_DEV_STATUS", + "MONITOR_DEV_STATUS_DECODE", "DEV_LEDS", "MAC_AVS_PARAM", "MAC_DEFAULT_PARAM", + "FRULISTS", "rg_eeprom", "i2ccheck_params", "FANCTROLDEBUG", "DEVMONITORDEBUG"] + +def getdeviceplatform(): + x = get_platform_info(get_machine_info()) + if x != None: + filepath = "/usr/share/sonic/device/" + x + return filepath + + +platform = get_platform_info(get_machine_info()) # platform get platform info x86_64-ruijie_b6520-64cq-r0 +platformpath = getdeviceplatform() # platformpath get mappable docker contents /usr/share/sonic/device/x86_64-ruijie_b6520-64cq-r0 +MAILBOX_DIR = "/sys/bus/i2c/devices/" # sysfs top contents +grtd_productfile = (platform + "_config").replace("-","_") +common_productfile = "ruijiecommon" +configfile_pre = "/usr/local/bin/" # py's contents, use /usr/local/bin temporarily + +sys.path.append(platformpath) +sys.path.append(configfile_pre) + +def get_rjconfig_info(attr_key): + rjconf_filename = platformpath + "/plugins" + "/rj.conf" + if not os.path.isfile(rjconf_filename): + return None + with open(rjconf_filename) as rjconf_file: + for line in rjconf_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + if tokens[0] == attr_key: + return tokens[1].strip() + return None + +#####BMC-Password### +OPENBMC_PASSWORD = get_rjconfig_info("OPENBMC_PASSWORD") +OPENBMC_PASSWORD = OPENBMC_PASSWORD if(OPENBMC_PASSWORD != None) else "0penBmc" + +############################################################################################ +## if there is no specific file, use common file +module_product = None +if os.path.exists(configfile_pre + grtd_productfile + ".py"): + module_product = __import__(grtd_productfile, globals(), locals(), [], 0) +elif os.path.exists(configfile_pre + common_productfile + ".py"): + module_product = __import__(common_productfile, globals(), locals(), [], 0) +else: + print("No Configuration existed, quit") + exit(-1) +############################################################################################ + +DEVICE = module_product.DEVICE + +##########Driver loading needs parameters +#get different product configuration +RUIJIE_GLOBALCONFIG ={ + "DRIVERLISTS":module_product.DRIVERLISTS, + "QSFP": {"startbus":module_product.PCA9548START, "endbus":module_product.PCA9548BUSEND}, + "DEVS": DEVICE +} +GLOBALCONFIG = RUIJIE_GLOBALCONFIG +GLOBALINITPARAM = module_product.INIT_PARAM +GLOBALINITCOMMAND = module_product.INIT_COMMAND + +fancontrol_loc = module_product.fancontrol_loc +fancontrol_config_loc = module_product.fancontrol_config_loc +MAC_LED_RESET = module_product.MAC_LED_RESET +###########Stat-up module parameters +STARTMODULE = module_product.STARTMODULE +FIRMWARE_TOOLS = module_product.FIRMWARE_TOOLS + + +##########Manufacturing-Test need parameters +FACTESTMODULE = module_product.FACTESTMODULE +TESTCASE = module_product.TESTCASE +menuList = module_product.menuList +alltest = module_product.alltest +diagtestall = module_product.diagtestall +looptest = module_product.looptest +fanloc = module_product.fanloc +fanlevel = module_product.fanlevel # fan adjustment level +TEMPIDCHANGE = module_product.TEMPIDCHANGE +CPLDVERSIONS = module_product.CPLDVERSIONS +RUIJIE_CARDID = module_product.RUIJIE_CARDID +RUIJIE_PRODUCTNAME = module_product.RUIJIE_PRODUCTNAME + +RUIJIE_PART_NUMBER = module_product.RUIJIE_PART_NUMBER +RUIJIE_LABEL_REVISION = module_product.RUIJIE_LABEL_REVISION +RUIJIE_ONIE_VERSION = module_product.RUIJIE_ONIE_VERSION +RUIJIE_MAC_SIZE = module_product.RUIJIE_MAC_SIZE +RUIJIE_MANUF_NAME = module_product.RUIJIE_MANUF_NAME +RUIJIE_MANUF_COUNTRY = module_product.RUIJIE_MANUF_COUNTRY +RUIJIE_VENDOR_NAME = module_product.RUIJIE_VENDOR_NAME +RUIJIE_DIAG_VERSION = module_product.RUIJIE_DIAG_VERSION +RUIJIE_SERVICE_TAG = module_product.RUIJIE_SERVICE_TAG + +E2_PROTECT = module_product.E2_PROTECT +E2_LOC = module_product.E2_LOC +FAN_PROTECT = module_product.FAN_PROTECT + +FANS_DEF = module_product.FANS_DEF +MONITOR_SYS_LED = module_product.MONITOR_SYS_LED +MONITOR_FANS_LED = module_product.MONITOR_FANS_LED +MONITOR_SYS_FAN_LED = module_product.MONITOR_SYS_FAN_LED +MONITOR_SYS_PSU_LED = module_product.MONITOR_SYS_PSU_LED +MONITOR_FAN_STATUS = module_product.MONITOR_FAN_STATUS +MONITOR_PSU_STATUS = module_product.MONITOR_PSU_STATUS +MONITOR_DEV_STATUS = module_product.MONITOR_DEV_STATUS +MONITOR_DEV_STATUS_DECODE = module_product.MONITOR_DEV_STATUS_DECODE +DEV_MONITOR_PARAM = module_product.DEV_MONITOR_PARAM +SLOT_MONITOR_PARAM = module_product.SLOT_MONITOR_PARAM + + +DEV_LEDS = module_product.DEV_LEDS +MEM_SLOTS = module_product.MEM_SLOTS + +MAC_AVS_PARAM = module_product.MAC_AVS_PARAM +MAC_DEFAULT_PARAM = module_product.MAC_DEFAULT_PARAM +E2TYPE = module_product.E2TYPE +FRULISTS = module_product.FRULISTS +rg_eeprom = "%d-%04x/eeprom" % (E2_LOC["bus"], E2_LOC["devno"]) +factest_module = module_product.factest_module + +LOCAL_LED_CONTROL = module_product.LOCAL_LED_CONTROL + +PCIe_DEV_LIST = module_product.PCIe_DEV_LIST +PCIe_SPEED_ITEM = module_product.PCIe_SPEED_ITEM +i2ccheck_params = module_product.i2ccheck_params + + +class MONITOR_CONST: + TEMP_MIN = module_product.MONITOR_TEMP_MIN + K =module_product.MONITOR_K + MAC_IN =module_product.MONITOR_MAC_IN + DEFAULT_SPEED =module_product.MONITOR_DEFAULT_SPEED + MAX_SPEED =module_product.MONITOR_MAX_SPEED + MIN_SPEED =module_product.MONITOR_MIN_SPEED + MAC_ERROR_SPEED =module_product.MONITOR_MAC_ERROR_SPEED + FAN_TOTAL_NUM =module_product.MONITOR_FAN_TOTAL_NUM + MAC_UP_TEMP =module_product.MONITOR_MAC_UP_TEMP + MAC_LOWER_TEMP =module_product.MONITOR_MAC_LOWER_TEMP + MAC_MAX_TEMP = module_product.MONITOR_MAC_MAX_TEMP + + MAC_WARNING_THRESHOLD = module_product.MONITOR_MAC_WARNING_THRESHOLD + OUTTEMP_WARNING_THRESHOLD = module_product.MONITOR_OUTTEMP_WARNING_THRESHOLD + BOARDTEMP_WARNING_THRESHOLD = module_product.MONITOR_BOARDTEMP_WARNING_THRESHOLD + CPUTEMP_WARNING_THRESHOLD = module_product.MONITOR_CPUTEMP_WARNING_THRESHOLD + INTEMP_WARNING_THRESHOLD = module_product.MONITOR_INTEMP_WARNING_THRESHOLD + + MAC_CRITICAL_THRESHOLD = module_product.MONITOR_MAC_CRITICAL_THRESHOLD + OUTTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_OUTTEMP_CRITICAL_THRESHOLD + BOARDTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_BOARDTEMP_CRITICAL_THRESHOLD + CPUTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_CPUTEMP_CRITICAL_THRESHOLD + INTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_INTEMP_CRITICAL_THRESHOLD + CRITICAL_NUM = module_product.MONITOR_CRITICAL_NUM + SHAKE_TIME = module_product.MONITOR_SHAKE_TIME + MONITOR_INTERVAL= module_product.MONITOR_INTERVAL + MONITOR_FALL_TEMP = module_product.MONITOR_FALL_TEMP + + MONITOR_MAC_SOURCE_SYSFS = module_product.MONITOR_MAC_SOURCE_SYSFS + MONITOR_MAC_SOURCE_PATH = module_product.MONITOR_MAC_SOURCE_PATH + +FANCTROLDEBUG = 0 # 1 means enable +DEVMONITORDEBUG = 0 # 1 means enable + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieutil.py b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieutil.py new file mode 100755 index 000000000000..ff594b72e342 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/script/ruijieutil.py @@ -0,0 +1,1828 @@ +# -*- coding: UTF-8 -*- +#------------------------------------------------------------------------- +# Name: ruijieutil +# Purpose: common configuration and api +# +# Author: rd +# +# Created: 02/07/2018 +# Copyright: (c) rd 2018 +#------------------------------------------------------------------------- +import sys +import os +import re +import subprocess +import syslog +import time +import binascii +import tty +import termios +import threading +import click +import mmap +from ruijieconfig import rg_eeprom, FRULISTS, MAC_DEFAULT_PARAM, MAC_AVS_PARAM, FANS_DEF, \ + FAN_PROTECT, E2_LOC, E2_PROTECT, RUIJIE_SERVICE_TAG, RUIJIE_DIAG_VERSION, \ + STARTMODULE, RUIJIE_CARDID, RUIJIE_PRODUCTNAME, RUIJIE_PART_NUMBER, \ + RUIJIE_LABEL_REVISION, RUIJIE_MAC_SIZE, RUIJIE_MANUF_NAME, RUIJIE_MANUF_COUNTRY, \ + RUIJIE_VENDOR_NAME, MAILBOX_DIR + +try: + from eepromutil.fru import ipmifru + +except Exception or SystemExit: + pass + +import logging.handlers +import shutil +import gzip +import glob + +__all__ = ["MENUID", "MENUPARENT", "MENUVALUE", "CHILDID", "MENUITEMNAME", "MENUITEMDEAL", + "GOBACK", "GOQUIT", "file_name", "CRITICAL", "FATAL", "ERROR", "WARNING", "WARN", + "INFO", "DEBUG", "NOTSET", "levelNames", "TLV_INFO_ID_STRING", "TLV_INFO_VERSION", + "TLV_INFO_LENGTH", "TLV_INFO_LENGTH_VALUE", "TLV_CODE_PRODUCT_NAME", + "TLV_CODE_PART_NUMBER", "TLV_CODE_SERIAL_NUMBER", "TLV_CODE_MAC_BASE", + "TLV_CODE_MANUF_DATE", "TLV_CODE_DEVICE_VERSION", "TLV_CODE_LABEL_REVISION", + "TLV_CODE_PLATFORM_NAME", "TLV_CODE_ONIE_VERSION", "TLV_CODE_MAC_SIZE", + "TLV_CODE_MANUF_NAME", "TLV_CODE_MANUF_COUNTRY", "TLV_CODE_VENDOR_NAME", + "TLV_CODE_DIAG_VERSION", "TLV_CODE_SERVICE_TAG", "TLV_CODE_VENDOR_EXT", + "TLV_CODE_CRC_32", "_TLV_DISPLAY_VENDOR_EXT", "TLV_CODE_RJ_CARID", + "_TLV_INFO_HDR_LEN", "SYSLOG_IDENTIFIER", "log_info", "log_debug", "log_warning", + "log_error", "CompressedRotatingFileHandler", "SETMACException", "checkinput", + "checkinputproduct", "getInputSetmac", "fan_tlv", "AVSUTIL", "I2CUTIL", "BMC", + "getSdkReg", "getfilevalue", "get_sysfs_value", "write_sysfs_value", + "RJPRINTERR", "strtoint", "inttostr", "str_to_hex", "hex_to_str", "str_to_bin", + "bin_to_str", "getMacTemp", "getMacTemp_sysfs", "restartDockerService", + "waitForDhcp", "waitForSdk", "waitForDocker", "getTLV_BODY", "_crc32", + "printvalue", "generate_value", "getsyseeprombyId", "fac_init_cardidcheck", + "isValidMac", "util_setmac", "getInputCheck", "getrawch", "upper_input", + "changeTypeValue", "astrcmp", "generate_ext", "rji2cget", "rji2cset", "rjpcird", + "rjpciwr", "rjsysset", "rji2cgetWord", "rji2csetWord", "fan_setmac", "checkfansninput", + "checkfanhwinput", "util_show_fanse2", "get_fane2_sysfs", "util_show_fane2", "getPid", + "fac_fans_setmac_tlv", "fac_fan_setmac_fru", "fac_fans_setmac", "fac_fan_setmac", + "writeToEEprom", "get_local_eth0_mac", "getonieversion", "createbmcMac", + "fac_board_setmac", "ipmi_set_mac", "getInputValue", "bmc_setmac", "closeProtocol", + "checkSdkMem", "getch", "get_raw_input", "getsysvalue", "get_pmc_register", "decoder", + "decode_eeprom", "get_sys_eeprom", "getCardId", "getsysmeminfo", "getsysmeminfo_detail", + "getDmiSysByType", "gethwsys", "getsysbios", "searchDirByName", "getUsbLocation", + "getusbinfo", "get_cpu_info", "get_version_config_info", "io_rd", "io_wr"] + +MENUID = "menuid" +MENUPARENT = "parentid" +MENUVALUE = "value" +CHILDID = "childid" +MENUITEMNAME = "name" +MENUITEMDEAL = "deal" +GOBACK = "goBack" +GOQUIT = "quit" + +file_name = "/etc/init.d/opennsl-modules-3.16.0-5-amd64" +########################################################################## +# ERROR LOG LEVEL +########################################################################## +CRITICAL = 50 +FATAL = CRITICAL +ERROR = 40 +WARNING = 30 +WARN = WARNING +INFO = 20 +DEBUG = 10 +NOTSET = 0 + +levelNames = { + CRITICAL: 'CRITICAL', + ERROR: 'ERROR', + WARNING: 'WARNING', + INFO: 'INFO', + DEBUG: 'DEBUG', + NOTSET: 'NOTSET', + 'CRITICAL': CRITICAL, + 'ERROR': ERROR, + 'WARN': WARNING, + 'WARNING': WARNING, + 'INFO': INFO, + 'DEBUG': DEBUG, + 'NOTSET': NOTSET, +} + +TLV_INFO_ID_STRING = "TlvInfo\x00" +TLV_INFO_VERSION = 0x01 +TLV_INFO_LENGTH = 0x00 +TLV_INFO_LENGTH_VALUE = 0xba + +########################################################################## +# eeprom info +########################################################################## +TLV_CODE_PRODUCT_NAME = 0x21 +TLV_CODE_PART_NUMBER = 0x22 +TLV_CODE_SERIAL_NUMBER = 0x23 +TLV_CODE_MAC_BASE = 0x24 +TLV_CODE_MANUF_DATE = 0x25 +TLV_CODE_DEVICE_VERSION = 0x26 +TLV_CODE_LABEL_REVISION = 0x27 +TLV_CODE_PLATFORM_NAME = 0x28 +TLV_CODE_ONIE_VERSION = 0x29 +TLV_CODE_MAC_SIZE = 0x2A +TLV_CODE_MANUF_NAME = 0x2B +TLV_CODE_MANUF_COUNTRY = 0x2C +TLV_CODE_VENDOR_NAME = 0x2D +TLV_CODE_DIAG_VERSION = 0x2E +TLV_CODE_SERVICE_TAG = 0x2F +TLV_CODE_VENDOR_EXT = 0xFD +TLV_CODE_CRC_32 = 0xFE +_TLV_DISPLAY_VENDOR_EXT = 1 +TLV_CODE_RJ_CARID = 0x01 +_TLV_INFO_HDR_LEN = 11 + + +SYSLOG_IDENTIFIER = "UTILTOOL" + +# ========================== Syslog wrappers ========================== + +def log_info(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + + if also_print_to_console: + click.echo(msg) + + +def log_debug(msg, also_print_to_console=False): + try: + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_DEBUG, msg) + syslog.closelog() + + if also_print_to_console: + click.echo(msg) + except Exception as e: + pass + + +def log_warning(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + if also_print_to_console: + click.echo(msg) + + +def log_error(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + if also_print_to_console: + click.echo(msg) + +class CompressedRotatingFileHandler(logging.handlers.RotatingFileHandler): + def doRollover(self): + """ + Do a rollover, as described in __init__(). + """ + if self.stream: + self.stream.close() + self.stream = None + if self.backupCount > 0: + for i in range(self.backupCount - 1, 0, -1): + sfn = "%s.%d.gz" % (self.baseFilename, i) + dfn = "%s.%d.gz" % (self.baseFilename, i + 1) + if os.path.exists(sfn): + if os.path.exists(dfn): + os.remove(dfn) + os.rename(sfn, dfn) + dfn = self.baseFilename + ".1.gz" + if os.path.exists(dfn): + os.remove(dfn) + # These two lines below are the only new lines. I commented out the os.rename(self.baseFilename, dfn) and + # replaced it with these two lines. + with open(self.baseFilename, 'rb') as f_in, gzip.open(dfn, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + self.mode = 'w' + self.stream = self._open() + + +class SETMACException(Exception): + def __init__(self, param='ERROR', errno="-1"): + err = "Setmac fail[%s]: %s" % (errno, param) + Exception.__init__(self, err) + self.param = param + self.errno = errno + +def checkinput(b): + if b.isdigit() == False: + raise Exception("Ivalid Number") + if int(b) > 0xff or int(b) < 0: + raise Exception("Out of area") + +def checkinputproduct(b): + if b.isalnum() ==False: + raise Exception("Invalid string") + +def getInputSetmac(val): + bia = val.boardInfoArea + pia = val.productInfoArea + if bia != None: + a = raw_input("[Board Card]Product Serial Number:") + if len(a) != 13: + raise Exception("Invalid Serial Number length") + checkinputproduct(a) + bia.boardSerialNumber = a + b = raw_input("[Board Card]Product Version:(from 1-255)") + checkinput(b) + b = "%0x" % int(b) + bia.boardextra1 = b.upper() + if pia != None: + a = raw_input("[Product Area]Product Serial Number:") + if len(a) != 13: + raise Exception("Invalid Serial Number") + checkinputproduct(a) + pia.productSerialNumber = a + b = raw_input("[Product Area]Product Version:(from 1-255)") + checkinput(b) + b = "%0x" % int(b) + pia.productVersion = b.upper() + return val + +class fan_tlv(object): + VERSION = 0x01 # E2PROM Version,start from 0x01 + FLAG = 0x7E # New E2PROM version flag is 0x7E + HW_VER = 0X01 # compose by master version and fixed version + TYPE = 0xf1 # hw type defination + TLV_LEN = 00 # data length (16bit) + _FAN_TLV_HDR_LEN = 6 + _FAN_TLV_CRC_LEN = 2 + + _FAN_TLV_TYPE_NAME = 0x02 + _FAN_TLV_TYPE_SN = 0x03 + _FAN_TLV_TYPE_HW_INFO = 0x05 + _FAN_TLV_TYPE_DEV_TYPE = 0x06 + + _fandecodetime = 0 + + @property + def dstatus(self): + return self._dstatus + + @property + def typename(self): + return self._typename + + @property + def typesn(self): + return self._typesn + + @property + def typehwinfo(self): + return self._typehwinfo + + @property + def typedevtype(self): + return self._typedevtype + + @property + def fanbus(self): + return self._fanbus + + @property + def fanloc(self): + return self._fanloc + + @property + def fandecodetime(self): + return self._fandecodetime + + def __init__(self): + self._typename = "" + self._typesn = "" + self._typehwinfo = "" + self._typedevtype = "" + self._dstatus = 0 + + def strtoarr(self, str): + s = [] + if str is not None: + for index in range(len(str)): + s.append(str[index]) + return s + + def generate_fan_value(self): + bin_buffer = [chr(0xff)] * 256 + bin_buffer[0] = chr(self.VERSION) + bin_buffer[1] = chr(self.FLAG) + bin_buffer[2] = chr(self.HW_VER) + bin_buffer[3] = chr(self.TYPE) + + temp_t = "%08x" % self.typedevtype # handle devtype first + typedevtype_t = hex_to_str(temp_t) + total_len = len(self.typename) + len(self.typesn) + \ + len(self.typehwinfo) + len(typedevtype_t) + 8 + + bin_buffer[4] = chr(total_len >> 8) + bin_buffer[5] = chr(total_len & 0x00FF) + + index_start = 6 + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_NAME) + bin_buffer[index_start + 1] = chr(len(self.typename)) + bin_buffer[index_start + 2: index_start + 2 + + len(self.typename)] = self.strtoarr(self.typename) + index_start = index_start + 2 + len(self.typename) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_SN) + bin_buffer[index_start + 1] = chr(len(self.typesn)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typesn)] = self.strtoarr(self.typesn) + index_start = index_start + 2 + len(self.typesn) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_HW_INFO) + bin_buffer[index_start + 1] = chr(len(self.typehwinfo)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typehwinfo)] = self.strtoarr(self.typehwinfo) + index_start = index_start + 2 + len(self.typehwinfo) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_DEV_TYPE) + bin_buffer[index_start + 1] = chr(len(typedevtype_t)) + bin_buffer[index_start + 2:index_start + 2 + + len(typedevtype_t)] = self.strtoarr(typedevtype_t) + index_start = index_start + 2 + len(typedevtype_t) + + crcs = fan_tlv.fancrc(''.join(bin_buffer[0:index_start])) # check 2bytes + bin_buffer[index_start] = chr(crcs >> 8) + bin_buffer[index_start + 1] = chr(crcs & 0x00ff) + return bin_buffer + + def decode(self, e2): + ret = [] + self.VERSION = ord(e2[0]) + self.FLAG = ord(e2[1]) + self.HW_VER = ord(e2[2]) + self.TYPE = ord(e2[3]) + self.TLV_LEN = (ord(e2[4]) << 8) | ord(e2[5]) + + tlv_index = self._FAN_TLV_HDR_LEN + tlv_end = self._FAN_TLV_HDR_LEN + self.TLV_LEN + + # check checksum + if len(e2) < self._FAN_TLV_HDR_LEN + self.TLV_LEN + 2: + self._dstatus = -2 + return ret + sumcrc = fan_tlv.fancrc(e2[0:self._FAN_TLV_HDR_LEN + self.TLV_LEN]) + readcrc = ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN] + ) << 8 | ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN + 1]) + if sumcrc != readcrc: + self._dstatus = -1 + return ret + else: + self._dstatus = 0 + while (tlv_index + 2) < len(e2) and tlv_index < tlv_end: + s = self.decoder( + e2[tlv_index:tlv_index + 2 + ord(e2[tlv_index + 1])]) + tlv_index += ord(e2[tlv_index + 1]) + 2 + ret.append(s) + + return ret + + @staticmethod + def fancrc(t): + sum = 0 + for index in range(len(t)): + sum += ord(t[index]) + return sum + + def decoder(self, t): + try: + name = "" + value = "" + if ord(t[0]) == self._FAN_TLV_TYPE_NAME: + name = "Product Name" + value = str(t[2:2 + ord(t[1])]) + self._typename = value + elif ord(t[0]) == self._FAN_TLV_TYPE_SN: + name = "serial Number" + value = str(t[2:2 + ord(t[1])]) + self._typesn = value + elif ord(t[0]) == self._FAN_TLV_TYPE_HW_INFO: + name = "hardware info" + value = str(t[2:2 + ord(t[1])]) + self._typehwinfo = value + elif ord(t[0]) == self._FAN_TLV_TYPE_DEV_TYPE: + name = "dev type" + value = str(t[2:2 + ord(t[1])]) + value = str_to_hex(value) + self._typedevtype = value + value = "0x08%x" % value + except Exception as e: + print(e) + return {"name": name, "code": ord(t[0]), "value": value} + + def __str__(self): + formatstr = "VERSION : 0x%02x \n" \ + " FLAG : 0x%02x \n" \ + " HW_VER : 0x%02x \n" \ + " TYPE : 0x%02x \n" \ + "typename : %s \n" \ + "typesn : %s \n" \ + "typehwinfo : %s \n" + return formatstr % (self.VERSION, self.FLAG, self.HW_VER, self.TYPE, self.typename, self.typesn, self.typehwinfo) + + +class AVSUTIL(): + @staticmethod + def mac_avs_chip(bus, devno, loc, open, close, loop, protectaddr, level, loopaddr): + # disable protection + rji2cset(bus, devno, protectaddr, open) + rji2cset(bus, devno, loopaddr, loop) + rji2csetWord(bus, devno, loc, level) + ret, value = rji2cgetWord(bus, devno, loc) + if strtoint(value) == level: + ret = 0 + # enable protection + rji2cset(bus, devno, protectaddr, close) + if ret == 0: + return True + return False + + @staticmethod + def macPressure_adj(macavs, avs_param, mac_def_param): + # check whether it within range + max_adj = max(avs_param.keys()) + min_adj = min(avs_param.keys()) + type = mac_def_param["type"] + level = 0 + if type == 0: + if macavs not in range(min_adj, max_adj + 1): + return False + else: + level = macavs + else: + if macavs not in range(min_adj, max_adj + 1): + level = mac_def_param["default"] + else: + level = macavs + ret = AVSUTIL.mac_avs_chip(mac_def_param["bus"], mac_def_param["devno"], mac_def_param["addr"], mac_def_param["open"], + mac_def_param["close"], mac_def_param["loop"], mac_def_param["protectaddr"], avs_param[level], mac_def_param["loopaddr"]) + return ret + + @staticmethod + def mac_adj(): + macavs = 0 + name = MAC_DEFAULT_PARAM["sdkreg"] + ret, status = getSdkReg(name) + if ret == False: + return False + status = strtoint(status) + # shift operation + if MAC_DEFAULT_PARAM["sdktype"] != 0: + status = ( + status >> MAC_DEFAULT_PARAM["macregloc"]) & MAC_DEFAULT_PARAM["mask"] + macavs = status + ret = AVSUTIL.macPressure_adj(macavs, MAC_AVS_PARAM, MAC_DEFAULT_PARAM) + return ret + + +class I2CUTIL(): + @staticmethod + def getvaluefromdevice(name): + ret = [] + for item in DEVICE: + if item["name"] == name: + ret.append(item) + return ret + + @staticmethod + def openFanE2Protect(): + rji2cset(FAN_PROTECT["bus"], FAN_PROTECT["devno"], + FAN_PROTECT["addr"], FAN_PROTECT["open"]) + + @staticmethod + def closeFanE2Protect(): + rji2cset(FAN_PROTECT["bus"], FAN_PROTECT["devno"], + FAN_PROTECT["addr"], FAN_PROTECT["close"]) + + @staticmethod + def writeToFanE2(bus, loc, rst_arr): + index = 0 + for item in rst_arr: + rji2cset(bus, loc, index, ord(item)) + index += 1 + + @staticmethod + def writeToE2(bus, loc, rst_arr): + index = 0 + for item in rst_arr: + rji2cset(bus, loc, index, ord(item)) + index += 1 + + @staticmethod + def getE2File(bus, loc): + return "/sys/bus/i2c/devices/%d-00%02x/eeprom" % (bus, loc) + + +class BMC(): + _instance_lock = threading.Lock() + + def __init__(self): + pass + + def __new__(cls, *args, **kwargs): + if not hasattr(Singleton, "_instance"): + with Singleton._instance_lock: + if not hasattr(Singleton, "_instance"): + Singleton._instance = object.__new__(cls) + return Singleton._instance + +# Internal interface + + +def getSdkReg(reg): + try: + cmd = "bcmcmd -t 1 'getr %s ' < /dev/null" % reg + ret, result = rj_os_system(cmd) + result_t = result.strip().replace("\r", "").replace("\n", "") + if ret != 0 or "Error:" in result_t: + return False, result + patt = r"%s.(.*):(.*)>drivshell" % reg + rt = re.findall(patt, result_t, re.S) + test = re.findall("=(.*)", rt[0][0])[0] + except Exception as e: + return False, 'getsdk register error' + return True, test + + +def getfilevalue(location): + try: + with open(location, 'r') as fd: + value = fd.read() + return True, value.strip() + except Exception as e: + return False, "error" + + +def get_sysfs_value(location): + pos_t = str(location) + name = get_pmc_register(pos_t) + return name + + +def write_sysfs_value(reg_name, value): + fileLoc = MAILBOX_DIR + reg_name + try: + if not os.path.isfile(fileLoc): + print(fileLoc, 'not found !') + return False + with open(fileLoc, 'w') as fd: + fd.write(value) + except Exception as error: + log_error("Unable to open " + fileLoc + "file !") + return False + return True + + +def RJPRINTERR(str): + print("\033[0;31m%s\033[0m" % str) + + +def strtoint(str): # convert Hex string to int such as "4040"/"0x4040"/"0X4040" = 16448 + value = 0 + rest_v = str.replace("0X", "").replace("0x", "") + for index in range(len(rest_v)): + print(rest_v[index]) + value |= int(rest_v[index], 16) << ((len(rest_v) - index - 1) * 4) + return value + +def inttostr(vl,len): # convert int to string such as 0x3030 = 00 + if type(vl) != int: + raise Exception(" type error") + index = 0 + ret_t = "" + while index < len: + ret = 0xff & (vl >> index * 8) + ret_t += chr(ret) + index += 1; + return ret_t + +def str_to_hex(rest_v): + value = 0 + for index in range(len(rest_v)): + value |= ord(rest_v[index]) << ((len(rest_v) - index - 1) * 8) + return value + + +def hex_to_str(s): + len_t = len(s) + if len_t % 2 != 0: + return 0 + ret = "" + for t in range(0, int(len_t / 2)): + ret += chr(int(s[2 * t:2 * t + 2], 16)) + return ret + + +def str_to_bin(s): + return ' '.join([bin(ord(c)).replace('0b', '') for c in s]) + + +def bin_to_str(s): + return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]]) + + +def getMacTemp(): + result = {} + #waitForDocker() + # exec twice, get the second result + rj_os_system("bcmcmd -t 1 \"show temp\" < /dev/null") + ret, log = rj_os_system("bcmcmd -t 1 \"show temp\" < /dev/null") + if ret: + return False, result + else: + # decode obtained info + logs = log.splitlines() + for line in logs: + if "average" in line: + b = re.findall(r'\d+.\d+', line) + result["average"] = b[0] + elif "maximum" in line: + b = re.findall(r'\d+.\d+', line) + result["maximum"] = b[0] + return True, result + +def getMacTemp_sysfs(mactempconf): + try: + temp = -1000000 + temp_list = [] + mac_temp_loc = mactempconf.get("loc", []) + mac_temp_flag = mactempconf.get("flag",None) + if mac_temp_flag is not None: # check mac temperature vaild flag + gettype = mac_temp_flag.get('gettype') + okbit = mac_temp_flag.get('okbit') + okval = mac_temp_flag.get('okval') + if gettype == "io": + io_addr = mac_temp_flag.get('io_addr') + val = io_rd(io_addr) + if val is None: + raise Exception("get mac_flag by io failed.") + else: + bus = mac_temp_flag.get('bus') + loc = mac_temp_flag.get('loc') + offset = mac_temp_flag.get('offset') + ind, val = rji2cget(bus, loc, offset) + if ind is not True: + raise Exception("get mac_flag by i2c failed.") + val_t = (int(val,16) & (1<< okbit)) >> okbit + if val_t != okval: + raise Exception("mac_flag invalid, val_t:%d." % val_t) + for loc in mac_temp_loc: + temp_s = get_sysfs_value(loc) + if isinstance(temp_s, str) and temp_s.startswith("ERR"): + raise Exception("get mac temp error. loc:%s" % loc) + temp_t = int(temp_s) + if temp_t == -1000000: + raise Exception("mac temp invalid.loc:%s" % loc) + temp_list.append(temp_t) + temp_list.sort(reverse=True) + temp = temp_list[0] + except Exception as e: + return False, temp + return True, temp + +def restartDockerService(force=False): + container_name = ["database","snmp","syncd","swss","dhcp_relay","radv","teamd","pmon"] + ret, status = rj_os_system("docker ps") + if ret == 0 : + for tmpname in container_name: + if (tmpname not in status): + if (force == True): + rj_os_system("docker restart %s"%tmpname) + else: + rj_os_system("systemctl restart %s"%tmpname) + + +def waitForDhcp(timeout): + time_cnt = 0 + while True: + try: + ret, status = rj_os_system("systemctl status dhcp_relay.service") + if (ret == 0 and "running" in status) or "SUCCESS" in status: + break + else: + sys.stdout.write(".") + sys.stdout.flush() + time_cnt = time_cnt + 1 + if time_cnt > timeout: + raise Exception("waitForDhcp timeout") + time.sleep(1) + except Exception as e: + return False + return True + +def waitForSdk(sdk_fpath ,timeout): + time_cnt = 0 + while True: + try: + if os.path.exists(sdk_fpath): + break + else: + sys.stdout.write(".") + sys.stdout.flush() + time_cnt = time_cnt + 1 + if time_cnt > timeout: + raise Exception("waitForSdk timeout") + time.sleep(1) + except Exception as e: + return False + return True + +def waitForDocker(need_restart=False,timeout=180): + sdkcheck_params = STARTMODULE.get("sdkcheck",{}) + if sdkcheck_params.get("checktype") == "file": # pass file check + sdk_fpath = sdkcheck_params.get("sdk_fpath") + return waitForSdk(sdk_fpath,timeout) + return waitForDhcp(timeout) + + +def getTLV_BODY(type, productname): + x = [] + temp_t = "" + if type == TLV_CODE_MAC_BASE: + arr = productname.split(':') + for tt in arr: + temp_t += chr(int(tt, 16)) + elif type == TLV_CODE_DEVICE_VERSION: + temp_t = chr(productname) + elif type == TLV_CODE_MAC_SIZE: + temp_t = chr(productname >> 8) + chr(productname & 0x00ff) + else: + temp_t = productname + x.append(chr(type)) + x.append(chr(len(temp_t))) + for i in temp_t: + x.append(i) + return x + + +def _crc32(v): + return '0x%08x' % (binascii.crc32(v) & 0xffffffff) # get 8 bytes of crc32 %x return hex + + +def printvalue(b): + index = 0 + for i in range(0, len(b)): + if index % 16 == 0: + print(" ") + print("%02x " % ord(b[i])) + index += 1 + print("\n") + + +def generate_value(_t): + ret = [] + for i in TLV_INFO_ID_STRING: + ret.append(i) + ret.append(chr(TLV_INFO_VERSION)) + ret.append(chr(TLV_INFO_LENGTH)) + ret.append(chr(TLV_INFO_LENGTH_VALUE)) + + total_len = 0 + for key in _t: + x = getTLV_BODY(key, _t[key]) + ret += x + total_len += len(x) + ret[10] = chr(total_len + 6) + + ret.append(chr(0xFE)) + ret.append(chr(0x04)) + s = _crc32(''.join(ret)) + for t in range(0, 4): + ret.append(chr(int(s[2 * t + 2:2 * t + 4], 16))) + totallen = len(ret) + if (totallen < 256): + for left_t in range(0, 256 - totallen): + ret.append(chr(0x00)) + return (ret, True) + + +def getsyseeprombyId(id): + ret = get_sys_eeprom() + for item in ret: + if item["code"] == id: + return item + return None + + +def fac_init_cardidcheck(): + rest = getsyseeprombyId(TLV_CODE_RJ_CARID) # check cardId same or not + if rest is None: + print("need to program write bin file") + return False + else: + rest_v = rest['value'] + value = strtoint(rest_v) + if value == RUIJIE_CARDID: + log_debug("check card ID pass") + else: + log_debug("check card ID error") + return False + return True + + +def isValidMac(mac): + if re.match(r"^\s*([0-9a-fA-F]{2,2}:){5,5}[0-9a-fA-F]{2,2}\s*$", mac): + return True + return False + +# Internet cardsetmac + + +def util_setmac(eth, mac): + rulefile = "/etc/udev/rules.d/70-persistent-net.rules" + if isValidMac(mac) == False: + return False, "MAC invaild" + cmd = "ethtool -e %s | grep 0x0010 | awk '{print \"0x\"$13$12$15$14}'" % eth + ret, log = rj_os_system(cmd) + log_debug(log) + magic = "" + if ret == 0 and len(log): + magic = log + macs = mac.upper().split(":") + + # chage ETH0 to value after setmac + ifconfigcmd = "ifconfig eth0 hw ether %s" % mac + log_debug(ifconfigcmd) + ret, status = rj_os_system(ifconfigcmd) + if ret: + raise SETMACException("software set Internet cardMAC error") + index = 0 + for item in macs: + cmd = "ethtool -E %s magic %s offset %d value 0x%s" % ( + eth, magic, index, item) + log_debug(cmd) + index += 1 + ret, log = rj_os_system(cmd) + if ret != 0: + raise SETMACException(" set hardware Internet card MAC error") + # get value after setting + cmd_t = "ethtool -e eth0 offset 0 length 6" + ret, log = rj_os_system(cmd_t) + m = re.split(':', log)[-1].strip().upper() + mac_result = m.upper().split(" ") + + for ind, s in enumerate(macs): + if s != mac_result[ind]: + RJPRINTERR("MAC comparison error") + if os.path.exists(rulefile): + os.remove(rulefile) + print("MGMT MAC[%s]" % mac) + return True + + +def getInputCheck(tips): + str = raw_input(tips) + if astrcmp(str, "y") or astrcmp(str, "ye") or astrcmp(str, "yes") or astrcmp(str, ""): + return True + else: + return False + +def getrawch(): + fd = sys.stdin.fileno() + old_settings = termios.tcgetattr(fd) + try: + tty.setraw(sys.stdin.fileno()) + ch = sys.stdin.read(1) + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + return ch + +def upper_input(tips): + sys.stdout.write(tips) + sys.stdout.flush() + passwd = [] + while True: + ch = getrawch().upper() + if ch == "\r" or ch == "\n": + return "".join(passwd) + elif ch == '\b' or ord(ch) == 127: + if passwd: + del passwd[-1] + sys.stdout.write('\b \b') + else: + sys.stdout.write(ch) + passwd.append(ch) + +def changeTypeValue(_value, type1, tips, example): + if type1 == TLV_CODE_PRODUCT_NAME: + while True: + print("please check (1)air from forward to backward/(2)air from backward to forward:") + option = raw_input() + if option == "1": + _value[type1] = example + "-F-RJ" + print("check Product is air from forward to backward device,Product Name:%s"%_value[type1]) + break + elif option == "2": + _value[type1] = example + "-R-RJ" + print("check Product is air from backward to forward device,Product Name:%s"%_value[type1]) + break + else: + print("input incorrect, check please") + return True + print("Please input[%s]such as(%s):" % (tips, example)) + name = upper_input("") + if type1 == TLV_CODE_MAC_BASE: + if len(name) != 12: + raise SETMACException("MAC address length incorrect, check please") + release_mac = "" + for i in range(int(len(name) / 2)): + if i == 0: + release_mac += name[i * 2:i * 2 + 2] + else: + release_mac += ":" + name[i * 2:i * 2 + 2] + if isValidMac(release_mac) == True: + _value[type1] = release_mac + else: + raise SETMACException("MAC address invaild, check please") + elif type1 == TLV_CODE_DEVICE_VERSION: + if name.isdigit(): + _value[type1] = int(name) + else: + raise SETMACException("Version is not number, check please") + elif type1 == TLV_CODE_MAC_SIZE: + if name.isdigit(): + _value[type1] = int(name, 16) + else: + raise SETMACException("Version is not number, check please") + elif type1 == TLV_CODE_SERIAL_NUMBER: + if name.isalnum() == False: + raise SETMACException("Serial Number invaild string, check please") + elif len(name) != 13: + raise SETMACException("Serial Number length incorrect, check please") + else: + _value[type1] = name + elif type1 == TLV_CODE_VENDOR_EXT: + _value[type1] = name + else: + _value[type1] = name + return True + + +def astrcmp(str1, str2): + return str1.lower() == str2.lower() + + +def generate_ext(cardid): + s = "%08x" % cardid + ret = "" + for t in range(0, 4): + ret += chr(int(s[2 * t:2 * t + 2], 16)) + ret = chr(0x01) + chr(len(ret)) + ret + return ret + + +def rji2cget(bus, devno, address): + command_line = "i2cget -f -y %d 0x%02x 0x%02x " % (bus, devno, address) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = rj_os_system(command_line) + if ret == 0: + return True, ret_t + time.sleep(0.1) + return False, ret_t + + +def rji2cset(bus, devno, address, byte): + command_line = "i2cset -f -y %d 0x%02x 0x%02x 0x%02x" % ( + bus, devno, address, byte) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = rj_os_system(command_line) + if ret == 0: + return True, ret_t + return False, ret_t + +def rjpcird(pcibus , slot , fn, bar, offset): + '''read pci register''' + if offset % 4 != 0: + return + filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % (int(pcibus), int(slot), int(fn), int(bar)) + file = open(filename, "r+") + size = os.path.getsize(filename) + data = mmap.mmap(file.fileno(), size) + result = data[offset: offset + 4] + s = result[::-1] + val = 0 + for i in range(0, len(s)): + val = val << 8 | ord(s[i]) + return "0x%08x" % val + + +def rjpciwr(pcibus , slot ,fn, bar, offset, data): + '''write pci register''' + ret = inttostr(data, 4) + filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % (int(pcibus), int(slot), int(fn), int(bar)) + file = open(filename, "r+") + size = os.path.getsize(filename) + data = mmap.mmap(file.fileno(), size) + data[offset: offset + 4] = ret + result = data[offset: offset + 4] + s = result[::-1] + val = 0 + for i in range(0, len(s)): + val = val << 8 | ord(s[i]) + data.close() + +def rjsysset(location, value): + command_line = "echo 0x%02x > %s" % (value, location) + retrytime = 6 + ret_t = "" + for i in range(retrytime): + ret, ret_t = rj_os_system(command_line) + if ret == 0: + return True, ret_t + return False, ret_t + + +def rji2cgetWord(bus, devno, address): + command_line = "i2cget -f -y %d 0x%02x 0x%02x w" % (bus, devno, address) + retrytime = 3 + ret_t = "" + for i in range(retrytime): + ret, ret_t = rj_os_system(command_line) + if ret == 0: + return True, ret_t + return False, ret_t + + +def rji2csetWord(bus, devno, address, byte): + command_line = "i2cset -f -y %d 0x%02x 0x%02x 0x%x w" % ( + bus, devno, address, byte) + rj_os_system(command_line) + + +def fan_setmac(): + rji2cset(FAN_PROTECT["bus"], FAN_PROTECT["devno"], + FAN_PROTECT["addr"], FAN_PROTECT["open"]) + rji2cset(FAN_PROTECT["bus"], FAN_PROTECT["devno"], + FAN_PROTECT["addr"], FAN_PROTECT["close"]) + + +def checkfansninput(fan_sn, fansntemp): + if fan_sn in fansntemp: + RJPRINTERR("exist same Serial Number,please input again") + return False + if(len(fan_sn) != 13): + RJPRINTERR("Serial Number length incorrect,please input again") + return False + return True + +# check 输入的hardware version + + +def checkfanhwinput(hw): + if len(hw) != 4: + RJPRINTERR("hardware version length incorrect, please input again") + return False + if hw.find(".") != 1: + RJPRINTERR("hardware version incorrect, please input again") + return False + return True + + +def util_show_fanse2(fans): + formatstr = "%-8s %-20s %-20s %-20s %-20s" + print(formatstr % ("id", "Name", "hardware version", "Serial Number", "Time")) + print(formatstr % ("------", "---------------", "---------------", "---------------", "----")) + for fan in fans: + # print fan.dstatus + if fan.dstatus < 0: + print("%-8s" % ("FAN%d" % (fans.index(fan) + 1))) + RJPRINTERR(" decode e2 error") + else: + print(formatstr % ("FAN%d" % (fans.index(fan) + 1), fan.typename.replace(chr(0x00), ""), + fan.typehwinfo.replace(chr(0x00), ""), fan.typesn.replace(chr(0x00), ""), fan.fandecodetime)) + + +def get_fane2_sysfs(bus, loc): + rg_fan_e2 = "%d-%04x/fan" % (bus, loc) + eeprom = get_sysfs_value(rg_fan_e2) + return eeprom + + +def util_show_fane2(): + ret = sorted(I2CUTIL.getvaluefromdevice("rg_fan")) + if len(ret) <=0: + return None + fans = [] + for index in range(len(ret)): + t1 = (int(round(time.time() * 1000))) + eeprom = get_fane2_sysfs(ret[index]["bus"], ret[index]["loc"]) + t2 = (int(round(time.time() * 1000))) + fane2 = fan_tlv() + fane2.fandecodetime = t2 - t1 + fane2.decode(eeprom) + fans.append(fane2) + util_show_fanse2(fans) + + +def getPid(name): + ret = [] + for dirname in os.listdir('/proc'): + if dirname == 'curproc': + continue + try: + with open('/proc/{}/cmdline'.format(dirname), mode='rb') as fd: + content = fd.read() + except Exception: + continue + if name in content: + ret.append(dirname) + return ret + +def fac_fans_setmac_tlv(ret): + if len(ret) <=0: + return None + fans = [] + fansntemp = [] + for index in range(len(ret)): + item = ret[index] + log_debug(item) + eeprom = get_fane2_sysfs(item["bus"], item["loc"]) + fane2 = fan_tlv() + fane2.decode(eeprom) + fane2.fanbus = item["bus"] + fane2.fanloc = item["loc"] + log_debug("decode eeprom success") + + print("Fan[%d]-[%s]setmac" % ((index + 1), FANS_DEF[fane2.typedevtype])) + while True: + print("Please input[%s]:" % "Serial Number") + fan_sn = raw_input() + if checkfansninput(fan_sn, fansntemp) == False: + continue + fansntemp.append(fan_sn) + fan_sn = fan_sn + chr(0x00) + fane2.typesn = fan_sn + chr(0x00) + break + while True: + print("Please input[%s]:" % "hardware version") + hwinfo = raw_input() + if checkfanhwinput(hwinfo) == False: + continue + fan_hwinfo = hwinfo + chr(0x00) + fane2.typehwinfo = fan_hwinfo + chr(0x00) + break + log_debug(fane2.typedevtype) + fane2.typename = FANS_DEF[fane2.typedevtype] + chr(0x00) + fans.append(fane2) + print("\n") + print("\n*******************************\n") + + util_show_fanse2(fans) + if getInputCheck("check input correctly or not(Yes/No):") == True: + for fan in fans: + log_debug("ouput fan") + fac_fan_setmac(fan) + else: + print("setmac quit") + return False + + +def fac_fan_setmac_fru(ret): + fans = FRULISTS.get('fans') + + fanfrus = {} + newfrus = {} + + #getmsg + try: + for fan in fans: + print("===============%s ================getmessage" % fan.get('name')) + eeprom = getsysvalue(I2CUTIL.getE2File(fan.get('bus'), fan.get('loc'))) + fru = ipmifru() + fru.decodeBin(eeprom) + fanfrus[fan.get('name')] = fru + except Exception as e: + print(str(e)) + return False + + #setmsg + for fan in fans: + print("===============%s ================setmac" % fan.get('name')) + fruold = fanfrus.get(fan.get('name')) + newfru = getInputSetmac(fruold) + newfru.recalcute() + newfrus[fan.get('name')] = newfru + #writemsg + for fan in fans: + print("===============%s ================writeToE2" % fan.get('name')) + ret_t = newfrus.get(fan.get('name')) + I2CUTIL.openFanE2Protect() + I2CUTIL.writeToFanE2(fan.get('bus'), fan.get('loc'), ret_t.bindata) + I2CUTIL.closeFanE2Protect() + #check + try: + for fan in fans: + print("===============%s ================getmessage" % fan.get('name')) + eeprom = getsysvalue(I2CUTIL.getE2File(fan.get('bus'), fan.get('loc'))) + fru = ipmifru() + fru.decodeBin(eeprom) + except Exception as e: + print(str(e)) + return False + return True + +def fac_fans_setmac(): + ret = I2CUTIL.getvaluefromdevice("rg_fan") + if ret is not None and len(ret) > 0: + return fac_fans_setmac_tlv(ret) + fans = FRULISTS.get('fans', None) + if fans is not None and len(fans)>0: + return fac_fan_setmac_fru(ret) + return False + +def fac_fan_setmac(item): + I2CUTIL.openFanE2Protect() + I2CUTIL.writeToFanE2(item.fanbus, item.fanloc, item.generate_fan_value()) + I2CUTIL.closeFanE2Protect() + +def writeToEEprom(rst_arr): + dealtype = E2_PROTECT.get('gettype',None) + if dealtype is None: + rji2cset(E2_PROTECT["bus"], E2_PROTECT["devno"], + E2_PROTECT["addr"], E2_PROTECT["open"]) + elif dealtype == "io": + io_wr(E2_PROTECT["io_addr"], E2_PROTECT["open"]) + index = 0 + for item in rst_arr: + rji2cset(E2_LOC["bus"], E2_LOC["devno"], index, ord(item)) + index += 1 + + if dealtype is None: + rji2cset(E2_PROTECT["bus"], E2_PROTECT["devno"], + E2_PROTECT["addr"], E2_PROTECT["close"]) + elif dealtype == "io": + io_wr(E2_PROTECT["io_addr"], E2_PROTECT["close"]) + # deal last drivers + os.system("rmmod at24 ") + os.system("modprobe at24 ") + os.system("rm -f /var/cache/sonic/decode-syseeprom/syseeprom_cache") + + +def get_local_eth0_mac(): + cmd = "ifconfig eth0 |grep HWaddr" + print(rj_os_system(cmd)) + +def getonieversion(): + if not os.path.isfile('/host/machine.conf'): + return "" + machine_vars = {} + with open('/host/machine.conf') as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars.get("onie_version") + +def createbmcMac(cpumac , num = 2): + bcmvalue = strtoint(cpumac[cpumac.rindex(":")+ 1:len(cpumac)]) + num + # bmcmac = + t = cpumac.split(":") + t[5] = "%02x" % bcmvalue + bmcmac = ":".join(t) + return bmcmac.upper() + + +def fac_board_setmac(): + _value = {} + # default value + _value[TLV_CODE_VENDOR_EXT] = generate_ext(RUIJIE_CARDID) # generate id + _value[TLV_CODE_PRODUCT_NAME] = RUIJIE_PRODUCTNAME + _value[TLV_CODE_PART_NUMBER] = RUIJIE_PART_NUMBER + _value[TLV_CODE_LABEL_REVISION] = RUIJIE_LABEL_REVISION + _value[TLV_CODE_PLATFORM_NAME] = platform + _value[TLV_CODE_ONIE_VERSION] = getonieversion() + _value[TLV_CODE_MAC_SIZE] = RUIJIE_MAC_SIZE + _value[TLV_CODE_MANUF_NAME] = RUIJIE_MANUF_NAME + _value[TLV_CODE_MANUF_COUNTRY] = RUIJIE_MANUF_COUNTRY + _value[TLV_CODE_VENDOR_NAME] = RUIJIE_VENDOR_NAME + _value[TLV_CODE_DIAG_VERSION] = RUIJIE_DIAG_VERSION + _value[TLV_CODE_SERVICE_TAG] = RUIJIE_SERVICE_TAG + try: + if 0x00004052 == RUIJIE_CARDID: + _value[TLV_CODE_PRODUCT_NAME] = RUIJIE_PRODUCTNAME + "-RJ" + elif 0x00004051 == RUIJIE_CARDID or 0x00004050 == RUIJIE_CARDID: + changeTypeValue(_value, TLV_CODE_PRODUCT_NAME, + "Product name",RUIJIE_PRODUCTNAME) + + changeTypeValue(_value, TLV_CODE_SERIAL_NUMBER, + "SN", "0000000000000") # add serial number + changeTypeValue(_value, TLV_CODE_DEVICE_VERSION, + "hardware version", "101") # hardware version + changeTypeValue(_value, TLV_CODE_MAC_BASE, + "MAC address", "58696cfb2108") # MAC address + _value[TLV_CODE_MANUF_DATE] = time.strftime( + '%m/%d/%Y %H:%M:%S', time.localtime()) # add setmac time + rst, ret = generate_value(_value) + if util_setmac("eth0", _value[TLV_CODE_MAC_BASE]) == True: # set Internet cardIP + writeToEEprom(rst) # write to e2 + # set BMC MAC + if "bmcsetmac" in FACTESTMODULE and FACTESTMODULE['bmcsetmac'] == 1: + bmcmac = createbmcMac(_value[TLV_CODE_MAC_BASE]) + if ipmi_set_mac(bmcmac) == True: + print("BMC MAC[%s]"%bmcmac) + else: + print("SET BMC MAC FAILED") + return False + else: + return False + except SETMACException as e: + #print(e) + RJPRINTERR("\n\n%s\n\n" % e) + return False + except ValueError as e: + return False + return True + + +def ipmi_set_mac(mac): + macs = mac.split(":") + cmdinit = "ipmitool raw 0x0c 0x01 0x01 0xc2 0x00" + cmdset = "ipmitool raw 0x0c 0x01 0x01 0x05" + for ind in range(len(macs)): + cmdset += " 0x%02x" % int(macs[ind], 16) + rj_os_system(cmdinit) + ret, status = rj_os_system(cmdset) + if ret: + RJPRINTERR("\n\n%s\n\n" % status) + return False + return True + + +def getInputValue(title, tips): + print("Please input[%s]such as(%s):" % (title, tips)) + name = raw_input() + + return name + + +def bmc_setmac(): + tips = "BMC MAC" + print("Please input value you want to change[%s]:" % tips) + name = raw_input() + if len(name) != 12: + RJPRINTERR("\nMAC address invaild, try again\n") + return False + release_mac = "" + for i in range(int(len(name) / 2)): + if i == 0: + release_mac += name[i * 2:i * 2 + 2] + else: + release_mac += ":" + name[i * 2:i * 2 + 2] + if isValidMac(release_mac) == True: + if ipmi_set_mac(release_mac) == True: + return True + else: + RJPRINTERR("\nMAC address invaild, try again\n") + return False + + +def closeProtocol(): + # disable LLDP + log_info("disable LLDP") + sys.stdout.write(".") + sys.stdout.flush() + rj_os_system("systemctl stop lldp.service") + log_info("disable lldp service") + sys.stdout.write(".") + sys.stdout.flush() + rj_os_system("systemctl stop bgp.service") + log_info("disable bgp service") + sys.stdout.write(".") + sys.stdout.flush() + #ret, status = rj_os_system('bcmcmd "port ce,xe stp=disable"') + +# check SDK memory must be 256M + + +def checkSdkMem(): + ind = 0 + file_data = "" + with open(file_name, "r") as f: + for line in f: + if "dmasize=16M" in line: + line = line.replace("dmasize=16M", "dmasize=256M") + ind = -1 + file_data += line + if ind == 0: + return + with open(file_name, "w") as f: + f.write(file_data) + print("change SDK memory to 256, reboot required") + rj_os_system("sync") + rj_os_system("reboot") + +########################################################################## +# receives a character setting +########################################################################## + + +def getch(msg): + ret = "" + fd = sys.stdin.fileno() + old_ttyinfo = termios.tcgetattr(fd) + new_ttyinfo = old_ttyinfo[:] + new_ttyinfo[3] &= ~termios.ICANON + new_ttyinfo[3] &= ~termios.ECHO + sys.stdout.write(msg) + sys.stdout.flush() + try: + termios.tcsetattr(fd, termios.TCSANOW, new_ttyinfo) + ret = os.read(fd, 1) + finally: + # print "try to setting" + termios.tcsetattr(fd, termios.TCSANOW, old_ttyinfo) + return ret + +def get_raw_input(): + ret="" + fd=sys.stdin.fileno() + old_ttyinfo=termios.tcgetattr(fd) + new_ttyinfo=old_ttyinfo[:] + new_ttyinfo[3] &= ~termios.ICANON + new_ttyinfo[3] &= ~termios.ECHO + try: + termios.tcsetattr(fd,termios.TCSANOW,new_ttyinfo) + ret=raw_input("") + except Exception as e: + print(e) + finally: + termios.tcsetattr(fd,termios.TCSANOW,old_ttyinfo) + return ret + + +def getsysvalue(location): + retval = None + mb_reg_file = location + if (not os.path.isfile(mb_reg_file)): + print(mb_reg_file, 'not found !') + return retval + try: + if (not os.path.isfile(mb_reg_file)): + print(mb_reg_file, 'not found !') + return retval + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + log_error("Unable to open " + mb_reg_file + "file !") + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + #log_debug(retval) + return retval + +# get file value + + +def get_pmc_register(reg_name): + retval = 'ERR' + mb_reg_file = MAILBOX_DIR + reg_name + filepath = glob.glob(mb_reg_file) + if(len(filepath) == 0): + return "%s %s notfound"% (retval , mb_reg_file) + mb_reg_file = filepath[0] + if (not os.path.isfile(mb_reg_file)): + return "%s %s notfound"% (retval , mb_reg_file) + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + pass + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +# decode EEPROM + + +def decoder(s, t): + if ord(t[0]) == TLV_CODE_PRODUCT_NAME: + name = "Product Name" + value = str(t[2:2 + ord(t[1])]) + elif ord(t[0]) == TLV_CODE_PART_NUMBER: + name = "Part Number" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_SERIAL_NUMBER: + name = "Serial Number" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_MAC_BASE: + name = "Base MAC Address" + value = ":".join([binascii.b2a_hex(T) for T in t[2:8]]).upper() + elif ord(t[0]) == TLV_CODE_MANUF_DATE: + name = "Manufacture Date" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_DEVICE_VERSION: + name = "Device Version" + value = str(ord(t[2])) + elif ord(t[0]) == TLV_CODE_LABEL_REVISION: + name = "Label Revision" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_PLATFORM_NAME: + name = "Platform Name" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_ONIE_VERSION: + name = "ONIE Version" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_MAC_SIZE: + name = "MAC Addresses" + value = str((ord(t[2]) << 8) | ord(t[3])) + elif ord(t[0]) == TLV_CODE_MANUF_NAME: + name = "Manufacturer" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_MANUF_COUNTRY: + name = "Manufacture Country" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_VENDOR_NAME: + name = "Vendor Name" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_DIAG_VERSION: + name = "Diag Version" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_SERVICE_TAG: + name = "Service Tag" + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_VENDOR_EXT: + name = "Vendor Extension" + value = "" + if _TLV_DISPLAY_VENDOR_EXT: + value = t[2:2 + ord(t[1])] + elif ord(t[0]) == TLV_CODE_CRC_32 and len(t) == 6: + name = "CRC-32" + value = "0x%08X" % (((ord(t[2]) << 24) | ( + ord(t[3]) << 16) | (ord(t[4]) << 8) | ord(t[5])),) + elif ord(t[0]) == TLV_CODE_RJ_CARID: + name = "rj_cardid" + value = "" + for c in t[2:2 + ord(t[1])]: + value += "%02X" % (ord(c),) + else: + name = "Unknown" + value = "" + for c in t[2:2 + ord(t[1])]: + value += "0x%02X " % (ord(c),) + return {"name": name, "code": ord(t[0]), "value": value} + + +def decode_eeprom(e): + total_len = (ord(e[9]) << 8) | ord(e[10]) + tlv_index = _TLV_INFO_HDR_LEN + tlv_end = _TLV_INFO_HDR_LEN + total_len + ret = [] + while (tlv_index + 2) < len(e) and tlv_index < tlv_end: + rt = decoder(None, e[tlv_index:tlv_index + 2 + ord(e[tlv_index + 1])]) + ret.append(rt) + if ord(e[tlv_index]) == TLV_CODE_CRC_32: + break + tlv_index += ord(e[tlv_index + 1]) + 2 + for item in ret: + if item['code'] == TLV_CODE_VENDOR_EXT: + rt = decoder(None, item["value"] + [0: 0 + 2 + ord(item["value"][0 + 1])]) + ret.append(rt) + return ret + + +def get_sys_eeprom(): + eeprom = get_sysfs_value(rg_eeprom) + return decode_eeprom(eeprom) + +# get card ID +def getCardId(): + ret = get_sys_eeprom() + for item in ret: + if item['code'] == TLV_CODE_RJ_CARID: + return item.get('value',None) + return None + +# ==================================== +# execute shell command +# ==================================== +def rj_os_system(cmd): + status, output = subprocess.getstatusoutput(cmd) + return status, output + +########################################### +# get memory slot and number via DMI command +########################################### +def getsysmeminfo(): + ret, log = rj_os_system("which dmidecode ") + if ret != 0 or len(log) <= 0: + error = "cmd find dmidecode" + return False, error + cmd = log + "|grep -P -A5 \"Memory\s+Device\"|grep Size|grep -v Range" + # get total number first + result = [] + ret1, log1 = rj_os_system(cmd) + if ret1 == 0 and len(log1): + log1 = log1.lstrip() + arr = log1.split("\n") + #total = len(arr) # total slot number + for i in range(len(arr)): + val = re.sub("\D", "", arr[i]) + if val == "": + val = arr[i].lstrip() + val = re.sub('Size:', '', val).lstrip() + # print val + result.append({"slot": i + 1, "size": val}) + return True, result + return False, "error" + +########################################### +# get memory slot and number via DMI command +# return various arrays +########################################### +def getsysmeminfo_detail(): + ret, log = rj_os_system("which dmidecode ") + if ret != 0 or len(log) <= 0: + error = "cmd find dmidecode" + return False, error + cmd = log + " -t 17 | grep -A21 \"Memory Device\"" # 17 + # get total number + ret1, log1 = rj_os_system(cmd) + if ret1 != 0 or len(log1) <= 0: + return False, "command execution error[%s]" % cmd + result_t = log1.split("--") + mem_rets = [] + for item in result_t: + its = item.replace("\t", "").strip().split("\n") + ret = {} + for it in its: + if ":" in it: + key = it.split(":")[0].lstrip() + value = it.split(":")[1].lstrip() + ret[key] = value + mem_rets.append(ret) + return True, mem_rets + + +########################################### +# get BIOS info via DMI command +########################################### +def getDmiSysByType(type_t): + ret, log = rj_os_system("which dmidecode ") + if ret != 0 or len(log) <= 0: + error = "cmd find dmidecode" + return False, error + cmd = log + " -t %s" % type_t + # get total number + ret1, log1 = rj_os_system(cmd) + if ret1 != 0 or len(log1) <= 0: + return False, "command execution error[%s]" % cmd + its = log1.replace("\t", "").strip().split("\n") + ret = {} + for it in its: + if ":" in it: + key = it.split(":")[0].lstrip() + value = it.split(":")[1].lstrip() + ret[key] = value + return True, ret + + +def gethwsys(): + return getDmiSysByType(1) + +########################################### +# get BIOS info via DMI command + + +def getsysbios(): + return getDmiSysByType(0) + + +def searchDirByName(name, dir): + result = [] + try: + files = os.listdir(dir) + for file in files: + if name in file: + result.append(os.path.join(dir, file)) + except Exception as e: + pass + return result + + +def getUsbLocation(): + dir = "/sys/block/" + spect = "sd" + usbpath = "" + result = searchDirByName(spect, dir) + if len(result) <= 0: + return False + for item in result: + with open(os.path.join(item, "removable"), 'r') as fd: + value = fd.read() + if value.strip() == "1": # U-Disk found + usbpath = item + break + if usbpath == "": # no U-Disk found + log_debug("no usb found") + return False, usbpath + return True, usbpath + +# judge USB file +def getusbinfo(): + ret, path = getUsbLocation() + if ret == False: + return False, "not usb exists" + str = os.path.join(path, "size") + ret, value = getfilevalue(str) + if ret == True: + return True, {"id": os.path.basename(path), "size": float(value) * 512 / 1024 / 1024 / 1024} + else: + return False, "Err" + +def get_cpu_info(): + cmd = "cat /proc/cpuinfo |grep processor -A18" # 17 + + ret, log1 = rj_os_system(cmd) + if ret != 0 or len(log1) <= 0: + return False, "command execution error[%s]" % cmd + result_t = log1.split("--") + mem_rets = [] + for item in result_t: + its = item.replace("\t", "").strip().split("\n") + ret = {} + for it in its: + if ":" in it: + key = it.split(":")[0].lstrip() + value = it.split(":")[1].lstrip() + ret[key] = value + mem_rets.append(ret) + return True, mem_rets +# read file +def get_version_config_info(attr_key, file_name=None): + if file_name is None: + version_conf_filename = "/root/version.json" + else: + version_conf_filename = file_name + if not os.path.isfile(version_conf_filename): + return None + with open(version_conf_filename) as rjconf_file: + for line in rjconf_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + if tokens[0] == attr_key: + return tokens[1].strip() + return None + + +def io_rd(reg_addr, len =1): + u'''io read''' + try: + regaddr = 0 + if type(reg_addr) == int: + regaddr = reg_addr + else: + regaddr = int(reg_addr, 16) + devfile = "/dev/port" + fd = os.open(devfile, os.O_RDWR|os.O_CREAT) + os.lseek(fd, regaddr, os.SEEK_SET) + str = os.read(fd, len) + return "".join(["%02x"% ord(item) for item in str]) + except ValueError: + return None + except Exception as e: + print(e) + return None + finally: + os.close(fd) + + +def io_wr(reg_addr, reg_data): + u'''io write''' + try: + regdata = 0 + regaddr = 0 + if type(reg_addr) == int: + regaddr = reg_addr + else: + regaddr = int(reg_addr, 16) + if type(reg_data) == int: + regdata = reg_data + else: + regdata = int(reg_data, 16) + devfile = "/dev/port" + fd = os.open(devfile, os.O_RDWR|os.O_CREAT) + os.lseek(fd, regaddr, os.SEEK_SET) + os.write(fd, chr(regdata)) + return True + except ValueError as e: + print(e) + return False + except Exception as e: + print(e) + return False + finally: + os.close(fd) + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/service/device_i2c.service b/platform/broadcom/sonic-platform-modules-ruijie/common/service/device_i2c.service new file mode 100755 index 000000000000..8777a46b7504 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/service/device_i2c.service @@ -0,0 +1,15 @@ +[Unit] +Description= Ruijie Global Initialize I2c drivers. +After=local-fs.target +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/device_i2c.py start +ExecStop=/usr/local/bin/device_i2c.py stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/changelog b/platform/broadcom/sonic-platform-modules-ruijie/debian/changelog new file mode 100755 index 000000000000..c987c3560017 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/changelog @@ -0,0 +1,5 @@ +sonic-ruijie-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- sonic_rd Fri, 21 APR 2017 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/compat b/platform/broadcom/sonic-platform-modules-ruijie/debian/compat new file mode 100755 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/control b/platform/broadcom/sonic-platform-modules-ruijie/debian/control new file mode 100755 index 000000000000..369ad546e8cc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/control @@ -0,0 +1,10 @@ +Source: sonic-ruijie-platform-modules +Section: main +Priority: extra +Maintainer: Ruijie Network +Standards-Version: 3.9.3 + +Package: platform-modules-ruijie-b6510-48vs8cq +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/copyright b/platform/broadcom/sonic-platform-modules-ruijie/debian/copyright new file mode 100755 index 000000000000..c00a47507890 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/copyright @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Ruijie Network Corporation + +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/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.init b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.init new file mode 100644 index 000000000000..a2ff25881623 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.init @@ -0,0 +1,39 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup B6510-48VS8CQ board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + /usr/local/bin/b6510-48vs8cq_platform.sh init + + echo "done." + ;; + +stop) + /usr/local/bin/b6510-48vs8cq_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-b6510-48vs8cq.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.install b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.install new file mode 100644 index 000000000000..436896926310 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.install @@ -0,0 +1,3 @@ +b6510-48vs8cq/modules/sonic_platform-1.0-py3-none-any.whl /usr/share/sonic/device/x86_64-ruijie_b6510-48vs8cq-r0 +b6510-48vs8cq/scripts/b6510-48vs8cq_platform.sh /usr/local/bin +b6510-48vs8cq/systemd/platform-modules-b6510-48vs8cq.service /usr/lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.postinst b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.postinst new file mode 100755 index 000000000000..5edc53b1cac5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/platform-modules-ruijie-b6510-48vs8cq.postinst @@ -0,0 +1,15 @@ +#!/bin/sh +# postinst + +kernel_version=$(uname -r) + +if [ -e /boot/System.map-${kernel_version} ]; then + depmod -a -F /boot/System.map-${kernel_version} ${kernel_version} || true +fi + +# Enable Ruijie-B6510-48VS8CQ-platform-service +depmod -a +systemctl enable platform-modules-b6510-48vs8cq.service +systemctl start platform-modules-b6510-48vs8cq.service + +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-ruijie/debian/rules b/platform/broadcom/sonic-platform-modules-ruijie/debian/rules new file mode 100755 index 000000000000..a2b71bb5c229 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/debian/rules @@ -0,0 +1,93 @@ +#!/usr/bin/make -f +CC=gcc +INSTALL_MOD_DIR:=extra +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +KBUILD_OUTPUT=$(KERNEL_SRC)/build + +LIB_DIR = usr/lib/python3.7/dist-packages +CUSTOM_RULES_DIR := $(shell pwd)/debian + +export INSTALL_MOD_DIR top_srcdir KVERSION KERNEL_SRC CC KBUILD_OUTPUT + +currentdir = $(shell pwd) +MODULE_DIRS := b6510-48vs8cq +export CUSTOMS_DIRS MODULE_DIRS + +#all product need common +COMPILE_DIRS = $(MODULE_DIRS) + +clean_dirs = $(MODULE_DIRS) +clean_dirs += common + +custom_clean_dirs := $(addprefix _clean_,$(clean_dirs) ) + + +%: + dh $@ +build: $(COMPILE_DIRS) + @echo "build success" + +$(custom_clean_dirs): + $(MAKE) -C $(patsubst _clean_%,%,$@) clean + +common_build : + $(MAKE) -C $(MOD_SRC_DIR)/common + +$(COMPILE_DIRS): common_build + $(MAKE) -C $(MOD_SRC_DIR)/$@ + dh_testdir + dh_installdirs + if [ $@ = "b6510-48vs8cq" ]; then \ + dh_installdirs -pplatform-modules-ruijie-$@ \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + fi; \ + cp -r $(MOD_SRC_DIR)/common/build/* debian/platform-modules-ruijie-$@/ + cp -r $(MOD_SRC_DIR)/$@/build/* debian/platform-modules-ruijie-$@/ + + @(for mod in $(MODULE_DIRS); do \ + cp -r $@/build/* $(MOD_SRC_DIR)/debian/platform-modules-ruijie-$${mod}/; \ + if [ $$mod = "b6510-48vs8cq" ]; then \ + cd $(MOD_SRC_DIR)/$${mod}; \ + cp -r $(MOD_SRC_DIR)/common/lib/plat_hal $(MOD_SRC_DIR)/$${mod}/; \ + cp -r $(MOD_SRC_DIR)/common/lib/rjutil $(MOD_SRC_DIR)/$${mod}/; \ + cp -r $(MOD_SRC_DIR)/common/lib/eepromutil $(MOD_SRC_DIR)/$${mod}/; \ + python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/plat_hal; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/rjutil; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/eepromutil; \ + cd $(MOD_SRC_DIR); \ + fi; \ + done) + +binary: binary-indep + @echo "=======================================================" + +binary-indep: + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +override_dh_usrlocal: + +override_dh_pysupport: + +clean: $(custom_clean_dirs) + dh_testdir + dh_testroot + dh_clean + +.PHONY: build $(COMPILE_DIRS) binary binary-arch binary-indep clean diff --git a/platform/marvell-armhf/sai.mk b/platform/marvell-armhf/sai.mk index 70aebfb514e3..e49050ac2acf 100644 --- a/platform/marvell-armhf/sai.mk +++ b/platform/marvell-armhf/sai.mk @@ -1,7 +1,7 @@ # Marvell SAI -export MRVL_SAI_VERSION = 1.7.1 -export MRVL_SAI = mrvllibsai_m0_MASTER_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb +export MRVL_SAI_VERSION = 1.7.1-1 +export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai $(eval $(call add_conflict_package,$(MRVL_SAI),$(LIBSAIVS_DEV))) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh index 4cad43348e06..3f23afe1fce2 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh @@ -51,7 +51,7 @@ chmod 644 /sys/class/i2c-adapter/i2c-0/0-0053/eeprom echo eeprom 0x55 > /sys/class/i2c-adapter/i2c-0/new_device echo eeprom 0x56 > /sys/class/i2c-adapter/i2c-0/new_device -# Enumerate psu eeprom devices +# Enumerate PSU eeprom devices echo eeprom 0x51 > /sys/class/i2c-adapter/i2c-1/new_device echo eeprom 0x52 > /sys/class/i2c-adapter/i2c-1/new_device diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/__init__.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/__init__.py index 139597f9cb07..39c712316dc6 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/__init__.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/__init__.py @@ -1,2 +1,4 @@ +__all__ = ["platform", "chassis"] +from sonic_platform import * diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py index b3ada4c71f9c..a01aca24b684 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py @@ -159,6 +159,14 @@ def get_model(self): """ return self._eeprom.part_number_str() + def get_service_tag(self): + """ + Retrieves the Service Tag of the chassis + Returns: + string: Service Tag of chassis + """ + return self._eeprom.service_tag_str() + def get_status(self): """ Retrieves the operational status of the chassis @@ -367,7 +375,7 @@ def get_watchdog(self): sonic_logger.log_warning(" Fail to load watchdog {}".format(repr(e))) return self._watchdog - + def get_position_in_parent(self): """ Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/component.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/component.py index 6a5410458df7..1c219d7920a5 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/component.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/component.py @@ -16,6 +16,7 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +smbus_present = 1 try: import smbus except ImportError as e: @@ -34,6 +35,7 @@ class Component(ComponentBase): ["System-CPLD", "Used for managing SFPs, LEDs, PSUs and FANs "], ["U-Boot", "Performs initialization during booting"], ] + CPLD_UPDATE_COMMAND = 'cp /usr/sbin/vme /tmp; cp {} /tmp; cd /tmp; ./vme {};' def __init__(self, component_index): self.index = component_index @@ -55,12 +57,12 @@ def _get_command_result(self, cmdline): def _get_cpld_version(self, cpld_number): if smbus_present == 0: - cmdstatus, cpld_version = cmd.getstatusoutput('i2cget -y 0 0x41 0x2') + cmdstatus, cpld_version = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x2') else: bus = smbus.SMBus(0) DEVICE_ADDRESS = 0x41 DEVICE_REG = 0x2 - cpld_version = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG) + cpld_version = str(bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG)) return str(int(cpld_version, 16)) @@ -93,7 +95,7 @@ def get_firmware_version(self): return self._get_cpld_version(self.index) if self.index == 1: - cmdstatus, uboot_version = cmd.getstatusoutput('grep --null-data U-Boot /dev/mtd0ro|head -1 | cut -c 1-30') + cmdstatus, uboot_version = cmd.getstatusoutput('grep --null-data U-Boot /dev/mtd0ro|head -1 | cut -d" " -f2-4') return uboot_version def install_firmware(self, image_path): @@ -114,6 +116,18 @@ def install_firmware(self, image_path): print("ERROR: the cpld image {} doesn't exist ".format(image_path)) return False + cmdline = self.CPLD_UPDATE_COMMAND.format(image_path, image_name) + success_flag = False + try: + subprocess.check_call(cmdline, stderr=subprocess.STDOUT, shell=True) + success_flag = True + except subprocess.CalledProcessError as e: + print("ERROR: Failed to upgrade CPLD: rc={}".format(e.returncode)) + + if success_flag: + print("INFO: Refresh or power cycle is required to finish CPLD installation") + return success_flag + diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py index cefcedaedf12..d0e3e00fffc2 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py @@ -1,5 +1,5 @@ ######################################################################## -# Nokia IXR7220_D1 +# Nokia IXS7215 # # Module contains platform specific implementation of SONiC Platform # Base API and provides the EEPROMs' information. @@ -7,10 +7,9 @@ # The different EEPROMs available are as follows: # - System EEPROM : Contains Serial number, Service tag, Base MA # address, etc. in ONIE TlvInfo EEPROM format. -# - PSU EEPROM : Contains Serial number, Part number, Service Tag, -# PSU type, Revision. -# - Fan EEPROM : Contains Serial number, Part number, Service Tag, -# Fan type, Number of Fans in Fantray, Revision. +# - PSU EEPROM : Contains Model name and Part number. +# - Fan EEPROM : Contains Part number, Serial number, Manufacture Date, +# and Service Tag. ######################################################################## @@ -23,15 +22,9 @@ # PSU eeprom fields in format required by EepromDecoder psu_eeprom_format = [ - ('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7), - ('Part Number', 's', 10), ('Part Num Revision', 's', 3), - ('Mfg Test', 's', 2), ('Redundant copy', 's', 83), ('PSU Type', 's', 1), - ('Fab Rev', 's', 2) - ] - -# Fan eeprom fields in format required by EepromDecoder -fan_eeprom_format = [ - ('Model', 's', 12), ('Serial Number', 's', 13) + ('Model', 's', 15), ('burn', 'x', 1), + ('Part Number', 's', 14), ('burn', 'x', 40), + ('Serial Number', 's', 11) ] @@ -48,6 +41,7 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): if self.is_sys_eeprom: self.start_offset = 0 self.eeprom_path = self.I2C_DIR + "i2c-0/0-0053/eeprom" + # System EEPROM is in ONIE TlvInfo EEPROM format super(Eeprom, self).__init__(self.eeprom_path, self.start_offset, '', True) @@ -55,18 +49,24 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): else: if self.is_psu_eeprom: self.index = psu_index - self.start_offset = 6 + self.start_offset = 18 self.eeprom_path = self.I2C_DIR \ - + "i2c-1/1-005{}/eeprom".format(2 - self.index) + + "i2c-1/1-005{}/eeprom".format(self.index) self.format = psu_eeprom_format + + # Decode device eeprom as per specified format + EepromDecoder.__init__(self, self.eeprom_path, self.format, + self.start_offset, '', True) else: self.index = fan_index - self.start_offset = 13 + self.start_offset = 0 self.eeprom_path = self.I2C_DIR \ - + "i2c-4{0}/4{0}-0050/eeprom".format(self.index - 1) - self.format = fan_eeprom_format - EepromDecoder.__init__(self, self.eeprom_path, self.format, - self.start_offset, '', True) + + "i2c-0/0-005{}/eeprom".format(self.index + 4) + + # Fan EEPROM is in ONIE TlvInfo EEPROM format + super(Eeprom, self).__init__(self.eeprom_path, + self.start_offset, '', True) + self._load_device_eeprom() def _load_system_eeprom(self): @@ -83,24 +83,24 @@ def _load_system_eeprom(self): self.serial_number = 'NA' self.part_number = 'NA' self.model_str = 'NA' - self.serial = 'NA' + self.service_tag = 'NA' self.eeprom_tlv_dict = dict() else: eeprom = self.eeprom_data - self.eeprom_tlv_dict = dict() - if not self.is_valid_tlvinfo_header(eeprom): self.base_mac = 'NA' self.serial_number = 'NA' self.part_number = 'NA' self.model_str = 'NA' - self.serial = 'NA' + self.service_tag = 'NA' return total_length = (eeprom[9] << 8) | eeprom[10] tlv_index = self._TLV_INFO_HDR_LEN tlv_end = self._TLV_INFO_HDR_LEN + total_length + # Construct dictionary of eeprom TLV entries + self.eeprom_tlv_dict = dict() while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: if not self.is_valid_tlv(eeprom[tlv_index:]): break @@ -108,7 +108,7 @@ def _load_system_eeprom(self): tlv = eeprom[tlv_index:tlv_index + 2 + eeprom[tlv_index + 1]] code = "0x%02X" % (tlv[0]) - + name, value = self.decoder(None, tlv) self.eeprom_tlv_dict[code] = value @@ -118,56 +118,98 @@ def _load_system_eeprom(self): tlv_index += eeprom[tlv_index+1] + 2 self.base_mac = self.eeprom_tlv_dict.get( - "0x%X" % (self._TLV_CODE_MAC_BASE), 'NA') + "0x%X" % (self._TLV_CODE_MAC_BASE), 'NA') self.serial_number = self.eeprom_tlv_dict.get( - "0x%X" % (self._TLV_CODE_SERIAL_NUMBER), 'NA') + "0x%X" % (self._TLV_CODE_SERIAL_NUMBER), 'NA') self.part_number = self.eeprom_tlv_dict.get( - "0x%X" % (self._TLV_CODE_PART_NUMBER), 'NA') + "0x%X" % (self._TLV_CODE_PART_NUMBER), 'NA') self.model_str = self.eeprom_tlv_dict.get( - "0x%X" % (self._TLV_CODE_PRODUCT_NAME), 'NA') - self.serial = self.eeprom_tlv_dict.get( - "0x%X" % (self._TLV_CODE_SERVICE_TAG), 'NA') + "0x%X" % (self._TLV_CODE_PRODUCT_NAME), 'NA') + self.service_tag = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_SERVICE_TAG), 'NA') def _load_device_eeprom(self): """ - Reads the Fan/PSU EEPROM and retrieves the serial number and - model number of the device. + Reads the Fan/PSU EEPROM and interprets as per the specified format """ - try: - # Read Fan/PSU EEPROM as per the specified format. - self.eeprom_data = EepromDecoder.read_eeprom(self) - except Exception as e: - self.serial_number = 'NA' - self.part_number = 'NA' - self.model_str = 'NA' - self.serial = 'NA' - else: + self.serial_number = 'NA' + self.part_number = 'NA' + self.model_str = 'NA' + self.service_tag = 'NA' + self.mfg_date = 'NA' + + # PSU device eeproms use proprietary format + if self.is_psu_eeprom: + try: + # Read Fan/PSU EEPROM as per the specified format. + self.eeprom_data = EepromDecoder.read_eeprom(self) + except Exception as e: + return + + # Bail out if PSU eeprom unavailable + if self.eeprom_data[0] == 255: + return + (valid, data) = self._get_eeprom_field("Model") if valid: - self.model_str = data - else: - self.model_str = 'NA' + self.model_str = data.decode() - (valid, data) = self._get_eeprom_field("Serial Number") + (valid, data) = self._get_eeprom_field("Part Number") if valid: - self.serial_number = data - else: - self.serial_number = 'NA' + self.part_number = data.decode() - if self.is_psu_eeprom: - (valid, data) = self._get_eeprom_field("PSU Type") + # Early PSU device eeproms were not programmed with serial # + try: + (valid, data) = self._get_eeprom_field("Serial Number") if valid: - self.psu_type = data - else: - self.psu_type = 'NA' - else: - (valid, data) = self._get_eeprom_field("Fan Type") - if valid: - self.fan_type = data - else: - self.fan_type = 'NA' + self.serial_number = data.decode() + except Exception as e: + return + + # Fan device eeproms use ONIE TLV format + else: + try: + # Read Fan EEPROM as per ONIE TlvInfo EEPROM format. + self.eeprom_data = self.read_eeprom() + except Exception as e: + return + + eeprom = self.eeprom_data + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = (eeprom[9] << 8) | eeprom[10] + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + # Construct dictionary of eeprom TLV entries + self.eeprom_tlv_dict = dict() + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + eeprom[tlv_index + 1]] + code = "0x%02X" % (tlv[0]) + + name, value = self.decoder(None, tlv) + + self.eeprom_tlv_dict[code] = value + if eeprom[tlv_index] == self._TLV_CODE_CRC_32: + break + + tlv_index += eeprom[tlv_index+1] + 2 + + self.serial_number = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_SERIAL_NUMBER), 'NA') + self.part_number = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_PART_NUMBER), 'NA') + self.model_str = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_PRODUCT_NAME), 'NA') + self.service_tag = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_SERVICE_TAG), 'NA') - def _get_eeprom_field(self, field_name): + def _get_eeprom_field(self, field_name, decode=False): """ For a field name specified in the EEPROM format, returns the presence of the field and the value for the same. @@ -205,24 +247,23 @@ def airflow_fan_type(self): else: return int(self.fan_type.encode('hex'), 16) - # System EEPROM specific methods - def base_mac_addr(self): - """ - Returns the base MAC address found in the system EEPROM. - """ - return self.base_mac - def modelstr(self): """ Returns the Model name. """ return self.model_str - def serial_str(self): + def base_mac_addr(self): + """ + Returns the base MAC address found in the system EEPROM. + """ + return self.base_mac + + def service_tag_str(self): """ Returns the servicetag number. """ - return self.serial + return self.service_tag def system_eeprom_info(self): """ diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py index 67610a125fad..14c00c763dde 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py @@ -1,5 +1,5 @@ ######################################################################## -# Nokia 7215 +# Nokia IXS7215 # # Module contains an implementation of SONiC Platform Base API and # provides the Fans' information which are available in the platform @@ -9,7 +9,9 @@ try: import os + import time from sonic_platform_base.fan_base import FanBase + from sonic_platform.eeprom import Eeprom from sonic_py_common import logger except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -41,6 +43,9 @@ def __init__(self, fan_index, fan_drawer, psu_fan=False, dependency=None): self.get_fan_speed_reg = ADT7473_DIR+"fan{}_input".format(self.index) self.max_fan_speed = MAX_IXS7215_FAN_SPEED self.supported_led_color = ['off', 'green', 'red'] + + # Fan eeprom + self.eeprom = Eeprom(is_fan=True, fan_index=self.index) else: # this is a PSU Fan self.index = fan_index @@ -78,6 +83,12 @@ def _set_i2c_register(self, reg_file, value): except Exception as e: rv = 'ERR' + # Ensure that the write operation has succeeded + if (int(self._get_i2c_register(reg_file)) != value ): + time.sleep(3) + if (int(self._get_i2c_register(reg_file)) != value ): + rv = 'ERR' + return rv def get_name(self): @@ -123,10 +134,9 @@ def get_model(self): Retrieves the model number of the Fan Returns: - string: Part number of Fan + string: Model number of Fan. Use part number for this. """ - - return 'NA' + return self.eeprom.part_number_str() def get_serial(self): """ @@ -135,8 +145,25 @@ def get_serial(self): Returns: string: Serial number of Fan """ + return self.eeprom.serial_number_str() + + def get_part_number(self): + """ + Retrieves the part number of the Fan + + Returns: + string: Part number of Fan + """ + return self.eeprom.part_number_str() - return 'NA' + def get_service_tag(self): + """ + Retrieves the service tag of the Fan + + Returns: + string: Service Tag of Fan + """ + return self.eeprom.service_tag_str() def get_status(self): """ diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py index cabb15d455d6..35b663cbb786 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py @@ -30,7 +30,7 @@ def get_model(self): """ Retrieves the model number of the Fan Drawer Returns: - string: Part number of Fan Drawer + string: Part number of Fan Drawer """ return self._fan_list[0].get_model() @@ -49,7 +49,7 @@ def get_status(self): bool: True if Fan is operating properly, False if not """ return self._fan_list[0].get_status() - + def get_direction(self): return 'intake' @@ -74,8 +74,8 @@ def get_position_in_parent(self): integer: The 1-based relative physical position in parent device """ return self._index - - + + # For Nokia platforms with fan drawer(s) class RealDrawer(NokiaFanDrawer): def __init__(self, index): @@ -84,8 +84,3 @@ def __init__(self, index): def get_name(self): return self._name - - - - - diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py index ab53abebf934..9de9ebec3699 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py @@ -1,5 +1,5 @@ ######################################################################## -# Nokia 7215 +# Nokia IXS7215 # # Module contains an implementation of SONiC Platform Base API and # provides the PSUs' information which are available in the platform @@ -10,6 +10,7 @@ import sys from sonic_platform_base.psu_base import PsuBase from sonic_py_common import logger + from sonic_platform.eeprom import Eeprom except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -34,6 +35,9 @@ def __init__(self, psu_index): self.index = psu_index + 1 self._fan_list = [] + # PSU eeprom + self.eeprom = Eeprom(is_psu=True, psu_index=self.index) + def get_name(self): """ Retrieves the name of the device @@ -52,7 +56,7 @@ def get_presence(self): """ if smbus_present == 0: # if called from psuutil outside of pmon - cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 0 0x41 0xa') + cmdstatus, psustatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0xa') psustatus = int(psustatus, 16) else: bus = smbus.SMBus(0) @@ -78,8 +82,7 @@ def get_model(self): Returns: string: Part number of PSU """ - return "N/A" -# return self.eeprom.serial_number_str() + return self.eeprom.modelstr() def get_serial(self): @@ -89,9 +92,17 @@ def get_serial(self): Returns: string: Serial number of PSU """ - return "N/A" -# return self.eeprom.serial_number_str() + return self.eeprom.serial_number_str() + + + def get_part_number(self): + """ + Retrieves the part number of the PSU + Returns: + string: Part number of PSU + """ + return self.eeprom.part_number_str() def get_status(self): """ @@ -102,7 +113,7 @@ def get_status(self): """ if smbus_present == 0: - cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 0 0x41 0xa') + cmdstatus, psustatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0xa') psustatus = int(psustatus, 16) sonic_logger.log_warning("PMON psu-smbus - presence = 0 ") else: @@ -131,7 +142,7 @@ def get_voltage(self): e.g. 12.1 """ if smbus_present == 0: - cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 0 0x41 0xa') + cmdstatus, psustatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0xa') psustatus = int(psustatus, 16) else: bus = smbus.SMBus(0) @@ -153,30 +164,6 @@ def get_voltage(self): psu_voltage = 0.0 return psu_voltage -# def get_current(self): -# """ -# Retrieves present electric current supplied by PSU -# -# Returns: -# A float number, electric current in amperes, -# e.g. 15.4 -# """ -# psu_current = 0.0 -# -# return psu_current -# -# def get_power(self): -# """ -# Retrieves current energy supplied by PSU -# -# Returns: -# A float number, the power in watts, -# e.g. 302.6 -# """ -# psu_power = 0.0 -# -# return psu_power - def get_position_in_parent(self): """ Retrieves 1-based relative physical position in parent device @@ -191,7 +178,7 @@ def is_replaceable(self): Returns: bool: True if it is replaceable. """ - return True + return True def get_powergood_status(self): """ @@ -202,7 +189,7 @@ def get_powergood_status(self): """ if smbus_present == 0: - cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 0 0x41 0xa') + cmdstatus, psustatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0xa') psustatus = int(psustatus, 16) else: bus = smbus.SMBus(0) @@ -243,6 +230,6 @@ def set_status_led(self, color): bool: True if status LED state is set successfully, False if not """ - # In ISX7215 , the firmware running in the PSU controls the LED + # The firmware running in the PSU controls the LED # and the PSU LED state cannot be changed from CPU. return False diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py index cb9c1b910561..57fcde16149d 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py @@ -366,7 +366,7 @@ def get_transceiver_info(self): transceiver_info_dict['nominal_bit_rate'] = str( sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) transceiver_info_dict['application_advertisement'] = 'N/A' - + return transceiver_info_dict def get_transceiver_bulk_status(self): @@ -571,7 +571,7 @@ def get_rx_los(self): rx_los_list.append(rx_los_data & 0x02 != 0) else: return None - + return rx_los_list def get_tx_fault(self): @@ -617,7 +617,7 @@ def get_tx_disable(self): tx_disable_list.append(tx_disable_data & 0xC0 != 0) else: return None - + return tx_disable_list def get_tx_disable_channel(self): @@ -668,7 +668,7 @@ def get_temperature(self): """ if self.sfp_type == COPPER_TYPE: return None - + transceiver_bulk_status = self.get_transceiver_bulk_status() return transceiver_bulk_status.get("temperature", "N/A") @@ -680,7 +680,7 @@ def get_voltage(self): """ if self.sfp_type == COPPER_TYPE: return None - + transceiver_bulk_status = self.get_transceiver_bulk_status() return transceiver_bulk_status.get("voltage", "N/A") @@ -688,11 +688,11 @@ def get_tx_bias(self): """ Retrieves the TX bias current of this SFP Returns: - + """ if self.sfp_type == COPPER_TYPE: return None - + tx_bias_list = [] transceiver_bulk_status = self.get_transceiver_bulk_status() tx_bias_list.append(transceiver_bulk_status.get("tx1bias", "N/A")) @@ -884,7 +884,7 @@ def get_presence(self): return False if smbus_present == 0: # if called from sfputil outside of pmon - cmdstatus, sfpstatus = cmd.getstatusoutput('i2cget -y 0 0x41 0x3') + cmdstatus, sfpstatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x3') sfpstatus = int(sfpstatus, 16) else: bus = smbus.SMBus(0) @@ -938,7 +938,7 @@ def is_replaceable(self): return True else: return False - + def get_position_in_parent(self): """ Retrieves 1-based relative physical position in parent device diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp_event.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp_event.py index ed2143886760..fd494ca674f5 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp_event.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp_event.py @@ -51,7 +51,7 @@ def deinitialize(self): def _get_transceiver_status(self): if smbus_present == 0: sonic_logger.log_info(" PMON - smbus ERROR - DEBUG sfp_event ") - cmdstatus, sfpstatus = cmd.getstatusoutput('i2cget -y 0 0x41 0x3') + cmdstatus, sfpstatus = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x3') sfpstatus = int(sfpstatus, 16) else: bus = smbus.SMBus(0) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py index 775596159269..53c047ca2329 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py @@ -41,6 +41,10 @@ def main(): print(" Chassis all_fans: {}\n".format(chassis.get_all_fans())) + print(" Chassis num_psus: {}".format(chassis.get_num_psus())) + + print(" Chassis all_psus: {}\n".format(chassis.get_all_psus())) + print(" Chassis num_thermals: {}".format(chassis.get_num_thermals())) print(" Chassis all_thermals: {}\n".format(chassis.get_all_thermals())) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-component.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-component.py index edc9e03b3f66..1116cc7b5857 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-component.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-component.py @@ -10,6 +10,11 @@ def main(): chassis = Chassis() + for component in chassis.get_all_components(): + print(" Name: {}".format(component.get_name())) + print(" Description: {}".format(component.get_description())) + print(" FW version: {}\n".format(component.get_firmware_version())) + return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-eeprom.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-eeprom.py index 76f3d8995e4a..40836611692b 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-eeprom.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-eeprom.py @@ -12,11 +12,11 @@ def main(): eeprom = chassis.get_eeprom() - print " Model: {}, Serial: {}".format(eeprom.modelstr(), - eeprom.serial_str()) - print " Part#: {}, Serial#: {}".format(eeprom.part_number_str(), - eeprom.serial_number_str()) - print " Base MAC: {}".format(eeprom.base_mac_addr()) + print(" Model: {}, Service Tag: {}".format(eeprom.modelstr(), + eeprom.service_tag_str())) + print(" Part#: {}, Serial#: {}".format(eeprom.part_number_str(), + eeprom.serial_number_str())) + print(" Base MAC: {}".format(eeprom.base_mac_addr())) return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-fan.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-fan.py index 6f1ebd42adbe..9bbf4d864acb 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-fan.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-fan.py @@ -11,15 +11,20 @@ def main(): chassis = Chassis() for fan in chassis.get_all_fans(): - print(" Name:", fan.get_name()) - print(" Presence: {}, Status: {}, LED: {}".format(fan.get_presence(), - fan.get_status(), - fan.get_status_led())) - print(" Model: {}, Serial: {}".format(fan.get_model(), - fan.get_serial())) - print(" Direction: {}, Speed: {}RPM, Target Speed: {}%\n".format(fan.get_direction(), - str(fan.get_speed()), - str(fan.get_target_speed()))) + if not fan.get_presence(): + print(" Name: {} not present".format(fan.get_name())) + else: + print(" Name:", fan.get_name()) + print(" Presence: {}, Status: {}, LED: {}".format(fan.get_presence(), + fan.get_status(), + fan.get_status_led())) + print(" Model: {}, Serial#: {}".format(fan.get_model(), + fan.get_serial())) + print(" Part#: {}, Service Tag: {}".format(fan.get_part_number(), + fan.get_service_tag())) + print(" Direction: {}, Speed: {}RPM, Target Speed: {}%\n".format(fan.get_direction(), + str(fan.get_speed()), + str(fan.get_target_speed()))) return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py index 692430ff2991..e3979b8c4175 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py @@ -11,13 +11,28 @@ def main(): chassis = Chassis() for psu in chassis.get_all_psus(): - print(" Name:", psu.get_name()) - print(" Presence: {}, Status: {}, LED: {}".format(psu.get_presence(), - psu.get_status(), - psu.get_status_led())) - print(" Model: {}, Serial: {}".format(psu.get_model(), - psu.get_serial())) - print(" Voltage: {}, Current: NO, Power: NO \n".format(psu.get_voltage())) + if not psu.get_presence(): + print(" Name: {} not present".format(psu.get_name())) + else: + print(" Name:", psu.get_name()) + print(" Presence: {}, Status: {}, LED: {}".format(psu.get_presence(), + psu.get_status(), + psu.get_status_led())) + print(" Model: {}, Serial#: {}, Part#: {}".format(psu.get_model(), + psu.get_serial(), + psu.get_part_number())) + try: + current = psu.get_current() + except NotImplementedError: + current = "NA" + try: + power = psu.get_power() + except NotImplementedError: + power = "NA" + + print(" Voltage: {}, Current: {}, Power: {}\n".format(psu.get_voltage(), + current, + power)) return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py index f5437b18f82e..4d283fa2eb03 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py @@ -7,15 +7,16 @@ def main(): + print("---------------------") + print("Chassis SFP Unit Test") + print("---------------------") + + chassis = Chassis() PORT_START = 1 PORT_END = 52 - chassis = Chassis() - for physical_port in range(PORT_START, PORT_END+1): - - print(" ") print(" SFP transceiver tests PORT = ", physical_port) name = chassis.get_sfp(physical_port).get_name() diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py index 9e99b0da3f41..91ef75d8f9a7 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py @@ -2,7 +2,6 @@ from sonic_platform.chassis import Chassis - def main(): print("-------------------------") print("Chassis Thermal Unit Test") @@ -11,13 +10,39 @@ def main(): chassis = Chassis() for thermal in chassis.get_all_thermals(): - print(" Name:", thermal.get_name()) - print(" Presence: {}, Status: {}".format(thermal.get_presence(), - thermal.get_status())) - print(" Model: {}, Serial: {}".format(thermal.get_model(), - thermal.get_serial())) - print(" Temperature: {}C, High Threshold: {}C\n".format(thermal.get_temperature(), - thermal.get_high_threshold())) + if not thermal.get_presence(): + print(" Name: {} not present".format(thermal.get_name())) + else: + print(" Name:", thermal.get_name()) + print(" Presence: {}, Status: {}".format(thermal.get_presence(), + thermal.get_status())) + print(" Model: {}, Serial#: {}".format(thermal.get_model(), + thermal.get_serial())) + print(" Temperature(C): {}".format(thermal.get_temperature())) + + try: + low_thresh = thermal.get_low_threshold() + except NotImplementedError: + low_thresh = "NA" + try: + high_thresh = thermal.get_high_threshold() + except NotImplementedError: + high_thresh = "NA" + + print(" Low Threshold(C): {}, High Threshold(C): {}".format(low_thresh, + high_thresh)) + + try: + crit_low_thresh = thermal.get_low_critical_threshold() + except NotImplementedError: + crit_low_thresh = "NA" + try: + crit_high_thresh = thermal.get_high_critical_threshold() + except NotImplementedError: + crit_high_thresh = "NA" + + print(" Crit Low Threshold(C): {}, Crit High Threshold(C): {}\n".format(crit_low_thresh, + crit_high_thresh)) return diff --git a/platform/mellanox/asic_table.j2 b/platform/mellanox/asic_table.j2 index 4afc780b0b06..4e41a416b6e0 100644 --- a/platform/mellanox/asic_table.j2 +++ b/platform/mellanox/asic_table.j2 @@ -21,6 +21,7 @@ 'x86_64-mlnx_msn4700_simx-r0':'MELLANOX-SPECTRUM-3', 'x86_64-mlnx_msn4700-r0':'MELLANOX-SPECTRUM-3', 'x86_64-mlnx_msn4600c-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-mlnx_msn4600-r0':'MELLANOX-SPECTRUM-3', 'vs-platform':'vs' } %} diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 5c9ac6c1c145..c862106c2b63 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -11,7 +11,13 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y \ - libxml2 + libxml2 \ + python-pip \ + python-dev \ + python-setuptools + +RUN pip2 install --upgrade pip +RUN apt-get purge -y python-pip {% if docker_syncd_mlnx_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 094a038c31b2..5b21692173c0 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -11,17 +11,17 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2008.2308 +MLNX_SPC_FW_VERSION = 13.2008.2314 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2008.2308 +MLNX_SPC2_FW_VERSION = 29.2008.2314 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) -MLNX_SPC3_FW_VERSION = 30.2008.2308 +MLNX_SPC3_FW_VERSION = 30.2008.2314 MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa $(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 521daa1c7c3b..c273f779cbb2 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = 7.0010.1300 +MLNX_HW_MANAGEMENT_VERSION = 7.0010.2000 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch new file mode 100644 index 000000000000..0eb3daa7977e --- /dev/null +++ b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch @@ -0,0 +1,48 @@ +diff --git a/usr/usr/bin/hw-management-ready.sh b/usr/usr/bin/hw-management-ready.sh +index 3c9f7b6..05d143f 100755 +--- a/usr/usr/bin/hw-management-ready.sh ++++ b/usr/usr/bin/hw-management-ready.sh +@@ -49,9 +49,12 @@ if [ -d /var/run/hw-management ]; then + rm -fr /var/run/hw-management + fi + +-while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] +-do +- sleep 1 +-done ++if [ -z "$(lspci -vvv | grep SimX)" ]; then ++ while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] ++ do ++ sleep 1 ++ done ++fi ++ + echo "Start Chassis HW management service." + logger -t hw-management -p daemon.notice "Start Chassis HW management service." +diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh +index 70f1297..e427a3d 100755 +--- a/usr/usr/bin/hw-management.sh ++++ b/usr/usr/bin/hw-management.sh +@@ -1110,6 +1110,13 @@ do_chip_down() + /usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p + } + ++check_simx() ++{ ++ if [ -n "$(lspci -vvv | grep SimX)" ]; then ++ exit 0 ++ fi ++} ++ + __usage=" + Usage: $(basename $0) [Options] + +@@ -1135,6 +1142,8 @@ Options: + force-reload Performs hw-management 'stop' and the 'start. + " + ++check_simx ++ + case $ACTION in + start) + if [ -d /var/run/hw-management ]; then diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index dec7935777b5..4ae17192db86 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit dec7935777b52d31a2220bad8b0cec4b71ec0961 +Subproject commit 4ae17192db868de19ea0725860b320c0d319d23a diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index 245ce75d5f18..e17ec176503c 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -251,7 +251,7 @@ function UpgradeFWFromImage() { } function ExitIfQEMU() { - if [[ $(cat /sys/devices/virtual/dmi/id/chassis_vendor) = "QEMU" ]]; then + if [ -n "$(lspci -vvv | grep SimX)" ]; then ExitSuccess "No FW upgrade for SimX platform" fi } diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index b5ca79286d1f..585a664efce1 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -45,7 +45,11 @@ # magic code defnition for port number, qsfp port position of each Platform # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -platform_dict_port = {'x86_64-mlnx_msn2010-r0': 3, 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700':0, 'x86_64-mlnx_msn2740-r0': 0, 'x86_64-mlnx_msn3420-r0':5, 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, 'x86_64-mlnx_msn3800-r0': 4, 'x86_64-mlnx_msn4600c-r0':4, 'x86_64-mlnx_msn4700-r0': 0, 'x86_64-mlnx_msn4410-r0': 0} +platform_dict_port = {'x86_64-mlnx_msn2010-r0': 3, 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, + 'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700': 0, 'x86_64-mlnx_msn2740-r0': 0, + 'x86_64-mlnx_msn3420-r0': 5, 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, + 'x86_64-mlnx_msn3800-r0': 4, 'x86_64-mlnx_msn4600-r0': 4, 'x86_64-mlnx_msn4600c-r0': 4, + 'x86_64-mlnx_msn4700-r0': 0, 'x86_64-mlnx_msn4410-r0': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), (0, 18, 21, 22, 1), (0, 0, 63, 64, 1), (0, 48, 59, 60, 1)] class Chassis(ChassisBase): diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py index e70007e96562..f2a66c6d42ee 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py @@ -323,6 +323,7 @@ def is_non_onie_firmware_update_supported(self): class Component(ComponentBase): def __init__(self): + super(Component, self).__init__() self.name = None self.description = None self.image_ext_name = None diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py index 3853cac3f713..a52886a9de51 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py @@ -250,5 +250,26 @@ 'hot_swappable': True, 'led_num': 1 } + }, + 'x86_64-mlnx_msn4600-r0': { + 'thermal': { + 'minimum_table': { + "unk_trust": {"-127:40": 12, "41:120": 13}, + "unk_untrust": {"-127:5": 12, "6:20": 13, "21:30": 14, "31:35": 15, "36:40": 16, "41:120": 17}, + } + }, + 'fans': { + 'drawer_num': 3, + 'drawer_type': 'real', + 'fan_num_per_drawer': 1, + 'support_fan_direction': True, + 'hot_swappable': True + }, + 'psus': { + 'psu_num': 2, + 'fan_num_per_psu': 1, + 'hot_swappable': True, + 'led_num': 1 + } } -} \ No newline at end of file +} diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 7b73b7196ce2..cb05278d5b66 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -31,7 +31,9 @@ # in most platforms the file psuX_curr, psuX_volt and psuX_power contain current, voltage and power data respectively. # but there are exceptions which will be handled by the following dictionary -platform_dict_psu = {'x86_64-mlnx_msn3420-r0':1, 'x86_64-mlnx_msn3700-r0': 1, 'x86_64-mlnx_msn3700c-r0': 1, 'x86_64-mlnx_msn3800-r0': 1, 'x86_64-mlnx_msn4600c-r0':1, 'x86_64-mlnx_msn4700-r0': 1, 'x86_64-mlnx_msn4410-r0': 1} +platform_dict_psu = {'x86_64-mlnx_msn3420-r0': 1, 'x86_64-mlnx_msn3700-r0': 1, 'x86_64-mlnx_msn3700c-r0': 1, + 'x86_64-mlnx_msn3800-r0': 1, 'x86_64-mlnx_msn4600-r0': 1, 'x86_64-mlnx_msn4600c-r0': 1, + 'x86_64-mlnx_msn4700-r0': 1, 'x86_64-mlnx_msn4410-r0': 1} psu_profile_list = [ # default filename convention diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py index c942b0d89d35..b0ddf13f7bb5 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py @@ -128,9 +128,13 @@ THERMAL_API_GET_HIGH_THRESHOLD ] -platform_dict_thermal = {'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700-r0':0, 'x86_64-mlnx_msn2740-r0': 3, 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 4, 'x86_64-mlnx_msn3420-r0':9, 'x86_64-mlnx_msn3700-r0': 5, 'x86_64-mlnx_msn3700c-r0': 6, 'x86_64-mlnx_msn3800-r0': 7, 'x86_64-mlnx_msn4600c-r0':9, 'x86_64-mlnx_msn4700-r0': 8, 'x86_64-mlnx_msn4410-r0': 8} +platform_dict_thermal = {'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700-r0': 0, 'x86_64-mlnx_msn2740-r0': 3, + 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 4, + 'x86_64-mlnx_msn3420-r0': 9, 'x86_64-mlnx_msn3700-r0': 5, 'x86_64-mlnx_msn3700c-r0': 6, + 'x86_64-mlnx_msn3800-r0': 7, 'x86_64-mlnx_msn4600-r0': 12, 'x86_64-mlnx_msn4600c-r0': 9, + 'x86_64-mlnx_msn4700-r0': 8, 'x86_64-mlnx_msn4410-r0': 8} thermal_profile_list = [ - # 2700 + # 0 2700 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -145,7 +149,7 @@ ] ) }, - # 2100 + # 1 2100 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 16), @@ -160,7 +164,7 @@ ] ) }, - # 2410 + # 2 2410 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), THERMAL_DEV_CATEGORY_MODULE:(1, 56), @@ -175,7 +179,7 @@ ] ) }, - # 2740 + # 3 2740 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -190,7 +194,7 @@ ] ) }, - # 2010 + # 4 2010 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 22), @@ -205,7 +209,7 @@ ] ) }, - # 3700 + # 5 3700 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -221,7 +225,7 @@ ] ) }, - # 3700c + # 6 3700c { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -237,7 +241,7 @@ ] ) }, - # 3800 + # 7 3800 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 64), @@ -253,7 +257,7 @@ ] ) }, - # 4700 + # 8 4700 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -269,7 +273,7 @@ ] ) }, - # 3420 + # 9 3420 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), THERMAL_DEV_CATEGORY_MODULE:(1, 60), @@ -285,7 +289,7 @@ ] ) }, - # 4600C + # 10 4600C { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 64), @@ -301,7 +305,7 @@ ] ) }, - # 4410 + # 11 4410 { THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), THERMAL_DEV_CATEGORY_MODULE:(1, 32), @@ -316,6 +320,22 @@ THERMAL_DEV_FAN_AMBIENT ] ) + }, + # 12 4600 + { + THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), + THERMAL_DEV_CATEGORY_MODULE:(1, 64), + THERMAL_DEV_CATEGORY_PSU:(1, 2), + THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), + THERMAL_DEV_CATEGORY_GEARBOX:(0,0), + THERMAL_DEV_CATEGORY_AMBIENT:(0, + [ + THERMAL_DEV_ASIC_AMBIENT, + THERMAL_DEV_COMEX_AMBIENT, + THERMAL_DEV_PORT_AMBIENT, + THERMAL_DEV_FAN_AMBIENT + ] + ) } ] @@ -373,6 +393,7 @@ def __init__(self, category, index, has_index, position, dependency = None): """ index should be a string for category ambient and int for other categories """ + super(Thermal, self).__init__() if category == THERMAL_DEV_CATEGORY_AMBIENT: self.name = thermal_ambient_name[index] self.index = index diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py index e9694f1b2a59..909ec6a8884a 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py @@ -63,6 +63,7 @@ def __init__(self, wd_device_path): Open a watchdog handle @param wd_device_path Path to watchdog device """ + super(WatchdogImplBase, self).__init__() self.watchdog_path = wd_device_path self.watchdog = os.open(self.watchdog_path, os.O_WRONLY) diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index 80937117fcd5..aa467f9462d0 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit 80937117fcd54e8df0581368f652f3664af6aecb +Subproject commit aa467f9462d063c79875b3a6ea699e9d0b1d8b57 diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 68f452e52bbb..78d452b90836 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 68f452e52bbbe9a9f68926867dd9ffcee41e15a9 +Subproject commit 78d452b90836005784cd6345bacf0a5df109f742 diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 7ae3289f249c..d35eb67a1f11 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,6 +1,6 @@ MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/ -MLNX_SDK_VERSION = 4.4.2308 +MLNX_SDK_VERSION = 4.4.2318 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION))) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py index 0e77a90dbab1..9d0d963347ba 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py @@ -1,9 +1,7 @@ -#!/usr/bin/env python - ############################################################################# # PDDF -# Module contains an implementation of SONiC Platform Base API and -# provides the platform information +# Module contains an implementation of SONiC PDDF Chassis Base API and +# provides the chassis information # ############################################################################# diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_eeprom.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_eeprom.py index 592485d617e4..16c43ab28f3a 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_eeprom.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_eeprom.py @@ -41,7 +41,7 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): if not self.is_valid_tlvinfo_header(eeprom): return - total_length = (ord(eeprom[9]) << 8) | ord(eeprom[10]) + total_length = ((eeprom[9]) << 8) | (eeprom[10]) tlv_index = self._TLV_INFO_HDR_LEN tlv_end = self._TLV_INFO_HDR_LEN + total_length @@ -50,21 +50,21 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): break tlv = eeprom[tlv_index:tlv_index + 2 - + ord(eeprom[tlv_index + 1])] - code = "0x%02X" % (ord(tlv[0])) + + (eeprom[tlv_index + 1])] + code = "0x%02X" % ((tlv[0])) - if ord(tlv[0]) == self._TLV_CODE_VENDOR_EXT: - value = str((ord(tlv[2]) << 24) | (ord(tlv[3]) << 16) | - (ord(tlv[4]) << 8) | ord(tlv[5])) - value += str(tlv[6:6 + ord(tlv[1])]) + if (tlv[0]) == self._TLV_CODE_VENDOR_EXT: + value = str(((tlv[2]) << 24) | ((tlv[3]) << 16) | + ((tlv[4]) << 8) | (tlv[5])) + value += str(tlv[6:6 + (tlv[1])]) else: name, value = self.decoder(None, tlv) self.eeprom_tlv_dict[code] = value - if ord(eeprom[tlv_index]) == self._TLV_CODE_CRC_32: + if (eeprom[tlv_index]) == self._TLV_CODE_CRC_32: break - tlv_index += ord(eeprom[tlv_index+1]) + 2 + tlv_index += (eeprom[tlv_index+1]) + 2 def serial_number_str(self): (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py index 5930345070b4..30be0dd74b35 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py @@ -1,13 +1,16 @@ -#!/usr/bin/env python - +############################################################################# +# PDDF +# +# PDDF fan base class inherited from the base class +# # All the supported FAN SysFS aattributes are -#- fan_present -#- fan_direction -#- fan_input -#- fan_pwm -#- fan_fault +# - fan_present +# - fan_direction +# - fan_input +# - fan_pwm +# - fan_fault # where idx is in the range [1-32] -# +############################################################################# try: from sonic_platform_base.fan_base import FanBase diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py index 00eefc9a815e..c9c3a8d851ac 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - ############################################################################# # PDDF # Module contains an implementation of SONiC Platform API and diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py index 58b69ce0aa73..433ba4b17dfa 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py @@ -1,17 +1,20 @@ -#!/usr/bin/env python +############################################################################# +# PDDF # -# All the supported PSU SysFS aattributes are -#- psu_present -#- psu_model_name -#- psu_power_good -#- psu_mfr_id -#- psu_serial_num -#- psu_fan_dir -#- psu_v_out -#- psu_i_out -#- psu_p_out -#- psu_fan1_speed_rpm +# PDDF psu base class inherited from the base class # +# All the supported PSU SysFS aattributes are +# - psu_present +# - psu_model_name +# - psu_power_good +# - psu_mfr_id +# - psu_serial_num +# - psu_fan_dir +# - psu_v_out +# - psu_i_out +# - psu_p_out +# - psu_fan1_speed_rpm +############################################################################# try: @@ -37,7 +40,6 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.platform = self.pddf_obj.get_platform() self.psu_index = index + 1 - self._fan_list = [] # _fan_list under PsuBase class is a global variable, hence we need to use _fan_list per class instatiation self.num_psu_fans = int(self.pddf_obj.get_num_psu_fans('PSU{}'.format(index+1))) for psu_fan_idx in range(self.num_psu_fans): psu_fan = Fan(0, psu_fan_idx, pddf_data, pddf_plugin_data, True, self.psu_index) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py index dc37bba6e888..aaa818c1d615 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py @@ -1,4 +1,8 @@ -#!/usr/bin/env python +############################################################################# +# PDDF +# +# PDDF sfp base class inherited from the base class +############################################################################# try: import time @@ -153,7 +157,7 @@ def __read_eeprom_specific_bytes(self, offset, num_bytes): sysfsfile_eeprom.seek(offset) raw = sysfsfile_eeprom.read(num_bytes) for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) except Exception as e: print("Error: Unable to open eeprom_path: %s" % (str(e))) finally: @@ -186,18 +190,19 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.eeprom_path = self.pddf_obj.get_path(self.device, 'eeprom') self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', - 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'vendor_date', 'vendor_oui', 'application_advertisement'] + 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', + 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', + 'application_advertisement'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', - 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] + 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', + 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', - 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', - 'txbiaslowwarning'] + 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] SfpBase.__init__(self) @@ -321,13 +326,17 @@ def get_transceiver_info(self): xcvr_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] else: xcvr_info_dict['type'] = sfp_type_data['data']['type']['value'] if sfp_type_data else 'N/A' - xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] if sfp_type_abbrv_name else 'N/A' + xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] \ + if sfp_type_abbrv_name else 'N/A' - xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' + xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] \ + if sfp_vendor_name_data else 'N/A' xcvr_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - xcvr_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + xcvr_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] \ + if sfp_vendor_rev_data else 'N/A' xcvr_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' + xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] \ + if sfp_vendor_oui_data else 'N/A' xcvr_info_dict['vendor_date'] = sfp_vendor_date_data['data'][ 'VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' xcvr_info_dict['cable_type'] = "Unknown" @@ -341,7 +350,8 @@ def get_transceiver_info(self): for key in qsfp_compliance_code_tup: if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ + 'value'][key]['value'] xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) nkey = 'Nominal Bit Rate(100Mbs)' @@ -360,7 +370,8 @@ def get_transceiver_info(self): for key in sfp_compliance_code_tup: if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ + 'value'][key]['value'] xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) xcvr_info_dict['nominal_bit_rate'] = str( @@ -602,20 +613,20 @@ def get_transceiver_threshold_info(self): if dom_thres_raw: channel_threshold_values = sfpd_obj.parse_channel_threshold_values( dom_thres_raw, 0) - channel_threshold_data = channel_threshold_values.get('data') - if channel_threshold_data: - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] + ch_th_data = channel_threshold_values.get('data') + if ch_th_data: + xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = ch_th_data['RxPowerHighAlarm']['value'] + xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = ch_th_data['RxPowerLowAlarm']['value'] + xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = ch_th_data['RxPowerHighWarning']['value'] + xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = ch_th_data['RxPowerLowWarning']['value'] xcvr_dom_threshold_info_dict['txpowerhighalarm'] = "0.0dBm" xcvr_dom_threshold_info_dict['txpowerlowalarm'] = "0.0dBm" xcvr_dom_threshold_info_dict['txpowerhighwarning'] = "0.0dBm" xcvr_dom_threshold_info_dict['txpowerlowwarning'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] + xcvr_dom_threshold_info_dict['txbiashighalarm'] = ch_th_data['TxBiasHighAlarm']['value'] + xcvr_dom_threshold_info_dict['txbiaslowalarm'] = ch_th_data['TxBiasLowAlarm']['value'] + xcvr_dom_threshold_info_dict['txbiashighwarning'] = ch_th_data['TxBiasHighWarning']['value'] + xcvr_dom_threshold_info_dict['txbiaslowwarning'] = ch_th_data['TxBiasLowWarning']['value'] else: # SFPs @@ -629,30 +640,34 @@ def get_transceiver_threshold_info(self): dom_module_threshold_raw = self.__read_eeprom_specific_bytes( (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) if dom_module_threshold_raw is not None: - dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( + dom_mod_th_data = sfpd_obj.parse_alarm_warning_threshold( dom_module_threshold_raw, 0) - xcvr_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - xcvr_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - xcvr_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - xcvr_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] - xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] - xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ + xcvr_dom_threshold_info_dict['temphighalarm'] = dom_mod_th_data['data']['TempHighAlarm']['value'] + xcvr_dom_threshold_info_dict['templowalarm'] = dom_mod_th_data['data']['TempLowAlarm']['value'] + xcvr_dom_threshold_info_dict['temphighwarning'] = dom_mod_th_data['data']['TempHighWarning']['value'] + xcvr_dom_threshold_info_dict['templowwarning'] = dom_mod_th_data['data']['TempLowWarning']['value'] + xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_mod_th_data['data']['VoltageHighAlarm']['value'] + xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_mod_th_data['data']['VoltageLowAlarm']['value'] + xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_mod_th_data[ 'data']['VoltageHighWarning']['value'] - xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] - xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_mod_th_data['data']['VoltageLowWarning']['value'] + xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_mod_th_data['data']['BiasHighAlarm']['value'] + xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_mod_th_data['data']['BiasLowAlarm']['value'] + xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_mod_th_data['data']['BiasHighWarning']['value'] + xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_mod_th_data['data']['BiasLowWarning']['value'] + xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_mod_th_data['data']['TXPowerHighAlarm']['value'] + xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_mod_th_data['data']['TXPowerLowAlarm']['value'] + xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_mod_th_data['data']['TXPowerHighWarning'][ + 'value'] + xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_mod_th_data['data']['TXPowerLowWarning'][ + 'value'] + xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_mod_th_data['data']['RXPowerHighAlarm']['value'] + xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_mod_th_data['data']['RXPowerLowAlarm']['value'] + xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_mod_th_data['data']['RXPowerHighWarning'][ + 'value'] + xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_mod_th_data['data']['RXPowerLowWarning'][ + 'value'] return xcvr_dom_threshold_info_dict @@ -748,7 +763,8 @@ def get_tx_fault(self): elif self.is_qsfp_port: tx_fault_list = [] dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) \ + if self.get_presence() else None if dom_channel_monitor_raw is not None: tx_fault_data = int(dom_channel_monitor_raw[0], 16) tx_fault_list.append(tx_fault_data & 0x01 != 0) @@ -1087,7 +1103,7 @@ def tx_disable(self, tx_disable): try: txdisable_ctl = 0xf if tx_disable else 0x0 buf = create_string_buffer(1) - buf[0] = chr(txdisable_ctl) + buf[0] = bytes([txdisable_ctl]) # Write to eeprom eeprom_f = open(self.eeprom_path, "r+b") eeprom_f.seek(QSFP_CONTROL_OFFSET) @@ -1114,7 +1130,7 @@ def tx_disable(self, tx_disable): try: eeprom_f = open(self.eeprom_path, mode="r+b", buffering=0) buf = create_string_buffer(1) - buf[0] = chr(txdisable_ctl) + buf[0] = bytes([txdisable_ctl]) # Write to eeprom eeprom_f.seek(SFP_STATUS_CONTROL_OFFSET) eeprom_f.write(buf[0]) @@ -1168,7 +1184,7 @@ def tx_disable_channel(self, channel, disable): channel_state = self.get_tx_disable_channel() txdisable_ctl = (channel_state | channel) if disable else (channel_state & ~channel) buf = create_string_buffer(1) - buf[0] = chr(txdisable_ctl) + buf[0] = bytes([txdisable_ctl]) # Write to eeprom eeprom_f = open(self.eeprom_path, "r+b") eeprom_f.seek(QSFP_CONTROL_OFFSET) @@ -1216,7 +1232,7 @@ def set_lpmode(self, lpmode): # Fill in write buffer regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode buffer = create_string_buffer(1) - buffer[0] = chr(regval) + buffer[0] = bytes([regval]) # Write to eeprom eeprom_f = open(self.eeprom_path, "r+b") @@ -1286,7 +1302,7 @@ def set_power_override(self, power_override, power_set): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = bytes([power_override_bit | power_set_bit]) # Write to eeprom eeprom_f = open(self.eeprom_path, "r+b") eeprom_f.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py index cd09041e152f..644292eb17e5 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py @@ -1,11 +1,15 @@ -#!/usr/bin/env python - +############################################################################# +# PDDF +# +# PDDF thermal base class inherited from the base class +# # All the supported Temperature Sensor SysFS aattributes are -#- temp1_high_crit_threshold -#- temp1_high_threshold -#- temp1_input -#- temp_low_threshold -#- temp1_low_crit_threshold +# - temp1_high_crit_threshold +# - temp1_high_threshold +# - temp1_input +# - temp_low_threshold +# - temp1_low_crit_threshold +############################################################################# try: from sonic_platform_base.thermal_base import ThermalBase diff --git a/platform/vs/docker-sonic-vs/platform.json b/platform/vs/docker-sonic-vs/platform.json index 053fed5516ed..1d14ff3ca842 100644 --- a/platform/vs/docker-sonic-vs/platform.json +++ b/platform/vs/docker-sonic-vs/platform.json @@ -3,194 +3,350 @@ "Ethernet0": { "index": "0,0,0,0", "lanes": "25,26,27,28", - "alias_at_lanes": "fortyGigE0/0,fortyGigE0/1,fortyGigE0/2,fortyGigE0/3", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/0"], + "2x50G": ["fortyGigE0/0", "fortyGigE0/2"], + "4x25G[10G]": ["fortyGigE0/0", "fortyGigE0/1", "fortyGigE0/2", "fortyGigE0/3"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/0", "fortyGigE0/1", "fortyGigE0/2"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/0", "fortyGigE0/2", "fortyGigE0/3"] + } }, "Ethernet4": { "index": "1,1,1,1", "lanes": "29,30,31,32", - "alias_at_lanes": "fortyGigE0/4,fortyGigE0/5,fortyGigE0/6,fortyGigE0/7", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/4"], + "2x50G": ["fortyGigE0/4", "fortyGigE0/6"], + "4x25G[10G]": ["fortyGigE0/4", "fortyGigE0/5", "fortyGigE0/6", "fortyGigE0/7"] + } }, "Ethernet8": { "index": "2,2,2,2", "lanes": "33,34,35,36", - "alias_at_lanes": "fortyGigE0/8,fortyGigE0/9,fortyGigE0/10,fortyGigE0/11", - "breakout_modes": "1x100G[40G],2x50G,2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/8"], + "2x50G": ["fortyGigE0/8", "fortyGigE0/10"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/8", "fortyGigE0/9", "fortyGigE0/10"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/8", "fortyGigE0/10", "fortyGigE0/11"] + } }, "Ethernet12": { "index": "3,3,3,3", "lanes": "37,38,39,40", - "alias_at_lanes": "fortyGigE0/12,fortyGigE0/13,fortyGigE0/14,fortyGigE0/15", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/12"], + "2x50G": ["fortyGigE0/12", "fortyGigE0/14"], + "4x25G[10G]": ["fortyGigE0/12", "fortyGigE0/13", "fortyGigE0/14", "fortyGigE0/15"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/12", "fortyGigE0/13", "fortyGigE0/14"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/12", "fortyGigE0/14", "fortyGigE0/15"] + } }, "Ethernet16": { "index": "4,4,4,4", "lanes": "45,46,47,48", - "alias_at_lanes": "fortyGigE0/16,fortyGigE0/17,fortyGigE0/18,fortyGigE0/19", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/16"], + "2x50G": ["fortyGigE0/16", "fortyGigE0/18"], + "4x25G[10G]": ["fortyGigE0/16", "fortyGigE0/17", "fortyGigE0/18", "fortyGigE0/19"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/16", "fortyGigE0/17", "fortyGigE0/18"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/16", "fortyGigE0/18", "fortyGigE0/19"] + } }, "Ethernet20": { "index": "5,5,5,5", "lanes": "41,42,43,44", - "alias_at_lanes": "fortyGigE0/20,fortyGigE0/21,fortyGigE0/22,fortyGigE0/23", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/20"], + "2x50G": ["fortyGigE0/20", "fortyGigE0/22"], + "4x25G[10G]": ["fortyGigE0/20", "fortyGigE0/21", "fortyGigE0/22", "fortyGigE0/23"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/20", "fortyGigE0/21", "fortyGigE0/22"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/20", "fortyGigE0/22", "fortyGigE0/23"] + } }, "Ethernet24": { "index": "6,6,6,6", "lanes": "1,2,3,4", - "alias_at_lanes": "fortyGigE0/24,fortyGigE0/25,fortyGigE0/26,fortyGigE0/27", - "breakout_modes": "1x100G[40G],4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/24"], + "4x25G[10G]": ["fortyGigE0/24", "fortyGigE0/25", "fortyGigE0/26", "fortyGigE0/27"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/24", "fortyGigE0/25", "fortyGigE0/26"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/24", "fortyGigE0/26", "fortyGigE0/27"] + } }, "Ethernet28": { "index": "7,7,7,7", "lanes": "5,6,7,8", - "alias_at_lanes": "fortyGigE0/28,fortyGigE0/29,fortyGigE0/30,fortyGigE0/31", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/28"], + "2x50G": ["fortyGigE0/28", "fortyGigE0/30"], + "4x25G[10G]": ["fortyGigE0/28", "fortyGigE0/29", "fortyGigE0/30", "fortyGigE0/31"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/28", "fortyGigE0/29", "fortyGigE0/30"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/28", "fortyGigE0/30", "fortyGigE0/31"] + } }, "Ethernet32": { "index": "8,8,8,8", "lanes": "13,14,15,16", - "alias_at_lanes": "fortyGigE0/32,fortyGigE0/33,fortyGigE0/34,fortyGigE0/35", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/32"], + "2x50G": ["fortyGigE0/32", "fortyGigE0/34"], + "4x25G[10G]": ["fortyGigE0/32", "fortyGigE0/33", "fortyGigE0/34", "fortyGigE0/35"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/32", "fortyGigE0/33", "fortyGigE0/34"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/32", "fortyGigE0/34", "fortyGigE0/35"] + } }, "Ethernet36": { "index": "9,9,9,9", "lanes": "9,10,11,12", - "alias_at_lanes": "fortyGigE0/36,fortyGigE0/37,fortyGigE0/38,fortyGigE0/39", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/36"], + "2x50G": ["fortyGigE0/36", "fortyGigE0/38"], + "4x25G[10G]": ["fortyGigE0/36", "fortyGigE0/37", "fortyGigE0/38", "fortyGigE0/39"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/36", "fortyGigE0/37", "fortyGigE0/38"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/36", "fortyGigE0/38", "fortyGigE0/39"] + } }, "Ethernet40": { "index": "10,10,10,10", "lanes": "17,18,19,20", - "alias_at_lanes": "fortyGigE0/40,fortyGigE0/41,fortyGigE0/42,fortyGigE0/43", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/40"], + "2x50G": ["fortyGigE0/40", "fortyGigE0/42"], + "4x25G[10G]": ["fortyGigE0/40", "fortyGigE0/41", "fortyGigE0/42", "fortyGigE0/43"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/40", "fortyGigE0/41", "fortyGigE0/42"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/40", "fortyGigE0/42", "fortyGigE0/43"] + } }, "Ethernet44": { "index": "11,11,11,11", "lanes": "21,22,23,24", - "alias_at_lanes": "fortyGigE0/44,fortyGigE0/45,fortyGigE0/46,fortyGigE0/47", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/44"], + "2x50G": ["fortyGigE0/44", "fortyGigE0/46"], + "4x25G[10G]": ["fortyGigE0/44", "fortyGigE0/45", "fortyGigE0/46", "fortyGigE0/47"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/44", "fortyGigE0/45", "fortyGigE0/46"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/44", "fortyGigE0/46", "fortyGigE0/47"] + } }, "Ethernet48": { "index": "12,12,12,12", "lanes": "53,54,55,56", - "alias_at_lanes": "fortyGigE0/48,fortyGigE0/49,fortyGigE0/50,fortyGigE0/51", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/48"], + "2x50G": ["fortyGigE0/48", "fortyGigE0/50"], + "4x25G[10G]": ["fortyGigE0/48", "fortyGigE0/49", "fortyGigE0/50", "fortyGigE0/51"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/48", "fortyGigE0/49", "fortyGigE0/50"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/48", "fortyGigE0/50", "fortyGigE0/51"] + } }, "Ethernet52": { "index": "13,13,13,13", "lanes": "49,50,51,52", - "alias_at_lanes": "fortyGigE0/52,fortyGigE0/53,fortyGigE0/54,fortyGigE0/55", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/52"], + "2x50G": ["fortyGigE0/52", "fortyGigE0/54"], + "4x25G[10G]": ["fortyGigE0/52", "fortyGigE0/53", "fortyGigE0/54", "fortyGigE0/55"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/52", "fortyGigE0/53", "fortyGigE0/54"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/52", "fortyGigE0/54", "fortyGigE0/55"] + } }, "Ethernet56": { "index": "14,14,14,14", "lanes": "57,58,59,60", - "alias_at_lanes": "fortyGigE0/56,fortyGigE0/57,fortyGigE0/58,fortyGigE0/59", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/56"], + "2x50G": ["fortyGigE0/56", "fortyGigE0/58"], + "4x25G[10G]": ["fortyGigE0/56", "fortyGigE0/57", "fortyGigE0/58", "fortyGigE0/59"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/56", "fortyGigE0/57", "fortyGigE0/58"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/56", "fortyGigE0/58", "fortyGigE0/59"] + } }, "Ethernet60": { "index": "15,15,15,15", "lanes": "61,62,63,64", - "alias_at_lanes": "fortyGigE0/60,fortyGigE0/61,fortyGigE0/62,fortyGigE0/63", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/60"], + "2x50G": ["fortyGigE0/60", "fortyGigE0/62"], + "4x25G[10G]": ["fortyGigE0/60", "fortyGigE0/61", "fortyGigE0/62", "fortyGigE0/63"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/60", "fortyGigE0/61", "fortyGigE0/62"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/60", "fortyGigE0/62", "fortyGigE0/63"] + } }, "Ethernet64": { "index": "16,16,16,16", "lanes": "69,70,71,72", - "alias_at_lanes": "fortyGigE0/64,fortyGigE0/65,fortyGigE0/66,fortyGigE0/67", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/64"], + "2x50G": ["fortyGigE0/64", "fortyGigE0/65"], + "4x25G[10G]": ["fortyGigE0/64", "fortyGigE0/65", "fortyGigE0/66", "fortyGigE0/67"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/64", "fortyGigE0/65", "fortyGigE0/66"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/64", "fortyGigE0/66", "fortyGigE0/67"] + } }, "Ethernet68": { "index": "17,17,17,17", "lanes": "65,66,67,68", - "alias_at_lanes": "fortyGigE0/68,fortyGigE0/69,fortyGigE0/70,fortyGigE0/71", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/68"], + "2x50G": ["fortyGigE0/68", "fortyGigE0/70"], + "4x25G[10G]": ["fortyGigE0/68", "fortyGigE0/69", "fortyGigE0/70", "fortyGigE0/71"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/68", "fortyGigE0/69", "fortyGigE0/70"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/68", "fortyGigE0/70", "fortyGigE0/71"] + } }, "Ethernet72": { "index": "18,18,18,18", "lanes": "73,74,75,76", - "alias_at_lanes": "fortyGigE0/72,fortyGigE0/73,fortyGigE0/74,fortyGigE0/75", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/72"], + "2x50G": ["fortyGigE0/72", "fortyGigE0/74"], + "4x25G[10G]": ["fortyGigE0/72", "fortyGigE0/73", "fortyGigE0/74", "fortyGigE0/75"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/72", "fortyGigE0/73", "fortyGigE0/74"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/72", "fortyGigE0/74", "fortyGigE0/75"] + } }, "Ethernet76": { "index": "19,19,19,19", "lanes": "77,78,79,80", - "alias_at_lanes": "fortyGigE0/76,fortyGigE0/77,fortyGigE0/78,fortyGigE0/79", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/76"], + "2x50G": ["fortyGigE0/76", "fortyGigE0/78"], + "4x25G[10G]": ["fortyGigE0/76", "fortyGigE0/77", "fortyGigE0/78", "fortyGigE0/79"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/76", "fortyGigE0/77", "fortyGigE0/78"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/76", "fortyGigE0/78", "fortyGigE0/79"] + } }, "Ethernet80": { "index": "20,20,20,20", "lanes": "109,110,111,112", - "alias_at_lanes": "fortyGigE0/80,fortyGigE0/81,fortyGigE0/82,fortyGigE0/83", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/80"], + "2x50G": ["fortyGigE0/80", "fortyGigE0/82"], + "4x25G[10G]": ["fortyGigE0/80", "fortyGigE0/81", "fortyGigE0/82", "fortyGigE0/83"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/80", "fortyGigE0/81", "fortyGigE0/82"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/80", "fortyGigE0/82", "fortyGigE0/83"] + } }, "Ethernet84": { "index": "21,21,21,21", "lanes": "105,106,107,108", - "alias_at_lanes": "fortyGigE0/84,fortyGigE0/85,fortyGigE0/86,fortyGigE0/87", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/84"], + "2x50G": ["fortyGigE0/84", "fortyGigE0/86"], + "4x25G[10G]": ["fortyGigE0/84", "fortyGigE0/85", "fortyGigE0/86", "fortyGigE0/87"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/84", "fortyGigE0/85", "fortyGigE0/86"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/84", "fortyGigE0/86", "fortyGigE0/87"] + } }, "Ethernet88": { "index": "22,22,22,22", "lanes": "113,114,115,116", - "alias_at_lanes": "fortyGigE0/88,fortyGigE0/89,fortyGigE0/90,fortyGigE0/91", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/88"], + "2x50G": ["fortyGigE0/88", "fortyGigE0/90"], + "4x25G[10G]": ["fortyGigE0/88", "fortyGigE0/89", "fortyGigE0/90", "fortyGigE0/91"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/88", "fortyGigE0/89", "fortyGigE0/90"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/88", "fortyGigE0/90", "fortyGigE0/91"] + } }, "Ethernet92": { "index": "23,23,23,23", "lanes": "117,118,119,120", - "alias_at_lanes": "fortyGigE0/92,fortyGigE0/93,fortyGigE0/94,fortyGigE0/95", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/92"], + "2x50G": ["fortyGigE0/92", "fortyGigE0/94"], + "4x25G[10G]": ["fortyGigE0/92", "fortyGigE0/93", "fortyGigE0/94", "fortyGigE0/95"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/92", "fortyGigE0/93", "fortyGigE0/94"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/92", "fortyGigE0/94", "fortyGigE0/95"] + } }, "Ethernet96": { "index": "24,24,24,24", "lanes": "125,126,127,128", - "alias_at_lanes": "fortyGigE0/96,fortyGigE0/97,fortyGigE0/98,fortyGigE0/99", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/96"], + "2x50G": ["fortyGigE0/96", "fortyGigE0/98"], + "4x25G[10G]": ["fortyGigE0/96", "fortyGigE0/97", "fortyGigE0/98", "fortyGigE0/99"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/96", "fortyGigE0/97", "fortyGigE0/98"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/96", "fortyGigE0/98", "fortyGigE0/99"] + } }, "Ethernet100": { "index": "25,25,25,25", "lanes": "121,122,123,124", - "alias_at_lanes": "fortyGigE0/100,fortyGigE0/101,fortyGigE0/102,fortyGigE0/103", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/100"], + "2x50G": ["fortyGigE0/100", "fortyGigE0/102"], + "4x25G[10G]": ["fortyGigE0/100", "fortyGigE0/101", "fortyGigE0/102", "fortyGigE0/103"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/100", "fortyGigE0/101", "fortyGigE0/102"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/100", "fortyGigE0/102", "fortyGigE0/103"] + } }, "Ethernet104": { "index": "26,26,26,26", "lanes": "81,82,83,84", - "alias_at_lanes": "fortyGigE0/104,fortyGigE0/105,fortyGigE0/106,fortyGigE0/107", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/104"], + "2x50G": ["fortyGigE0/104", "fortyGigE0/106"], + "4x25G[10G]": ["fortyGigE0/104", "fortyGigE0/105", "fortyGigE0/106", "fortyGigE0/107"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/104", "fortyGigE0/105", "fortyGigE0/106"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/104", "fortyGigE0/106", "fortyGigE0/107"] + } }, "Ethernet108": { "index": "27,27,27,27", "lanes": "85,86,87,88", - "alias_at_lanes": "fortyGigE0/108,fortyGigE0/109,fortyGigE0/110,fortyGigE0/111", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/108"], + "2x50G": ["fortyGigE0/108", "fortyGigE0/110"], + "4x25G[10G]": ["fortyGigE0/108", "fortyGigE0/109", "fortyGigE0/110", "fortyGigE0/111"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/108", "fortyGigE0/109", "fortyGigE0/110"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/108", "fortyGigE0/110", "fortyGigE0/111"] + } }, "Ethernet112": { "index": "28,28,28,28", "lanes": "93,94,95,96", - "alias_at_lanes": "fortyGigE0/112,fortyGigE0/113,fortyGigE0/114,fortyGigE0/115", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/112"], + "2x50G": ["fortyGigE0/112", "fortyGigE0/114"], + "4x25G[10G]": ["fortyGigE0/112", "fortyGigE0/113", "fortyGigE0/114", "fortyGigE0/115"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/112", "fortyGigE0/113", "fortyGigE0/114"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/112", "fortyGigE0/114", "fortyGigE0/115"] + } }, "Ethernet116": { "index": "29,29,29,29", "lanes": "89,90,91,92", - "alias_at_lanes": "fortyGigE0/116,fortyGigE0/117,fortyGigE0/118,fortyGigE0/119", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/116"], + "2x50G": ["fortyGigE0/116", "fortyGigE0/118"], + "4x25G[10G]": ["fortyGigE0/116", "fortyGigE0/117", "fortyGigE0/118", "fortyGigE0/119"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/116", "fortyGigE0/117", "fortyGigE0/118"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/116", "fortyGigE0/118", "fortyGigE0/119"] + } }, "Ethernet120": { "index": "30,30,30,30", "lanes": "101,102,103,104", - "alias_at_lanes": "fortyGigE0/120,fortyGigE0/121,fortyGigE0/122,fortyGigE0/123", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/120"], + "2x50G": ["fortyGigE0/120", "fortyGigE0/122"], + "4x25G[10G]": ["fortyGigE0/120", "fortyGigE0/121", "fortyGigE0/122", "fortyGigE0/123"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/120", "fortyGigE0/121", "fortyGigE0/122"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/120", "fortyGigE0/122", "fortyGigE0/123"] + } }, "Ethernet124": { "index": "31,31,31,31", "lanes": "97,98,99,100", - "alias_at_lanes": "fortyGigE0/124,fortyGigE0/125,fortyGigE0/126,fortyGigE0/127", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["fortyGigE0/124"], + "2x50G": ["fortyGigE0/124", "fortyGigE0/126"], + "4x25G[10G]": ["fortyGigE0/124", "fortyGigE0/125", "fortyGigE0/126", "fortyGigE0/127"], + "2x25G(2)+1x50G(2)": ["fortyGigE0/124", "fortyGigE0/125", "fortyGigE0/126"], + "1x50G(2)+2x25G(2)": ["fortyGigE0/124", "fortyGigE0/126", "fortyGigE0/127"] + } } } } diff --git a/rules/config b/rules/config index 433bbeedebf0..b45ce2152806 100644 --- a/rules/config +++ b/rules/config @@ -146,6 +146,9 @@ INCLUDE_NAT = y # run as worker node in kubernetes cluster. INCLUDE_KUBERNETES = n +# INCLUDE_MACSEC - build docker-macsec for macsec support +INCLUDE_MACSEC = y + # KUBERNETES_VERSION - Set to the required version. # K8s_GCR_IO_PAUSE_VERSION - Version of k8s universal pause container image # These are Used *only* when INCLUDE_KUBERNETES=y diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index d4aace307a19..1ea79bc80a42 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -30,4 +30,5 @@ $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSA:/usr/bin/TSA $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSB:/usr/bin/TSB $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSC:/usr/bin/TSC +$(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TS:/usr/bin/TS $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += monit_bgp:/etc/monit/conf.d diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index f9f8c9b41298..e112a8fd3d8a 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -16,17 +16,18 @@ $(DOCKER_MACSEC)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE $(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_MACSEC) +ifeq ($(INCLUDE_MACSEC), y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MACSEC) -SONIC_BUSTER_DOCKERS += $(DOCKER_MACSEC) +endif SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) +ifeq ($(INCLUDE_MACSEC), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) +endif $(DOCKER_MACSEC)_CONTAINER_NAME = macsec $(DOCKER_MACSEC)_RUN_OPT += --privileged -t $(DOCKER_MACSEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot -# $(DOCKER_MACSEC)_BASE_IMAGE_FILES += macsecctl:/usr/bin/macsecctl $(DOCKER_MACSEC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 547fbf60813f..7628fdbfaca3 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -33,6 +33,7 @@ $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3) ifeq ($(PDDF_SUPPORT),y) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) endif $(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) diff --git a/rules/frr.mk b/rules/frr.mk index bb6a96a61fa4..c8175339f444 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -3,7 +3,7 @@ FRR_VERSION = 7.5 FRR_SUBVERSION = 0 FRR_BRANCH = frr/7.5 -FRR_TAG = frr-7.5-s2 +FRR_TAG = frr-7.5-s3 export FRR_VERSION FRR_SUBVERSION FRR_BRANCH FRR_TAG diff --git a/slave.mk b/slave.mk index 33b97653c597..7bde5d23923d 100644 --- a/slave.mk +++ b/slave.mk @@ -138,6 +138,9 @@ ifeq ($(SONIC_INCLUDE_NAT),y) INCLUDE_NAT = y endif +ifeq ($(SONIC_INCLUDE_MACSEC),y) +INCLUDE_MACSEC = y +endif include $(RULES_PATH)/functions @@ -252,6 +255,7 @@ $(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)") $(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)") $(info "INCLUDE_NAT" : "$(INCLUDE_NAT)") $(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)") +$(info "INCLUDE_MACSEC" : "$(INCLUDE_MACSEC)") $(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)") $(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)") $(info ) @@ -892,6 +896,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export include_restapi="$(INCLUDE_RESTAPI)" export include_nat="$(INCLUDE_NAT)" export include_sflow="$(INCLUDE_SFLOW)" + export include_macsec="$(INCLUDE_MACSEC)" export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)" export include_iccpd="$(INCLUDE_ICCPD)" export pddf_support="$(PDDF_SUPPORT)" diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py index f6108bfb61c4..3ab7dba4f612 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py @@ -191,6 +191,8 @@ def add_peer(self, vrf, nbr, data): 'neighbor_addr': nbr, 'bgp_session': data, 'loopback0_ipv4': lo0_ipv4, + 'CONFIG_DB__LOOPBACK_INTERFACE':{ tuple(key.split('|')) : {} for key in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME) + if '|' in key } } if self.check_neig_meta: neigmeta = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_NEIGHBOR_METADATA_TABLE_NAME) @@ -384,4 +386,4 @@ def load_peers(): log_crit("Can't read vrf '%s' neighbors: %s" % (vrf, str(err))) raise Exception("Can't read vrf '%s' neighbors: %s" % (vrf, str(err))) - return peers \ No newline at end of file + return peers diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf index fc7b82a64acc..63958c1d0400 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf @@ -6,9 +6,9 @@ neighbor 10.10.10.10 timers 3 10 address-family ipv4 neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4 + neighbor 10.10.10.10 next-hop-self force neighbor 10.10.10.10 route-map FROM_BGP_INTERNAL_PEER_V4 in neighbor 10.10.10.10 route-reflector-client - neighbor 10.10.10.10 next-hop-self force neighbor 10.10.10.10 activate exit-address-family ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf index 74cececad969..900cf4c399bf 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf @@ -6,9 +6,9 @@ neighbor fc::10 timers 3 10 address-family ipv6 neighbor fc::10 peer-group INTERNAL_PEER_V6 + neighbor fc::10 next-hop-self force neighbor fc::10 route-map FROM_BGP_INTERNAL_PEER_V6 in neighbor fc::10 route-reflector-client - neighbor fc::10 next-hop-self force neighbor fc::10 activate exit-address-family ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v4.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v4.conf index 95eb985b1546..ffd9977f9fe6 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v4.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v4.conf @@ -6,7 +6,6 @@ neighbor 10.10.10.10 timers 3 10 address-family ipv4 neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4 - neighbor 10.10.10.10 next-hop-self force neighbor 10.10.10.10 activate exit-address-family ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v6.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v6.conf index a4a4648e4855..5b4a2137dddc 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v6.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_front_v6.conf @@ -6,7 +6,6 @@ neighbor fc::10 timers 3 10 address-family ipv6 neighbor fc::10 peer-group INTERNAL_PEER_V6 - neighbor fc::10 next-hop-self force neighbor fc::10 activate exit-address-family ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_back.conf b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_back.conf index 15076685eb1a..28a543841fef 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_back.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_back.conf @@ -6,12 +6,14 @@ address-family ipv4 neighbor INTERNAL_PEER_V4 route-reflector-client neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V4 allowas-in 1 neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out exit-address-family address-family ipv6 neighbor INTERNAL_PEER_V6 route-reflector-client neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V6 allowas-in 1 neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out exit-address-family diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_front.conf b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_front.conf index 8f4aa450f5db..5b061fa52b44 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_front.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_front.conf @@ -5,11 +5,13 @@ neighbor INTERNAL_PEER_V6 peer-group address-family ipv4 neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V4 allowas-in 1 neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out exit-address-family address-family ipv6 neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V6 allowas-in 1 neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out exit-address-family diff --git a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/param_back.json b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/param_back.json index 148456fe960f..37e54d785e27 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/param_back.json +++ b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/param_back.json @@ -4,5 +4,7 @@ "sub_role": "BackEnd" } }, - "loopback0_ipv4": "10.10.10.10/32" -} \ No newline at end of file + "CONFIG_DB__LOOPBACK_INTERFACE": { + "Loopback4096|10.10.10.10/32": {} + } +} diff --git a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_back.conf b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_back.conf index 81bf0808f77a..81b5aab193c6 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_back.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_back.conf @@ -6,8 +6,8 @@ route-map FROM_BGP_INTERNAL_PEER_V4 permit 100 route-map TO_BGP_INTERNAL_PEER_V4 permit 100 ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 1 - on-match next set ipv6 next-hop prefer-global + on-match next ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 100 ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_front.conf b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_front.conf index 94dc55a5458f..880530a2797e 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_front.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/policies.conf/result_front.conf @@ -6,8 +6,8 @@ route-map FROM_BGP_INTERNAL_PEER_V4 permit 100 route-map TO_BGP_INTERNAL_PEER_V4 permit 100 ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 1 - on-match next set ipv6 next-hop prefer-global + on-match next ! route-map FROM_BGP_INTERNAL_PEER_V6 permit 100 ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index 43a65bd2dd61..e2f9964766c1 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -51,10 +51,14 @@ router bgp 55555 bgp router-id 55.55.55.55 ! network 55.55.55.55/32 + network 55.55.55.56/32 route-map HIDE_INTERNAL ! address-family ipv6 network fc00::1/64 exit-address-family + address-family ipv6 + network fc00::2/64 route-map HIDE_INTERNAL + exit-address-family ! network 10.10.10.1/24 address-family ipv6 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json index 17e32589d84c..bc266ed70429 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json @@ -8,7 +8,9 @@ }, "LOOPBACK_INTERFACE": { "Loopback0|55.55.55.55/32": {}, - "Loopback0|fc00::1/128": {} + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} }, "VLAN_INTERFACE": { "Vlan10|10.10.10.1/24": {}, diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index 4a749516fe18..c7f2971fd7c0 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -33,10 +33,14 @@ router bgp 55555 bgp router-id 55.55.55.55 ! network 55.55.55.55/32 + network 55.55.55.56/32 route-map HIDE_INTERNAL ! address-family ipv6 network fc00::1/64 exit-address-family + address-family ipv6 + network fc00::2/64 route-map HIDE_INTERNAL + exit-address-family ! network 10.10.10.1/24 address-family ipv6 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json index 3d5d07d95f09..c8f0141ec4f5 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json @@ -7,7 +7,9 @@ }, "LOOPBACK_INTERFACE": { "Loopback0|55.55.55.55/32": {}, - "Loopback0|fc00::1/128": {} + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} }, "VLAN_INTERFACE": { "Vlan10|10.10.10.1/24": {}, diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index 30fc479d6af8..431499ceaf92 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -33,10 +33,14 @@ router bgp 55555 bgp router-id 55.55.55.55 ! network 55.55.55.55/32 + network 55.55.55.56/32 route-map HIDE_INTERNAL ! address-family ipv6 network fc00::1/64 exit-address-family + address-family ipv6 + network fc00::2/64 route-map HIDE_INTERNAL + exit-address-family ! network 10.10.10.1/24 address-family ipv6 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json index e841437650ac..5b30406668ab 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json @@ -7,7 +7,9 @@ }, "LOOPBACK_INTERFACE": { "Loopback0|55.55.55.55/32": {}, - "Loopback0|fc00::1/128": {} + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} }, "VLAN_INTERFACE": { "Vlan10|10.10.10.1/24": {}, diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 37b7691ad95f..e977d2b5cffc 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -36,11 +36,10 @@ link-detect ip route 0.0.0.0/0 10.10.10.1 200 !! ! -! ! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix ipv6 route fc00::/64 Loopback0 -! !! +! ! template: bgpd/bgpd.main.conf.j2 ! ! bgp multiple-instance @@ -75,10 +74,14 @@ router bgp 55555 bgp router-id 55.55.55.55 ! network 55.55.55.55/32 + network 55.55.55.56/32 route-map HIDE_INTERNAL ! address-family ipv6 network fc00::1/64 exit-address-family + address-family ipv6 + network fc00::2/64 route-map HIDE_INTERNAL + exit-address-family ! network 10.10.10.1/24 address-family ipv6 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json index d81eba2b0fe6..92143a2a9deb 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json @@ -21,7 +21,9 @@ }, "LOOPBACK_INTERFACE": { "Loopback0|55.55.55.55/32": {}, - "Loopback0|fc00::1/128": {} + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} }, "VLAN_INTERFACE": { "Vlan10|10.10.10.1/24": {}, @@ -43,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 06b799cdeff7..568f6cc4f4e1 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -522,10 +522,16 @@ def parse_dpg(dpg, hname): dpg_ecmp_content['ipv4'] = ipv4_content dpg_ecmp_content['ipv6'] = ipv6_content vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) - vlan_intfs = [] vlans = {} vlan_members = {} vlantype_name = "" + intf_vlan_mbr = defaultdict(list) + for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): + vlanid = vintf.find(str(QName(ns, "VlanID"))).text + vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text + vmbr_list = vintfmbr.split(';') + for i, member in enumerate(vmbr_list): + intf_vlan_mbr[member].append(vlanid) for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): vintfname = vintf.find(str(QName(ns, "Name"))).text vlanid = vintf.find(str(QName(ns, "VlanID"))).text @@ -539,10 +545,12 @@ def parse_dpg(dpg, hname): sonic_vlan_member_name = "Vlan%s" % (vlanid) if vlantype_name == "Tagged": vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'tagged'} + elif len(intf_vlan_mbr[member]) > 1: + vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'tagged'} else: vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'untagged'} - vlan_attributes = {'vlanid': vlanid} + vlan_attributes = {'vlanid': vlanid, 'members': vmbr_list } # If this VLAN requires a DHCP relay agent, it will contain a element # containing a list of DHCP server IPs @@ -570,7 +578,7 @@ def parse_dpg(dpg, hname): aclname = aclintf.find(str(QName(ns, "OutAcl"))).text.upper().replace(" ", "_").replace("-", "_") stage = "egress" else: - system.exit("Error: 'AclInterface' must contain either an 'InAcl' or 'OutAcl' subelement.") + sys.exit("Error: 'AclInterface' must contain either an 'InAcl' or 'OutAcl' subelement.") aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') acl_intfs = [] is_mirror = False @@ -587,7 +595,11 @@ def parse_dpg(dpg, hname): # to LAG will be applied to all the LAG members internally by SAI/SDK acl_intfs.append(member) elif member in vlans: - acl_intfs.append(member) + # For egress ACL attaching to vlan, we break them into vlan members + if stage == "egress": + acl_intfs.extend(vlans[member]['members']) + else: + acl_intfs.append(member) elif member in port_alias_map: acl_intfs.append(port_alias_map[member]) # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface @@ -611,9 +623,15 @@ def parse_dpg(dpg, hname): acl_intfs.append(panel_port) break if acl_intfs: + # Remove duplications + dedup_intfs = [] + for intf in acl_intfs: + if intf not in dedup_intfs: + dedup_intfs.append(intf) + acls[aclname] = {'policy_desc': aclname, 'stage': stage, - 'ports': acl_intfs} + 'ports': dedup_intfs} if is_mirror: acls[aclname]['type'] = 'MIRROR' elif is_mirror_v6: @@ -1346,6 +1364,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw for port in ports.values(): port['pfc_asym'] = 'off' + # make admin status to down if port not parsed from minigraph + for port in ports.keys(): + if 'admin_status' in ports[port] and port not in port_speeds_default: + ports[port]['admin_status'] = 'down' + # set physical port default admin status up for port in phyport_intfs: if port[0] in ports: diff --git a/src/sonic-config-engine/openconfig_acl.py b/src/sonic-config-engine/openconfig_acl.py index c49f79c70175..5399f21a7d7f 100644 --- a/src/sonic-config-engine/openconfig_acl.py +++ b/src/sonic-config-engine/openconfig_acl.py @@ -5,21 +5,45 @@ # 1. Sync openconfig ACL yang models from https://github.com/openconfig/public/tree/master/release/models/acl # 2. Sync inet yang models which contain type dependencies for openconfig ACL yang models from https://github.com/YangModels/yang/tree/master/standard/ietf/RFC , and put them in the same folder with models from step 1. # 3. Install PyangBind: -# pip install pyangbind +# pip3 install pyangbind # 4. Get PyangBind install path: -# export PYBINDPLUGIN=`/usr/bin/env python -c \ +# export PYBINDPLUGIN=`/usr/bin/env python3 -c \ # 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)'` -# 5. Generate this file with pyang: -# pyang --plugindir $PYBINDPLUGIN -f pybind -o openconfig_acl.py openconfig-acl.yang +# 5. Generate this file with pyang: +# pyang --plugindir $PYBINDPLUGIN -f pybind -o openconfig_acl.py openconfig-acl.yang sonic-acl-extension.yang +# -*- coding: utf-8 -*- from operator import attrgetter -from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType -from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType +from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType +from pyangbind.lib.yangtypes import RestrictedClassType +from pyangbind.lib.yangtypes import TypedListType +from pyangbind.lib.yangtypes import YANGBool +from pyangbind.lib.yangtypes import YANGListType +from pyangbind.lib.yangtypes import YANGDynClass +from pyangbind.lib.yangtypes import ReferenceType from pyangbind.lib.base import PybindBase +from collections import OrderedDict from decimal import Decimal from bitarray import bitarray +import six -import builtins +# PY3 support of some PY2 keywords (needs improved) +if six.PY3: + import builtins as __builtin__ + long = int +elif six.PY2: + import __builtin__ + +class sonic_acl_extension(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module sonic-acl-extension - based on the path /sonic-acl-extension. Each member element of + the container is represented as a class variable - with a specific + YANG type. + """ + _pyangbind_elements = {} + + class yc_state_openconfig_acl__acl_state(PybindBase): """ @@ -30,14 +54,18 @@ class yc_state_openconfig_acl__acl_state(PybindBase): YANG Description: Global operational state data for ACLs """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__counter_capability',) + __slots__ = ('_path_helper', '_extmethods', '__counter_capability',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-acl:AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) load = kwargs.pop("load", None) if args: @@ -64,7 +92,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'state'] + return [u'acl', u'state'] def _get_counter_capability(self): """ @@ -89,12 +117,12 @@ def _set_counter_capability(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-acl:AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """counter_capability must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", }) self.__counter_capability = t @@ -102,12 +130,12 @@ def _set_counter_capability(self, v, load=False): self._set() def _unset_counter_capability(self): - self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-acl:AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'AGGREGATE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_AGGREGATE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:INTERFACE_ONLY': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) - counter_capability = builtins.property(_get_counter_capability) + counter_capability = __builtin__.property(_get_counter_capability) - _pyangbind_elements = {'counter_capability': counter_capability, } + _pyangbind_elements = OrderedDict([('counter_capability', counter_capability), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_config(PybindBase): @@ -119,15 +147,19 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_config(PybindBase): YANG Description: Access list config """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__description',) + __slots__ = ('_path_helper', '_extmethods', '__name','__description',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: @@ -154,7 +186,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'config'] def _get_name(self): """ @@ -177,12 +209,12 @@ def _set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", }) self.__name = t @@ -190,7 +222,7 @@ def _set_name(self, v, load=False): self._set() def _unset_name(self): - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) def _get_description(self): @@ -214,12 +246,12 @@ def _set_description(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", }) self.__description = t @@ -227,13 +259,13 @@ def _set_description(self, v, load=False): self._set() def _unset_description(self): - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) - name = builtins.property(_get_name, _set_name) - description = builtins.property(_get_description, _set_description) + name = __builtin__.property(_get_name, _set_name) + description = __builtin__.property(_get_description, _set_description) - _pyangbind_elements = {'name': name, 'description': description, } + _pyangbind_elements = OrderedDict([('name', name), ('description', description), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_state(PybindBase): @@ -245,15 +277,19 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_state(PybindBase): YANG Description: Access list state information """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__description',) + __slots__ = ('_path_helper', '_extmethods', '__name','__description',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) load = kwargs.pop("load", None) if args: @@ -280,7 +316,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'state'] def _get_name(self): """ @@ -303,12 +339,12 @@ def _set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", }) self.__name = t @@ -316,7 +352,7 @@ def _set_name(self, v, load=False): self._set() def _unset_name(self): - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) def _get_description(self): @@ -340,12 +376,12 @@ def _set_description(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", }) self.__description = t @@ -353,13 +389,13 @@ def _set_description(self, v, load=False): self._set() def _unset_description(self): - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) - name = builtins.property(_get_name) - description = builtins.property(_get_description) + name = __builtin__.property(_get_name) + description = __builtin__.property(_get_description) - _pyangbind_elements = {'name': name, 'description': description, } + _pyangbind_elements = OrderedDict([('name', name), ('description', description), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config(PybindBase): @@ -371,15 +407,19 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_confi YANG Description: Access list entries config """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__description',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__description',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: @@ -406,7 +446,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'config'] def _get_sequence_id(self): """ @@ -437,7 +477,7 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with uint32""", @@ -450,7 +490,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) def _get_description(self): @@ -476,12 +516,12 @@ def _set_description(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", }) self.__description = t @@ -489,13 +529,13 @@ def _set_description(self, v, load=False): self._set() def _unset_description(self): - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) - sequence_id = builtins.property(_get_sequence_id, _set_sequence_id) - description = builtins.property(_get_description, _set_description) + sequence_id = __builtin__.property(_get_sequence_id, _set_sequence_id) + description = __builtin__.property(_get_description, _set_description) - _pyangbind_elements = {'sequence_id': sequence_id, 'description': description, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('description', description), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state(PybindBase): @@ -507,17 +547,21 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state( YANG Description: State information for ACL entries """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__description','__matched_packets','__matched_octets',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__description','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) load = kwargs.pop("load", None) if args: @@ -544,7 +588,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'state'] def _get_sequence_id(self): """ @@ -575,7 +619,7 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with uint32""", @@ -588,7 +632,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) def _get_description(self): @@ -614,12 +658,12 @@ def _set_description(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", }) self.__description = t @@ -627,7 +671,7 @@ def _set_description(self, v, load=False): self._set() def _unset_description(self): - self.__description = YANGDynClass(base=str, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) def _get_matched_packets(self): @@ -677,7 +721,7 @@ def _set_matched_packets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_packets must be of a type compatible with yang:counter64""", @@ -690,7 +734,7 @@ def _set_matched_packets(self, v, load=False): self._set() def _unset_matched_packets(self): - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) def _get_matched_octets(self): @@ -740,7 +784,7 @@ def _set_matched_octets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_octets must be of a type compatible with yang:counter64""", @@ -753,15 +797,15 @@ def _set_matched_octets(self, v, load=False): self._set() def _unset_matched_octets(self): - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - sequence_id = builtins.property(_get_sequence_id) - description = builtins.property(_get_description) - matched_packets = builtins.property(_get_matched_packets) - matched_octets = builtins.property(_get_matched_octets) + sequence_id = __builtin__.property(_get_sequence_id) + description = __builtin__.property(_get_description) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) - _pyangbind_elements = {'sequence_id': sequence_id, 'description': description, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('description', description), ('matched_packets', matched_packets), ('matched_octets', matched_octets), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config(PybindBase): @@ -773,18 +817,23 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_co YANG Description: Configuration data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype',) + __slots__ = ('_path_helper', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype','__vlan_id',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) - self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) - self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) - self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) - self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__vlan_id = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..4095']}), is_leaf=True, yang_name="vlan-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='vlan-id-type', is_config=True) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) load = kwargs.pop("load", None) if args: @@ -811,7 +860,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'l2', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2', u'config'] def _get_source_mac(self): """ @@ -834,12 +883,12 @@ def _set_source_mac(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_mac must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", }) self.__source_mac = t @@ -847,7 +896,7 @@ def _set_source_mac(self, v, load=False): self._set() def _unset_source_mac(self): - self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) def _get_source_mac_mask(self): @@ -871,12 +920,12 @@ def _set_source_mac_mask(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_mac_mask must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", }) self.__source_mac_mask = t @@ -884,7 +933,7 @@ def _set_source_mac_mask(self, v, load=False): self._set() def _unset_source_mac_mask(self): - self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) def _get_destination_mac(self): @@ -908,12 +957,12 @@ def _set_destination_mac(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_mac must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", }) self.__destination_mac = t @@ -921,7 +970,7 @@ def _set_destination_mac(self, v, load=False): self._set() def _unset_destination_mac(self): - self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) def _get_destination_mac_mask(self): @@ -945,12 +994,12 @@ def _set_destination_mac_mask(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_mac_mask must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", }) self.__destination_mac_mask = t @@ -958,7 +1007,7 @@ def _set_destination_mac_mask(self, v, load=False): self._set() def _unset_destination_mac_mask(self): - self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) def _get_ethertype(self): @@ -982,12 +1031,12 @@ def _set_ethertype(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """ethertype must be of a type compatible with oc-pkt-match-types:ethertype-type""", 'defined-type': "oc-pkt-match-types:ethertype-type", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True)""", }) self.__ethertype = t @@ -995,16 +1044,54 @@ def _set_ethertype(self, v, load=False): self._set() def _unset_ethertype(self): - self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + + + def _get_vlan_id(self): + """ + Getter method for vlan_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/vlan_id (vlan-id-type) + + YANG Description: VLAN ID field to match in DOT1Q packets + """ + return self.__vlan_id + + def _set_vlan_id(self, v, load=False): + """ + Setter method for vlan_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/vlan_id (vlan-id-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_vlan_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_vlan_id() directly. + + YANG Description: VLAN ID field to match in DOT1Q packets + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..4095']}), is_leaf=True, yang_name="vlan-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='vlan-id-type', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """vlan_id must be of a type compatible with vlan-id-type""", + 'defined-type': "sonic-acl-extension:vlan-id-type", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..4095']}), is_leaf=True, yang_name="vlan-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='vlan-id-type', is_config=True)""", + }) + + self.__vlan_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_vlan_id(self): + self.__vlan_id = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..4095']}), is_leaf=True, yang_name="vlan-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='vlan-id-type', is_config=True) - source_mac = builtins.property(_get_source_mac, _set_source_mac) - source_mac_mask = builtins.property(_get_source_mac_mask, _set_source_mac_mask) - destination_mac = builtins.property(_get_destination_mac, _set_destination_mac) - destination_mac_mask = builtins.property(_get_destination_mac_mask, _set_destination_mac_mask) - ethertype = builtins.property(_get_ethertype, _set_ethertype) + source_mac = __builtin__.property(_get_source_mac, _set_source_mac) + source_mac_mask = __builtin__.property(_get_source_mac_mask, _set_source_mac_mask) + destination_mac = __builtin__.property(_get_destination_mac, _set_destination_mac) + destination_mac_mask = __builtin__.property(_get_destination_mac_mask, _set_destination_mac_mask) + ethertype = __builtin__.property(_get_ethertype, _set_ethertype) + vlan_id = __builtin__.property(_get_vlan_id, _set_vlan_id) - _pyangbind_elements = {'source_mac': source_mac, 'source_mac_mask': source_mac_mask, 'destination_mac': destination_mac, 'destination_mac_mask': destination_mac_mask, 'ethertype': ethertype, } + _pyangbind_elements = OrderedDict([('source_mac', source_mac), ('source_mac_mask', source_mac_mask), ('destination_mac', destination_mac), ('destination_mac_mask', destination_mac_mask), ('ethertype', ethertype), ('vlan_id', vlan_id), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state(PybindBase): @@ -1016,18 +1103,22 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_sta YANG Description: State Information. """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype',) + __slots__ = ('_path_helper', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) - self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) - self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) - self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) - self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) load = kwargs.pop("load", None) if args: @@ -1054,7 +1145,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'l2', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2', u'state'] def _get_source_mac(self): """ @@ -1077,12 +1168,12 @@ def _set_source_mac(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_mac must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", }) self.__source_mac = t @@ -1090,7 +1181,7 @@ def _set_source_mac(self, v, load=False): self._set() def _unset_source_mac(self): - self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) def _get_source_mac_mask(self): @@ -1114,12 +1205,12 @@ def _set_source_mac_mask(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_mac_mask must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", }) self.__source_mac_mask = t @@ -1127,7 +1218,7 @@ def _set_source_mac_mask(self, v, load=False): self._set() def _unset_source_mac_mask(self): - self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) def _get_destination_mac(self): @@ -1151,12 +1242,12 @@ def _set_destination_mac(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_mac must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", }) self.__destination_mac = t @@ -1164,7 +1255,7 @@ def _set_destination_mac(self, v, load=False): self._set() def _unset_destination_mac(self): - self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) def _get_destination_mac_mask(self): @@ -1188,12 +1279,12 @@ def _set_destination_mac_mask(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_mac_mask must be of a type compatible with yang:mac-address""", 'defined-type': "yang:mac-address", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", }) self.__destination_mac_mask = t @@ -1201,7 +1292,7 @@ def _set_destination_mac_mask(self, v, load=False): self._set() def _unset_destination_mac_mask(self): - self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) def _get_ethertype(self): @@ -1225,12 +1316,12 @@ def _set_ethertype(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """ethertype must be of a type compatible with oc-pkt-match-types:ethertype-type""", 'defined-type': "oc-pkt-match-types:ethertype-type", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False)""", }) self.__ethertype = t @@ -1238,16 +1329,16 @@ def _set_ethertype(self, v, load=False): self._set() def _unset_ethertype(self): - self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['1..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_ARP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_VLAN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_MPLS': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'ETHERTYPE_LLDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'1..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) - source_mac = builtins.property(_get_source_mac) - source_mac_mask = builtins.property(_get_source_mac_mask) - destination_mac = builtins.property(_get_destination_mac) - destination_mac_mask = builtins.property(_get_destination_mac_mask) - ethertype = builtins.property(_get_ethertype) + source_mac = __builtin__.property(_get_source_mac) + source_mac_mask = __builtin__.property(_get_source_mac_mask) + destination_mac = __builtin__.property(_get_destination_mac) + destination_mac_mask = __builtin__.property(_get_destination_mac_mask) + ethertype = __builtin__.property(_get_ethertype) - _pyangbind_elements = {'source_mac': source_mac, 'source_mac_mask': source_mac_mask, 'destination_mac': destination_mac, 'destination_mac_mask': destination_mac_mask, 'ethertype': ethertype, } + _pyangbind_elements = OrderedDict([('source_mac', source_mac), ('source_mac_mask', source_mac_mask), ('destination_mac', destination_mac), ('destination_mac_mask', destination_mac_mask), ('ethertype', ethertype), ]) class yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2(PybindBase): @@ -1259,12 +1350,16 @@ class yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2(Pybind YANG Description: Ethernet header fields """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'l2' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'l2' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -1294,7 +1389,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'l2'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2'] def _get_config(self): """ @@ -1369,11 +1464,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) - _pyangbind_elements = {'config': config, 'state': state, } + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config(PybindBase): @@ -1385,21 +1480,25 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_co YANG Description: Configuration data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + __slots__ = ('_path_helper', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) - self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) - self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) - self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) - self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) - self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) - self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) - self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) load = kwargs.pop("load", None) if args: @@ -1426,7 +1525,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'ip', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip', u'config'] def _get_ip_version(self): """ @@ -1449,12 +1548,12 @@ def _set_ip_version(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """ip_version must be of a type compatible with inet:ip-version""", 'defined-type': "inet:ip-version", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True)""", }) self.__ip_version = t @@ -1462,7 +1561,7 @@ def _set_ip_version(self, v, load=False): self._set() def _unset_ip_version(self): - self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) def _get_source_ip_address(self): @@ -1486,12 +1585,12 @@ def _set_source_ip_address(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_ip_address must be of a type compatible with inet:ip-prefix""", 'defined-type': "inet:ip-prefix", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", }) self.__source_ip_address = t @@ -1499,7 +1598,7 @@ def _set_source_ip_address(self, v, load=False): self._set() def _unset_source_ip_address(self): - self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) def _get_source_ip_flow_label(self): @@ -1523,12 +1622,12 @@ def _set_source_ip_flow_label(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", 'defined-type': "inet:ipv6-flow-label", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", }) self.__source_ip_flow_label = t @@ -1536,7 +1635,7 @@ def _set_source_ip_flow_label(self, v, load=False): self._set() def _unset_source_ip_flow_label(self): - self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) def _get_destination_ip_address(self): @@ -1560,12 +1659,12 @@ def _set_destination_ip_address(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_ip_address must be of a type compatible with inet:ip-prefix""", 'defined-type': "inet:ip-prefix", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", }) self.__destination_ip_address = t @@ -1573,7 +1672,7 @@ def _set_destination_ip_address(self, v, load=False): self._set() def _unset_destination_ip_address(self): - self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) def _get_destination_ip_flow_label(self): @@ -1597,12 +1696,12 @@ def _set_destination_ip_flow_label(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", 'defined-type': "inet:ipv6-flow-label", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", }) self.__destination_ip_flow_label = t @@ -1610,7 +1709,7 @@ def _set_destination_ip_flow_label(self, v, load=False): self._set() def _unset_destination_ip_flow_label(self): - self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) def _get_dscp(self): @@ -1634,12 +1733,12 @@ def _set_dscp(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """dscp must be of a type compatible with inet:dscp""", 'defined-type': "inet:dscp", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True)""", }) self.__dscp = t @@ -1647,7 +1746,7 @@ def _set_dscp(self, v, load=False): self._set() def _unset_dscp(self): - self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) def _get_protocol(self): @@ -1671,12 +1770,12 @@ def _set_protocol(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """protocol must be of a type compatible with oc-pkt-match-types:ip-protocol-type""", 'defined-type': "oc-pkt-match-types:ip-protocol-type", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True)""", }) self.__protocol = t @@ -1684,7 +1783,7 @@ def _set_protocol(self, v, load=False): self._set() def _unset_protocol(self): - self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) def _get_hop_limit(self): @@ -1710,12 +1809,12 @@ def _set_hop_limit(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """hop_limit must be of a type compatible with uint8""", 'defined-type': "uint8", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True)""", }) self.__hop_limit = t @@ -1723,19 +1822,19 @@ def _set_hop_limit(self, v, load=False): self._set() def _unset_hop_limit(self): - self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) - ip_version = builtins.property(_get_ip_version, _set_ip_version) - source_ip_address = builtins.property(_get_source_ip_address, _set_source_ip_address) - source_ip_flow_label = builtins.property(_get_source_ip_flow_label, _set_source_ip_flow_label) - destination_ip_address = builtins.property(_get_destination_ip_address, _set_destination_ip_address) - destination_ip_flow_label = builtins.property(_get_destination_ip_flow_label, _set_destination_ip_flow_label) - dscp = builtins.property(_get_dscp, _set_dscp) - protocol = builtins.property(_get_protocol, _set_protocol) - hop_limit = builtins.property(_get_hop_limit, _set_hop_limit) + ip_version = __builtin__.property(_get_ip_version, _set_ip_version) + source_ip_address = __builtin__.property(_get_source_ip_address, _set_source_ip_address) + source_ip_flow_label = __builtin__.property(_get_source_ip_flow_label, _set_source_ip_flow_label) + destination_ip_address = __builtin__.property(_get_destination_ip_address, _set_destination_ip_address) + destination_ip_flow_label = __builtin__.property(_get_destination_ip_flow_label, _set_destination_ip_flow_label) + dscp = __builtin__.property(_get_dscp, _set_dscp) + protocol = __builtin__.property(_get_protocol, _set_protocol) + hop_limit = __builtin__.property(_get_hop_limit, _set_hop_limit) - _pyangbind_elements = {'ip_version': ip_version, 'source_ip_address': source_ip_address, 'source_ip_flow_label': source_ip_flow_label, 'destination_ip_address': destination_ip_address, 'destination_ip_flow_label': destination_ip_flow_label, 'dscp': dscp, 'protocol': protocol, 'hop_limit': hop_limit, } + _pyangbind_elements = OrderedDict([('ip_version', ip_version), ('source_ip_address', source_ip_address), ('source_ip_flow_label', source_ip_flow_label), ('destination_ip_address', destination_ip_address), ('destination_ip_flow_label', destination_ip_flow_label), ('dscp', dscp), ('protocol', protocol), ('hop_limit', hop_limit), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state(PybindBase): @@ -1747,21 +1846,25 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_sta YANG Description: State information """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + __slots__ = ('_path_helper', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) - self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) - self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) - self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) - self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) - self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) - self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) - self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) load = kwargs.pop("load", None) if args: @@ -1788,7 +1891,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'ip', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip', u'state'] def _get_ip_version(self): """ @@ -1811,12 +1914,12 @@ def _set_ip_version(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """ip_version must be of a type compatible with inet:ip-version""", 'defined-type': "inet:ip-version", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False)""", }) self.__ip_version = t @@ -1824,7 +1927,7 @@ def _set_ip_version(self, v, load=False): self._set() def _unset_ip_version(self): - self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'unknown': {'value': 0}, 'ipv4': {'value': 1}, 'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'unknown': {u'value': 0}, u'ipv4': {u'value': 1}, u'ipv6': {u'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) def _get_source_ip_address(self): @@ -1848,12 +1951,12 @@ def _set_source_ip_address(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_ip_address must be of a type compatible with inet:ip-prefix""", 'defined-type': "inet:ip-prefix", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", }) self.__source_ip_address = t @@ -1861,7 +1964,7 @@ def _set_source_ip_address(self, v, load=False): self._set() def _unset_source_ip_address(self): - self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) def _get_source_ip_flow_label(self): @@ -1885,12 +1988,12 @@ def _set_source_ip_flow_label(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", 'defined-type': "inet:ipv6-flow-label", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", }) self.__source_ip_flow_label = t @@ -1898,7 +2001,7 @@ def _set_source_ip_flow_label(self, v, load=False): self._set() def _unset_source_ip_flow_label(self): - self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) def _get_destination_ip_address(self): @@ -1922,12 +2025,12 @@ def _set_destination_ip_address(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_ip_address must be of a type compatible with inet:ip-prefix""", 'defined-type': "inet:ip-prefix", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", }) self.__destination_ip_address = t @@ -1935,7 +2038,7 @@ def _set_destination_ip_address(self, v, load=False): self._set() def _unset_destination_ip_address(self): - self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=str, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) def _get_destination_ip_flow_label(self): @@ -1959,12 +2062,12 @@ def _set_destination_ip_flow_label(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", 'defined-type': "inet:ipv6-flow-label", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", }) self.__destination_ip_flow_label = t @@ -1972,7 +2075,7 @@ def _set_destination_ip_flow_label(self, v, load=False): self._set() def _unset_destination_ip_flow_label(self): - self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={u'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) def _get_dscp(self): @@ -1996,12 +2099,12 @@ def _set_dscp(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """dscp must be of a type compatible with inet:dscp""", 'defined-type': "inet:dscp", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False)""", }) self.__dscp = t @@ -2009,7 +2112,7 @@ def _set_dscp(self, v, load=False): self._set() def _unset_dscp(self): - self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) def _get_protocol(self): @@ -2033,12 +2136,12 @@ def _set_protocol(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """protocol must be of a type compatible with oc-pkt-match-types:ip-protocol-type""", 'defined-type': "oc-pkt-match-types:ip-protocol-type", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False)""", }) self.__protocol = t @@ -2046,7 +2149,7 @@ def _set_protocol(self, v, load=False): self._set() def _unset_protocol(self): - self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..254']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'oc-pkt-match-types:IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_L2TP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_TCP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_AUTH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_GRE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_RSVP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_PIM': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_UDP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:IP_IGMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'IP_ICMP': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..254']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_TCP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) def _get_hop_limit(self): @@ -2072,12 +2175,12 @@ def _set_hop_limit(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """hop_limit must be of a type compatible with uint8""", 'defined-type': "uint8", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False)""", }) self.__hop_limit = t @@ -2085,19 +2188,19 @@ def _set_hop_limit(self, v, load=False): self._set() def _unset_hop_limit(self): - self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) - ip_version = builtins.property(_get_ip_version) - source_ip_address = builtins.property(_get_source_ip_address) - source_ip_flow_label = builtins.property(_get_source_ip_flow_label) - destination_ip_address = builtins.property(_get_destination_ip_address) - destination_ip_flow_label = builtins.property(_get_destination_ip_flow_label) - dscp = builtins.property(_get_dscp) - protocol = builtins.property(_get_protocol) - hop_limit = builtins.property(_get_hop_limit) + ip_version = __builtin__.property(_get_ip_version) + source_ip_address = __builtin__.property(_get_source_ip_address) + source_ip_flow_label = __builtin__.property(_get_source_ip_flow_label) + destination_ip_address = __builtin__.property(_get_destination_ip_address) + destination_ip_flow_label = __builtin__.property(_get_destination_ip_flow_label) + dscp = __builtin__.property(_get_dscp) + protocol = __builtin__.property(_get_protocol) + hop_limit = __builtin__.property(_get_hop_limit) - _pyangbind_elements = {'ip_version': ip_version, 'source_ip_address': source_ip_address, 'source_ip_flow_label': source_ip_flow_label, 'destination_ip_address': destination_ip_address, 'destination_ip_flow_label': destination_ip_flow_label, 'dscp': dscp, 'protocol': protocol, 'hop_limit': hop_limit, } + _pyangbind_elements = OrderedDict([('ip_version', ip_version), ('source_ip_address', source_ip_address), ('source_ip_flow_label', source_ip_flow_label), ('destination_ip_address', destination_ip_address), ('destination_ip_flow_label', destination_ip_flow_label), ('dscp', dscp), ('protocol', protocol), ('hop_limit', hop_limit), ]) class yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip(PybindBase): @@ -2109,12 +2212,16 @@ class yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip(Pybind YANG Description: Top level container """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'ip' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'ip' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -2144,7 +2251,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'ip'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip'] def _get_config(self): """ @@ -2219,11 +2326,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) - _pyangbind_elements = {'config': config, 'state': state, } + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config(PybindBase): @@ -2235,16 +2342,20 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_trans YANG Description: Configuration data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + __slots__ = ('_path_helper', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) - self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) - self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + self.__tcp_flags = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) load = kwargs.pop("load", None) if args: @@ -2271,7 +2382,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'transport', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport', u'config'] def _get_source_port(self): """ @@ -2294,12 +2405,12 @@ def _set_source_port(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""", 'defined-type': "oc-pkt-match-types:port-num-range", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", }) self.__source_port = t @@ -2307,7 +2418,7 @@ def _set_source_port(self, v, load=False): self._set() def _unset_source_port(self): - self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) def _get_destination_port(self): @@ -2331,12 +2442,12 @@ def _set_destination_port(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""", 'defined-type': "oc-pkt-match-types:port-num-range", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", }) self.__destination_port = t @@ -2344,7 +2455,7 @@ def _set_destination_port(self, v, load=False): self._set() def _unset_destination_port(self): - self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) def _get_tcp_flags(self): @@ -2368,12 +2479,12 @@ def _set_tcp_flags(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """tcp_flags must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + 'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", }) self.__tcp_flags = t @@ -2381,14 +2492,14 @@ def _set_tcp_flags(self, v, load=False): self._set() def _unset_tcp_flags(self): - self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__tcp_flags = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) - source_port = builtins.property(_get_source_port, _set_source_port) - destination_port = builtins.property(_get_destination_port, _set_destination_port) - tcp_flags = builtins.property(_get_tcp_flags, _set_tcp_flags) + source_port = __builtin__.property(_get_source_port, _set_source_port) + destination_port = __builtin__.property(_get_destination_port, _set_destination_port) + tcp_flags = __builtin__.property(_get_tcp_flags, _set_tcp_flags) - _pyangbind_elements = {'source_port': source_port, 'destination_port': destination_port, 'tcp_flags': tcp_flags, } + _pyangbind_elements = OrderedDict([('source_port', source_port), ('destination_port', destination_port), ('tcp_flags', tcp_flags), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state(PybindBase): @@ -2400,16 +2511,20 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transp YANG Description: State data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + __slots__ = ('_path_helper', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) - self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) - self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + self.__tcp_flags = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) load = kwargs.pop("load", None) if args: @@ -2436,7 +2551,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'transport', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport', u'state'] def _get_source_port(self): """ @@ -2459,12 +2574,12 @@ def _set_source_port(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""", 'defined-type': "oc-pkt-match-types:port-num-range", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", }) self.__source_port = t @@ -2472,7 +2587,7 @@ def _set_source_port(self, v, load=False): self._set() def _unset_source_port(self): - self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) def _get_destination_port(self): @@ -2496,12 +2611,12 @@ def _set_destination_port(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + t = YANGDynClass(v,base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""", 'defined-type': "oc-pkt-match-types:port-num-range", - 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", }) self.__destination_port = t @@ -2509,7 +2624,7 @@ def _set_destination_port(self, v, load=False): self._set() def _unset_destination_port(self): - self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=str, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={u'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={u'range': [u'0..65535']}),RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) def _get_tcp_flags(self): @@ -2533,12 +2648,12 @@ def _set_tcp_flags(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """tcp_flags must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + 'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", }) self.__tcp_flags = t @@ -2546,14 +2661,14 @@ def _set_tcp_flags(self, v, load=False): self._set() def _unset_tcp_flags(self): - self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_SYN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_CWR': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_RST': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@namespace': 'http://openconfig.net/yang/packet-match-types', '@module': 'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__tcp_flags = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_RST': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {u'@namespace': u'http://openconfig.net/yang/packet-match-types', u'@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) - source_port = builtins.property(_get_source_port) - destination_port = builtins.property(_get_destination_port) - tcp_flags = builtins.property(_get_tcp_flags) + source_port = __builtin__.property(_get_source_port) + destination_port = __builtin__.property(_get_destination_port) + tcp_flags = __builtin__.property(_get_tcp_flags) - _pyangbind_elements = {'source_port': source_port, 'destination_port': destination_port, 'tcp_flags': tcp_flags, } + _pyangbind_elements = OrderedDict([('source_port', source_port), ('destination_port', destination_port), ('tcp_flags', tcp_flags), ]) class yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport(PybindBase): @@ -2565,12 +2680,16 @@ class yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_tr YANG Description: Transport fields container """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'transport' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'transport' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -2600,7 +2719,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'transport'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport'] def _get_config(self): """ @@ -2675,11 +2794,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) - _pyangbind_elements = {'config': config, 'state': state, } + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config(PybindBase): @@ -2691,15 +2810,19 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input YANG Description: Configured reference to interface / subinterface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + __slots__ = ('_path_helper', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) load = kwargs.pop("load", None) if args: @@ -2726,7 +2849,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'input-interface', 'interface-ref', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref', u'config'] def _get_interface(self): """ @@ -2753,12 +2876,12 @@ def _set_interface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """interface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__interface = t @@ -2766,7 +2889,7 @@ def _set_interface(self, v, load=False): self._set() def _unset_interface(self): - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_subinterface(self): @@ -2796,12 +2919,12 @@ def _set_subinterface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """subinterface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__subinterface = t @@ -2809,13 +2932,13 @@ def _set_subinterface(self, v, load=False): self._set() def _unset_subinterface(self): - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - interface = builtins.property(_get_interface, _set_interface) - subinterface = builtins.property(_get_subinterface, _set_subinterface) + interface = __builtin__.property(_get_interface, _set_interface) + subinterface = __builtin__.property(_get_subinterface, _set_subinterface) - _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + _pyangbind_elements = OrderedDict([('interface', interface), ('subinterface', subinterface), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state(PybindBase): @@ -2827,15 +2950,19 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_ YANG Description: Operational state for interface-ref """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + __slots__ = ('_path_helper', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) load = kwargs.pop("load", None) if args: @@ -2862,7 +2989,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'input-interface', 'interface-ref', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref', u'state'] def _get_interface(self): """ @@ -2889,12 +3016,12 @@ def _set_interface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """interface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__interface = t @@ -2902,7 +3029,7 @@ def _set_interface(self, v, load=False): self._set() def _unset_interface(self): - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_subinterface(self): @@ -2932,12 +3059,12 @@ def _set_subinterface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """subinterface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__subinterface = t @@ -2945,13 +3072,13 @@ def _set_subinterface(self, v, load=False): self._set() def _unset_subinterface(self): - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - interface = builtins.property(_get_interface) - subinterface = builtins.property(_get_subinterface) + interface = __builtin__.property(_get_interface) + subinterface = __builtin__.property(_get_subinterface) - _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + _pyangbind_elements = OrderedDict([('interface', interface), ('subinterface', subinterface), ]) class yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref(PybindBase): @@ -2963,12 +3090,16 @@ class yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entr YANG Description: Reference to an interface or subinterface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'interface-ref' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'interface-ref' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -2998,7 +3129,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'input-interface', 'interface-ref'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref'] def _get_config(self): """ @@ -3073,11 +3204,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) - _pyangbind_elements = {'config': config, 'state': state, } + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) class yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface(PybindBase): @@ -3089,12 +3220,16 @@ class yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_en YANG Description: Input interface container """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface_ref',) + __slots__ = ('_path_helper', '_extmethods', '__interface_ref',) + + _yang_name = 'input-interface' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'input-interface' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -3123,7 +3258,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'input-interface'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface'] def _get_interface_ref(self): """ @@ -3161,10 +3296,10 @@ def _set_interface_ref(self, v, load=False): def _unset_interface_ref(self): self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - interface_ref = builtins.property(_get_interface_ref, _set_interface_ref) + interface_ref = __builtin__.property(_get_interface_ref, _set_interface_ref) - _pyangbind_elements = {'interface_ref': interface_ref, } + _pyangbind_elements = OrderedDict([('interface_ref', interface_ref), ]) class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config(PybindBase): @@ -3176,15 +3311,19 @@ class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actio YANG Description: Config data for ACL actions """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__forwarding_action','__log_action',) + __slots__ = ('_path_helper', '_extmethods', '__forwarding_action','__log_action',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) - self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) load = kwargs.pop("load", None) if args: @@ -3211,7 +3350,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'actions', 'config'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions', u'config'] def _get_forwarding_action(self): """ @@ -3236,12 +3375,12 @@ def _set_forwarding_action(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """forwarding_action must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", }) self.__forwarding_action = t @@ -3249,7 +3388,7 @@ def _set_forwarding_action(self, v, load=False): self._set() def _unset_forwarding_action(self): - self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) def _get_log_action(self): @@ -3277,12 +3416,12 @@ def _set_log_action(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """log_action must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", }) self.__log_action = t @@ -3290,13 +3429,13 @@ def _set_log_action(self, v, load=False): self._set() def _unset_log_action(self): - self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) - forwarding_action = builtins.property(_get_forwarding_action, _set_forwarding_action) - log_action = builtins.property(_get_log_action, _set_log_action) + forwarding_action = __builtin__.property(_get_forwarding_action, _set_forwarding_action) + log_action = __builtin__.property(_get_log_action, _set_log_action) - _pyangbind_elements = {'forwarding_action': forwarding_action, 'log_action': log_action, } + _pyangbind_elements = OrderedDict([('forwarding_action', forwarding_action), ('log_action', log_action), ]) class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state(PybindBase): @@ -3308,15 +3447,19 @@ class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_action YANG Description: State information for ACL actions """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__forwarding_action','__log_action',) + __slots__ = ('_path_helper', '_extmethods', '__forwarding_action','__log_action',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) - self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) load = kwargs.pop("load", None) if args: @@ -3343,7 +3486,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'actions', 'state'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions', u'state'] def _get_forwarding_action(self): """ @@ -3368,12 +3511,12 @@ def _set_forwarding_action(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """forwarding_action must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", }) self.__forwarding_action = t @@ -3381,7 +3524,7 @@ def _set_forwarding_action(self, v, load=False): self._set() def _unset_forwarding_action(self): - self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'REJECT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:ACCEPT': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:DROP': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'REJECT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:DROP': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) def _get_log_action(self): @@ -3409,12 +3552,12 @@ def _set_log_action(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """log_action must be of a type compatible with identityref""", 'defined-type': "openconfig-acl:identityref", - 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", }) self.__log_action = t @@ -3422,13 +3565,13 @@ def _set_log_action(self, v, load=False): self._set() def _unset_log_action(self): - self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=str, restriction_type="dict_key", restriction_arg={'LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_SYSLOG': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}, 'oc-acl:LOG_NONE': {'@namespace': 'http://openconfig.net/yang/acl', '@module': 'openconfig-acl'}},), default=str("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {u'@namespace': u'http://openconfig.net/yang/acl', u'@module': u'openconfig-acl'}},), default=six.text_type("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) - forwarding_action = builtins.property(_get_forwarding_action) - log_action = builtins.property(_get_log_action) + forwarding_action = __builtin__.property(_get_forwarding_action) + log_action = __builtin__.property(_get_log_action) - _pyangbind_elements = {'forwarding_action': forwarding_action, 'log_action': log_action, } + _pyangbind_elements = OrderedDict([('forwarding_action', forwarding_action), ('log_action', log_action), ]) class yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions(PybindBase): @@ -3441,12 +3584,16 @@ class yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_acti YANG Description: Enclosing container for list of ACL actions associated with an entry """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'actions' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'actions' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -3476,7 +3623,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry', 'actions'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions'] def _get_config(self): """ @@ -3551,11 +3698,224 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/icmp/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + """ + __slots__ = ('_path_helper', '_extmethods', '__type','__code',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__code = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="code", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-code-type', is_config=True) + self.__type = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-type-type', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'icmp', u'config'] + + def _get_type(self): + """ + Getter method for type, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config/type (icmp-type-type) + + YANG Description: ICMP(V6) type. + """ + return self.__type + + def _set_type(self, v, load=False): + """ + Setter method for type, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config/type (icmp-type-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_type is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_type() directly. + + YANG Description: ICMP(V6) type. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-type-type', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """type must be of a type compatible with icmp-type-type""", + 'defined-type': "sonic-acl-extension:icmp-type-type", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-type-type', is_config=True)""", + }) + + self.__type = t + if hasattr(self, '_set'): + self._set() + + def _unset_type(self): + self.__type = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-type-type', is_config=True) + + + def _get_code(self): + """ + Getter method for code, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config/code (icmp-code-type) + + YANG Description: ICMP(V6) code. + """ + return self.__code + + def _set_code(self, v, load=False): + """ + Setter method for code, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config/code (icmp-code-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_code is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_code() directly. + + YANG Description: ICMP(V6) code. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="code", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-code-type', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """code must be of a type compatible with icmp-code-type""", + 'defined-type': "sonic-acl-extension:icmp-code-type", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="code", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-code-type', is_config=True)""", + }) + + self.__code = t + if hasattr(self, '_set'): + self._set() + + def _unset_code(self): + self.__code = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={u'range': [u'0..255']}), is_leaf=True, yang_name="code", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='icmp-code-type', is_config=True) + + type = __builtin__.property(_get_type, _set_type) + code = __builtin__.property(_get_code, _set_code) + + + _pyangbind_elements = OrderedDict([('type', type), ('code', code), ]) - _pyangbind_elements = {'config': config, 'state': state, } +class yc_icmp_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/icmp. Each member element of + the container is represented as a class variable - with a specific + YANG type. + """ + __slots__ = ('_path_helper', '_extmethods', '__config',) + + _yang_name = 'icmp' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'icmp'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config (container) + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + + + _pyangbind_elements = OrderedDict([('config', config), ]) class yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry(PybindBase): @@ -3567,19 +3927,24 @@ class yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry(Py YANG Description: List of ACL entries comprising an ACL set """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__config','__state','__l2','__ip','__transport','__input_interface','__actions',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__config','__state','__l2','__ip','__transport','__input_interface','__actions','__icmp',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entry' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__ip = YANGDynClass(base=yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip, is_container='container', yang_name="ip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__input_interface = YANGDynClass(base=yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface, is_container='container', yang_name="input-interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__actions = YANGDynClass(base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) self.__l2 = YANGDynClass(base=yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2, is_container='container', yang_name="l2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__icmp = YANGDynClass(base=yc_icmp_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp, is_container='container', yang_name="icmp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__transport = YANGDynClass(base=yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport, is_container='container', yang_name="transport", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -3608,7 +3973,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries', 'acl-entry'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry'] def _get_sequence_id(self): """ @@ -3636,12 +4001,12 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__sequence_id = t @@ -3649,7 +4014,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_config(self): @@ -3912,17 +4277,51 @@ def _set_actions(self, v, load=False): def _unset_actions(self): self.__actions = YANGDynClass(base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - sequence_id = builtins.property(_get_sequence_id, _set_sequence_id) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) - l2 = builtins.property(_get_l2, _set_l2) - ip = builtins.property(_get_ip, _set_ip) - transport = builtins.property(_get_transport, _set_transport) - input_interface = builtins.property(_get_input_interface, _set_input_interface) - actions = builtins.property(_get_actions, _set_actions) + + def _get_icmp(self): + """ + Getter method for icmp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp (container) + """ + return self.__icmp + + def _set_icmp(self, v, load=False): + """ + Setter method for icmp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/icmp (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_icmp is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_icmp() directly. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_icmp_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp, is_container='container', yang_name="icmp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """icmp must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_icmp_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp, is_container='container', yang_name="icmp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True)""", + }) + + self.__icmp = t + if hasattr(self, '_set'): + self._set() + + def _unset_icmp(self): + self.__icmp = YANGDynClass(base=yc_icmp_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_icmp, is_container='container', yang_name="icmp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='https://github.com/Azure/sonic-buildimage', defining_module='sonic-acl-extension', yang_type='container', is_config=True) + + sequence_id = __builtin__.property(_get_sequence_id, _set_sequence_id) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + l2 = __builtin__.property(_get_l2, _set_l2) + ip = __builtin__.property(_get_ip, _set_ip) + transport = __builtin__.property(_get_transport, _set_transport) + input_interface = __builtin__.property(_get_input_interface, _set_input_interface) + actions = __builtin__.property(_get_actions, _set_actions) + icmp = __builtin__.property(_get_icmp, _set_icmp) - _pyangbind_elements = {'sequence_id': sequence_id, 'config': config, 'state': state, 'l2': l2, 'ip': ip, 'transport': transport, 'input_interface': input_interface, 'actions': actions, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('config', config), ('state', state), ('l2', l2), ('ip', ip), ('transport', transport), ('input_interface', input_interface), ('actions', actions), ('icmp', icmp), ]) class yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries(PybindBase): @@ -3934,12 +4333,16 @@ class yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries(PybindBase YANG Description: Access list entries container """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + __slots__ = ('_path_helper', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entries' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) @@ -3968,7 +4371,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set', 'acl-entries'] + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries'] def _get_acl_entry(self): """ @@ -4006,10 +4409,10 @@ def _set_acl_entry(self, v, load=False): def _unset_acl_entry(self): self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) - acl_entry = builtins.property(_get_acl_entry, _set_acl_entry) + acl_entry = __builtin__.property(_get_acl_entry, _set_acl_entry) - _pyangbind_elements = {'acl_entry': acl_entry, } + _pyangbind_elements = OrderedDict([('acl_entry', acl_entry), ]) class yc_acl_set_openconfig_acl__acl_acl_sets_acl_set(PybindBase): @@ -4022,16 +4425,20 @@ class yc_acl_set_openconfig_acl__acl_acl_sets_acl_set(PybindBase): YANG Description: List of ACL sets, each comprising of a list of ACL entries """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__config','__state','__acl_entries',) + __slots__ = ('_path_helper', '_extmethods', '__name','__config','__state','__acl_entries',) + + _yang_name = 'acl-set' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-set' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) load = kwargs.pop("load", None) @@ -4059,7 +4466,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets', 'acl-set'] + return [u'acl', u'acl-sets', u'acl-set'] def _get_name(self): """ @@ -4087,12 +4494,12 @@ def _set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__name = t @@ -4100,7 +4507,7 @@ def _set_name(self, v, load=False): self._set() def _unset_name(self): - self.__name = YANGDynClass(base=str, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_config(self): @@ -4213,13 +4620,13 @@ def _set_acl_entries(self, v, load=False): def _unset_acl_entries(self): self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - name = builtins.property(_get_name, _set_name) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) - acl_entries = builtins.property(_get_acl_entries, _set_acl_entries) + name = __builtin__.property(_get_name, _set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) - _pyangbind_elements = {'name': name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + _pyangbind_elements = OrderedDict([('name', name), ('config', config), ('state', state), ('acl_entries', acl_entries), ]) class yc_acl_sets_openconfig_acl__acl_acl_sets(PybindBase): @@ -4231,12 +4638,16 @@ class yc_acl_sets_openconfig_acl__acl_acl_sets(PybindBase): YANG Description: Access list entries variables enclosing container """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_set',) + __slots__ = ('_path_helper', '_extmethods', '__acl_set',) + + _yang_name = 'acl-sets' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-sets' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__acl_set = YANGDynClass(base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) @@ -4265,7 +4676,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'acl-sets'] + return [u'acl', u'acl-sets'] def _get_acl_set(self): """ @@ -4305,10 +4716,10 @@ def _set_acl_set(self, v, load=False): def _unset_acl_set(self): self.__acl_set = YANGDynClass(base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) - acl_set = builtins.property(_get_acl_set, _set_acl_set) + acl_set = __builtin__.property(_get_acl_set, _set_acl_set) - _pyangbind_elements = {'acl_set': acl_set, } + _pyangbind_elements = OrderedDict([('acl_set', acl_set), ]) class yc_config_openconfig_acl__acl_interfaces_interface_config(PybindBase): @@ -4320,14 +4731,18 @@ class yc_config_openconfig_acl__acl_interfaces_interface_config(PybindBase): YANG Description: Configuration for ACL per-interface data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id',) + __slots__ = ('_path_helper', '_extmethods', '__id',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) load = kwargs.pop("load", None) if args: @@ -4354,7 +4769,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'config'] + return [u'acl', u'interfaces', u'interface', u'config'] def _get_id(self): """ @@ -4379,12 +4794,12 @@ def _set_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """id must be of a type compatible with oc-if:interface-id""", 'defined-type': "oc-if:interface-id", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True)""", }) self.__id = t @@ -4392,12 +4807,12 @@ def _set_id(self, v, load=False): self._set() def _unset_id(self): - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) - id = builtins.property(_get_id, _set_id) + id = __builtin__.property(_get_id, _set_id) - _pyangbind_elements = {'id': id, } + _pyangbind_elements = OrderedDict([('id', id), ]) class yc_state_openconfig_acl__acl_interfaces_interface_state(PybindBase): @@ -4409,14 +4824,18 @@ class yc_state_openconfig_acl__acl_interfaces_interface_state(PybindBase): YANG Description: Operational state for ACL per-interface data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id',) + __slots__ = ('_path_helper', '_extmethods', '__id',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) load = kwargs.pop("load", None) if args: @@ -4443,7 +4862,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'state'] + return [u'acl', u'interfaces', u'interface', u'state'] def _get_id(self): """ @@ -4468,12 +4887,12 @@ def _set_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """id must be of a type compatible with oc-if:interface-id""", 'defined-type': "oc-if:interface-id", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False)""", }) self.__id = t @@ -4481,12 +4900,12 @@ def _set_id(self, v, load=False): self._set() def _unset_id(self): - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) - id = builtins.property(_get_id) + id = __builtin__.property(_get_id) - _pyangbind_elements = {'id': id, } + _pyangbind_elements = OrderedDict([('id', id), ]) class yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config(PybindBase): @@ -4498,15 +4917,19 @@ class yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config(Py YANG Description: Configured reference to interface / subinterface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + __slots__ = ('_path_helper', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) load = kwargs.pop("load", None) if args: @@ -4533,7 +4956,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'interface-ref', 'config'] + return [u'acl', u'interfaces', u'interface', u'interface-ref', u'config'] def _get_interface(self): """ @@ -4560,12 +4983,12 @@ def _set_interface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """interface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__interface = t @@ -4573,7 +4996,7 @@ def _set_interface(self, v, load=False): self._set() def _unset_interface(self): - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_subinterface(self): @@ -4603,12 +5026,12 @@ def _set_subinterface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """subinterface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__subinterface = t @@ -4616,13 +5039,13 @@ def _set_subinterface(self, v, load=False): self._set() def _unset_subinterface(self): - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - interface = builtins.property(_get_interface, _set_interface) - subinterface = builtins.property(_get_subinterface, _set_subinterface) + interface = __builtin__.property(_get_interface, _set_interface) + subinterface = __builtin__.property(_get_subinterface, _set_subinterface) - _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + _pyangbind_elements = OrderedDict([('interface', interface), ('subinterface', subinterface), ]) class yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state(PybindBase): @@ -4634,15 +5057,19 @@ class yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state(Pybi YANG Description: Operational state for interface-ref """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + __slots__ = ('_path_helper', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) load = kwargs.pop("load", None) if args: @@ -4669,7 +5096,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'interface-ref', 'state'] + return [u'acl', u'interfaces', u'interface', u'interface-ref', u'state'] def _get_interface(self): """ @@ -4696,12 +5123,12 @@ def _set_interface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """interface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__interface = t @@ -4709,7 +5136,7 @@ def _set_interface(self, v, load=False): self._set() def _unset_interface(self): - self.__interface = YANGDynClass(base=str, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__interface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_subinterface(self): @@ -4739,12 +5166,12 @@ def _set_subinterface(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """subinterface must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__subinterface = t @@ -4752,13 +5179,13 @@ def _set_subinterface(self, v, load=False): self._set() def _unset_subinterface(self): - self.__subinterface = YANGDynClass(base=str, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - interface = builtins.property(_get_interface) - subinterface = builtins.property(_get_subinterface) + interface = __builtin__.property(_get_interface) + subinterface = __builtin__.property(_get_subinterface) - _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + _pyangbind_elements = OrderedDict([('interface', interface), ('subinterface', subinterface), ]) class yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref(PybindBase): @@ -4770,12 +5197,16 @@ class yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref(Py YANG Description: Reference to an interface or subinterface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + __slots__ = ('_path_helper', '_extmethods', '__config','__state',) + + _yang_name = 'interface-ref' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'interface-ref' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -4805,7 +5236,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'interface-ref'] + return [u'acl', u'interfaces', u'interface', u'interface-ref'] def _get_config(self): """ @@ -4880,11 +5311,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) - _pyangbind_elements = {'config': config, 'state': state, } + _pyangbind_elements = OrderedDict([('config', config), ('state', state), ]) class yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config(PybindBase): @@ -4896,14 +5327,18 @@ class yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingres YANG Description: Configuration data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + __slots__ = ('_path_helper', '_extmethods', '__set_name',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) load = kwargs.pop("load", None) if args: @@ -4930,7 +5365,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set', 'config'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'config'] def _get_set_name(self): """ @@ -4953,12 +5388,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__set_name = t @@ -4966,12 +5401,12 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - set_name = builtins.property(_get_set_name, _set_set_name) + set_name = __builtin__.property(_get_set_name, _set_set_name) - _pyangbind_elements = {'set_name': set_name, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ]) class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state(PybindBase): @@ -4983,14 +5418,18 @@ class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress YANG Description: Operational state data for interface ingress ACLs """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + __slots__ = ('_path_helper', '_extmethods', '__set_name',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) load = kwargs.pop("load", None) if args: @@ -5017,7 +5456,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set', 'state'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'state'] def _get_set_name(self): """ @@ -5040,12 +5479,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__set_name = t @@ -5053,12 +5492,12 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - set_name = builtins.property(_get_set_name) + set_name = __builtin__.property(_get_set_name) - _pyangbind_elements = {'set_name': set_name, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ]) class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state(PybindBase): @@ -5070,16 +5509,20 @@ class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress YANG Description: Operational state data for per-interface ACL entries """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) load = kwargs.pop("load", None) if args: @@ -5106,7 +5549,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set', 'acl-entries', 'acl-entry', 'state'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries', u'acl-entry', u'state'] def _get_sequence_id(self): """ @@ -5131,12 +5574,12 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__sequence_id = t @@ -5144,7 +5587,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_matched_packets(self): @@ -5194,7 +5637,7 @@ def _set_matched_packets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_packets must be of a type compatible with yang:counter64""", @@ -5207,7 +5650,7 @@ def _set_matched_packets(self, v, load=False): self._set() def _unset_matched_packets(self): - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) def _get_matched_octets(self): @@ -5257,7 +5700,7 @@ def _set_matched_octets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_octets must be of a type compatible with yang:counter64""", @@ -5270,14 +5713,14 @@ def _set_matched_octets(self, v, load=False): self._set() def _unset_matched_octets(self): - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - sequence_id = builtins.property(_get_sequence_id) - matched_packets = builtins.property(_get_matched_packets) - matched_octets = builtins.property(_get_matched_octets) + sequence_id = __builtin__.property(_get_sequence_id) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) - _pyangbind_elements = {'sequence_id': sequence_id, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('matched_packets', matched_packets), ('matched_octets', matched_octets), ]) class yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry(PybindBase): @@ -5289,14 +5732,18 @@ class yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ing YANG Description: List of ACL entries assigned to an interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__state',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__state',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entry' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) load = kwargs.pop("load", None) @@ -5324,7 +5771,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set', 'acl-entries', 'acl-entry'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries', u'acl-entry'] def _get_sequence_id(self): """ @@ -5352,12 +5799,12 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__sequence_id = t @@ -5365,7 +5812,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_state(self): @@ -5404,11 +5851,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) - sequence_id = builtins.property(_get_sequence_id) - state = builtins.property(_get_state) + sequence_id = __builtin__.property(_get_sequence_id) + state = __builtin__.property(_get_state) - _pyangbind_elements = {'sequence_id': sequence_id, 'state': state, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('state', state), ]) class yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries(PybindBase): @@ -5420,12 +5867,16 @@ class yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_i YANG Description: Enclosing container for list of references to ACLs """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + __slots__ = ('_path_helper', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entries' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) @@ -5454,7 +5905,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set', 'acl-entries'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries'] def _get_acl_entry(self): """ @@ -5492,10 +5943,10 @@ def _set_acl_entry(self, v, load=False): def _unset_acl_entry(self): self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) - acl_entry = builtins.property(_get_acl_entry) + acl_entry = __builtin__.property(_get_acl_entry) - _pyangbind_elements = {'acl_entry': acl_entry, } + _pyangbind_elements = OrderedDict([('acl_entry', acl_entry), ]) class yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set(PybindBase): @@ -5507,14 +5958,18 @@ class yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_se YANG Description: List of ingress ACLs on the interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name','__config','__state','__acl_entries',) + __slots__ = ('_path_helper', '_extmethods', '__set_name','__config','__state','__acl_entries',) + + _yang_name = 'ingress-acl-set' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'ingress-acl-set' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -5544,7 +5999,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets', 'ingress-acl-set'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set'] def _get_set_name(self): """ @@ -5572,12 +6027,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__set_name = t @@ -5585,7 +6040,7 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_config(self): @@ -5698,13 +6153,13 @@ def _set_acl_entries(self, v, load=False): def _unset_acl_entries(self): self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - set_name = builtins.property(_get_set_name, _set_set_name) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) - acl_entries = builtins.property(_get_acl_entries, _set_acl_entries) + set_name = __builtin__.property(_get_set_name, _set_set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) - _pyangbind_elements = {'set_name': set_name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ('config', config), ('state', state), ('acl_entries', acl_entries), ]) class yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets(PybindBase): @@ -5717,12 +6172,16 @@ class yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_s YANG Description: Enclosing container the list of ingress ACLs on the interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ingress_acl_set',) + __slots__ = ('_path_helper', '_extmethods', '__ingress_acl_set',) + + _yang_name = 'ingress-acl-sets' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'ingress-acl-sets' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__ingress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) @@ -5751,7 +6210,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'ingress-acl-sets'] + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets'] def _get_ingress_acl_set(self): """ @@ -5789,10 +6248,10 @@ def _set_ingress_acl_set(self, v, load=False): def _unset_ingress_acl_set(self): self.__ingress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) - ingress_acl_set = builtins.property(_get_ingress_acl_set, _set_ingress_acl_set) + ingress_acl_set = __builtin__.property(_get_ingress_acl_set, _set_ingress_acl_set) - _pyangbind_elements = {'ingress_acl_set': ingress_acl_set, } + _pyangbind_elements = OrderedDict([('ingress_acl_set', ingress_acl_set), ]) class yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config(PybindBase): @@ -5804,14 +6263,18 @@ class yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_ YANG Description: Configuration data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + __slots__ = ('_path_helper', '_extmethods', '__set_name',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'config' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) load = kwargs.pop("load", None) if args: @@ -5838,7 +6301,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set', 'config'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'config'] def _get_set_name(self): """ @@ -5861,12 +6324,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__set_name = t @@ -5874,12 +6337,12 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) - set_name = builtins.property(_get_set_name, _set_set_name) + set_name = __builtin__.property(_get_set_name, _set_set_name) - _pyangbind_elements = {'set_name': set_name, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ]) class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state(PybindBase): @@ -5891,14 +6354,18 @@ class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_a YANG Description: Operational state data for interface egress ACLs """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + __slots__ = ('_path_helper', '_extmethods', '__set_name',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) load = kwargs.pop("load", None) if args: @@ -5925,7 +6392,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set', 'state'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'state'] def _get_set_name(self): """ @@ -5948,12 +6415,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__set_name = t @@ -5961,12 +6428,12 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - set_name = builtins.property(_get_set_name) + set_name = __builtin__.property(_get_set_name) - _pyangbind_elements = {'set_name': set_name, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ]) class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state(PybindBase): @@ -5978,16 +6445,20 @@ class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_a YANG Description: Operational state data for per-interface ACL entries """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'state' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) load = kwargs.pop("load", None) if args: @@ -6014,7 +6485,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set', 'acl-entries', 'acl-entry', 'state'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries', u'acl-entry', u'state'] def _get_sequence_id(self): """ @@ -6039,12 +6510,12 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__sequence_id = t @@ -6052,7 +6523,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_matched_packets(self): @@ -6102,7 +6573,7 @@ def _set_matched_packets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_packets must be of a type compatible with yang:counter64""", @@ -6115,7 +6586,7 @@ def _set_matched_packets(self, v, load=False): self._set() def _unset_matched_packets(self): - self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) def _get_matched_octets(self): @@ -6165,7 +6636,7 @@ def _set_matched_octets(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """matched_octets must be of a type compatible with yang:counter64""", @@ -6178,14 +6649,14 @@ def _set_matched_octets(self, v, load=False): self._set() def _unset_matched_octets(self): - self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) - sequence_id = builtins.property(_get_sequence_id) - matched_packets = builtins.property(_get_matched_packets) - matched_octets = builtins.property(_get_matched_octets) + sequence_id = __builtin__.property(_get_sequence_id) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) - _pyangbind_elements = {'sequence_id': sequence_id, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('matched_packets', matched_packets), ('matched_octets', matched_octets), ]) class yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry(PybindBase): @@ -6197,14 +6668,18 @@ class yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egre YANG Description: List of ACL entries assigned to an interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__state',) + __slots__ = ('_path_helper', '_extmethods', '__sequence_id','__state',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entry' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) load = kwargs.pop("load", None) @@ -6232,7 +6707,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set', 'acl-entries', 'acl-entry'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries', u'acl-entry'] def _get_sequence_id(self): """ @@ -6260,12 +6735,12 @@ def _set_sequence_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) except (TypeError, ValueError): raise ValueError({ 'error-string': """sequence_id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", }) self.__sequence_id = t @@ -6273,7 +6748,7 @@ def _set_sequence_id(self, v, load=False): self._set() def _unset_sequence_id(self): - self.__sequence_id = YANGDynClass(base=str, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__sequence_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) def _get_state(self): @@ -6312,11 +6787,11 @@ def _set_state(self, v, load=False): def _unset_state(self): self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) - sequence_id = builtins.property(_get_sequence_id) - state = builtins.property(_get_state) + sequence_id = __builtin__.property(_get_sequence_id) + state = __builtin__.property(_get_state) - _pyangbind_elements = {'sequence_id': sequence_id, 'state': state, } + _pyangbind_elements = OrderedDict([('sequence_id', sequence_id), ('state', state), ]) class yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries(PybindBase): @@ -6328,12 +6803,16 @@ class yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_eg YANG Description: Enclosing container for list of references to ACLs """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + __slots__ = ('_path_helper', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl-entries' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) @@ -6362,7 +6841,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set', 'acl-entries'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries'] def _get_acl_entry(self): """ @@ -6400,10 +6879,10 @@ def _set_acl_entry(self, v, load=False): def _unset_acl_entry(self): self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) - acl_entry = builtins.property(_get_acl_entry) + acl_entry = __builtin__.property(_get_acl_entry) - _pyangbind_elements = {'acl_entry': acl_entry, } + _pyangbind_elements = OrderedDict([('acl_entry', acl_entry), ]) class yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set(PybindBase): @@ -6415,14 +6894,18 @@ class yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets YANG Description: List of egress ACLs on the interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name','__config','__state','__acl_entries',) + __slots__ = ('_path_helper', '_extmethods', '__set_name','__config','__state','__acl_entries',) + + _yang_name = 'egress-acl-set' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'egress-acl-set' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -6452,7 +6935,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets', 'egress-acl-set'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set'] def _get_set_name(self): """ @@ -6480,12 +6963,12 @@ def _set_set_name(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """set_name must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__set_name = t @@ -6493,7 +6976,7 @@ def _set_set_name(self, v, load=False): self._set() def _unset_set_name(self): - self.__set_name = YANGDynClass(base=str, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__set_name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_config(self): @@ -6606,13 +7089,13 @@ def _set_acl_entries(self, v, load=False): def _unset_acl_entries(self): self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - set_name = builtins.property(_get_set_name, _set_set_name) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) - acl_entries = builtins.property(_get_acl_entries, _set_acl_entries) + set_name = __builtin__.property(_get_set_name, _set_set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) - _pyangbind_elements = {'set_name': set_name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + _pyangbind_elements = OrderedDict([('set_name', set_name), ('config', config), ('state', state), ('acl_entries', acl_entries), ]) class yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets(PybindBase): @@ -6625,12 +7108,16 @@ class yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_set YANG Description: Enclosing container the list of egress ACLs on the interface """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__egress_acl_set',) + __slots__ = ('_path_helper', '_extmethods', '__egress_acl_set',) + + _yang_name = 'egress-acl-sets' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'egress-acl-sets' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__egress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) @@ -6659,7 +7146,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface', 'egress-acl-sets'] + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets'] def _get_egress_acl_set(self): """ @@ -6697,10 +7184,10 @@ def _set_egress_acl_set(self, v, load=False): def _unset_egress_acl_set(self): self.__egress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) - egress_acl_set = builtins.property(_get_egress_acl_set, _set_egress_acl_set) + egress_acl_set = __builtin__.property(_get_egress_acl_set, _set_egress_acl_set) - _pyangbind_elements = {'egress_acl_set': egress_acl_set, } + _pyangbind_elements = OrderedDict([('egress_acl_set', egress_acl_set), ]) class yc_interface_openconfig_acl__acl_interfaces_interface(PybindBase): @@ -6712,18 +7199,22 @@ class yc_interface_openconfig_acl__acl_interfaces_interface(PybindBase): YANG Description: List of interfaces on which ACLs are set """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id','__config','__state','__interface_ref','__ingress_acl_sets','__egress_acl_sets',) + __slots__ = ('_path_helper', '_extmethods', '__id','__config','__state','__interface_ref','__ingress_acl_sets','__egress_acl_sets',) + + _yang_name = 'interface' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'interface' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__ingress_acl_sets = YANGDynClass(base=yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets, is_container='container', yang_name="ingress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__egress_acl_sets = YANGDynClass(base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) load = kwargs.pop("load", None) @@ -6751,7 +7242,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces', 'interface'] + return [u'acl', u'interfaces', u'interface'] def _get_id(self): """ @@ -6779,12 +7270,12 @@ def _set_id(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """id must be of a type compatible with leafref""", 'defined-type': "leafref", - 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", }) self.__id = t @@ -6792,7 +7283,7 @@ def _set_id(self, v, load=False): self._set() def _unset_id(self): - self.__id = YANGDynClass(base=str, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) def _get_config(self): @@ -6983,15 +7474,15 @@ def _set_egress_acl_sets(self, v, load=False): def _unset_egress_acl_sets(self): self.__egress_acl_sets = YANGDynClass(base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - id = builtins.property(_get_id, _set_id) - config = builtins.property(_get_config, _set_config) - state = builtins.property(_get_state, _set_state) - interface_ref = builtins.property(_get_interface_ref, _set_interface_ref) - ingress_acl_sets = builtins.property(_get_ingress_acl_sets, _set_ingress_acl_sets) - egress_acl_sets = builtins.property(_get_egress_acl_sets, _set_egress_acl_sets) + id = __builtin__.property(_get_id, _set_id) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + interface_ref = __builtin__.property(_get_interface_ref, _set_interface_ref) + ingress_acl_sets = __builtin__.property(_get_ingress_acl_sets, _set_ingress_acl_sets) + egress_acl_sets = __builtin__.property(_get_egress_acl_sets, _set_egress_acl_sets) - _pyangbind_elements = {'id': id, 'config': config, 'state': state, 'interface_ref': interface_ref, 'ingress_acl_sets': ingress_acl_sets, 'egress_acl_sets': egress_acl_sets, } + _pyangbind_elements = OrderedDict([('id', id), ('config', config), ('state', state), ('interface_ref', interface_ref), ('ingress_acl_sets', ingress_acl_sets), ('egress_acl_sets', egress_acl_sets), ]) class yc_interfaces_openconfig_acl__acl_interfaces(PybindBase): @@ -7004,12 +7495,16 @@ class yc_interfaces_openconfig_acl__acl_interfaces(PybindBase): YANG Description: Enclosing container for the list of interfaces on which ACLs are set """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface',) + __slots__ = ('_path_helper', '_extmethods', '__interface',) + + _yang_name = 'interfaces' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'interfaces' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__interface = YANGDynClass(base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) @@ -7038,7 +7533,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl', 'interfaces'] + return [u'acl', u'interfaces'] def _get_interface(self): """ @@ -7076,10 +7571,10 @@ def _set_interface(self, v, load=False): def _unset_interface(self): self.__interface = YANGDynClass(base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) - interface = builtins.property(_get_interface, _set_interface) + interface = __builtin__.property(_get_interface, _set_interface) - _pyangbind_elements = {'interface': interface, } + _pyangbind_elements = OrderedDict([('interface', interface), ]) class yc_acl_openconfig_acl__acl(PybindBase): @@ -7092,12 +7587,16 @@ class yc_acl_openconfig_acl__acl(PybindBase): YANG Description: Top level enclosing container for ACL model config and operational state data """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__state','__acl_sets','__interfaces',) + __slots__ = ('_path_helper', '_extmethods', '__state','__acl_sets','__interfaces',) + + _yang_name = 'acl' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'acl' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) self.__acl_sets = YANGDynClass(base=yc_acl_sets_openconfig_acl__acl_acl_sets, is_container='container', yang_name="acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -7128,7 +7627,7 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['acl'] + return [u'acl'] def _get_state(self): """ @@ -7242,12 +7741,12 @@ def _set_interfaces(self, v, load=False): def _unset_interfaces(self): self.__interfaces = YANGDynClass(base=yc_interfaces_openconfig_acl__acl_interfaces, is_container='container', yang_name="interfaces", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - state = builtins.property(_get_state, _set_state) - acl_sets = builtins.property(_get_acl_sets, _set_acl_sets) - interfaces = builtins.property(_get_interfaces, _set_interfaces) + state = __builtin__.property(_get_state, _set_state) + acl_sets = __builtin__.property(_get_acl_sets, _set_acl_sets) + interfaces = __builtin__.property(_get_interfaces, _set_interfaces) - _pyangbind_elements = {'state': state, 'acl_sets': acl_sets, 'interfaces': interfaces, } + _pyangbind_elements = OrderedDict([('state', state), ('acl_sets', acl_sets), ('interfaces', interfaces), ]) class openconfig_acl(PybindBase): @@ -7272,12 +7771,16 @@ class openconfig_acl(PybindBase): criteria that cross protocol layers, e.g., MAC layer and IP layer matches. """ - __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl',) + __slots__ = ('_path_helper', '_extmethods', '__acl',) + + _yang_name = 'openconfig-acl' + + _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): - self._yang_name = 'openconfig-acl' - self._pybind_generated_by = 'container' + self._path_helper = False + self._extmethods = False self.__acl = YANGDynClass(base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) @@ -7346,7 +7849,9 @@ def _set_acl(self, v, load=False): def _unset_acl(self): self.__acl = YANGDynClass(base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) - acl = builtins.property(_get_acl, _set_acl) + acl = __builtin__.property(_get_acl, _set_acl) + + + _pyangbind_elements = OrderedDict([('acl', acl), ]) - _pyangbind_elements = {'acl': acl, } diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index 478198e5af84..011642b2b812 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -26,8 +26,7 @@ INTF_KEY = "interfaces" OPTIONAL_HWSKU_ATTRIBUTES = ["fec", "autoneg"] -BRKOUT_PATTERN = r'(\d{1,3})x(\d{1,3}G)(\[\d{1,3}G\])?(\((\d{1,3})\))?' - +BRKOUT_PATTERN = r'(\d{1,3})x(\d{1,3}G)(\[(\d{1,3}G,?)*\])?(\((\d{1,3})\))?' # # Helper Functions @@ -149,23 +148,24 @@ def parse_port_config_file(port_config_file): return (ports, port_alias_map, port_alias_asic_map) # Generate configs (i.e. alias, lanes, speed, index) for port -def gen_port_config(ports, parent_intf_id, index, alias_at_lanes, lanes, k, offset): +def gen_port_config(ports, parent_intf_id, index, alias_list, lanes, k, offset): if k is not None: - num_lane_used, speed, alt_speed, _ , assigned_lane = k[0], k[1], k[2], k[3], k[4] + num_lane_used, speed, alt_speed, _, _ , assigned_lane = k[0], k[1], k[2], k[3], k[4], k[5] # In case of symmetric mode if assigned_lane is None: assigned_lane = len(lanes.split(",")) parent_intf_id = int(offset)+int(parent_intf_id) - alias_start = 0 + offset + alias_position = 0 + int(offset)//int(num_lane_used) + lanes_start = 0 + int(offset) step = int(assigned_lane)//int(num_lane_used) for i in range(0,int(assigned_lane), step): intf_name = PORT_STR + str(parent_intf_id) ports[intf_name] = {} - ports[intf_name]['alias'] = alias_at_lanes.split(",")[alias_start] - ports[intf_name]['lanes'] = ','.join(lanes.split(",")[alias_start:alias_start+step]) + ports[intf_name]['alias'] = alias_list[alias_position] + ports[intf_name]['lanes'] = ','.join(lanes.split(",")[lanes_start:lanes_start+step]) if speed: speed_pat = re.search("^((\d+)G|\d+)$", speed.upper()) if speed_pat is None: @@ -179,11 +179,12 @@ def gen_port_config(ports, parent_intf_id, index, alias_at_lanes, lanes, k, off else: raise Exception('Regex return for speed is None...') - ports[intf_name]['index'] = index.split(",")[alias_start] + ports[intf_name]['index'] = index.split(",")[alias_position] ports[intf_name]['admin_status'] = "up" parent_intf_id += step - alias_start += step + alias_position += 1 + lanes_start += step offset = int(assigned_lane) + int(offset) return offset @@ -200,7 +201,7 @@ def get_child_ports(interface, breakout_mode, platform_json_file): port_dict = readJson(platform_json_file) index = port_dict[INTF_KEY][interface]['index'] - alias_at_lanes = port_dict[INTF_KEY][interface]['alias_at_lanes'] + alias_list = port_dict[INTF_KEY][interface]['breakout_modes'][breakout_mode] lanes = port_dict[INTF_KEY][interface]['lanes'] """ @@ -224,7 +225,7 @@ def get_child_ports(interface, breakout_mode, platform_json_file): offset = 0 parent_intf_id = int(re.search("Ethernet(\d+)", interface).group(1)) for k in match_list: - offset = gen_port_config(child_ports, parent_intf_id, index, alias_at_lanes, lanes, k, offset) + offset = gen_port_config(child_ports, parent_intf_id, index, alias_list, lanes, k, offset) return child_ports def parse_platform_json_file(hwsku_json_file, platform_json_file): diff --git a/src/sonic-config-engine/sonic-acl-extension.yang b/src/sonic-config-engine/sonic-acl-extension.yang new file mode 100644 index 000000000000..eac83b985f30 --- /dev/null +++ b/src/sonic-config-engine/sonic-acl-extension.yang @@ -0,0 +1,76 @@ +module sonic-acl-extension { + yang-version "1"; + namespace "https://github.com/Azure/sonic-buildimage"; + + prefix "sonic-acl-extension"; + + import openconfig-acl { prefix oc-acl; } + + typedef vlan-id-type { + type uint16 { + range 0..4095; + } + description + "The VLAN ID value may be expressed as a 12-bit number in decimal notation"; + } + + typedef icmp-type-type { + type uint8 { + range 0..255; + } + description + "The ICMP type value may be expressed as an 8-bit number in decimal notation"; + } + + typedef icmp-code-type { + type uint8 { + range 0..255; + } + description + "The ICMP code value may be expressed as an 8-bit number in decimal notation"; + } + + grouping extended-l2-match { + leaf vlan-id { + type vlan-id-type; + description + "VLAN ID field to match in DOT1Q packets"; + } + } + + grouping icmp-protocol-fields-config { + description + "Configuration data of ICMP protocol fields."; + + leaf type { + type icmp-type-type; + description + "ICMP(V6) type."; + } + + leaf code { + type icmp-code-type; + description + "ICMP(V6) code."; + } + } + + grouping icmp-protocol-fields-top { + description + "ICMP header fields for IPv4 and IPv6"; + + container icmp { + container config { + uses icmp-protocol-fields-config; + } + } + } + + augment "/oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:l2/oc-acl:config" { + uses extended-l2-match; + } + + augment "/oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry" { + uses icmp-protocol-fields-top; + } +} diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 0f9ffafad635..b0a6295ad189 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -41,7 +41,7 @@ from functools import partial from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role from portconfig import get_port_config, get_breakout_mode from redis_bcc import RedisBytecodeCache -from sonic_py_common.multi_asic import get_asic_id_from_name, is_multi_asic +from sonic_py_common.multi_asic import get_asic_id_from_name from sonic_py_common import device_info from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector @@ -251,8 +251,6 @@ def _get_jinja2_env(paths): env.filters['ip_network'] = ip_network for attr in ['ip', 'network', 'prefixlen', 'netmask', 'broadcast']: env.filters[attr] = partial(prefix_attr, attr) - # Pass the is_multi_asic function as global - env.globals['multi_asic'] = is_multi_asic return env diff --git a/src/sonic-config-engine/tests/sample_hwsku.json b/src/sonic-config-engine/tests/sample_hwsku.json index 5b450932c238..b4864d40eb11 100644 --- a/src/sonic-config-engine/tests/sample_hwsku.json +++ b/src/sonic-config-engine/tests/sample_hwsku.json @@ -31,10 +31,10 @@ "default_brkout_mode": "1x50G(2)+2x25G(2)" }, "Ethernet40": { - "default_brkout_mode": "1x100G[40G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" }, "Ethernet44": { - "default_brkout_mode": "2x50G" + "default_brkout_mode": "2x50G[40G,25G,10G,1G]" }, "Ethernet48": { "default_brkout_mode": "4x25G[10G]" diff --git a/src/sonic-config-engine/tests/sample_output/platform_output.json b/src/sonic-config-engine/tests/sample_output/platform_output.json index f4e031fbe536..8cf405e311cc 100644 --- a/src/sonic-config-engine/tests/sample_output/platform_output.json +++ b/src/sonic-config-engine/tests/sample_output/platform_output.json @@ -12,10 +12,10 @@ "Ethernet9": { "index": "3", "lanes": "9", - "description": " Eth3/2", + "description": "Eth3/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth3/2", + "alias": "Eth3/2", "pfc_asym": "off", "speed": "25000" }, @@ -32,10 +32,10 @@ "Ethernet98": { "index": "25", "lanes": "98", - "description": " Eth25/3", + "description": "Eth25/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth25/3", + "alias": "Eth25/2", "pfc_asym": "off", "speed": "25000" }, @@ -43,20 +43,20 @@ "index": "1", "lanes": "0,1,2,3", "fec": "rs", - "description": "Eth1/1", + "description": "Eth1", "admin_status": "up", "mtu": "9100", - "alias": "Eth1/1", + "alias": "Eth1", "pfc_asym": "off", "speed": "100000" }, "Ethernet6": { "index": "2", "lanes": "6,7", - "description": " Eth2/3", + "description": "Eth2/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth2/3", + "alias": "Eth2/2", "pfc_asym": "off", "speed": "50000" }, @@ -73,10 +73,10 @@ "Ethernet109": { "index": "28", "lanes": "109", - "description": " Eth28/2", + "description": "Eth28/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth28/2", + "alias": "Eth28/2", "pfc_asym": "off", "speed": "25000" }, @@ -93,10 +93,10 @@ "Ethernet18": { "index": "5", "lanes": "18", - "description": " Eth5/3", + "description": "Eth5/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth5/3", + "alias": "Eth5/2", "pfc_asym": "off", "speed": "25000" }, @@ -104,20 +104,20 @@ "index": "26", "lanes": "100,101,102,103", "fec": "rs", - "description": "Eth26/1", + "description": "Eth26", "admin_status": "up", "mtu": "9100", - "alias": "Eth26/1", + "alias": "Eth26", "pfc_asym": "off", "speed": "100000" }, "Ethernet34": { "index": "9", "lanes": "34,35", - "description": " Eth9/3", + "description": "Eth9/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth9/3", + "alias": "Eth9/3", "pfc_asym": "off", "speed": "50000" }, @@ -134,30 +134,30 @@ "Ethernet106": { "index": "27", "lanes": "106,107", - "description": " Eth27/3", + "description": "Eth27/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth27/3", + "alias": "Eth27/2", "pfc_asym": "off", "speed": "50000" }, "Ethernet94": { "index": "24", "lanes": "94,95", - "description": " Eth24/3", - "admin_status": "up", + "description": "Eth24/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth24/3", + "alias": "Eth24/3", "pfc_asym": "off", "speed": "50000" }, "Ethernet126": { "index": "32", "lanes": "126,127", - "description": " Eth32/3", - "admin_status": "up", + "description": "Eth32/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth32/3", + "alias": "Eth32/2", "pfc_asym": "off", "speed": "50000" }, @@ -165,7 +165,7 @@ "index": "25", "lanes": "96,97", "description": "Eth25/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth25/1", "pfc_asym": "off", @@ -175,7 +175,7 @@ "index": "32", "lanes": "124,125", "description": "Eth32/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth32/1", "pfc_asym": "off", @@ -184,20 +184,20 @@ "Ethernet90": { "index": "23", "lanes": "90", - "description": " Eth23/3", - "admin_status": "up", + "description": "Eth23/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth23/3", + "alias": "Eth23/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet91": { "index": "23", "lanes": "91", - "description": " Eth23/4", - "admin_status": "up", + "description": "Eth23/4", + "admin_status": "down", "mtu": "9100", - "alias": " Eth23/4", + "alias": "Eth23/4", "pfc_asym": "off", "speed": "25000" }, @@ -205,7 +205,7 @@ "index": "24", "lanes": "92", "description": "Eth24/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth24/1", "pfc_asym": "off", @@ -214,30 +214,30 @@ "Ethernet93": { "index": "24", "lanes": "93", - "description": " Eth24/2", - "admin_status": "up", + "description": "Eth24/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth24/2", + "alias": "Eth24/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet50": { "index": "13", "lanes": "50", - "description": " Eth13/3", - "admin_status": "up", + "description": "Eth13/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth13/3", + "alias": "Eth13/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet51": { "index": "13", "lanes": "51", - "description": " Eth13/4", - "admin_status": "up", + "description": "Eth13/4", + "admin_status": "down", "mtu": "9100", - "alias": " Eth13/4", + "alias": "Eth13/4", "pfc_asym": "off", "speed": "25000" }, @@ -245,7 +245,7 @@ "index": "14", "lanes": "52", "description": "Eth14/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth14/1", "pfc_asym": "off", @@ -254,30 +254,30 @@ "Ethernet53": { "index": "14", "lanes": "53", - "description": " Eth14/2", - "admin_status": "up", + "description": "Eth14/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth14/2", + "alias": "Eth14/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet54": { "index": "14", "lanes": "54,55", - "description": " Eth14/3", - "admin_status": "up", + "description": "Eth14/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth14/3", + "alias": "Eth14/3", "pfc_asym": "off", "speed": "50000" }, "Ethernet99": { "index": "25", "lanes": "99", - "description": " Eth25/4", - "admin_status": "up", + "description": "Eth25/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth25/4", + "alias": "Eth25/3", "pfc_asym": "off", "speed": "25000" }, @@ -285,7 +285,7 @@ "index": "15", "lanes": "56,57", "description": "Eth15/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth15/1", "pfc_asym": "off", @@ -294,10 +294,10 @@ "Ethernet113": { "index": "29", "lanes": "113", - "description": " Eth29/2", - "admin_status": "up", + "description": "Eth29/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth29/2", + "alias": "Eth29/2", "pfc_asym": "off", "speed": "25000" }, @@ -314,20 +314,20 @@ "Ethernet74": { "index": "19", "lanes": "74,75", - "description": " Eth19/3", + "description": "Eth19/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth19/3", + "alias": "Eth19/3", "pfc_asym": "off", "speed": "50000" }, "Ethernet39": { "index": "10", "lanes": "39", - "description": " Eth10/4", + "description": "Eth10/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth10/4", + "alias": "Eth10/3", "pfc_asym": "off", "speed": "25000" }, @@ -344,30 +344,30 @@ "Ethernet73": { "index": "19", "lanes": "73", - "description": " Eth19/2", + "description": "Eth19/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth19/2", + "alias": "Eth19/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet70": { "index": "18", "lanes": "70", - "description": " Eth18/3", + "description": "Eth18/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth18/3", + "alias": "Eth18/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet71": { "index": "18", "lanes": "71", - "description": " Eth18/4", + "description": "Eth18/4", "admin_status": "up", "mtu": "9100", - "alias": " Eth18/4", + "alias": "Eth18/4", "pfc_asym": "off", "speed": "25000" }, @@ -384,10 +384,10 @@ "Ethernet33": { "index": "9", "lanes": "33", - "description": " Eth9/2", + "description": "Eth9/2", "admin_status": "up", "mtu": "9100", - "alias": " Eth9/2", + "alias": "Eth9/2", "pfc_asym": "off", "speed": "25000" }, @@ -404,30 +404,30 @@ "Ethernet111": { "index": "28", "lanes": "111", - "description": " Eth28/4", - "admin_status": "up", + "description": "Eth28/4", + "admin_status": "down", "mtu": "9100", - "alias": " Eth28/4", + "alias": "Eth28/4", "pfc_asym": "off", "speed": "25000" }, "Ethernet10": { "index": "3", "lanes": "10", - "description": " Eth3/3", + "description": "Eth3/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth3/3", + "alias": "Eth3/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet11": { "index": "3", "lanes": "11", - "description": " Eth3/4", + "description": "Eth3/4", "admin_status": "up", "mtu": "9100", - "alias": " Eth3/4", + "alias": "Eth3/4", "pfc_asym": "off", "speed": "25000" }, @@ -435,7 +435,7 @@ "index": "4", "lanes": "12", "description": "Eth4/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth4/1", "pfc_asym": "off", @@ -444,60 +444,60 @@ "Ethernet13": { "index": "4", "lanes": "13", - "description": " Eth4/2", - "admin_status": "up", + "description": "Eth4/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth4/2", + "alias": "Eth4/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet58": { "index": "15", "lanes": "58", - "description": " Eth15/3", - "admin_status": "up", + "description": "Eth15/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth15/3", + "alias": "Eth15/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet19": { "index": "5", "lanes": "19", - "description": " Eth5/4", + "description": "Eth5/3", "admin_status": "up", "mtu": "9100", - "alias": " Eth5/4", + "alias": "Eth5/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet59": { "index": "15", "lanes": "59", - "description": " Eth15/4", - "admin_status": "up", + "description": "Eth15/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth15/4", + "alias": "Eth15/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet38": { "index": "10", "lanes": "38", - "description": " Eth10/3", - "admin_status": "up", + "description": "Eth10/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth10/3", + "alias": "Eth10/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet78": { "index": "20", "lanes": "78", - "description": " Eth20/3", - "admin_status": "up", + "description": "Eth20/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth20/3", + "alias": "Eth20/2", "pfc_asym": "off", "speed": "25000" }, @@ -505,7 +505,7 @@ "index": "18", "lanes": "68", "description": "Eth18/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth18/1", "pfc_asym": "off", @@ -514,20 +514,20 @@ "Ethernet14": { "index": "4", "lanes": "14,15", - "description": " Eth4/3", - "admin_status": "up", + "description": "Eth4/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth4/3", + "alias": "Eth4/3", "pfc_asym": "off", "speed": "50000" }, "Ethernet89": { "index": "23", "lanes": "89", - "description": " Eth23/2", - "admin_status": "up", + "description": "Eth23/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth23/2", + "alias": "Eth23/2", "pfc_asym": "off", "speed": "25000" }, @@ -535,7 +535,7 @@ "index": "23", "lanes": "88", "description": "Eth23/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth23/1", "pfc_asym": "off", @@ -544,20 +544,20 @@ "Ethernet118": { "index": "30", "lanes": "118", - "description": " Eth30/3", - "admin_status": "up", + "description": "Eth30/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth30/3", + "alias": "Eth30/2", "pfc_asym": "off", "speed": "25000" }, "Ethernet119": { "index": "30", "lanes": "119", - "description": " Eth30/4", - "admin_status": "up", + "description": "Eth30/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth30/4", + "alias": "Eth30/3", "pfc_asym": "off", "speed": "25000" }, @@ -565,7 +565,7 @@ "index": "30", "lanes": "116,117", "description": "Eth30/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth30/1", "pfc_asym": "off", @@ -574,10 +574,10 @@ "Ethernet114": { "index": "29", "lanes": "114,115", - "description": " Eth29/3", - "admin_status": "up", + "description": "Eth29/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth29/3", + "alias": "Eth29/3", "pfc_asym": "off", "speed": "50000" }, @@ -585,10 +585,10 @@ "index": "21", "lanes": "80,81,82,83", "fec": "rs", - "description": "Eth21/1", - "admin_status": "up", + "description": "Eth21", + "admin_status": "down", "mtu": "9100", - "alias": "Eth21/1", + "alias": "Eth21", "pfc_asym": "off", "speed": "100000" }, @@ -605,20 +605,20 @@ "Ethernet86": { "index": "22", "lanes": "86,87", - "description": " Eth22/3", - "admin_status": "up", + "description": "Eth22/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth22/3", + "alias": "Eth22/2", "pfc_asym": "off", "speed": "50000" }, "Ethernet110": { "index": "28", "lanes": "110", - "description": " Eth28/3", - "admin_status": "up", + "description": "Eth28/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth28/3", + "alias": "Eth28/3", "pfc_asym": "off", "speed": "25000" }, @@ -626,7 +626,7 @@ "index": "22", "lanes": "84,85", "description": "Eth22/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth22/1", "pfc_asym": "off", @@ -635,20 +635,20 @@ "Ethernet31": { "index": "8", "lanes": "31", - "description": " Eth8/4", - "admin_status": "up", + "description": "Eth8/4", + "admin_status": "down", "mtu": "9100", - "alias": " Eth8/4", + "alias": "Eth8/4", "pfc_asym": "off", "speed": "25000" }, "Ethernet49": { "index": "13", "lanes": "49", - "description": " Eth13/2", - "admin_status": "up", + "description": "Eth13/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth13/2", + "alias": "Eth13/2", "pfc_asym": "off", "speed": "25000" }, @@ -656,7 +656,7 @@ "index": "13", "lanes": "48", "description": "Eth13/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth13/1", "pfc_asym": "off", @@ -665,30 +665,30 @@ "Ethernet46": { "index": "12", "lanes": "46,47", - "description": " Eth12/3", - "admin_status": "up", + "description": "Eth12/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth12/3", + "alias": "Eth12/2", "pfc_asym": "off", "speed": "50000" }, "Ethernet30": { "index": "8", "lanes": "30", - "description": " Eth8/3", - "admin_status": "up", + "description": "Eth8/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth8/3", + "alias": "Eth8/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet29": { "index": "8", "lanes": "29", - "description": " Eth8/2", - "admin_status": "up", + "description": "Eth8/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth8/2", + "alias": "Eth8/2", "pfc_asym": "off", "speed": "25000" }, @@ -696,10 +696,10 @@ "index": "11", "lanes": "40,41,42,43", "fec": "rs", - "description": "Eth11/1", - "admin_status": "up", + "description": "Eth11", + "admin_status": "down", "mtu": "9100", - "alias": "Eth11/1", + "alias": "Eth11", "pfc_asym": "off", "speed": "100000" }, @@ -707,10 +707,10 @@ "index": "31", "lanes": "120,121,122,123", "fec": "rs", - "description": "Eth31/1", - "admin_status": "up", + "description": "Eth31", + "admin_status": "down", "mtu": "9100", - "alias": "Eth31/1", + "alias": "Eth31", "pfc_asym": "off", "speed": "100000" }, @@ -718,7 +718,7 @@ "index": "8", "lanes": "28", "description": "Eth8/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth8/1", "pfc_asym": "off", @@ -727,10 +727,10 @@ "Ethernet66": { "index": "17", "lanes": "66,67", - "description": " Eth17/3", - "admin_status": "up", + "description": "Eth17/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth17/3", + "alias": "Eth17/2", "pfc_asym": "off", "speed": "50000" }, @@ -738,10 +738,10 @@ "index": "16", "lanes": "60,61,62,63", "fec": "rs", - "description": "Eth16/1", - "admin_status": "up", + "description": "Eth16", + "admin_status": "down", "mtu": "9100", - "alias": "Eth16/1", + "alias": "Eth16", "pfc_asym": "off", "speed": "100000" }, @@ -749,7 +749,7 @@ "index": "17", "lanes": "64,65", "description": "Eth17/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth17/1", "pfc_asym": "off", @@ -759,7 +759,7 @@ "index": "12", "lanes": "44,45", "description": "Eth12/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth12/1", "pfc_asym": "off", @@ -769,30 +769,30 @@ "index": "6", "lanes": "20,21,22,23", "fec": "rs", - "description": "Eth6/1", - "admin_status": "up", + "description": "Eth6", + "admin_status": "down", "mtu": "9100", - "alias": "Eth6/1", + "alias": "Eth6", "pfc_asym": "off", "speed": "100000" }, "Ethernet79": { "index": "20", "lanes": "79", - "description": " Eth20/4", - "admin_status": "up", + "description": "Eth20/3", + "admin_status": "down", "mtu": "9100", - "alias": " Eth20/4", + "alias": "Eth20/3", "pfc_asym": "off", "speed": "25000" }, "Ethernet69": { "index": "18", "lanes": "69", - "description": " Eth18/2", - "admin_status": "up", + "description": "Eth18/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth18/2", + "alias": "Eth18/2", "pfc_asym": "off", "speed": "25000" }, @@ -800,7 +800,7 @@ "index": "7", "lanes": "24,25", "description": "Eth7/1", - "admin_status": "up", + "admin_status": "down", "mtu": "9100", "alias": "Eth7/1", "pfc_asym": "off", @@ -809,10 +809,10 @@ "Ethernet26": { "index": "7", "lanes": "26,27", - "description": " Eth7/3", - "admin_status": "up", + "description": "Eth7/2", + "admin_status": "down", "mtu": "9100", - "alias": " Eth7/3", + "alias": "Eth7/2", "pfc_asym": "off", "speed": "50000" } diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf new file mode 100644 index 000000000000..ce4f4d7ce23f --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -0,0 +1,78 @@ +! +! template: bgpd/bgpd.conf.j2 +! +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 with config DB data +! file: bgpd.conf +! +! +! template: common/daemons.common.conf.j2 +! +hostname multi_npu_platform_01 +password zebra +enable password zebra +! +log syslog informational +log facility local4 +! +! end of template: common/daemons.common.conf.j2! +agentx +! +! +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 +! +! +route-map HIDE_INTERNAL permit 10 + set community local-AS +! +! +router bgp 65100 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp graceful-restart preserve-fw-state +! + bgp router-id 8.0.0.5 +! + network 10.1.0.32/32 + network 8.0.0.5/32 route-map HIDE_INTERNAL +! + address-family ipv6 + network fc00:1::32/64 + exit-address-family + address-family ipv6 + network fd00:4::32/64 route-map HIDE_INTERNAL + exit-address-family +! +! +! +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +!! +! end of template: bgpd/bgpd.conf.j2 +! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf new file mode 100644 index 000000000000..dcdcc78af033 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -0,0 +1,84 @@ +! +! template: bgpd/bgpd.conf.j2 +! +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 with config DB data +! file: bgpd.conf +! +! +! template: common/daemons.common.conf.j2 +! +hostname multi_npu_platform_01 +password zebra +enable password zebra +! +log syslog informational +log facility local4 +! +! end of template: common/daemons.common.conf.j2! +agentx +! +! +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 +! +! +route-map HIDE_INTERNAL permit 10 + set community local-AS +! +! +router bgp 65100 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp graceful-restart preserve-fw-state +! + bgp router-id 10.1.0.32 +! + network 10.1.0.32/32 + network 8.0.0.0/32 route-map HIDE_INTERNAL +! + address-family ipv6 + network fc00:1::32/64 + exit-address-family + address-family ipv6 + network fd00:1::32/64 route-map HIDE_INTERNAL + exit-address-family +! +! +! + address-family ipv4 + redistribute connected route-map HIDE_INTERNAL + exit-address-family + address-family ipv6 + redistribute connected route-map HIDE_INTERNAL + exit-address-family +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +!! +! end of template: bgpd/bgpd.conf.j2 +! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf new file mode 100644 index 000000000000..ce4f4d7ce23f --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -0,0 +1,78 @@ +! +! template: bgpd/bgpd.conf.j2 +! +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 with config DB data +! file: bgpd.conf +! +! +! template: common/daemons.common.conf.j2 +! +hostname multi_npu_platform_01 +password zebra +enable password zebra +! +log syslog informational +log facility local4 +! +! end of template: common/daemons.common.conf.j2! +agentx +! +! +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 +! +! +route-map HIDE_INTERNAL permit 10 + set community local-AS +! +! +router bgp 65100 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp graceful-restart preserve-fw-state +! + bgp router-id 8.0.0.5 +! + network 10.1.0.32/32 + network 8.0.0.5/32 route-map HIDE_INTERNAL +! + address-family ipv6 + network fc00:1::32/64 + exit-address-family + address-family ipv6 + network fd00:4::32/64 route-map HIDE_INTERNAL + exit-address-family +! +! +! +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +!! +! end of template: bgpd/bgpd.conf.j2 +! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf new file mode 100644 index 000000000000..dcdcc78af033 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -0,0 +1,84 @@ +! +! template: bgpd/bgpd.conf.j2 +! +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 with config DB data +! file: bgpd.conf +! +! +! template: common/daemons.common.conf.j2 +! +hostname multi_npu_platform_01 +password zebra +enable password zebra +! +log syslog informational +log facility local4 +! +! end of template: common/daemons.common.conf.j2! +agentx +! +! +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 +! +! +route-map HIDE_INTERNAL permit 10 + set community local-AS +! +! +router bgp 65100 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp graceful-restart preserve-fw-state +! + bgp router-id 10.1.0.32 +! + network 10.1.0.32/32 + network 8.0.0.0/32 route-map HIDE_INTERNAL +! + address-family ipv6 + network fc00:1::32/64 + exit-address-family + address-family ipv6 + network fd00:1::32/64 route-map HIDE_INTERNAL + exit-address-family +! +! +! + address-family ipv4 + redistribute connected route-map HIDE_INTERNAL + exit-address-family + address-family ipv6 + redistribute connected route-map HIDE_INTERNAL + exit-address-family +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +!! +! end of template: bgpd/bgpd.conf.j2 +! diff --git a/src/sonic-config-engine/tests/sample_platform.json b/src/sonic-config-engine/tests/sample_platform.json index fd11a49ed0a0..1d8887920c9e 100644 --- a/src/sonic-config-engine/tests/sample_platform.json +++ b/src/sonic-config-engine/tests/sample_platform.json @@ -3,194 +3,353 @@ "Ethernet0": { "index": "1,1,1,1", "lanes": "0,1,2,3", - "alias_at_lanes": "Eth1/1, Eth1/2, Eth1/3, Eth1/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth1"], + "2x50G": ["Eth1/1", "Eth1/2"], + "4x25G[10G]": ["Eth1/1", "Eth1/2", "Eth1/3", "Eth1/4"], + "2x25G(2)+1x50G(2)": ["Eth1/1", "Eth1/2", "Eth1/3"], + "1x50G(2)+2x25G(2)": ["Eth1/1", "Eth1/2", "Eth1/3"] + } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", - "alias_at_lanes": "Eth2/1, Eth2/2, Eth2/3, Eth2/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G]" + "breakout_modes": { + "1x100G[40G]": ["Eth2"], + "2x50G": ["Eth2/1", "Eth2/2"], + "4x25G[10G]": ["Eth2/1", "Eth2/2", "Eth2/3", "Eth2/4"] + } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", - "alias_at_lanes": "Eth3/1, Eth3/2, Eth3/3, Eth3/4", - "breakout_modes": "1x100G[40G],2x50G,2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth3"], + "2x50G": ["Eth3/1", "Eth3/2"], + "4x25G[10G]": ["Eth3/1", "Eth3/2", "Eth3/3", "Eth3/4"], + "2x25G(2)+1x50G(2)": ["Eth3/1", "Eth3/2", "Eth3/3"], + "1x50G(2)+2x25G(2)": ["Eth3/1", "Eth3/2", "Eth3/3"] + } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", - "alias_at_lanes": "Eth4/1, Eth4/2, Eth4/3, Eth4/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth4"], + "2x50G": ["Eth4/1", "Eth4/2"], + "4x25G[10G]": ["Eth4/1", "Eth4/2", "Eth4/3", "Eth4/4"], + "2x25G(2)+1x50G(2)": ["Eth4/1", "Eth4/2", "Eth4/3"], + "1x50G(2)+2x25G(2)": ["Eth4/1", "Eth4/2", "Eth4/3"] + } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", - "alias_at_lanes": "Eth5/1, Eth5/2, Eth5/3, Eth5/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth5"], + "2x50G": ["Eth5/1", "Eth5/2"], + "4x25G[10G]": ["Eth5/1", "Eth5/2", "Eth5/3", "Eth5/4"], + "2x25G(2)+1x50G(2)": ["Eth5/1", "Eth5/2", "Eth5/3"], + "1x50G(2)+2x25G(2)": ["Eth5/1", "Eth5/2", "Eth5/3"] + } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", - "alias_at_lanes": "Eth6/1, Eth6/2, Eth6/3, Eth6/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth6"], + "2x50G": ["Eth6/1", "Eth6/2"], + "4x25G[10G]": ["Eth6/1", "Eth6/2", "Eth6/3", "Eth6/4"], + "2x25G(2)+1x50G(2)": ["Eth6/1", "Eth6/2", "Eth6/3"], + "1x50G(2)+2x25G(2)": ["Eth6/1", "Eth6/2", "Eth6/3"] + } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", - "alias_at_lanes": "Eth7/1, Eth7/2, Eth7/3, Eth7/4", - "breakout_modes": "1x100G[40G],4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth7"], + "2x50G": ["Eth7/1", "Eth7/2"], + "4x25G[10G]": ["Eth7/1", "Eth7/2", "Eth7/3", "Eth7/4"], + "2x25G(2)+1x50G(2)": ["Eth7/1", "Eth7/2", "Eth7/3"], + "1x50G(2)+2x25G(2)": ["Eth7/1", "Eth7/2", "Eth7/3"] + } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", - "alias_at_lanes": "Eth8/1, Eth8/2, Eth8/3, Eth8/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth8"], + "2x50G": ["Eth8/1", "Eth8/2"], + "4x25G[10G]": ["Eth8/1", "Eth8/2", "Eth8/3", "Eth8/4"], + "2x25G(2)+1x50G(2)": ["Eth8/1", "Eth8/2", "Eth8/3"], + "1x50G(2)+2x25G(2)": ["Eth8/1", "Eth8/2", "Eth8/3"] + } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", - "alias_at_lanes": "Eth9/1, Eth9/2, Eth9/3, Eth9/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth9"], + "2x50G": ["Eth9/1", "Eth9/2"], + "4x25G[10G]": ["Eth9/1", "Eth9/2", "Eth9/3", "Eth9/4"], + "2x25G(2)+1x50G(2)": ["Eth9/1", "Eth9/2", "Eth9/3"], + "1x50G(2)+2x25G(2)": ["Eth9/1", "Eth9/2", "Eth9/3"] + } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", - "alias_at_lanes": "Eth10/1, Eth10/2, Eth10/3, Eth10/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth10"], + "2x50G": ["Eth10/1", "Eth10/2"], + "4x25G[10G]": ["Eth10/1", "Eth10/2", "Eth10/3", "Eth10/4"], + "2x25G(2)+1x50G(2)": ["Eth10/1", "Eth10/2", "Eth10/3"], + "1x50G(2)+2x25G(2)": ["Eth10/1", "Eth10/2", "Eth10/3"] + } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", - "alias_at_lanes": "Eth11/1, Eth11/2, Eth11/3, Eth11/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["Eth11"], + "2x50G[40G,25G,10G,1G]": ["Eth11/1", "Eth11/2"], + "4x25G[10G]": ["Eth11/1", "Eth11/2", "Eth11/3", "Eth11/4"], + "2x25G(2)+1x50G(2)": ["Eth11/1", "Eth11/2", "Eth11/3"], + "1x50G(2)+2x25G(2)": ["Eth11/1", "Eth11/2", "Eth11/3"] + } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", - "alias_at_lanes": "Eth12/1, Eth12/2, Eth12/3, Eth12/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[50G,40G,25G,10G,1G]": ["Eth12"], + "2x50G[40G,25G,10G,1G]": ["Eth12/1", "Eth12/2"], + "4x25G[10G]": ["Eth12/1", "Eth12/2", "Eth12/3", "Eth12/4"], + "2x25G(2)+1x50G(2)": ["Eth12/1", "Eth12/2", "Eth12/3"], + "1x50G(2)+2x25G(2)": ["Eth12/1", "Eth12/2", "Eth12/3"] + } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", - "alias_at_lanes": "Eth13/1, Eth13/2, Eth13/3, Eth13/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth13"], + "2x50G": ["Eth13/1", "Eth13/2"], + "4x25G[10G]": ["Eth13/1", "Eth13/2", "Eth13/3", "Eth13/4"], + "2x25G(2)+1x50G(2)": ["Eth13/1", "Eth13/2", "Eth13/3"], + "1x50G(2)+2x25G(2)": ["Eth13/1", "Eth13/2", "Eth13/3"] + } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", - "alias_at_lanes": "Eth14/1, Eth14/2, Eth14/3, Eth14/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth14"], + "2x50G": ["Eth14/1", "Eth14/2"], + "4x25G[10G]": ["Eth14/1", "Eth14/2", "Eth14/3", "Eth14/4"], + "2x25G(2)+1x50G(2)": ["Eth14/1", "Eth14/2", "Eth14/3"], + "1x50G(2)+2x25G(2)": ["Eth14/1", "Eth14/2", "Eth14/3"] + } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", - "alias_at_lanes": "Eth15/1, Eth15/2, Eth15/3, Eth15/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth15"], + "2x50G": ["Eth15/1", "Eth15/2"], + "4x25G[10G]": ["Eth15/1", "Eth15/2", "Eth15/3", "Eth15/4"], + "2x25G(2)+1x50G(2)": ["Eth15/1", "Eth15/2", "Eth15/3"], + "1x50G(2)+2x25G(2)": ["Eth15/1", "Eth15/2", "Eth15/3"] + } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", - "alias_at_lanes": "Eth16/1, Eth16/2, Eth16/3, Eth16/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth16"], + "2x50G": ["Eth16/1", "Eth16/2"], + "4x25G[10G]": ["Eth16/1", "Eth16/2", "Eth16/3", "Eth16/4"], + "2x25G(2)+1x50G(2)": ["Eth16/1", "Eth16/2", "Eth16/3"], + "1x50G(2)+2x25G(2)": ["Eth16/1", "Eth16/2", "Eth16/3"] + } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", - "alias_at_lanes": "Eth17/1, Eth17/2, Eth17/3, Eth17/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth17"], + "2x50G": ["Eth17/1", "Eth17/2"], + "4x25G[10G]": ["Eth17/1", "Eth17/2", "Eth17/3", "Eth17/4"], + "2x25G(2)+1x50G(2)": ["Eth17/1", "Eth17/2", "Eth17/3"], + "1x50G(2)+2x25G(2)": ["Eth17/1", "Eth17/2", "Eth17/3"] + } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", - "alias_at_lanes": "Eth18/1, Eth18/2, Eth18/3, Eth18/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth18"], + "2x50G": ["Eth18/1", "Eth18/2"], + "4x25G[10G]": ["Eth18/1", "Eth18/2", "Eth18/3", "Eth18/4"], + "2x25G(2)+1x50G(2)": ["Eth18/1", "Eth18/2", "Eth18/3"], + "1x50G(2)+2x25G(2)": ["Eth18/1", "Eth18/2", "Eth18/3"] + } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", - "alias_at_lanes": "Eth19/1, Eth19/2, Eth19/3, Eth19/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth19"], + "2x50G": ["Eth19/1", "Eth19/2"], + "4x25G[10G]": ["Eth19/1", "Eth19/2", "Eth19/3", "Eth19/4"], + "2x25G(2)+1x50G(2)": ["Eth19/1", "Eth19/2", "Eth19/3"], + "1x50G(2)+2x25G(2)": ["Eth19/1", "Eth19/2", "Eth19/3"] + } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", - "alias_at_lanes": "Eth20/1, Eth20/2, Eth20/3, Eth20/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth20"], + "2x50G": ["Eth20/1", "Eth20/2"], + "4x25G[10G]": ["Eth20/1", "Eth20/2", "Eth20/3", "Eth20/4"], + "2x25G(2)+1x50G(2)": ["Eth20/1", "Eth20/2", "Eth20/3"], + "1x50G(2)+2x25G(2)": ["Eth20/1", "Eth20/2", "Eth20/3"] + } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", - "alias_at_lanes": "Eth21/1, Eth21/2, Eth21/3, Eth21/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth21"], + "2x50G": ["Eth21/1", "Eth21/2"], + "4x25G[10G]": ["Eth21/1", "Eth21/2", "Eth21/3", "Eth21/4"], + "2x25G(2)+1x50G(2)": ["Eth21/1", "Eth21/2", "Eth21/3"], + "1x50G(2)+2x25G(2)": ["Eth21/1", "Eth21/2", "Eth21/3"] + } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", - "alias_at_lanes": "Eth22/1, Eth22/2, Eth22/3, Eth22/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth22"], + "2x50G": ["Eth22/1", "Eth22/2"], + "4x25G[10G]": ["Eth22/1", "Eth22/2", "Eth22/3", "Eth22/4"], + "2x25G(2)+1x50G(2)": ["Eth22/1", "Eth22/2", "Eth22/3"], + "1x50G(2)+2x25G(2)": ["Eth22/1", "Eth22/2", "Eth22/3"] + } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", "alias_at_lanes": "Eth23/1, Eth23/2, Eth23/3, Eth23/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth23"], + "2x50G": ["Eth23/1", "Eth23/2"], + "4x25G[10G]": ["Eth23/1", "Eth23/2", "Eth23/3", "Eth23/4"], + "2x25G(2)+1x50G(2)": ["Eth23/1", "Eth23/2", "Eth23/3"], + "1x50G(2)+2x25G(2)": ["Eth23/1", "Eth23/2", "Eth23/3"] + } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", - "alias_at_lanes": "Eth24/1, Eth24/2, Eth24/3, Eth24/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth24"], + "2x50G": ["Eth24/1", "Eth24/2"], + "4x25G[10G]": ["Eth24/1", "Eth24/2", "Eth24/3", "Eth24/4"], + "2x25G(2)+1x50G(2)": ["Eth24/1", "Eth24/2", "Eth24/3"], + "1x50G(2)+2x25G(2)": ["Eth24/1", "Eth24/2", "Eth24/3"] + } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", - "alias_at_lanes": "Eth25/1, Eth25/2, Eth25/3, Eth25/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth25"], + "2x50G": ["Eth25/1", "Eth25/2"], + "4x25G[10G]": ["Eth25/1", "Eth25/2", "Eth25/3", "Eth25/4"], + "2x25G(2)+1x50G(2)": ["Eth25/1", "Eth25/2", "Eth25/3"], + "1x50G(2)+2x25G(2)": ["Eth25/1", "Eth25/2", "Eth25/3"] + } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", - "alias_at_lanes": "Eth26/1, Eth26/2, Eth26/3, Eth26/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth26"], + "2x50G": ["Eth26/1", "Eth26/2"], + "4x25G[10G]": ["Eth26/1", "Eth26/2", "Eth26/3", "Eth26/4"], + "2x25G(2)+1x50G(2)": ["Eth26/1", "Eth26/2", "Eth26/3"], + "1x50G(2)+2x25G(2)": ["Eth26/1", "Eth26/2", "Eth26/3"] + } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", - "alias_at_lanes": "Eth27/1, Eth27/2, Eth27/3, Eth27/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth27"], + "2x50G": ["Eth27/1", "Eth27/2"], + "4x25G[10G]": ["Eth27/1", "Eth27/2", "Eth27/3", "Eth27/4"], + "2x25G(2)+1x50G(2)": ["Eth27/1", "Eth27/2", "Eth27/3"], + "1x50G(2)+2x25G(2)": ["Eth27/1", "Eth27/2", "Eth27/3"] + } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", - "alias_at_lanes": "Eth28/1, Eth28/2, Eth28/3, Eth28/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth28"], + "2x50G": ["Eth28/1", "Eth28/2"], + "4x25G[10G]": ["Eth28/1", "Eth28/2", "Eth28/3", "Eth28/4"], + "2x25G(2)+1x50G(2)": ["Eth28/1", "Eth28/2", "Eth28/3"], + "1x50G(2)+2x25G(2)": ["Eth28/1", "Eth28/2", "Eth28/3"] + } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", - "alias_at_lanes": "Eth29/1, Eth29/2, Eth29/3, Eth29/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth29"], + "2x50G": ["Eth29/1", "Eth29/2"], + "4x25G[10G]": ["Eth29/1", "Eth29/2", "Eth29/3", "Eth29/4"], + "2x25G(2)+1x50G(2)": ["Eth29/1", "Eth29/2", "Eth29/3"], + "1x50G(2)+2x25G(2)": ["Eth29/1", "Eth29/2", "Eth29/3"] + } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", - "alias_at_lanes": "Eth30/1, Eth30/2, Eth30/3, Eth30/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth30"], + "2x50G": ["Eth30/1", "Eth30/2"], + "4x25G[10G]": ["Eth30/1", "Eth30/2", "Eth30/3", "Eth30/4"], + "2x25G(2)+1x50G(2)": ["Eth30/1", "Eth30/2", "Eth30/3"], + "1x50G(2)+2x25G(2)": ["Eth30/1", "Eth30/2", "Eth30/3"] + } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", - "alias_at_lanes": "Eth31/1, Eth31/2, Eth31/3, Eth31/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth31"], + "2x50G": ["Eth31/1", "Eth31/2"], + "4x25G[10G]": ["Eth31/1", "Eth31/2", "Eth31/3", "Eth31/4"], + "2x25G(2)+1x50G(2)": ["Eth31/1", "Eth31/2", "Eth31/3"], + "1x50G(2)+2x25G(2)": ["Eth31/1", "Eth31/2", "Eth31/3"] + } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", - "alias_at_lanes": "Eth32/1, Eth32/2, Eth32/3, Eth32/4", - "breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)" + "breakout_modes": { + "1x100G[40G]": ["Eth32"], + "2x50G": ["Eth32/1", "Eth32/2"], + "4x25G[10G]": ["Eth32/1", "Eth32/2", "Eth32/3", "Eth32/4"], + "2x25G(2)+1x50G(2)": ["Eth32/1", "Eth32/2", "Eth32/3"], + "1x50G(2)+2x25G(2)": ["Eth32/1", "Eth32/2", "Eth32/3"] + } } } } diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 7215209da545..a2b350ccd6b2 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -173,6 +173,22 @@ Tagged 192.168.0.0/28 + + ab2 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2000 + 2000 + 192.168.0.240/27 + + + ab3 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2001 + 2001 + 192.168.0.240/27 + @@ -372,6 +388,500 @@ 100000 Interface description + + DeviceInterface + + true + true + 1 + Eth3/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth3/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth3/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth3/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth10/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth25/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Eth2/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth2/2 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth28/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth28/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth5/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth5/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth5/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth26 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Eth9/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth27/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth27/2 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth29/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth20/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth19/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Eth10/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth19/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth19/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth18/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth18/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth19/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth19/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth18/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth18/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth9/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Eth9/2 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + 5/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + 28/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + 3/3 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + 3/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + 4/1 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + 4/2 + + false + 0 + 0 + 25000 + true 0 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 63f892fe6d04..d3d0a7f93d53 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -260,6 +260,20 @@ + + Vlan98 + fortyGigE0/100;PortChannel01;PortChannel03 + False + 0.0.0.0/0 + + UserDefinedL2Vlan + 192.0.0.1;192.0.0.2 + 98 + 98 + + + + @@ -331,7 +345,7 @@ DataPlane - PortChannel01;PortChannel02 + PortChannel01;PortChannel02;Vlan98 DataAclEgress DataPlane diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 3a85346de2fd..89984a6fedd1 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -121,6 +121,8 @@ def test_var_json_data(self): utils.to_dict(output.strip()), utils.to_dict( '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n },' + ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' ) ) @@ -175,7 +177,7 @@ def test_minigraph_acl(self): "'DATAACLINGRESS': {'stage': 'ingress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04'], 'policy_desc': 'DATAACLINGRESS'}, " "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'stage': 'ingress'}, " "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'stage': 'ingress'}, " - "'DATAACLEGRESS': {'stage': 'egress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02'], 'policy_desc': 'DATAACLEGRESS'}, " + "'DATAACLEGRESS': {'stage': 'egress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02', 'Ethernet100', 'PortChannel03'], 'policy_desc': 'DATAACLEGRESS'}, " "'EVERFLOWV6': {'stage': 'ingress', 'type': 'MIRRORV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOWV6'}}" ) ) @@ -205,8 +207,10 @@ def test_minigraph_vlans(self): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}, " - "'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020'}}" + "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000', 'members': ['Ethernet8']}, " + "'Vlan2001': {'alias': 'ab3', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2001', 'members': ['Ethernet12']}," + "'Vlan2000': {'alias': 'ab2', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2000', 'members': ['Ethernet12']}," + "'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020', 'members': ['Ethernet12']}}" ) ) @@ -214,9 +218,13 @@ def test_minigraph_vlan_members(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN_MEMBER' output = self.run_script(argument) self.assertEqual( - output.strip(), - "{('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, " - "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + utils.to_dict(output.strip()), + utils.to_dict( + "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, " + "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + ) ) def test_minigraph_vlan_interfaces(self): diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 64e0bb09d730..806916639b76 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -94,7 +94,7 @@ def test_minigraph_vlans(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000', 'mac': '00:aa:bb:cc:dd:ee' }}") + utils.to_dict("{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000', 'mac': '00:aa:bb:cc:dd:ee', 'members': ['Ethernet8'] }}") ) def test_minigraph_vlan_members(self): diff --git a/src/sonic-config-engine/tests/test_multinpu_cfggen.py b/src/sonic-config-engine/tests/test_multinpu_cfggen.py index 83955925c9e5..af0e773c1636 100644 --- a/src/sonic-config-engine/tests/test_multinpu_cfggen.py +++ b/src/sonic-config-engine/tests/test_multinpu_cfggen.py @@ -1,3 +1,4 @@ +import filecmp import json import os import shutil @@ -26,6 +27,7 @@ def setUp(self): self.port_config = [] for asic in range(NUM_ASIC): self.port_config.append(os.path.join(self.test_data_dir, "sample_port_config-{}.ini".format(asic))) + self.output_file = os.path.join(self.test_dir, 'output') def run_script(self, argument, check_stderr=False): print('\n Running sonic-cfggen ' + argument) @@ -47,6 +49,22 @@ def run_script(self, argument, check_stderr=False): def run_diff(self, file1, file2): return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True) + def run_frr_asic_case(self, template, target, asic, port_config): + template_dir = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', "frr") + conf_template = os.path.join(template_dir, template) + constants = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'constants', 'constants.yml') + cmd_args = asic, self.sample_graph, port_config, constants, conf_template, template_dir, self.output_file + cmd = "-n %s -m %s -p %s -y %s -t %s -T %s > %s" % cmd_args + self.run_script(cmd) + + original_filename = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, target) + r = filecmp.cmp(original_filename, self.output_file) + diff_output = self.run_diff(original_filename, self.output_file) if not r else "" + + return r, "Diff:\n" + diff_output + + + def run_script_for_asic(self,argument,asic, port_config=None): argument = "{} -n asic{} ".format(argument, asic) if port_config: @@ -352,3 +370,8 @@ def test_buffers_multi_asic_template(self): } } ) + def test_bgpd_frr_frontendasic(self): + self.assertTrue(*self.run_frr_asic_case('bgpd/bgpd.conf.j2', 'bgpd_frr_frontend_asic.conf', "asic0", self.port_config[0])) + + def test_bgpd_frr_backendasic(self): + self.assertTrue(*self.run_frr_asic_case('bgpd/bgpd.conf.j2', 'bgpd_frr_backend_asic.conf', "asic3", self.port_config[3])) diff --git a/src/sonic-device-data/tests/platform_json_checker b/src/sonic-device-data/tests/platform_json_checker index 1612c0082c1d..5385295ef520 100755 --- a/src/sonic-device-data/tests/platform_json_checker +++ b/src/sonic-device-data/tests/platform_json_checker @@ -6,7 +6,7 @@ import re import sys # Global variable -PORT_ATTRIBUTES = ["index", "lanes", "alias_at_lanes", "breakout_modes"] +PORT_ATTRIBUTES = ["index", "lanes", "breakout_modes"] ATTR_LEN = len(PORT_ATTRIBUTES) PORT_REG = "Ethernet(\d+)" PLATFORM_JSON = '*platform.json' @@ -23,12 +23,20 @@ def check_port_attr(port_attr): if each_key not in PORT_ATTRIBUTES: print("Error: "+ each_key + " is not the correct Port attribute.") return False + if not port_attr[each_key]: print("Error: "+ each_key + " has no value.") return False - if not isinstance(port_attr[each_key], str): - print("Error:value type of "+ each_key + " must be string.") - return False + + if each_key.lower() == "breakout_modes": + brkout_modes = port_attr[each_key] + if not isinstance(brkout_modes, dict): + print("Error:value type of "+ each_key + " must be dictionary.") + return False + else: + if not isinstance(port_attr[each_key], str): + print("Error:value type of "+ each_key + " must be string.") + return False return True diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index 6b2b5cce3557..e2f17ae47ad0 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit 6b2b5cce3557a383942fc194257da77e4e5270e4 +Subproject commit e2f17ae47ad047e66923c2ff1e84c9ba10d4ad38 diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.caclmgrd.service b/src/sonic-host-services-data/debian/sonic-host-services-data.caclmgrd.service index 4df4d948ef1d..e24ed10bb33d 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.caclmgrd.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.caclmgrd.service @@ -2,6 +2,8 @@ Description=Control Plane ACL configuration daemon Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=simple @@ -10,4 +12,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service index ea0c3ba60fb7..4adf2aba77ad 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service @@ -2,10 +2,13 @@ Description=Host config enforcer daemon Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=simple ExecStart=/usr/local/bin/hostcfgd [Install] -WantedBy=multi-user.target +WantedBy=sonic.target + diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.procdockerstatsd.service b/src/sonic-host-services-data/debian/sonic-host-services-data.procdockerstatsd.service index 388197d9741b..68b9e61b62c2 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.procdockerstatsd.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.procdockerstatsd.service @@ -2,6 +2,8 @@ Description=Process and docker CPU/memory utilization data export daemon Requires=database.service updategraph.service After=database.service updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=simple @@ -9,5 +11,4 @@ ExecStart=/usr/local/bin/procdockerstatsd Restart=always [Install] -WantedBy=multi-user.target - +WantedBy=sonic.target diff --git a/src/sonic-host-services/scripts/caclmgrd b/src/sonic-host-services/scripts/caclmgrd index e029066a6e47..cc1cb14315ec 100755 --- a/src/sonic-host-services/scripts/caclmgrd +++ b/src/sonic-host-services/scripts/caclmgrd @@ -63,19 +63,23 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): ACL_SERVICES = { "NTP": { "ip_protocols": ["udp"], - "dst_ports": ["123"] + "dst_ports": ["123"], + "multi_asic_ns_to_host_fwd":False }, "SNMP": { "ip_protocols": ["tcp", "udp"], - "dst_ports": ["161"] + "dst_ports": ["161"], + "multi_asic_ns_to_host_fwd":True }, "SSH": { "ip_protocols": ["tcp"], - "dst_ports": ["22"] + "dst_ports": ["22"], + "multi_asic_ns_to_host_fwd":True }, "ANY": { "ip_protocols": ["any"], - "dst_ports": ["0"] + "dst_ports": ["0"], + "multi_asic_ns_to_host_fwd":False } } @@ -226,54 +230,81 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format (self.namespace_docker_mgmt_ip[namespace], self.namespace_docker_mgmt_ip[namespace])) - # For namespace docker allow all tcp/udp traffic from host docker bridge to its eth0 management ip - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p tcp -s {} -d {} -j ACCEPT".format + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format + (self.namespace_docker_mgmt_ipv6[namespace], self.namespace_docker_mgmt_ipv6[namespace])) + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format (self.namespace_mgmt_ip, self.namespace_docker_mgmt_ip[namespace])) - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p udp -s {} -d {} -j ACCEPT".format - (self.namespace_mgmt_ip, self.namespace_docker_mgmt_ip[namespace])) + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format + (self.namespace_mgmt_ipv6, self.namespace_docker_mgmt_ipv6[namespace])) + else: + + # Also host namespace communication on docker bridge on multi-asic. + if self.namespace_docker_mgmt_ip: + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format + (self.namespace_mgmt_ip, self.namespace_mgmt_ip)) + + if self.namespace_docker_mgmt_ipv6: + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format + (self.namespace_mgmt_ipv6, self.namespace_mgmt_ipv6)) # In host allow all tcp/udp traffic from namespace docker eth0 management ip to host docker bridge for docker_mgmt_ip in list(self.namespace_docker_mgmt_ip.values()): - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p tcp -s {} -d {} -j ACCEPT".format + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format (docker_mgmt_ip, self.namespace_mgmt_ip)) - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p udp -s {} -d {} -j ACCEPT".format - (docker_mgmt_ip, self.namespace_mgmt_ip)) + for docker_mgmt_ipv6 in list(self.namespace_docker_mgmt_ipv6.values()): + allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format + (docker_mgmt_ipv6, self.namespace_mgmt_ipv6)) + return allow_internal_docker_ip_cmds - def generate_fwd_snmp_traffic_from_namespace_to_host_commands(self, namespace): + def generate_fwd_traffic_from_namespace_to_host_commands(self, namespace, acl_source_ip_map): """ - The below SNAT and DNAT rules are added in asic namespace in multi-ASIC platforms. It helps to forward the SNMP request coming - in through the front panel interfaces created/present in the asic namespace to the SNMP Agent running in SNMP container in - linux host network namespace. The external IP addresses are NATed to the internal docker IP addresses for the SNMP Agent to respond. + The below SNAT and DNAT rules are added in asic namespace in multi-ASIC platforms. It helps to forward request coming + in through the front panel interfaces created/present in the asic namespace for the servie running in linux host network namespace. + The external IP addresses are NATed to the internal docker IP addresses for the Host service to respond. """ - fwd_snmp_traffic_from_namespace_to_host_cmds = [] - if namespace: - # IPv4 rules - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -X") - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -F") - - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "iptables -t nat -A PREROUTING -p udp --dport {} -j DNAT --to-destination {}".format - (self.ACL_SERVICES['SNMP']['dst_ports'][0], self.namespace_mgmt_ip)) - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "iptables -t nat -A POSTROUTING -p udp --dport {} -j SNAT --to-source {}".format - (self.ACL_SERVICES['SNMP']['dst_ports'][0], self.namespace_docker_mgmt_ip[namespace])) - - # IPv6 rules - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -X") - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -F") - - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "ip6tables -t nat -A PREROUTING -p udp --dport {} -j DNAT --to-destination {}".format - (self.ACL_SERVICES['SNMP']['dst_ports'][0], self.namespace_mgmt_ipv6)) - fwd_snmp_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "ip6tables -t nat -A POSTROUTING -p udp --dport {} -j SNAT --to-source {}".format - (self.ACL_SERVICES['SNMP']['dst_ports'][0], self.namespace_docker_mgmt_ipv6[namespace])) - - return fwd_snmp_traffic_from_namespace_to_host_cmds + if not namespace: + return [] + + fwd_traffic_from_namespace_to_host_cmds = [] + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -X") + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -F") + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -X") + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -F") + + for acl_service in self.ACL_SERVICES: + if self.ACL_SERVICES[acl_service]["multi_asic_ns_to_host_fwd"]: + # Get the Source IP Set if exists else use default source ip prefix + nat_source_ipv4_set = acl_source_ip_map[acl_service]["ipv4"] if acl_source_ip_map and acl_source_ip_map[acl_service]["ipv4"] else { "0.0.0.0/0" } + nat_source_ipv6_set = acl_source_ip_map[acl_service]["ipv6"] if acl_source_ip_map and acl_source_ip_map[acl_service]["ipv6"] else { "::/0" } + + for ip_protocol in self.ACL_SERVICES[acl_service]["ip_protocols"]: + for dst_port in self.ACL_SERVICES[acl_service]["dst_ports"]: + for ipv4_src_ip in nat_source_ipv4_set: + # IPv4 rules + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + + "iptables -t nat -A PREROUTING -p {} -s {} --dport {} -j DNAT --to-destination {}".format + (ip_protocol, ipv4_src_ip, dst_port, + self.namespace_mgmt_ip)) + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + + "iptables -t nat -A POSTROUTING -p {} -s {} --dport {} -j SNAT --to-source {}".format + (ip_protocol, ipv4_src_ip, dst_port, + self.namespace_docker_mgmt_ip[namespace])) + for ipv6_src_ip in nat_source_ipv6_set: + # IPv6 rules + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + + "ip6tables -t nat -A PREROUTING -p {} -s {} --dport {} -j DNAT --to-destination {}".format + (ip_protocol, ipv6_src_ip, dst_port, + self.namespace_mgmt_ipv6)) + fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + + "ip6tables -t nat -A POSTROUTING -p {} -s {} --dport {} -j SNAT --to-source {}".format + (ip_protocol,ipv6_src_ip, dst_port, + self.namespace_docker_mgmt_ipv6[namespace])) + + return fwd_traffic_from_namespace_to_host_cmds def is_rule_ipv4(self, rule_props): if (("SRC_IP" in rule_props and rule_props["SRC_IP"]) or @@ -298,6 +329,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): A list of strings, each string is an iptables shell command """ iptables_cmds = [] + service_to_source_ip_map = {} # First, add iptables commands to set default policies to accept all # traffic. In case we are connected remotely, the connection will not @@ -436,7 +468,8 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): self.log_warning("Unable to determine if ACL table '{}' contains IPv4 or IPv6 rules. Skipping table..." .format(table_name)) continue - + ipv4_src_ip_set = set() + ipv6_src_ip_set = set() # For each ACL rule in this table (in descending order of priority) for priority in sorted(iter(acl_rules.keys()), reverse=True): rule_props = acl_rules[priority] @@ -456,8 +489,12 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): if "SRC_IPV6" in rule_props and rule_props["SRC_IPV6"]: rule_cmd += " -s {}".format(rule_props["SRC_IPV6"]) + if rule_props["PACKET_ACTION"] == "ACCEPT": + ipv6_src_ip_set.add(rule_props["SRC_IPV6"]) elif "SRC_IP" in rule_props and rule_props["SRC_IP"]: rule_cmd += " -s {}".format(rule_props["SRC_IP"]) + if rule_props["PACKET_ACTION"] == "ACCEPT": + ipv4_src_ip_set.add(rule_props["SRC_IP"]) # Destination port 0 is reserved/unused port, so, using it to apply the rule to all ports. if dst_port != "0": @@ -479,6 +516,9 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + rule_cmd) num_ctrl_plane_acl_rules += 1 + + service_to_source_ip_map.update({ acl_service:{ "ipv4":ipv4_src_ip_set, "ipv6":ipv6_src_ip_set } }) + # Add iptables commands to block ip2me traffic iptables_cmds += self.generate_block_ip2me_traffic_iptables_commands(namespace) @@ -493,7 +533,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -j DROP") iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -j DROP") - return iptables_cmds + return iptables_cmds, service_to_source_ip_map def update_control_plane_acls(self, namespace): """ @@ -501,20 +541,25 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): Config DB, translates control plane ACLs into a list of iptables commands and runs them. """ - iptables_cmds = self.get_acl_rules_and_translate_to_iptables_commands(namespace) + iptables_cmds, service_to_source_ip_map = self.get_acl_rules_and_translate_to_iptables_commands(namespace) self.log_info("Issuing the following iptables commands:") for cmd in iptables_cmds: self.log_info(" " + cmd) self.run_commands(iptables_cmds) - def update_control_plane_nat_acls(self, namespace): + self.update_control_plane_nat_acls(namespace, service_to_source_ip_map) + + def update_control_plane_nat_acls(self, namespace, service_to_source_ip_map): """ - Convenience wrapper which programs the NAT rules for allowing the - snmp traffic coming on the front panel interface + Convenience wrapper for multi-asic platforms + which programs the NAT rules for redirecting the + traffic coming on the front panel interface map to namespace + to the host. """ - # Add iptables commands to allow front panel snmp traffic - iptables_cmds = self.generate_fwd_snmp_traffic_from_namespace_to_host_commands(namespace) + # Add iptables commands to allow front panel traffic + iptables_cmds = self.generate_fwd_traffic_from_namespace_to_host_commands(namespace, service_to_source_ip_map) + self.log_info("Issuing the following iptables commands:") for cmd in iptables_cmds: self.log_info(" " + cmd) @@ -580,7 +625,6 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): for namespace in list(self.config_db_map.keys()): # Unconditionally update control plane ACLs once at start on given namespace self.update_control_plane_acls(namespace) - self.update_control_plane_nat_acls(namespace) # Connect to Config DB of given namespace acl_db_connector = swsscommon.DBConnector("CONFIG_DB", 0, False, namespace) # Subscribe to notifications when ACL tables changes diff --git a/src/sonic-host-services/scripts/procdockerstatsd b/src/sonic-host-services/scripts/procdockerstatsd index 90b7bd10c95f..d0b4c8fbf2ac 100755 --- a/src/sonic-host-services/scripts/procdockerstatsd +++ b/src/sonic-host-services/scripts/procdockerstatsd @@ -72,7 +72,7 @@ class ProcDockerStats(daemon_base.DaemonBase): UNITS_MiB = 'MiB' UNITS_GiB = 'GiB' - res = re.match('(\d+\.?\d*)([a-zA-Z]+)', value) + res = re.match(r'(\d+\.?\d*)([a-zA-Z]+)', value) value = float(res.groups()[0]) units = res.groups()[1] if units.lower() == UNITS_KB.lower(): diff --git a/src/sonic-host-services/tests/determine-reboot-cause_test.py b/src/sonic-host-services/tests/determine-reboot-cause_test.py index afd74957b6f4..924befdf48ee 100644 --- a/src/sonic-host-services/tests/determine-reboot-cause_test.py +++ b/src/sonic-host-services/tests/determine-reboot-cause_test.py @@ -1,4 +1,4 @@ -import imp +import importlib import sys import os import pytest @@ -28,6 +28,15 @@ scripts_path = os.path.join(modules_path, "scripts") sys.path.insert(0, modules_path) +# Load the file under test +determine_reboot_cause_path = os.path.join(scripts_path, 'determine-reboot-cause') +loader = importlib.machinery.SourceFileLoader('determine_reboot_cause', determine_reboot_cause_path) +spec = importlib.util.spec_from_loader(loader.name, loader) +determine_reboot_cause = importlib.util.module_from_spec(spec) +loader.exec_module(determine_reboot_cause) +sys.modules['determine_reboot_cause'] = determine_reboot_cause + + PROC_CMDLINE_CONTENTS = """\ BOOT_IMAGE=/image-20191130.52/boot/vmlinuz-4.9.0-11-2-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet net.ifnames=0 biosdevname=0 loop=image-20191130.52/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096 usbcore.autosuspend=-1 module_blacklist=gpio_ich SONIC_BOOT_TYPE=warm""" @@ -37,9 +46,9 @@ BOOT_IMAGE=/image-20191130.52/boot/vmlinuz-4.9.0-11-2-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet net.ifnames=0 biosdevname=0 loop=image-20191130.52/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096 usbcore.autosuspend=-1 module_blacklist=gpio_ich SONIC_BOOT_TYPE=warm""" REBOOT_CAUSE_CONTENTS = """\ -User issued 'warm-reboot' command [User: admin, Time: Mon Nov 2 22:37:45 UTC 2020]""" +User issued 'warm-reboot' command [User: admin, Time: Mon Nov 2 22:37:45 UTC 2020]""" -GET_SONIC_VERSION_INFO = {'commit_id': 'e59ec8291', 'build_date': 'Mon Nov 2 06:00:14 UTC 2020', 'build_number': 75, 'kernel_version': '4.9.0-11-2-amd64', 'debian_version': '9.13', 'built_by': 'sonicbld@jenkins-slave-phx-2', 'asic_type': 'mellanox', 'build_version': '20191130.52'} +GET_SONIC_VERSION_INFO = {'commit_id': 'e59ec8291', 'build_date': 'Mon Nov 2 06:00:14 UTC 2020', 'build_number': 75, 'kernel_version': '4.9.0-11-2-amd64', 'debian_version': '9.13', 'built_by': 'sonicbld@jenkins-slave-phx-2', 'asic_type': 'mellanox', 'build_version': '20191130.52'} REBOOT_CAUSE_WATCHDOG = "Watchdog" GEN_TIME_WATCHDOG = "2020_10_22_03_15_08" @@ -55,63 +64,52 @@ EXPECTED_WATCHDOG_REBOOT_CAUSE_DICT = {'comment': '', 'gen_time': '2020_10_22_03_15_08', 'cause': 'Watchdog', 'user': 'N/A', 'time': 'N/A'} EXPECTED_USER_REBOOT_CAUSE_DICT = {'comment': '', 'gen_time': '2020_10_22_03_14_07', 'cause': 'reboot', 'user': 'admin', 'time': 'Thu Oct 22 03:11:08 UTC 2020'} -imp.load_source('determine_reboot_cause', scripts_path + '/determine-reboot-cause') -from determine_reboot_cause import * class TestDetermineRebootCause(object): - @classmethod - def setup_class(cls): - print("SETUP") - def test_parse_warmfast_reboot_from_proc_cmdline(self): with mock.patch("os.path.isfile") as mock_isfile: mock_isfile.return_value = True - open_mocked = mock.mock_open(read_data=PROC_CMDLINE_CONTENTS) - with mock.patch("{}.open".format(BUILTINS), open_mocked): - result = parse_warmfast_reboot_from_proc_cmdline() + open_mocked = mock.mock_open(read_data=PROC_CMDLINE_CONTENTS) + with mock.patch("{}.open".format(BUILTINS), open_mocked): + result = determine_reboot_cause.parse_warmfast_reboot_from_proc_cmdline() assert result == EXPECTED_PARSE_WARMFAST_REBOOT_FROM_PROC_CMDLINE - open_mocked.assert_called_once_with("/proc/cmdline") + open_mocked.assert_called_once_with("/proc/cmdline") def test_find_software_reboot_cause_user(self): - with mock.patch("os.path.isfile") as mock_isfile: - mock_isfile.return_value = True - open_mocked = mock.mock_open(read_data=REBOOT_CAUSE_CONTENTS) - with mock.patch("{}.open".format(BUILTINS), open_mocked): - result = find_software_reboot_cause_from_reboot_cause_file() + with mock.patch("os.path.isfile") as mock_isfile: + mock_isfile.return_value = True + open_mocked = mock.mock_open(read_data=REBOOT_CAUSE_CONTENTS) + with mock.patch("{}.open".format(BUILTINS), open_mocked): + result = determine_reboot_cause.find_software_reboot_cause_from_reboot_cause_file() assert result == EXPECTED_FIND_SOFTWARE_REBOOT_CAUSE_USER - open_mocked.assert_called_once_with("/host/reboot-cause/reboot-cause.txt") + open_mocked.assert_called_once_with("/host/reboot-cause/reboot-cause.txt") def test_find_software_reboot_cause_first_boot(self): with mock.patch("sonic_py_common.device_info.get_sonic_version_info", return_value=GET_SONIC_VERSION_INFO): - result = find_first_boot_version() + result = determine_reboot_cause.find_first_boot_version() assert result == EXPECTED_FIND_FIRSTBOOT_VERSION def test_find_software_reboot_cause(self): with mock.patch("determine_reboot_cause.find_software_reboot_cause_from_reboot_cause_file", return_value="Unknown"): - with mock.patch("os.path.isfile") as mock_isfile: - mock_isfile.return_value = False - result = find_software_reboot_cause() + with mock.patch("os.path.isfile") as mock_isfile: + mock_isfile.return_value = False + result = determine_reboot_cause.find_software_reboot_cause() assert result == "Unknown" def test_find_proc_cmdline_reboot_cause(self): with mock.patch("determine_reboot_cause.parse_warmfast_reboot_from_proc_cmdline", return_value="fast-reboot"): - result = find_proc_cmdline_reboot_cause() + result = determine_reboot_cause.find_proc_cmdline_reboot_cause() assert result == "fast-reboot" def test_find_hardware_reboot_cause(self): with mock.patch("determine_reboot_cause.get_reboot_cause_from_platform", return_value=("Powerloss", None)): - result = find_hardware_reboot_cause() + result = determine_reboot_cause.find_hardware_reboot_cause() assert result == "Powerloss (None)" def test_get_reboot_cause_dict_watchdog(self): - reboot_cause_dict = get_reboot_cause_dict(REBOOT_CAUSE_WATCHDOG, "", GEN_TIME_WATCHDOG) + reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_WATCHDOG, "", GEN_TIME_WATCHDOG) assert reboot_cause_dict == EXPECTED_WATCHDOG_REBOOT_CAUSE_DICT def test_get_reboot_cause_dict_user(self): - reboot_cause_dict = get_reboot_cause_dict(REBOOT_CAUSE_USER, "", GEN_TIME_USER) + reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_USER, "", GEN_TIME_USER) assert reboot_cause_dict == EXPECTED_USER_REBOOT_CAUSE_DICT - - @classmethod - def teardown_class(cls): - print("TEARDOWN") - diff --git a/src/sonic-host-services/tests/procdockerstatsd_test.py b/src/sonic-host-services/tests/procdockerstatsd_test.py index 5c47e91458f3..db7c6a1f0e3d 100644 --- a/src/sonic-host-services/tests/procdockerstatsd_test.py +++ b/src/sonic-host-services/tests/procdockerstatsd_test.py @@ -1,4 +1,4 @@ -import imp +import importlib import sys import os import pytest @@ -14,8 +14,13 @@ scripts_path = os.path.join(modules_path, "scripts") sys.path.insert(0, modules_path) -imp.load_source('procdockerstatsd', scripts_path + '/procdockerstatsd') -from procdockerstatsd import * +# Load the file under test +procdockerstatsd_path = os.path.join(scripts_path, 'procdockerstatsd') +loader = importlib.machinery.SourceFileLoader('procdockerstatsd', procdockerstatsd_path) +spec = importlib.util.spec_from_loader(loader.name, loader) +procdockerstatsd = importlib.util.module_from_spec(spec) +loader.exec_module(procdockerstatsd) +sys.modules['procdockerstatsd'] = procdockerstatsd class TestProcDockerStatsDaemon(object): def test_convert_to_bytes(self): @@ -35,7 +40,7 @@ def test_convert_to_bytes(self): ('7.751GiB', 8322572878) ] - pdstatsd = ProcDockerStats(SYSLOG_IDENTIFIER) + pdstatsd = procdockerstatsd.ProcDockerStats(procdockerstatsd.SYSLOG_IDENTIFIER) for test_input, expected_output in test_data: res = pdstatsd.convert_to_bytes(test_input) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 11f0da688d5b..65fccd7a079e 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 11f0da688d5bd7e206c3e50fd408d0717e9626d1 +Subproject commit 65fccd7a079e03d439376f2f647110979c75c13e diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 513920ceb241..c6b642b03a64 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 513920ceb2419873a1e27969b428af95c2e9e60f +Subproject commit c6b642b03a64fbd530b229a0a79d5bff9a938845 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index e72f6cd95881..068bcccf1f30 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit e72f6cd958810e3af9b18a71bc078dbb8c5d6cac +Subproject commit 068bcccf1f3057607b8f37709033d7f44a6ff844 diff --git a/src/sonic-py-common/sonic_py_common/daemon_base.py b/src/sonic-py-common/sonic_py_common/daemon_base.py index c3ecc12cf856..3797c19b6b7d 100644 --- a/src/sonic-py-common/sonic_py_common/daemon_base.py +++ b/src/sonic-py-common/sonic_py_common/daemon_base.py @@ -1,4 +1,4 @@ -import imp +import importlib import signal import sys @@ -25,10 +25,21 @@ def db_connect(db_name, namespace=EMPTY_NAMESPACE): from swsscommon import swsscommon return swsscommon.DBConnector(db_name, REDIS_TIMEOUT_MSECS, True, namespace) + +def _load_module_from_file(module_name, file_path): + loader = importlib.machinery.SourceFileLoader(module_name, file_path) + spec = importlib.util.spec_from_loader(loader.name, loader) + module = importlib.util.module_from_spec(spec) + loader.exec_module(module) + sys.modules[module_name] = module + return module + + # # DaemonBase =================================================================== # + class DaemonBase(Logger): def __init__(self, log_identifier): super(DaemonBase, self).__init__( @@ -68,7 +79,7 @@ def load_platform_util(self, module_name, class_name): try: module_file = "/".join([platform_path, "plugins", module_name + ".py"]) - module = imp.load_source(module_name, module_file) + module = _load_module_from_file(module_name, module_file) except IOError as e: raise IOError("Failed to load platform module '%s': %s" % (module_name, str(e))) diff --git a/src/sonic-restapi b/src/sonic-restapi index b0024559f6a8..71847d3fbe16 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit b0024559f6a888444dc5159c80ac9212cce77a07 +Subproject commit 71847d3fbe16f191efa7ffac6901d5599d044c5f diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 3885f193be05..183162fcc468 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 3885f193be05099659808092d22c5f69407cdda4 +Subproject commit 183162fcc468b3af774be2353b84bdf0b8365b46 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 9e91e0d89139..b75aab763602 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 9e91e0d891398b468b8087682ae91335791fac51 +Subproject commit b75aab7636021199d3f6498eb2295f8e9dc34d73 diff --git a/src/sonic-telemetry b/src/sonic-telemetry index 9ceb58ca1f93..7cd86c5a6bc3 160000 --- a/src/sonic-telemetry +++ b/src/sonic-telemetry @@ -1 +1 @@ -Subproject commit 9ceb58ca1f93c266b0ef2723d99696d14f4b0b20 +Subproject commit 7cd86c5a6bc38b94f0d7e87c9c278b9d20779a2b diff --git a/src/sonic-utilities b/src/sonic-utilities index c7e46c9a9c6d..04300838a47b 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c7e46c9a9c6d9f9108e9e27ecf6effb2b8727414 +Subproject commit 04300838a47bc42c2f9ffad2dc5d89bf0cace44e diff --git a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py index adf643ad793e..f492dbd28694 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py +++ b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py @@ -190,10 +190,18 @@ def initTest(self): about high threshold being lower than low threshold.', 'eStr': ['high_threshold should be more than low_threshold'] }, + 'CRM_WITH_CORRECT_FREE_VALUE': { + 'desc': 'CRM_WITH_CORRECT_FREE_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, 'CRM_WITH_CORRECT_USED_VALUE': { 'desc': 'CRM_WITH_CORRECT_USED_VALUE no failure.', 'eStr': self.defaultYANGFailure['None'] }, + 'CRM_WITH_WRONG_THRESHOLD_TYPE': { + 'desc': 'CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.', + 'eStr': self.defaultYANGFailure['Pattern'] + ['wrong'] + }, 'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE': { 'desc': 'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure.', 'eStr': self.defaultYANGFailure['None'] @@ -241,6 +249,69 @@ def initTest(self): 'BREAKOUT_CFG_INCORRECT_MODES': { 'desc': 'BREAKOUT_CFG wrong breakout modes', 'eStr': self.defaultYANGFailure['Pattern'] + }, + 'SNAT_WITH_WRONG_PERCENTAGE': { + 'desc': 'SNAT_WITH_WRONG_PERCENTAGE must condition failure.', + 'eStr': self.defaultYANGFailure['Must'] + }, + 'SNAT_WITH_HIGH_THRESHOLD_ERR': { + 'desc': 'SNAT_WITH_HIGH_THRESHOLD_ERR must condition failure \ + about high threshold being lower than low threshold.', + 'eStr': ['high_threshold should be more than low_threshold'] + }, + 'SNAT_WITH_CORRECT_FREE_VALUE': { + 'desc': 'SNAT_WITH_CORRECT_FREE_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'SNAT_WITH_CORRECT_USED_VALUE': { + 'desc': 'SNAT_WITH_CORRECT_USED_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'SNAT_WITH_WRONG_THRESHOLD_TYPE': { + 'desc': 'SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.', + 'eStr': self.defaultYANGFailure['Pattern'] + ['wrong'] + }, + 'DNAT_WITH_WRONG_PERCENTAGE': { + 'desc': 'DNAT_WITH_WRONG_PERCENTAGE must condition failure.', + 'eStr': self.defaultYANGFailure['Must'] + }, + 'DNAT_WITH_HIGH_THRESHOLD_ERR': { + 'desc': 'DNAT_WITH_HIGH_THRESHOLD_ERR must condition failure \ + about high threshold being lower than low threshold.', + 'eStr': ['high_threshold should be more than low_threshold'] + }, + 'DNAT_WITH_CORRECT_FREE_VALUE': { + 'desc': 'DNAT_WITH_CORRECT_FREE_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'DNAT_WITH_CORRECT_USED_VALUE': { + 'desc': 'DNAT_WITH_CORRECT_USED_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'DNAT_WITH_WRONG_THRESHOLD_TYPE': { + 'desc': 'DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.', + 'eStr': self.defaultYANGFailure['Pattern'] + ['wrong'] + }, + 'IPMC_WITH_WRONG_PERCENTAGE': { + 'desc': 'IPMC_WITH_WRONG_PERCENTAGE must condition failure.', + 'eStr': self.defaultYANGFailure['Must'] + }, + 'IPMC_WITH_HIGH_THRESHOLD_ERR': { + 'desc': 'IPMC_WITH_HIGH_THRESHOLD_ERR must condition failure \ + about high threshold being lower than low threshold.', + 'eStr': ['high_threshold should be more than low_threshold'] + }, + 'IPMC_WITH_CORRECT_FREE_VALUE': { + 'desc': 'IPMC_WITH_CORRECT_FREE_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'IPMC_WITH_CORRECT_USED_VALUE': { + 'desc': 'IPMC_WITH_CORRECT_USED_VALUE no failure.', + 'eStr': self.defaultYANGFailure['None'] + }, + 'IPMC_WITH_WRONG_THRESHOLD_TYPE': { + 'desc': 'IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.', + 'eStr': self.defaultYANGFailure['Pattern'] + ['wrong'] } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json b/src/sonic-yang-models/tests/yang_model_tests/yangTest.json index 92c841830d63..44e74c1f2cc1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json +++ b/src/sonic-yang-models/tests/yang_model_tests/yangTest.json @@ -814,12 +814,12 @@ } }, - "CRM_WITH_WRONG_THRESHOLD": { + "CRM_WITH_CORRECT_FREE_VALUE": { "sonic-crm:sonic-crm": { "sonic-crm:CRM": { "Config": { - "acl_counter_high_threshold": 85, - "acl_counter_low_threshold": 90, + "acl_counter_high_threshold": 90, + "acl_counter_low_threshold": 70, "acl_counter_threshold_type": "free" } } @@ -838,6 +838,198 @@ } }, + "CRM_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": 90, + "acl_counter_low_threshold": 70, + "acl_counter_threshold_type": "wrong" + } + } + } + }, + + "SNAT_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "snat_entry_high_threshold": 110, + "snat_entry_low_threshold": 85, + "snat_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "SNAT_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "snat_entry_high_threshold": 80, + "snat_entry_low_threshold": 81, + "snat_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "SNAT_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "snat_entry_high_threshold": 90, + "snat_entry_low_threshold": 70, + "snat_entry_threshold_type": "free" + } + } + } + }, + + "SNAT_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "snat_entry_high_threshold": 85, + "snat_entry_low_threshold": 25, + "snat_entry_threshold_type": "used" + } + } + } + }, + + "SNAT_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "snat_entry_high_threshold": 90, + "snat_entry_low_threshold": 70, + "snat_entry_threshold_type": "wrong" + } + } + } + }, + + "DNAT_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "dnat_entry_high_threshold": 110, + "dnat_entry_low_threshold": 85, + "dnat_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "DNAT_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "dnat_entry_high_threshold": 80, + "dnat_entry_low_threshold": 81, + "dnat_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "DNAT_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "dnat_entry_high_threshold": 90, + "dnat_entry_low_threshold": 70, + "dnat_entry_threshold_type": "free" + } + } + } + }, + + "DNAT_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "dnat_entry_high_threshold": 85, + "dnat_entry_low_threshold": 25, + "dnat_entry_threshold_type": "used" + } + } + } + }, + + "DNAT_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "dnat_entry_high_threshold": 90, + "dnat_entry_low_threshold": 70, + "dnat_entry_threshold_type": "wrong" + } + } + } + }, + + "IPMC_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "ipmc_entry_high_threshold": 110, + "ipmc_entry_low_threshold": 85, + "ipmc_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "IPMC_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "ipmc_entry_high_threshold": 80, + "ipmc_entry_low_threshold": 81, + "ipmc_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + + "IPMC_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "ipmc_entry_high_threshold": 90, + "ipmc_entry_low_threshold": 70, + "ipmc_entry_threshold_type": "free" + } + } + } + }, + + "IPMC_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "ipmc_entry_high_threshold": 85, + "ipmc_entry_low_threshold": 25, + "ipmc_entry_threshold_type": "used" + } + } + } + }, + + "IPMC_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "ipmc_entry_high_threshold": 90, + "ipmc_entry_low_threshold": 70, + "ipmc_entry_threshold_type": "wrong" + } + } + } + }, + "DEVICE_METADATA_DEFAULT_BGP_STATUS": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { @@ -953,6 +1145,15 @@ "nexthop_group_high_threshold": "67", "nexthop_group_low_threshold": "56", "nexthop_group_threshold_type": "percentage", + "snat_entry_threshold_type": "percentage", + "snat_entry_low_threshold": "70", + "snat_entry_high_threshold": "85", + "dnat_entry_threshold_type": "percentage", + "dnat_entry_low_threshold": "70", + "dnat_entry_high_threshold": "85", + "ipmc_entry_threshold_type": "percentage", + "ipmc_entry_low_threshold": "70", + "ipmc_entry_high_threshold": "85", "polling_interval": "0" } } @@ -1743,6 +1944,15 @@ "nexthop_group_high_threshold": "67", "nexthop_group_low_threshold": "56", "nexthop_group_threshold_type": "percentage", + "snat_entry_threshold_type": "percentage", + "snat_entry_low_threshold": "70", + "snat_entry_high_threshold": "85", + "dnat_entry_threshold_type": "percentage", + "dnat_entry_low_threshold": "70", + "dnat_entry_high_threshold": "85", + "ipmc_entry_threshold_type": "percentage", + "ipmc_entry_low_threshold": "70", + "ipmc_entry_high_threshold": "85", "polling_interval": "0" } } diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index cc53aa7f0d50..29161958e479 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -60,7 +60,7 @@ module sonic-crm { leaf acl_group_high_threshold { must "(current() > ../acl_group_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -80,7 +80,7 @@ module sonic-crm { leaf acl_entry_high_threshold { must "(current() > ../acl_entry_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -100,7 +100,7 @@ module sonic-crm { leaf acl_table_high_threshold { must "(current() > ../acl_table_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -120,7 +120,7 @@ module sonic-crm { leaf fdb_entry_high_threshold { must "(current() > ../fdb_entry_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -140,7 +140,7 @@ module sonic-crm { leaf ipv4_neighbor_high_threshold { must "(current() > ../ipv4_neighbor_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -160,7 +160,7 @@ module sonic-crm { leaf ipv4_nexthop_high_threshold { must "(current() > ../ipv4_nexthop_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -180,7 +180,7 @@ module sonic-crm { leaf ipv4_route_high_threshold { must "(current() > ../ipv4_route_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -200,7 +200,7 @@ module sonic-crm { leaf ipv6_neighbor_high_threshold { must "(current() > ../ipv6_neighbor_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -220,7 +220,7 @@ module sonic-crm { leaf ipv6_nexthop_high_threshold { must "(current() > ../ipv6_nexthop_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -240,7 +240,7 @@ module sonic-crm { leaf ipv6_route_high_threshold { must "(current() > ../ipv6_route_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -260,7 +260,7 @@ module sonic-crm { leaf nexthop_group_high_threshold { must "(current() > ../nexthop_group_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -280,7 +280,7 @@ module sonic-crm { leaf nexthop_group_member_high_threshold { must "(current() > ../nexthop_group_member_low_threshold)" { - error-message "high_threshold should be more that low_threshold"; + error-message "high_threshold should be more than low_threshold"; } type threshold; } @@ -293,6 +293,66 @@ module sonic-crm { type threshold; } + leaf dnat_entry_threshold_type { + must "(((current()='PERCENTAGE' or current()='percentage') and + ../dnat_entry_high_threshold<100 and + ../dnat_entry_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf dnat_entry_high_threshold { + must "(current() > ../dnat_entry_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf dnat_entry_low_threshold { + type threshold; + } + + leaf snat_entry_threshold_type { + must "(((current()='PERCENTAGE' or current()='percentage') and + ../snat_entry_high_threshold<100 and + ../snat_entry_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf snat_entry_high_threshold { + must "(current() > ../snat_entry_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf snat_entry_low_threshold { + type threshold; + } + + leaf ipmc_entry_threshold_type { + must "(((current()='PERCENTAGE' or current()='percentage') and + ../ipmc_entry_high_threshold<100 and + ../ipmc_entry_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf ipmc_entry_high_threshold { + must "(current() > ../ipmc_entry_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf ipmc_entry_low_threshold { + type threshold; + } + } /* end of Config */ } diff --git a/src/wpasupplicant/sonic-wpa-supplicant b/src/wpasupplicant/sonic-wpa-supplicant index 3b330db4a331..7b6c1604a5e0 160000 --- a/src/wpasupplicant/sonic-wpa-supplicant +++ b/src/wpasupplicant/sonic-wpa-supplicant @@ -1 +1 @@ -Subproject commit 3b330db4a331d591cea5a1f3e820435181625793 +Subproject commit 7b6c1604a5e0fa5cf092d844eb7c2a64ae2b8ea6