Skip to content

Commit 0ae478a

Browse files
author
Arthi Sivanantham
committed
Merge branch 'master' into sonic_warmrestart
2 parents ac17433 + 653ff2c commit 0ae478a

File tree

443 files changed

+42183
-6496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+42183
-6496
lines changed

.azure-pipelines/azure-pipelines-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444

4545
- name: barefoot
4646
variables:
47+
sync_rpc_image: yes
48+
platform_rpc: bfn
4749
swi_image: yes
4850

4951
- name: broadcom
@@ -72,7 +74,7 @@ jobs:
7274

7375
- name: innovium
7476
variables:
75-
swi_image: yes
77+
dbg_image: yes
7678

7779
- name: marvell-armhf
7880
pool: sonicbld_8c

.azure-pipelines/docker-sonic-mgmt.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ stages:
3232
- stage: Build
3333
jobs:
3434
- job: Build
35-
pool: sonicbld
35+
pool: sonictest
3636
timeoutInMinutes: 360
3737
steps:
3838
- template: cleanup.yml
@@ -43,6 +43,7 @@ stages:
4343
set -xe
4444
make configure PLATFORM=generic
4545
make target/docker-sonic-mgmt.gz
46+
cp target -r $(Build.ArtifactStagingDirectory)/target
4647
docker load -i target/docker-sonic-mgmt.gz
4748
docker tag docker-sonic-mgmt $REGISTRY_SERVER/docker-sonic-mgmt:latest
4849
env:
@@ -55,3 +56,7 @@ stages:
5556
repository: docker-sonic-mgmt
5657
command: push
5758
tags: latest
59+
- publish: $(Build.ArtifactStagingDirectory)
60+
artifact: 'docker-sonic-mgmt'
61+
displayName: "Archive docker image sonic-mgmt"
62+

Makefile.work

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# * SONIC_DPKG_CACHE_METHOD: Specifying method of obtaining the Debian packages from cache: none or cache
3939
# * SONIC_DPKG_CACHE_SOURCE: Debian package cache location when cache enabled for debian packages
4040
# * BUILD_LOG_TIMESTAMP: Set timestamp in the build log (simple/none)
41+
# * DOCKER_EXTRA_OPTS: Extra command line arguments for dockerd running in slave container.
4142
#
4243
###############################################################################
4344

@@ -131,7 +132,7 @@ $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
131132
scripts/generate_buildinfo_config.sh)
132133

133134
# Generate the slave Dockerfile, and prepare build info for it
134-
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
135+
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
135136
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user)
136137
$(shell BUILD_SLAVE=y scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV))
137138

build_debian.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ then
237237
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubelet=${KUBERNETES_VERSION}-00
238238
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubectl=${KUBERNETES_VERSION}-00
239239
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubeadm=${KUBERNETES_VERSION}-00
240-
# kubeadm package auto install kubelet & kubectl
241240
else
242241
echo '[INFO] Skipping Install kubernetes'
243242
fi
@@ -392,9 +391,9 @@ set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::ClientAliv
392391
save
393392
quit
394393
EOF
395-
# Configure sshd to listen for v4 connections; disable listening for v6 connections
396-
sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config
394+
# Configure sshd to listen for v4 and v6 connections
397395
sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config
396+
sudo sed -i 's/^#ListenAddress ::/ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config
398397

399398
## Config rsyslog
400399
sudo augtool -r $FILESYSTEM_ROOT --autosave "
@@ -474,16 +473,15 @@ fi
474473

475474
## Version file
476475
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic
477-
sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null <<EOF
478-
build_version: '${SONIC_IMAGE_VERSION}'
479-
debian_version: '$(cat $FILESYSTEM_ROOT/etc/debian_version)'
480-
kernel_version: '$kversion'
481-
asic_type: $sonic_asic_platform
482-
commit_id: '$(git rev-parse --short HEAD)'
483-
build_date: $(date -u)
484-
build_number: ${BUILD_NUMBER:-0}
485-
built_by: $USER@$BUILD_HOSTNAME
486-
EOF
476+
export build_version="${SONIC_IMAGE_VERSION}"
477+
export debian_version="$(cat $FILESYSTEM_ROOT/etc/debian_version)"
478+
export kernel_version="${kversion}"
479+
export asic_type="${sonic_asic_platform}"
480+
export commit_id="$(git rev-parse --short HEAD)"
481+
export build_date="$(date -u)"
482+
export build_number="${BUILD_NUMBER:-0}"
483+
export built_by="$USER@$BUILD_HOSTNAME"
484+
j2 files/build_templates/sonic_version.yml.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml
487485

