Skip to content

Commit

Permalink
Merge branch 'master' into bookworm_migration_for_mgmt_framework_and_…
Browse files Browse the repository at this point in the history
…gnmi
  • Loading branch information
ranjinidn committed Apr 23, 2024
2 parents 0650b83 + d3b18c4 commit bff4efa
Show file tree
Hide file tree
Showing 66 changed files with 1,810 additions and 3,418 deletions.
2 changes: 1 addition & 1 deletion dockers/docker-lldp/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-snmp/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python3_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down
16 changes: 8 additions & 8 deletions dockers/docker-snmp/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true

[program:start]
Expand All @@ -34,8 +34,8 @@ priority=1
autostart=true
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running

Expand All @@ -44,8 +44,8 @@ command=/usr/sbin/snmpd -f -LS0-2d -u Debian-snmp -g Debian-snmp -I -smux,mteTri
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=start:exited

Expand All @@ -54,7 +54,7 @@ command=/usr/bin/env python3 -m sonic_ax_impl
priority=4
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=snmpd:running
39 changes: 22 additions & 17 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -416,28 +416,33 @@ start() {

DOCKERCHECK=`docker inspect --type container ${DOCKERNAME} 2>/dev/null`
if [ "$?" -eq "0" ]; then
{%- if docker_container_name == "database" %}
DOCKERMOUNT=""
{%- if docker_container_name == "database" and sonic_asic_platform == "vs" %}
echo "Removing existing ${DOCKERNAME} container"
docker rm -f ${DOCKERNAME}
{%- else %}
DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"`
{%- endif %}
if [ x"$DOCKERMOUNT" == x"$MOUNTPATH" ]; then
CONTAINER_EXISTS="yes"
preStartAction
{%- if docker_container_name == "database" %}
echo "Starting existing ${DOCKERNAME} container"
docker start ${DOCKERNAME}
DOCKERMOUNT=""
{%- else %}
echo "Starting existing ${DOCKERNAME} container with HWSKU $HWSKU"
/usr/local/bin/container start ${DOCKERNAME}
DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"`
{%- endif %}
postStartAction
exit $?
fi
if [ x"$DOCKERMOUNT" == x"$MOUNTPATH" ]; then
CONTAINER_EXISTS="yes"
preStartAction
{%- if docker_container_name == "database" %}
echo "Starting existing ${DOCKERNAME} container"
docker start ${DOCKERNAME}
{%- else %}
echo "Starting existing ${DOCKERNAME} container with HWSKU $HWSKU"
/usr/local/bin/container start ${DOCKERNAME}
{%- endif %}
postStartAction
exit $?
fi

# docker created with a different HWSKU, remove and recreate
echo "Removing obsolete ${DOCKERNAME} container with HWSKU $DOCKERMOUNT"
docker rm -f ${DOCKERNAME}
# docker created with a different HWSKU, remove and recreate
echo "Removing obsolete ${DOCKERNAME} container with HWSKU $DOCKERMOUNT"
docker rm -f ${DOCKERNAME}
{%- endif %}
fi

{%- if docker_container_name == "database" %}
Expand Down
3 changes: 1 addition & 2 deletions files/image_config/topology/topology.service
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ ExecStart=/usr/bin/topology.sh start
ExecStop=/usr/bin/topology.sh stop

[Install]
WantedBy=multi-user.target

WantedBy=sonic.target
93 changes: 91 additions & 2 deletions files/image_config/topology/topology.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,99 @@ get_hwsku() {
echo "${HWSKU}"
}

bind_ports_to_ns() {
PLATFORM="$1"
HWSKU="$2"
BIND="$3"

# Check if the directory exists
if [[ ! -d "/usr/share/sonic/device/$PLATFORM/$HWSKU" ]]; then
echo "Directory /usr/share/sonic/device/$PLATFORM/$HWSKU does not exist"
exit 1
fi

# Read NUM_ASIC from asic.conf file
asic_conf="/usr/share/sonic/device/$PLATFORM/asic.conf"
if [[ ! -f "$asic_conf" ]]; then
echo "Error: $asic_conf file not found"
exit 1
fi

# Read NUM_ASIC from asic.conf file
num_asic=$(awk -F "=" '/^NUM_ASIC=/ {print $2}' "$asic_conf")
if [[ -z $num_asic ]]; then
echo "NUM_ASIC not found in $asic_conf"
exit 1
fi

for ((asic_num = 0; asic_num < num_asic; asic_num++)); do
echo "Processing $PLATFORM/$HWSKU/$asic_num"
asic_dir="/usr/share/sonic/device/$PLATFORM/$HWSKU/$asic_num"

# Check if the directory exists for the ASIC number
if [[ ! -d "$asic_dir" ]]; then
echo "Directory $asic_dir does not exist"
exit 1
fi

lanemap_ini="$asic_dir/lanemap.ini"

if [[ ! -f "$lanemap_ini" ]]; then
echo "lanemap.ini not found in $asic_dir"
exit 1
fi

# Loop through each line of lanemap.ini
while IFS= read -r line; do
# Extract interface before ":"
intf=$(echo "$line" | cut -d ":" -f 1)
if [[ $BIND == true ]]; then
echo "Moving interface $intf to asic$asic_num"
if [[ $intf == "Cpu0" ]]; then
# Extract the numeric part of the interface name
num="${prev#eth}"
# Increment the numeric part
((num++))
# Construct the new interface name
cur="eth$num"
echo "Renaming $cur to $intf"
ip link sev dev $cur down
ip link set dev $cur name $intf
fi
ip link set dev $intf netns asic$asic_num
sudo ip netns exec asic$asic_num ip link set dev $intf mtu 9100
sudo ip netns exec asic$asic_num ip link set $intf up
else
echo "Moving interface $intf back to default ns"
sudo ip netns exec asic$asic_num ip link set dev $intf netns 1
if [[ $intf == "Cpu0" ]]; then
# Extract the numeric part of the interface name
num="${prev#eth}"
# Increment the numeric part
((num++))
# Construct the new interface name
cur="eth$num"
echo "Renaming $intf to $cur"
ip link set dev $intf down
ip link set dev $intf name $cur
ip link set dev $cur up
fi
fi
prev=$intf
done < "$lanemap_ini"
done
exit 0 # Exit script with success
}


start() {
TOPOLOGY_SCRIPT="topology.sh"
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
HWSKU=`get_hwsku`
if [[ $HWSKU != "" ]]; then
if [[ $HWSKU == "msft_"* ]]; then
/usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT start
elif [[ $HWSKU != "" ]]; then
bind_ports_to_ns "$PLATFORM" "$HWSKU" true
else
echo "Failed to get HWSKU"
exit 1
Expand All @@ -38,8 +125,10 @@ stop() {
TOPOLOGY_SCRIPT="topology.sh"
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
HWSKU=`get_hwsku`
if [[ $HWSKU != "" ]]; then
if [[ $HWSKU == "msft_"* ]]; then
/usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT stop
elif [[ $HWSKU != "" ]]; then
bind_ports_to_ns "$PLATFORM" "$HWSKU" false
else
echo "Failed to get HWSKU"
exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ifneq ($(KERNELRELEASE),)
obj-m:= wistron_6512_32r_cpld.o wistron_6512_32r_fan.o \
wistron_6512_32r_oom.o wistron_6512_32r_psu.o \
wistron_6512_32r_thermal.o i2c-imc.o \
wistron_6512_32r_thermal.o i2c-imc.o oldjc42.o \
wistron_6512_32r_leds.o wistron_6512_32r_syseeprom.o
else
ifeq (,$(KERNEL_SRC))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@


/* DIMMs hold jc42 thermal sensors starting at i2c address 0x18 */
#define DIMM_SENSOR_DRV "jc42"
#define DIMM_SENSOR_DRV "oldjc42"
#define DIMM_SENSOR_BASE_ADR 0x18


Expand Down
Loading

0 comments on commit bff4efa

Please sign in to comment.