-
Notifications
You must be signed in to change notification settings - Fork 273
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
modify syncd init script for supporting yml #1474
Merged
vishnushetty
merged 3 commits into
sonic-net:master
from
geans-pin:common_config_improvement_new
Dec 3, 2024
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
###BRCM Common config UT#### | ||
HWSKU_DIR=/usr/share/sonic/hwsku | ||
PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common | ||
PLT_SAI_PROFILE=$(find $HWSKU_DIR -name 'sai.profile') | ||
readline=$(grep SAI_INIT_CONFIG_FILE $PLT_SAI_PROFILE) | ||
PLATFORM_DIR=/usr/share/sonic/platform | ||
PLT_CONFIG_BCM="" | ||
PLT_CONFIG_YML="" | ||
|
||
if [ ${readline: -3} == "bcm" ]; then | ||
PLT_CONFIG_BCM=${readline#*=} | ||
elif [ ${readline: -3} == "yml" ]; then | ||
PLT_CONFIG_YML=${readline#*=} | ||
fi | ||
|
||
if [ ! -z "$PLT_CONFIG_BCM" ] && [ -f $PLATFORM_DIR/common_config_support ] ; then | ||
CONFIG_BCM=$(find /tmp -name '*.bcm') | ||
|
||
#Get first three characters of chip id | ||
readline=$(grep '0x14e4' /proc/linux-kernel-bde) | ||
chip_id=${readline#*0x14e4:0x} | ||
chip_id=${chip_id::3} | ||
COMMON_CONFIG_BCM=$(find $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id} -maxdepth 1 -name '*.bcm') | ||
check_override=false | ||
check_pass=false | ||
|
||
#Check if common config does apply to config bcm correctly | ||
while read line | ||
do | ||
line=$( echo $line | xargs ) | ||
if [ ! -z "$line" ];then | ||
if [ "${line::1}" == '#' ];then | ||
echo "Skip checking line starting with #" | ||
elif [ "$line" == "[High Inheritance Precedence]" ];then | ||
echo "Checking High Inheritance property..." | ||
check_override=true | ||
elif [ "$line" == "[Low Inheritance Precedence]" ];then | ||
echo "Checking Low Inheritance property..." | ||
check_override=false | ||
else | ||
if $check_override ;then | ||
if grep -q "$line" $CONFIG_BCM ;then | ||
check_pass=true | ||
else | ||
echo "Fail: Checking overwite properties not existing.." | ||
return | ||
fi | ||
else | ||
sedline=${line%=*} | ||
if grep -q $sedline $CONFIG_BCM ;then | ||
check_pass=true | ||
else | ||
echo "Fail: Checking properties not existing.." | ||
return | ||
fi | ||
fi | ||
fi | ||
fi | ||
done < $COMMON_CONFIG_BCM | ||
if $check_pass ;then | ||
echo "PASS: Checking Common config merged Success" | ||
fi | ||
fi | ||
|
||
if [ ! -z "$PLT_CONFIG_YML" ] && [ -f $PLATFORM_DIR/common_config_support ]; then | ||
CONFIG_YML=$(find /tmp -name '*.yml') | ||
|
||
#Get first three characters of chip id | ||
readline=$(grep '0:14e4' /proc/linux_ngbde) | ||
chip_id=${readline#*0:14e4:} | ||
chip_id=${chip_id::3} | ||
COMMON_CONFIG_BCM=$(find $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id} -maxdepth 1 -name '*.bcm') | ||
check_override=false | ||
check_pass=false | ||
|
||
#Check if common config does apply to config bcm correctly | ||
while read line | ||
do | ||
line=$( echo $line | xargs ) | ||
if [ ! -z "$line" ];then | ||
if [ "${line::1}" == '#' ];then | ||
echo "Skip checking line starting with #" | ||
elif [ "$line" == "[High Inheritance Precedence]" ];then | ||
echo "Checking High Inheritance property..." | ||
check_override=true | ||
elif [ "$line" == "[Low Inheritance Precedence]" ];then | ||
echo "Checking Low Inheritance property..." | ||
check_override=false | ||
else | ||
if $check_override ;then | ||
if grep -q "$line" $CONFIG_YML ;then | ||
check_pass=true | ||
else | ||
echo "Fail: Checking overwite properties not existing.." | ||
check_pass=false | ||
return | ||
fi | ||
else | ||
sedline=${line%:*} | ||
if grep -q $sedline $CONFIG_YML ;then | ||
check_pass=true | ||
else | ||
echo "Fail: Checking properties not existing.." | ||
check_pass=false | ||
return | ||
fi | ||
fi | ||
fi | ||
fi | ||
done < $COMMON_CONFIG_BCM | ||
|
||
if $check_pass ;then | ||
echo "PASS: Checking Common config merged Success" | ||
fi | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@geans-pin same sai.profile location issue for ut test.
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.
Apply the same change in the new commit for UT script