488486
## Copy over clean-up script
489487
sudo cp ./files/scripts/core_cleanup.py $FILESYSTEM_ROOT/usr/bin/core_cleanup.py

device/accton/x86_64-accton_as5835_54x-r0/Accton-AS5835-54X/port_config.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Ethernet45 74 tenGigE46 46 10000
4848
Ethernet46 75 tenGigE47 47 10000
4949
Ethernet47 76 tenGigE48 48 10000
5050
Ethernet48 37,38,39,40 hundredGigE49 49 100000
51-
Ethernet52 29,30,31,32 hundredGigE50 53 100000
52-
Ethernet56 33,34,35,36 hundredGigE51 57 100000
53-
Ethernet60 49,50,51,52 hundredGigE52 61 100000
54-
Ethernet64 45,46,47,48 hundredGigE53 65 100000
55-
Ethernet68 41,42,43,44 hundredGigE54 69 100000
51+
Ethernet52 29,30,31,32 hundredGigE50 50 100000
52+
Ethernet56 33,34,35,36 hundredGigE51 51 100000
53+
Ethernet60 49,50,51,52 hundredGigE52 52 100000
54+
Ethernet64 45,46,47,48 hundredGigE53 53 100000
55+
Ethernet68 41,42,43,44 hundredGigE54 54 100000
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan']
2+
from . import platform
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
#############################################################################
2+
# Edgecore
3+
#
4+
# Module contains an implementation of SONiC Platform Base API and
5+
# provides the Chassis information which are available in the platform
6+
#
7+
#############################################################################
8+
9+
import os
10+
import sys
11+
12+
try:
13+
from sonic_platform_base.chassis_base import ChassisBase
14+
from .helper import APIHelper
15+
from .event import SfpEvent
16+
except ImportError as e:
17+
raise ImportError(str(e) + "- required module not found")
18+
19+
NUM_FAN_TRAY = 5
20+
NUM_FAN = 2
21+
NUM_PSU = 2
22+
NUM_THERMAL = 4
23+
NUM_QSFP = 54
24+
PORT_START = 1
25+
PORT_END = 54
26+
NUM_COMPONENT = 4
27+
HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/"
28+
PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/"
29+
REBOOT_CAUSE_FILE = "reboot-cause.txt"
30+
PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt"
31+
HOST_CHK_CMD = "docker > /dev/null 2>&1"
32+
33+
34+
class Chassis(ChassisBase):
35+
"""Platform-specific Chassis class"""
36+
37+
def __init__(self):
38+
ChassisBase.__init__(self)
39+
self._api_helper = APIHelper()
40+
self._api_helper = APIHelper()
41+
self.is_host = self._api_helper.is_host()
42+
43+
self.config_data = {}
44+
45+
self.__initialize_fan()
46+
self.__initialize_psu()
47+
self.__initialize_thermals()
48+
self.__initialize_components()
49+
self.__initialize_sfp()
50+
self.__initialize_eeprom()
51+
52+
def __initialize_sfp(self):
53+
from sonic_platform.sfp import Sfp
54+
for index in range(0, PORT_END):
55+
sfp = Sfp(index)
56+
self._sfp_list.append(sfp)
57+
self.sfp_module_initialized = True
58+
59+
def __initialize_fan(self):
60+
from sonic_platform.fan import Fan
61+
for fant_index in range(0, NUM_FAN_TRAY):
62+
for fan_index in range(0, NUM_FAN):
63+
fan = Fan(fant_index, fan_index)
64+
self._fan_list.append(fan)
65+
66+
def __initialize_psu(self):
67+
from sonic_platform.psu import Psu
68+
for index in range(0, NUM_PSU):
69+
psu = Psu(index)
70+
self._psu_list.append(psu)
71+
72+
def __initialize_thermals(self):
73+
from sonic_platform.thermal import Thermal
74+
for index in range(0, NUM_THERMAL):
75+
thermal = Thermal(index)
76+
self._thermal_list.append(thermal)
77+
78+
def __initialize_eeprom(self):
79+
from sonic_platform.eeprom import Tlv
80+
self._eeprom = Tlv()
81+
82+
def __initialize_components(self):
83+
from sonic_platform.component import Component
84+
for index in range(0, NUM_COMPONENT):
85+
component = Component(index)
86+
self._component_list.append(component)
87+
88+
def __initialize_watchdog(self):
89+
from sonic_platform.watchdog import Watchdog
90+
self._watchdog = Watchdog()
91+
92+
93+
def __is_host(self):
94+
return os.system(HOST_CHK_CMD) == 0
95+
96+
def __read_txt_file(self, file_path):
97+
try:
98+
with open(file_path, 'r') as fd:
99+
data = fd.read()
100+
return data.strip()
101+
except IOError:
102+
pass
103+
return None
104+
105+
def get_model(self):
106+
"""
107+
Retrieves the model number (or part number) of the device
108+
Returns:
109+
string: Model/part number of device
110+
"""
111+
return self._eeprom.get_pn()
112+
113+
def get_name(self):
114+
"""
115+
Retrieves the name of the device
116+
Returns:
117+
string: The name of the device
118+
"""
119+
120+
return self._api_helper.hwsku
121+
122+
def get_presence(self):
123+
"""
124+
Retrieves the presence of the Chassis
125+
Returns:
126+
bool: True if Chassis is present, False if not
127+
"""
128+
return True
129+
130+
def get_status(self):
131+
"""
132+
Retrieves the operational status of the device
133+
Returns:
134+
A boolean value, True if device is operating properly, False if not
135+
"""
136+
return True
137+
138+
def get_base_mac(self):
139+
"""
140+
Retrieves the base MAC address for the chassis
141+
Returns:
142+
A string containing the MAC address in the format
143+
'XX:XX:XX:XX:XX:XX'
144+
"""
145+
return self._eeprom.get_mac()
146+
147+
def get_serial_number(self):
148+
"""
149+
Retrieves the hardware serial number for the chassis
150+
Returns:
151+
A string containing the hardware serial number for this chassis.
152+
"""
153+
return self._eeprom.get_serial()
154+
155+
def get_system_eeprom_info(self):
156+
"""
157+
Retrieves the full content of system EEPROM information for the chassis
158+
Returns:
159+
A dictionary where keys are the type code defined in
160+
OCP ONIE TlvInfo EEPROM format and values are their corresponding
161+
values.
162+
"""
163+
return self._eeprom.get_eeprom()
164+
165+
def get_reboot_cause(self):
166+
"""
167+
Retrieves the cause of the previous reboot
168+
169+
Returns:
170+
A tuple (string, string) where the first element is a string
171+
containing the cause of the previous reboot. This string must be
172+
one of the predefined strings in this class. If the first string
173+
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
174+
to pass a description of the reboot cause.
175+
"""
176+
177+
reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE)
178+
sw_reboot_cause = self._api_helper.read_txt_file(
179+
reboot_cause_path) or "Unknown"
180+
181+
182+
return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause)
183+
184+
def get_change_event(self, timeout=0):
185+
# SFP event
186+
if not self.sfp_module_initialized:
187+
self.__initialize_sfp()
188+
189+
status, sfp_event = SfpEvent(self._sfp_list).get_sfp_event(timeout)
190+
191+
return status, sfp_event
192+
193+
def get_sfp(self, index):
194+
"""
195+
Retrieves sfp represented by (1-based) index <index>
196+
Args:
197+
index: An integer, the index (1-based) of the sfp to retrieve.
198+
The index should be the sequence of a physical port in a chassis,
199+
starting from 1.
200+
For example, 1 for Ethernet0, 2 for Ethernet4 and so on.
201+
Returns:
202+
An object dervied from SfpBase representing the specified sfp
203+
"""
204+
sfp = None
205+
if not self.sfp_module_initialized:
206+
self.__initialize_sfp()
207+
208+
try:
209+
# The index will start from 1
210+
sfp = self._sfp_list[index-1]
211+
except IndexError:
212+
sys.stderr.write("SFP index {} out of range (1-{})\n".format(
213+
index, len(self._sfp_list)))
214+
return sfp

0 commit comments

Comments
 (0)