Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
44 changes: 36 additions & 8 deletions files/image_config/topology/topology.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down