Commit 2ed6e17 1 parent 856fcc9 commit 2ed6e17 Copy full SHA for 2ed6e17
File tree 8 files changed +63
-5
lines changed
docker-fpm-frr/base_image_files
src/sonic-py-common/sonic_py_common
8 files changed +63
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ # Source the platform_utils script
4
+ source " $( dirname " $0 " ) /platform_utils"
5
+
3
6
# Restrict command to sudo users
4
7
if [ " $EUID " -ne 0 ] ; then
5
8
echo " Root priveleges are needed for this operation"
6
9
exit 1
7
10
fi
8
11
9
- if [ -f /etc/sonic/chassisdb.conf ]; then
12
+ if [ -f /etc/sonic/chassisdb.conf ] && [ " $SMARTSWITCH " = false ] ; then
10
13
CHASSIS_TSA_STATE_UPDATE=" CHASSIS_APP_DB HMSET " BGP_DEVICE_GLOBAL\| STATE" tsa_enabled " true" "
11
14
CONFIG_DB_TSA_STATE_UPDATE=' {"BGP_DEVICE_GLOBAL":{"STATE":{"tsa_enabled": "true"}}}'
12
15
current_tsa_state=" $( sonic-cfggen -d -v BGP_DEVICE_GLOBAL.STATE.tsa_enabled) "
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ # Source the platform_utils script
4
+ source " $( dirname " $0 " ) /platform_utils"
5
+
3
6
# Restrict command to sudo users
4
7
if [ " $EUID " -ne 0 ] ; then
5
8
echo " Root priveleges are needed for this operation"
6
9
exit 1
7
10
fi
8
11
9
- if [ -f /etc/sonic/chassisdb.conf ]; then
12
+ if [ -f /etc/sonic/chassisdb.conf ] && [ " $SMARTSWITCH " = false ] ; then
10
13
CHASSIS_TSA_STATE_UPDATE=" CHASSIS_APP_DB HMSET " BGP_DEVICE_GLOBAL\| STATE" tsa_enabled " false" "
11
14
CONFIG_DB_TSA_STATE_UPDATE=' {"BGP_DEVICE_GLOBAL":{"STATE":{"tsa_enabled": "false"}}}'
12
15
current_tsa_state=" $( sonic-cfggen -d -v BGP_DEVICE_GLOBAL.STATE.tsa_enabled) "
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ # Source the platform_utils script
4
+ source " $( dirname " $0 " ) /platform_utils"
5
+
3
6
# Restrict command to sudo users
4
7
if [ " $EUID " -ne 0 ] ; then
5
8
echo " Root priveleges are needed for this operation"
6
9
exit 1
7
10
fi
8
11
9
- if [ -f /etc/sonic/chassisdb.conf ]; then
12
+ if [ -f /etc/sonic/chassisdb.conf ] && [ " $SMARTSWITCH " = false ] ; then
10
13
if [[ $1 == " no-stats" ]]; then
11
14
rexec all -c " sudo TSC no-stats"
12
15
else
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # platform_utils
4
+
5
+ # Determine platform and is smartswitch
6
+ PLATFORM=" $( sonic-cfggen -d -v DEVICE_METADATA.localhost.platform) "
7
+ SMARTSWITCH=false
8
+ PLATFORM_JSON=/usr/share/sonic/device/$PLATFORM /platform.json
9
+
10
+ if [ -f " $PLATFORM_JSON " ]; then
11
+ NUM_DPU=$( jq -r ' .DPUS | length' $PLATFORM_JSON 2> /dev/null)
12
+ if [[ $NUM_DPU -gt 0 ]]; then
13
+ SMARTSWITCH=true
14
+ fi
15
+ fi
16
+
17
+ # Export SMARTSWITCH for other scripts
18
+ export SMARTSWITCH
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ stdout_logfile=syslog
28
28
stderr_logfile=syslog
29
29
dependent_startup=true
30
30
31
- {% if not skip_chassisd and IS_MODULAR_CHASSIS == 1 %}
31
+ {% if not skip_chassisd and ( IS_MODULAR_CHASSIS == 1 or is_smartswitch ) %}
32
32
[program:chassisd]
33
33
command=/usr/local/bin/chassisd
34
34
priority=3
Original file line number Diff line number Diff line change @@ -109,8 +109,15 @@ def get_expected_running_containers():
109
109
else :
110
110
always_running_containers .add (container_name )
111
111
112
- if device_info .is_supervisor ():
112
+ if device_info .is_supervisor () or device_info . is_smartswitch () :
113
113
always_running_containers .add ("database-chassis" )
114
+
115
+ if device_info .is_smartswitch ():
116
+ raw_dpustable = config_db .get_table ("DPUS" )
117
+ for dpu_name in raw_dpustable :
118
+ container_name = f"databasedpu{ dpu_name .replace ('dpu' , '' )} "
119
+ always_running_containers .add (container_name )
120
+
114
121
return expected_running_containers , always_running_containers
115
122
116
123
def get_current_running_from_DB (always_running_containers ):
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ DEFAULT_BUILD_LOG_TIMESTAMP = none
42
42
# CHANGE_DEFAULT_PASSWORD - enforce default user/users to change password on 1st login
43
43
CHANGE_DEFAULT_PASSWORD ?= n
44
44
45
+ # Default value for SMARTSWITCH
46
+ SMARTSWITCH ?= 0
47
+
45
48
# DEFAULT_USERNAME - default username for installer build
46
49
DEFAULT_USERNAME = admin
47
50
@@ -152,6 +155,11 @@ INCLUDE_DHCP_RELAY = y
152
155
# INCLUDE_DHCP_SERVER - build and install dhcp-server package
153
156
INCLUDE_DHCP_SERVER ?= n
154
157
158
+ # Conditionally enable DHCP_SERVER when SMARTSWITCH is set to 1
159
+ ifeq ($(SMARTSWITCH), 1)
160
+ INCLUDE_DHCP_SERVER = y
161
+ endif
162
+
155
163
# INCLUDE_P4RT - build docker-p4rt for P4RT support
156
164
INCLUDE_P4RT = n
157
165
Original file line number Diff line number Diff line change @@ -576,6 +576,22 @@ def is_chassis():
576
576
return is_voq_chassis () or is_packet_chassis ()
577
577
578
578
579
+ def is_smartswitch ():
580
+ # Get platform
581
+ platform = get_platform ()
582
+ if not platform :
583
+ return False
584
+
585
+ # get platform.json file path
586
+ platform_json = os .path .join (HOST_DEVICE_PATH , platform , "platform.json" )
587
+ try :
588
+ with open (platform_json , 'r' ) as f :
589
+ platform_cfg = json .loads (f .read ())
590
+ return "DPUS" in platform_cfg
591
+ except IOError :
592
+ return False
593
+
594
+
579
595
def is_supervisor ():
580
596
platform_env_conf_file_path = get_platform_env_conf_file_path ()
581
597
if platform_env_conf_file_path is None :
You can’t perform that action at this time.
0 commit comments