-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[synchronous-mode] Add template file for synchronous mode #5644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
6248c49
54bbc32
54240c6
74c6afc
030247f
b7eaa05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,18 @@ else | |
export platform=$fake_platform | ||
fi | ||
|
||
CFG_VARS=$(sonic-cfggen -d --var-json 'DEVICE_METADATA') | ||
MAC_ADDRESS=$(echo $CFG_VARS | jq -r '.localhost.mac') | ||
EXIT_SWSS_VARS_FILE_NOT_FOUND=1 | ||
SWSS_VARS_FILE=/etc/sonic/swss_syncd_vars.j2 | ||
|
||
if [ ! -f "$SWSS_VARS_FILE" ]; then | ||
echo "SWSS vars template file not found" | ||
exit $EXIT_SWSS_VARS_FILE_NOT_FOUND | ||
fi | ||
|
||
# Retrieve SWSS vars from sonic-cfggen | ||
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If SWSS vars template file not found, the command substitution will fail, so you can catch the error and exit. It is too verbose to check every input files. #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the verbose check for the template file. |
||
|
||
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac') | ||
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then | ||
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') | ||
logger "Mac address not found in Device Metadata, Falling back to eth0" | ||
|
@@ -21,7 +31,7 @@ ORCHAGENT_ARGS="-d /var/log/swss " | |
ORCHAGENT_ARGS+="-b 8192 " | ||
|
||
# Set synchronous mode if it is enabled in CONFIG_DB | ||
SYNC_MODE=$(echo $CFG_VARS | jq -r '.localhost.synchronous_mode') | ||
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode') | ||
if [ "$SYNC_MODE" == "enable" ]; then | ||
ORCHAGENT_ARGS+="-s " | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,15 @@ $(SYSCTL_NET_CONFIG)_PATH = files/image_config/sysctl | |
UPDATE_CHASSISDB_CONFIG_SCRIPT = update_chassisdb_config | ||
$(UPDATE_CHASSISDB_CONFIG_SCRIPT)_PATH = files/scripts | ||
|
||
SWSS_SYNCD_VARS_TEMPLATE = swss_syncd_vars.j2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wondering why original code don't need it. #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is needed here to make the file available to be copied to dvs and p4 docker. The template file was not available in the platforms. |
||
$(SWSS_SYNCD_VARS_TEMPLATE)_PATH = files/build_templates | ||
|
||
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why we don't need to change this before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The template file was previously put in the docker-orchagent directory, so it could be seen by orchagent docker. Since we want to put this file into more than one docker, I moved it into a shared place and added this change. |
||
$(ARP_UPDATE_SCRIPT) \ | ||
$(ARP_UPDATE_VARS_TEMPLATE) \ | ||
$(BUFFERS_CONFIG_TEMPLATE) \ | ||
$(QOS_CONFIG_TEMPLATE) \ | ||
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) \ | ||
$(SYSCTL_NET_CONFIG) \ | ||
$(UPDATE_CHASSISDB_CONFIG_SCRIPT) | ||
$(UPDATE_CHASSISDB_CONFIG_SCRIPT) \ | ||
$(SWSS_SYNCD_VARS_TEMPLATE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make more sense to keep it in original directory? User are not expected to modify this file.
BTW, keep the original filename still make sense to me. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original directory
/usr/share/sonic/templates
is only available in swss docker. The reason to move it to/etc/sonic
is to make the same template file accessible to both swss and syncd. Also, as this template is going to be accessed by syncd as well, I renamed to reflect this.