forked from sonoble/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve DOM info using platform API 2.0 if implemented (sonic-net#48)
- Loading branch information
1 parent
e198189
commit de33b65
Showing
4 changed files
with
124 additions
and
0 deletions.
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
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,89 @@ | ||
#!/bin/bash | ||
## This script is to apply inventec own patch to SONiC | ||
|
||
BASE_PATH=$(pwd) | ||
INV_PATCH_DIR=$BASE_PATH/inv_build/patch_files | ||
|
||
if [ ! -d ${INV_PATCH_DIR}/* ]; then | ||
exit 0 | ||
fi | ||
|
||
# Find each submodule need to patch | ||
echo "[INFO] start to apply patch in different module" | ||
for entry in $INV_PATCH_DIR/* | ||
do | ||
if [ ! -d $entry ]; then | ||
continue | ||
fi | ||
|
||
SUB_MODULE="$(basename $entry)" | ||
|
||
if [ "$SUB_MODULE" = "README" ]; then | ||
continue | ||
elif [ "$SUB_MODULE" = "sonic-buildimage" ]; then | ||
echo | ||
echo "=== apply patch to $SUB_MODULE ===" | ||
seriesfile="${INV_PATCH_DIR}/${SUB_MODULE}/series" | ||
exec < ${seriesfile} | ||
|
||
while read line | ||
do | ||
content=$(echo $line | awk /#/'{print $1}') | ||
if [ "$content" = "#" ]; then | ||
continue | ||
fi | ||
content=$(echo $line | awk /CodeBase/'{print $1}') | ||
if [ "$content" = "[CodeBase]" ]; then | ||
content=$(echo $line | awk '{print $NF}') | ||
continue | ||
fi | ||
content=$(echo $line | awk /order/'{print $1}') | ||
if [ "$content" = "[order]" ]; then | ||
continue | ||
fi | ||
git am --whitespace=nowarn ${INV_PATCH_DIR}/${SUB_MODULE}/$line | ||
echo $line | ||
done | ||
echo | ||
else | ||
cd src/$SUB_MODULE | ||
echo "=== apply patch to ${SUB_MODULE} ===" | ||
CURRENT_HEAD="$(git rev-parse HEAD)" | ||
seriesfile="${INV_PATCH_DIR}/${SUB_MODULE}/series" | ||
exec < ${seriesfile} | ||
while read line | ||
do | ||
content=$(echo $line | awk /#/'{print $1}') | ||
if [ "$content" = "#" ]; then | ||
continue | ||
fi | ||
content=$(echo $line | awk /CodeBase/'{print $1}') | ||
if [ "$content" = "[CodeBase]" ]; then | ||
TARGET_VERSION=$(echo $line | awk '{print $NF}') | ||
if [ "$CURRENT_HEAD" != "$TARGET_VERSION" ]; then | ||
echo "error --> $SUB_MODULE:Target version $TARGET_VERSION not match current $CURRENT_HEAD" | ||
break | ||
fi | ||
continue | ||
fi | ||
content=$(echo $line | awk /order/'{print $1}') | ||
if [ "$content" = "[order]" ]; then | ||
continue | ||
fi | ||
git am --whitespace=nowarn ${INV_PATCH_DIR}/${SUB_MODULE}/$line | ||
done | ||
echo | ||
fi | ||
cd $BASE_PATH | ||
echo "already executed make init and patched files" > ${INV_PATCH_DIR}/already_patched | ||
done |
30 changes: 30 additions & 0 deletions
30
...platform-daemons/[sonic-platform-daemons]xcvrd-retrieve-DOM-info-using-platform-API.patch
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,30 @@ | ||
From 8fcfd356b0bbfd81329e4b7a0aea5d6196cc4349 Mon Sep 17 00:00:00 2001 | ||
From: James Huang <huang.james@inventec.com> | ||
Date: Fri, 6 Mar 2020 15:27:00 +0800 | ||
Subject: [PATCH] [xcvrd] Retrieve DOM info using platform API 2.0 if | ||
implemented #48 | ||
|
||
--- | ||
sonic-xcvrd/scripts/xcvrd | 6 ++++-- | ||
1 file changed, 4 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/sonic-xcvrd/scripts/xcvrd b/sonic-xcvrd/scripts/xcvrd | ||
index c491375..0347c65 100644 | ||
--- a/sonic-xcvrd/scripts/xcvrd | ||
+++ b/sonic-xcvrd/scripts/xcvrd | ||
@@ -143,8 +143,10 @@ def _wrapper_get_transceiver_dom_info(physical_port): | ||
|
||
def _wrapper_get_transceiver_dom_threshold_info(physical_port): | ||
if platform_chassis is not None: | ||
- return None | ||
- | ||
+ try: | ||
+ return platform_chassis.get_sfp(physical_port).get_transceiver_threshold_info() | ||
+ except NotImplementedError: | ||
+ pass | ||
return platform_sfputil.get_transceiver_dom_threshold_info_dict(physical_port) | ||
|
||
def _wrapper_get_transceiver_change_event(timeout): | ||
-- | ||
2.7.4 | ||
|
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,4 @@ | ||
# This series applies to sonic-platform-daemons GIT commit | ||
[CodeBase] a34ba131f618a8df6beec1f548aa08f9cedc48db | ||
[order] | ||
[sonic-platform-daemons]xcvrd-retrieve-DOM-info-using-platform-API.patch |